diff --git a/core/lib/Drupal/Component/DependencyInjection/Container.php b/core/lib/Drupal/Component/DependencyInjection/Container.php index 6b0df79..bf74487 100644 --- a/core/lib/Drupal/Component/DependencyInjection/Container.php +++ b/core/lib/Drupal/Component/DependencyInjection/Container.php @@ -188,7 +188,7 @@ public function get($id, $invalid_behavior = ContainerInterface::EXCEPTION_ON_IN unset($this->services[$id]); } - if (self::EXCEPTION_ON_INVALID_REFERENCE !== $invalid_behavior) { + if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalid_behavior) { return; } @@ -354,7 +354,7 @@ protected function createService(array $definition, $id) { /** * {@inheritdoc} */ - public function set($id, $service, $scope = self::SCOPE_CONTAINER) { + public function set($id, $service, $scope = ContainerInterface::SCOPE_CONTAINER) { $this->services[$id] = $service; } diff --git a/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php b/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php index c0ec669..acaf796 100644 --- a/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php +++ b/core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php @@ -69,7 +69,7 @@ public function getArray() { $definition['parameters'] = $this->getParameters(); $definition['services'] = $this->getServiceDefinitions(); $definition['frozen'] = $this->container->isFrozen(); - $definition['machine_format'] = $this->getMachineFormat(); + $definition['machine_format'] = $this->supportsMachineFormat(); return $definition; } @@ -515,7 +515,7 @@ protected function getExpressionCall($expression) { * @return bool * TRUE if this supports machine-optimized format, FALSE otherwise. */ - protected function getMachineFormat() { + protected function supportsMachineFormat() { return TRUE; } diff --git a/core/lib/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php b/core/lib/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php index 2f2f517..4932dd7 100644 --- a/core/lib/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php +++ b/core/lib/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php @@ -70,7 +70,7 @@ protected function getParameterCall($name) { /** * {@inheritdoc} */ - protected function getMachineFormat() { + protected function supportsMachineFormat() { return FALSE; } diff --git a/core/lib/Drupal/Component/DependencyInjection/composer.json b/core/lib/Drupal/Component/DependencyInjection/composer.json new file mode 100644 index 0000000..7e5e666 --- /dev/null +++ b/core/lib/Drupal/Component/DependencyInjection/composer.json @@ -0,0 +1,18 @@ +{ + "name": "drupal/core-dependency-injection", + "description": "Dependency Injection container optimized for Drupal's needs.", + "keywords": ["drupal", "dependency injection"], + "type": "library", + "homepage": "https://www.drupal.org/project/drupal", + "license": "GPL-2.0+", + "support": { + "issues": "https://www.drupal.org/project/issues/drupal", + "irc": "irc://irc.freenode.net/drupal-contribute", + "source": "https://www.drupal.org/project/drupal/git-instructions" + }, + "autoload": { + "psr-4": { + "Drupal\\Component\\DependencyInjection\\": "" + } + } +} diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php index 3802e84..fff8364 100644 --- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php @@ -882,6 +882,9 @@ protected function getMockContainerDefinition() { $services['synthetic'] = array( 'synthetic' => TRUE, ); + // The file could have been named as a .php file. The reason it is a .data + // file is that SimpleTest tries to load it. SimpleTest does not like such + // fixtures and hence we use a neutral name like .data. $services['container_test_file_service_test'] = array( 'class' => '\stdClass', 'file' => __DIR__ . '/Fixture/container_test_file_service_test_service_function.data', diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php index 72af63e..b315403 100644 --- a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php @@ -63,7 +63,7 @@ public function setUp() { * * @covers ::dump * @covers ::getArray - * @covers ::getMachineFormat + * @covers ::supportsMachineFormat */ public function testDumpForEmptyContainer() { $serialized_definition = $this->dumper->dump();