Commit e62a2c7e authored by alexpott's avatar alexpott

Issue #2572601 by attiks, alexpott, tatarbj: Fix...

Issue #2572601 by attiks, alexpott, tatarbj: Fix 'Drupal.Classes.ClassCreateInstance' coding standard
parent b264dd2b
......@@ -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.
......
......@@ -219,7 +219,7 @@ private function readHeader() {
if (!$item) {
return;
}
$header = new PoHeader;
$header = new PoHeader();
$header->setFromString(trim($item->getTranslation()));
$this->_header = $header;
}
......
......@@ -68,7 +68,7 @@ public function getControllerFromDefinition($controller, $path = '') {
return $controller;
}
elseif (method_exists($controller, '__invoke')) {
return new $controller;
return new $controller();
}
}
......
......@@ -1208,7 +1208,7 @@ protected function initializeServiceProviders() {
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;
......
......@@ -416,7 +416,7 @@ protected function getProcessNormalized(array $process) {
*/
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);
......
......@@ -97,7 +97,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
}
}
}
throw new MigrateSkipRowException;
throw new MigrateSkipRowException();
}
}
......@@ -19,7 +19,7 @@ function testSimpletestPhpUnitRunCommand() {
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());
......
......@@ -14,7 +14,7 @@ class MockFileTransfer {
* A new Drupal\system_test\MockFileTransfer object.
*/
public static function factory() {
return new MockFileTransfer;
return new MockFileTransfer();
}
/**
......
......@@ -14,7 +14,7 @@ class MockFileTransfer {
* A new Drupal\update_test\MockFileTransfer object.
*/
public static function factory() {
return new FileTransfer;
return new FileTransfer();
}
/**
......
......@@ -12,6 +12,7 @@
<!-- Only include specific sniffs that pass. This ensures that, if new sniffs are added, HEAD does not fail.-->
<!-- Drupal sniffs -->
<rule ref="Drupal.Classes.ClassCreateInstance"/>
<rule ref="Drupal.Classes.UnusedUseStatement"/>
<rule ref="Drupal.CSS.ClassDefinitionNameSpacing"/>
<rule ref="Drupal.CSS.ColourDefinition"/>
......
......@@ -435,7 +435,7 @@ protected function assertNoID($id, $html) {
* 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);
......
......@@ -519,7 +519,7 @@ public static function assertLink(array $properties, MarkupInterface $html, $cou
}
// Execute the query.
$document = new \DOMDocument;
$document = new \DOMDocument();
$document->loadHTML($html);
$xpath = new \DOMXPath($document);
......@@ -538,7 +538,7 @@ public static function assertLink(array $properties, MarkupInterface $html, $cou
* 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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment