diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 385f128c7c5..33b1769f462 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1528,7 +1528,7 @@ function template_preprocess_field(&$variables, $hook) { static $default_attributes; if (!isset($default_attributes)) { - $default_attributes = new Attribute; + $default_attributes = new Attribute(); } // Merge attributes when a single-value field has a hidden label. diff --git a/core/lib/Drupal/Component/Gettext/PoStreamReader.php b/core/lib/Drupal/Component/Gettext/PoStreamReader.php index dbd06d1eb86..faaa95f91a8 100644 --- a/core/lib/Drupal/Component/Gettext/PoStreamReader.php +++ b/core/lib/Drupal/Component/Gettext/PoStreamReader.php @@ -219,7 +219,7 @@ class PoStreamReader implements PoStreamInterface, PoReaderInterface { if (!$item) { return; } - $header = new PoHeader; + $header = new PoHeader(); $header->setFromString(trim($item->getTranslation())); $this->_header = $header; } diff --git a/core/lib/Drupal/Core/Controller/ControllerResolver.php b/core/lib/Drupal/Core/Controller/ControllerResolver.php index a8fad7479c3..d16b48da3e9 100644 --- a/core/lib/Drupal/Core/Controller/ControllerResolver.php +++ b/core/lib/Drupal/Core/Controller/ControllerResolver.php @@ -68,7 +68,7 @@ class ControllerResolver extends BaseControllerResolver implements ControllerRes return $controller; } elseif (method_exists($controller, '__invoke')) { - return new $controller; + return new $controller(); } } diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index fce9f0900ee..b41a91d49e8 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -1208,7 +1208,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { foreach ($this->serviceProviderClasses as $origin => $classes) { foreach ($classes as $name => $class) { if (!is_object($class)) { - $this->serviceProviders[$origin][$name] = new $class; + $this->serviceProviders[$origin][$name] = new $class(); } else { $this->serviceProviders[$origin][$name] = $class; diff --git a/core/modules/migrate/src/Plugin/Migration.php b/core/modules/migrate/src/Plugin/Migration.php index 2f1154d699c..9b22e359fae 100644 --- a/core/modules/migrate/src/Plugin/Migration.php +++ b/core/modules/migrate/src/Plugin/Migration.php @@ -416,7 +416,7 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn */ public function getDestinationPlugin($stub_being_requested = FALSE) { if ($stub_being_requested && !empty($this->destination['no_stub'])) { - throw new MigrateSkipRowException; + throw new MigrateSkipRowException(); } if (!isset($this->destinationPlugin)) { $this->destinationPlugin = $this->destinationPluginManager->createInstance($this->destination['plugin'], $this->destination, $this); diff --git a/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php b/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php index c7a0472ca67..0cb7c68a8d3 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php +++ b/core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php @@ -97,7 +97,7 @@ class MenuLinkParent extends ProcessPluginBase implements ContainerFactoryPlugin } } } - throw new MigrateSkipRowException; + throw new MigrateSkipRowException(); } } diff --git a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php index 0e3d2a497b3..4a3d2524145 100644 --- a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php +++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php @@ -19,7 +19,7 @@ class SimpletestPhpunitRunCommandTest extends UnitTestCase { include_once __DIR__ .'/../../fixtures/simpletest_phpunit_run_command_test.php'; $app_root = __DIR__ . '/../../../../../..'; include_once "$app_root/core/modules/simpletest/simpletest.module"; - $container = new ContainerBuilder; + $container = new ContainerBuilder(); $container->set('app.root', $app_root); $file_system = $this->prophesize('Drupal\Core\File\FileSystemInterface'); $file_system->realpath('public://simpletest')->willReturn(sys_get_temp_dir()); diff --git a/core/modules/system/tests/modules/system_test/src/MockFileTransfer.php b/core/modules/system/tests/modules/system_test/src/MockFileTransfer.php index 63500417cb0..9e716002a7a 100644 --- a/core/modules/system/tests/modules/system_test/src/MockFileTransfer.php +++ b/core/modules/system/tests/modules/system_test/src/MockFileTransfer.php @@ -14,7 +14,7 @@ class MockFileTransfer { * A new Drupal\system_test\MockFileTransfer object. */ public static function factory() { - return new MockFileTransfer; + return new MockFileTransfer(); } /** diff --git a/core/modules/update/tests/modules/update_test/src/MockFileTransfer.php b/core/modules/update/tests/modules/update_test/src/MockFileTransfer.php index 1f73b1cad33..9e40b65e5c8 100644 --- a/core/modules/update/tests/modules/update_test/src/MockFileTransfer.php +++ b/core/modules/update/tests/modules/update_test/src/MockFileTransfer.php @@ -14,7 +14,7 @@ class MockFileTransfer { * A new Drupal\update_test\MockFileTransfer object. */ public static function factory() { - return new FileTransfer; + return new FileTransfer(); } /** diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index 34c0ef99295..ab2081d0207 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -12,6 +12,7 @@ + diff --git a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php index fd0ead9e54f..09ec9894dcc 100644 --- a/core/tests/Drupal/Tests/Core/Template/AttributeTest.php +++ b/core/tests/Drupal/Tests/Core/Template/AttributeTest.php @@ -435,7 +435,7 @@ class AttributeTest extends UnitTestCase { * The number of results that are found. */ protected function getXPathResultCount($query, $html) { - $document = new \DOMDocument; + $document = new \DOMDocument(); $document->loadHTML($html); $xpath = new \DOMXPath($document); diff --git a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php index 89cf62ceafa..97fb9d3b314 100644 --- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php @@ -519,7 +519,7 @@ class LinkGeneratorTest extends UnitTestCase { } // Execute the query. - $document = new \DOMDocument; + $document = new \DOMDocument(); $document->loadHTML($html); $xpath = new \DOMXPath($document); @@ -538,7 +538,7 @@ class LinkGeneratorTest extends UnitTestCase { * The number of results that are found. */ protected function assertNoXPathResults($query, $html) { - $document = new \DOMDocument; + $document = new \DOMDocument(); $document->loadHTML($html); $xpath = new \DOMXPath($document);