Skip to content

Commit e306465

Browse files
[Coding Style] Enable rule PSR12.Classes.ClassInstantiation.MissingParentheses (matomo-org#21681)
* Enable rule PSR12.Classes.ClassInstantiation.MissingParentheses * Apply CS --------- Co-authored-by: Stefan Giehl <[email protected]>
1 parent 5979482 commit e306465

31 files changed

Lines changed: 111 additions & 112 deletions

core/ArchiveProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ protected function getAggregatedNumericMetrics($columns, $operationsToApply)
706706

707707
$rowMetrics = $results->getFirstRow();
708708
if ($rowMetrics === false) {
709-
$rowMetrics = new Row;
709+
$rowMetrics = new Row();
710710
}
711711
$this->enrichWithUniqueVisitorsMetric($rowMetrics);
712712
$this->renameColumnsAfterAggregation($results, self::$columnsToRenameAfterAggregation);

core/BaseFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static function factory($classId)
3838
throw new Exception(static::getInvalidClassIdExceptionMessage($classId));
3939
}
4040

41-
return new $className;
41+
return new $className();
4242
}
4343

4444
private static function sendPlainHeader()

core/Columns/MetricsList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static function get()
109109
return $cache->fetch($cacheKey);
110110
}
111111

112-
$list = new static;
112+
$list = new static();
113113

114114
/**
115115
* Triggered to add new metrics that cannot be picked up automatically by the platform.

core/Console.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ private function addCommandIfExists($command)
166166
Log::warning(sprintf('Cannot add command %s, class does not extend Piwik\Plugin\ConsoleCommand', $command));
167167
} else {
168168
/** @var Command $commandInstance */
169-
$commandInstance = new $command;
169+
$commandInstance = new $command();
170170

171171
// do not add the command if it already exists; this way we can add the command ourselves in tests
172172
if (!$this->has($commandInstance->getName())) {

core/CronArchive.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public function run()
344344
{
345345
$pid = Common::getProcessId();
346346

347-
$timer = new Timer;
347+
$timer = new Timer();
348348

349349
$this->logSection("START");
350350
$this->logger->info("Starting Matomo reports archiving...");

core/DataTable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ public function getRowIdFromLabel($label)
747747
*/
748748
public function getEmptyClone($keepFilters = true)
749749
{
750-
$clone = new DataTable;
750+
$clone = new DataTable();
751751
if ($keepFilters) {
752752
$clone->queuedFilters = $this->queuedFilters;
753753
}
@@ -2040,7 +2040,7 @@ protected function aggregateRowFromSimpleTable($row)
20402040
}
20412041
$thisRow = $this->getFirstRow();
20422042
if ($thisRow === false) {
2043-
$thisRow = new Row;
2043+
$thisRow = new Row();
20442044
$this->addRow($thisRow);
20452045
}
20462046
$thisRow->sumRow($row, $copyMeta = true, $this->getMetadata(self::COLUMN_AGGREGATION_OPS_METADATA_NAME));

core/DataTable/Map.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ public function mergeSubtables()
518518
*/
519519
public function getEmptyClone()
520520
{
521-
$dataTableMap = new Map;
521+
$dataTableMap = new Map();
522522
$dataTableMap->setKeyName($this->getKeyName());
523523
return $dataTableMap;
524524
}

core/Option.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public static function clearCache()
141141
private static function getInstance()
142142
{
143143
if (self::$instance == null) {
144-
self::$instance = new self;
144+
self::$instance = new self();
145145
}
146146

147147
return self::$instance;

core/Plugin/Manager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ protected function makePluginClass($pluginName)
12631263
if (!class_exists($namespacedClass, false)) {
12641264
throw new \Exception("The class $pluginClassName couldn't be found in the file '$path'");
12651265
}
1266-
$newPlugin = new $namespacedClass;
1266+
$newPlugin = new $namespacedClass();
12671267

12681268
if (!($newPlugin instanceof Plugin)) {
12691269
throw new \Exception("The plugin $pluginClassName in the file $path must inherit from Plugin.");

core/Plugin/ReportsProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static function factory($module, $action)
4242

4343
$klassName = $listApiToReport[$api];
4444

45-
return new $klassName;
45+
return new $klassName();
4646
}
4747

4848
private static function getMapOfModuleActionsToReport()

0 commit comments

Comments
 (0)