Skip to content

Commit 21c3055

Browse files
committed
Merge branch '31173-laminas-di-dependency' of github.com:ProkopovVitaliy/magento2 into php8-develop
2 parents a76bcb6 + c9f729b commit 21c3055

File tree

12 files changed

+460
-234
lines changed

12 files changed

+460
-234
lines changed

composer.json

+9-8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"colinmollenhour/credis": "1.11.1",
3434
"colinmollenhour/php-redis-session-abstract": "~1.4.0",
3535
"composer/composer": "^1.9 || ^2.0",
36-
"magento/magento-composer-installer": ">=0.1.11",
3736
"elasticsearch/elasticsearch": "~7.11.0",
3837
"guzzlehttp/guzzle": "^6.3.3",
3938
"laminas/laminas-captcha": "^2.7.1",
@@ -42,7 +41,7 @@
4241
"laminas/laminas-crypt": "^3.4.0",
4342
"laminas/laminas-db": "^2.8.2",
4443
"laminas/laminas-dependency-plugin": "^2.1.0",
45-
"laminas/laminas-di": "^2.6.1",
44+
"laminas/laminas-di": "^3.2.0",
4645
"laminas/laminas-eventmanager": "^3.0.0",
4746
"laminas/laminas-feed": "^2.9.0",
4847
"laminas/laminas-form": "^2.10.0",
@@ -53,18 +52,23 @@
5352
"laminas/laminas-mail": "^2.9.0",
5453
"laminas/laminas-mime": "^2.5.0",
5554
"laminas/laminas-modulemanager": "^2.7",
56-
"laminas/laminas-mvc": "~2.7.0",
55+
"laminas/laminas-mvc": "^3.2.0",
56+
"laminas/laminas-mvc-console": "^1.3.0",
5757
"laminas/laminas-serializer": "^2.7.2",
5858
"laminas/laminas-server": "^2.6.1",
59-
"laminas/laminas-servicemanager": "^2.7.8",
59+
"laminas/laminas-servicemanager": "^3.6.0",
6060
"laminas/laminas-session": "^2.7.3",
6161
"laminas/laminas-soap": "^2.7.0",
6262
"laminas/laminas-stdlib": "^3.2.1",
6363
"laminas/laminas-text": "^2.6.0",
6464
"laminas/laminas-uri": "^2.5.1",
6565
"laminas/laminas-validator": "^2.6.0",
6666
"laminas/laminas-view": "~2.11.2",
67+
"league/flysystem": "^1.0",
68+
"league/flysystem-aws-s3-v3": "^1.0",
69+
"league/flysystem-cached-adapter": "^1.0",
6770
"magento/composer": "1.6.0",
71+
"magento/magento-composer-installer": ">=0.1.11",
6872
"magento/zendframework1": "~1.14.2",
6973
"monolog/monolog": "^1.17",
7074
"paragonie/sodium_compat": "^1.6",
@@ -79,10 +83,7 @@
7983
"tedivm/jshrink": "~1.4.0",
8084
"tubalmartin/cssmin": "4.1.1",
8185
"webonyx/graphql-php": "^0.13.8",
82-
"wikimedia/less.php": "^3.0.0",
83-
"league/flysystem": "^1.0",
84-
"league/flysystem-aws-s3-v3": "^1.0",
85-
"league/flysystem-cached-adapter": "^1.0"
86+
"wikimedia/less.php": "^3.0.0"
8687
},
8788
"require-dev": {
8889
"allure-framework/allure-phpunit": "~1.2.0",

composer.lock

+354-189
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/internal/Magento/Framework/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"laminas/laminas-http": "^2.6.0",
3131
"laminas/laminas-mail": "^2.9.0",
3232
"laminas/laminas-mime": "^2.5.0",
33-
"laminas/laminas-mvc": "~2.7.0",
33+
"laminas/laminas-mvc": "^3.2.0",
3434
"laminas/laminas-stdlib": "^3.2.1",
3535
"laminas/laminas-uri": "^2.5.1",
3636
"laminas/laminas-validator": "^2.6.0",

setup/config/application.config.php

+8-10
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
use Magento\Setup\Di\MagentoDiFactory;
78
use Magento\Setup\Mvc\Bootstrap\InitParamListener;
8-
use Laminas\Mvc\Service\DiAbstractServiceFactoryFactory;
9-
use Laminas\ServiceManager\Di\DiAbstractServiceFactory;
109

1110
return [
12-
'modules' => [
13-
'Magento\Setup',
14-
],
11+
'modules' => require __DIR__ . '/modules.config.php',
1512
'module_listener_options' => [
1613
'module_paths' => [
1714
__DIR__ . '/../src',
@@ -25,12 +22,13 @@
2522
],
2623
'service_manager' => [
2724
'factories' => [
28-
DiAbstractServiceFactory::class => DiAbstractServiceFactoryFactory::class,
2925
InitParamListener::BOOTSTRAP_PARAM => InitParamListener::class,
26+
\Magento\Framework\App\MaintenanceMode::class => MagentoDiFactory::class,
27+
\Magento\Setup\Model\ConfigGenerator::class => MagentoDiFactory::class,
28+
\Magento\Indexer\Console\Command\IndexerReindexCommand::class => MagentoDiFactory::class,
29+
\Symfony\Component\Console\Helper\TableFactory::class => MagentoDiFactory::class,
30+
\Magento\Deploy\Console\InputValidator::class => MagentoDiFactory::class,
31+
\Magento\Framework\App\State::class => MagentoDiFactory::class,
3032
],
31-
],
32-
// list of Magento specific required services, like default abstract factory
33-
'required_services' => [
34-
DiAbstractServiceFactory::class
3533
]
3634
];

setup/config/di.config.php

+12-10
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,26 @@
1717
use Magento\Framework\Setup\Declaration\Schema\SchemaConfig;
1818

1919
return [
20-
'di' => [
21-
'instance' => [
22-
'preference' => [
20+
'dependencies' => [
21+
'auto' => [
22+
'preferences' => [
2323
EventManagerInterface::class => 'EventManager',
2424
ServiceLocatorInterface::class => ServiceManager::class,
2525
LoggerInterface::class => Quiet::class,
2626
ConfigInterface::class => Config::class,
2727
DriverInterface::class => \Magento\Framework\Filesystem\Driver\File::class,
2828
ComponentRegistrarInterface::class => ComponentRegistrar::class,
2929
],
30-
SchemaConfig::class => [
31-
'parameters' => [
32-
'connectionScopes' => [
33-
'default',
34-
'checkout',
35-
'sales'
30+
'types' => [
31+
SchemaConfig::class => [
32+
'parameters' => [
33+
'connectionScopes' => [
34+
'default',
35+
'checkout',
36+
'sales'
37+
]
3638
]
37-
]
39+
],
3840
],
3941
],
4042
],

setup/config/modules.config.php

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
/**
7+
* List of enabled modules for this application.
8+
*
9+
* This should be an array of module namespaces used in the application.
10+
*/
11+
return [
12+
'Magento\Setup',
13+
'Laminas\Db',
14+
'Laminas\Di',
15+
'Laminas\Form',
16+
'Laminas\Filter',
17+
'Laminas\Hydrator',
18+
'Laminas\I18n',
19+
'Laminas\InputFilter',
20+
'Laminas\Log',
21+
'Laminas\Mail',
22+
'Laminas\Router',
23+
'Laminas\Serializer',
24+
'Laminas\Session',
25+
'Laminas\Validator',
26+
'Laminas\Mvc\Console'
27+
];

setup/src/Magento/Setup/Application.php

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public function bootstrap(array $configuration)
4343

4444
$listeners = $this->getListeners($serviceManager, $configuration);
4545
$application = new LaminasApplication(
46-
$configuration,
4746
$serviceManager,
4847
$serviceManager->get('EventManager'),
4948
$serviceManager->get('Request'),

setup/src/Magento/Setup/Console/Command/BackupCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function () use ($input, $output) {
155155
$output,
156156
false
157157
);
158-
158+
159159
return $returnValue;
160160
}
161161

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Setup\Di;
9+
10+
use Interop\Container\ContainerInterface;
11+
use Laminas\ServiceManager\Factory\FactoryInterface;
12+
use Magento\Framework\App\ObjectManager;
13+
14+
/**
15+
* Instantiates the type via Magento object manager
16+
*/
17+
class MagentoDiFactory implements FactoryInterface
18+
{
19+
/**
20+
* @inheritdoc
21+
*/
22+
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
23+
{
24+
return ObjectManager::getInstance()->get($requestedName);
25+
}
26+
}

setup/src/Magento/Setup/Mvc/Bootstrap/InitParamListener.php

+17-9
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
*/
66
namespace Magento\Setup\Mvc\Bootstrap;
77

8+
use Interop\Container\ContainerInterface;
89
use Magento\Framework\App\Bootstrap as AppBootstrap;
910
use Magento\Framework\App\Filesystem\DirectoryList;
10-
use Magento\Framework\App\ObjectManager;
11-
use Magento\Framework\App\Request\Http;
1211
use Magento\Framework\App\State;
1312
use Magento\Framework\Filesystem;
1413
use Magento\Framework\Shell\ComplexParameter;
@@ -17,11 +16,9 @@
1716
use Laminas\EventManager\ListenerAggregateInterface;
1817
use Laminas\Mvc\Application;
1918
use Laminas\Mvc\MvcEvent;
20-
use Laminas\Router\Http\RouteMatch;
21-
use Laminas\ServiceManager\FactoryInterface;
19+
use Laminas\ServiceManager\Factory\FactoryInterface;
2220
use Laminas\ServiceManager\ServiceLocatorInterface;
2321
use Laminas\Stdlib\RequestInterface;
24-
use Laminas\Uri\UriInterface;
2522

2623
/**
2724
* A listener that injects relevant Magento initialization parameters and initializes filesystem
@@ -37,7 +34,7 @@ class InitParamListener implements ListenerAggregateInterface, FactoryInterface
3734
const BOOTSTRAP_PARAM = 'magento-init-params';
3835

3936
/**
40-
* @var \Laminas\Stdlib\CallbackHandler[]
37+
* @var callable[]
4138
*/
4239
private $listeners = [];
4340

@@ -97,14 +94,25 @@ public function onBootstrap(MvcEvent $e)
9794
}
9895

9996
/**
100-
* @inheritdoc
97+
* Create service. Proxy to the __invoke method
98+
*
99+
* @deprecared use the __invoke method instead
101100
*
102101
* @param ServiceLocatorInterface $serviceLocator
103-
* @return mixed
102+
* @return array
103+
* @throws \Interop\Container\Exception\ContainerException
104104
*/
105105
public function createService(ServiceLocatorInterface $serviceLocator)
106106
{
107-
return $this->extractInitParameters($serviceLocator->get('Application'));
107+
return $this($serviceLocator, 'Application');
108+
}
109+
110+
/**
111+
* @inheritdoc
112+
*/
113+
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
114+
{
115+
return $this->extractInitParameters($container->get('Application'));
108116
}
109117

110118
/**

setup/src/Magento/Setup/Test/Unit/Mvc/Bootstrap/InitParamListenerTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,17 @@ public function testCreateDirectoryListException()
121121
public function testCreateServiceNotConsole()
122122
{
123123
/**
124-
* @var ServiceLocatorInterface|MockObject $serviceLocator
124+
* @var ServiceLocatorInterface|MockObject $container
125125
*/
126-
$serviceLocator = $this->getMockForAbstractClass(ServiceLocatorInterface::class);
126+
$container = $this->getMockForAbstractClass(ServiceLocatorInterface::class);
127127
$mvcApplication = $this->getMockBuilder(Application::class)
128128
->disableOriginalConstructor()
129129
->getMock();
130130
$request = $this->getMockForAbstractClass(RequestInterface::class);
131131
$mvcApplication->expects($this->any())->method('getRequest')->willReturn($request);
132-
$serviceLocator->expects($this->once())->method('get')->with('Application')
132+
$container->expects($this->once())->method('get')->with('Application')
133133
->willReturn($mvcApplication);
134-
$this->assertEquals([], $this->listener->createService($serviceLocator));
134+
$this->assertEquals([], $this->listener->createService($container));
135135
}
136136

137137
/**

setup/src/Zend/Mvc/Controller/LazyControllerAbstractFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Laminas\Log\ProcessorPluginManager as LogProcessorManager;
2121
use Laminas\Log\WriterPluginManager as LogWriterManager;
2222
use Laminas\Serializer\AdapterPluginManager as SerializerAdapterManager;
23-
use Laminas\ServiceManager\AbstractFactoryInterface;
23+
use Laminas\ServiceManager\Factory\AbstractFactoryInterface;
2424
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
2525
use Laminas\ServiceManager\ServiceLocatorInterface;
2626
use Laminas\Stdlib\DispatchableInterface;

0 commit comments

Comments
 (0)