Skip to content

Commit

Permalink
[Coding Style] Enable rule PSR12.ControlStructures.ControlStructureSp…
Browse files Browse the repository at this point in the history
…acing.LineIndent (#21818)

* [Coding Style] Enable rule PSR12.ControlStructures.ControlStructureSpacing.LineIndent

* Apply CS

* add new CS commits to ignore list
  • Loading branch information
sgiehl authored Jan 17, 2024
1 parent d7801a7 commit 8878b7a
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 18 deletions.
26 changes: 26 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,29 @@ b9c6430c0569308350c3b33231646016d19924ea
6fa0f5bb8bd0cb06c44db97e226612af9f844a81
# [Coding Style] Enable rule Generic.Formatting.DisallowMultipleStatements.SameLine (#21700)
942300387c974a8313b2bd5ecdb486957cca02c4
# [Coding Style] Enable rule PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE (#21702)
f5719461b8342b2fcefe148c8c7174cdc72a89a7
# [Coding Style] Enable rule Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma (#21707)
01c30b930db2e8f96b0c146c21f895832e26fab0
# [Coding Style] Enable rules Generic.Functions.FunctionCallArgumentSpacing.* (#21710)
22162916d36389c7c7f3380ab3467890a0c2ef6e
# [Coding Style] Enable rule Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace (#21716)
4bf4190287d599d4ae6a67ba4bec1366d5cc541c
# Enable rule Squiz.Functions.MultiLineFunctionDeclaration.SpaceBeforeBrace (#21717)
2cb62b61716129dca0b5d9fa2f8a5b3ac1eebac4
# [Coding Style] Enable rule PSR2.Classes.ClassDeclaration.SpaceAfterKeyword (#21720)
d6742943fe234d9f80727ae49ffebfb1539a3e67
# [Coding Style] Enable rules PSR2.Classes.ClassDeclaration.* (#21727)
8bfe2c7465a25081d8e5a23fcfa9b2f888272d41
# [Coding Style] Enable rule PSR12.Keywords.ShortFormTypeKeywords.LongFound (#21728)
04f8ed7c3406afbb155ba3af765169e6579eb3e4
# [Coding Style] Enable rule PSR2.ControlStructures.SwitchDeclaration.WrongOpenercase (#21731)
8f6e92f4b5c0e813fb09f2bae2fb91f7ade024d1
# [Coding Style] Enable rule PSR12.ControlStructures.BooleanOperatorPlacement.FoundMixed (#21730)
2e3c5156818f5c3b986243870d02ff99c3319f2f
# [Coding Style] Enable rule Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose (#21742)
16f8db6d5c6e5cf1e79344877749077ead1361bf
# [Coding Style] Enable rule PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose (#21747)
d209158e6ee34dc4b7c50df98c078954a750979f
# [Coding Style] Enable rule Squiz.Functions.FunctionDeclarationArgumentSpacing.NoSpaceBeforeArg (#21754)
7ccae042b39c80b26243f18f93b1c8042de178ca
2 changes: 1 addition & 1 deletion core/ArchiveProcessor/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private function prepareArchiveImpl($pluginName)
// invalidate existing archives before we start archiving in case data was tracked in the past. if the archive is
// made invalid, we will correctly re-archive below.
if ($this->invalidateBeforeArchiving
&& Rules::isBrowserTriggerEnabled()
&& Rules::isBrowserTriggerEnabled()
) {
$this->invalidatedReportsIfNeeded();
}
Expand Down
10 changes: 5 additions & 5 deletions core/ArchiveProcessor/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Rules
public static function getDoneStringFlagFor(array $idSites, $segment, $periodLabel, $plugin)
{
if (!empty($plugin)
&& !self::shouldProcessReportsAllPlugins($idSites, $segment, $periodLabel)
&& !self::shouldProcessReportsAllPlugins($idSites, $segment, $periodLabel)
) {
return self::getDoneFlagArchiveContainsOnePlugin($segment, $plugin);
}
Expand Down Expand Up @@ -143,7 +143,7 @@ public static function getMinTimeProcessedForInProgressArchive(
$isArchivingDisabled = Rules::isArchivingDisabledFor($idSites, $segment, $period->getLabel());
if ($isArchivingDisabled) {
if ($period->getNumberOfSubperiods() == 0
&& $dateStart->getTimestamp() <= $now
&& $dateStart->getTimestamp() <= $now
) {
// Today: accept any recent enough archive
$minimumArchiveTime = false;
Expand Down Expand Up @@ -216,7 +216,7 @@ public static function isArchivingEnabledFor(array $idSites, Segment $segment, $

if ($periodLabel === 'range') {
if (isset($generalConfig['archiving_range_force_on_browser_request'])
&& $generalConfig['archiving_range_force_on_browser_request'] == false
&& $generalConfig['archiving_range_force_on_browser_request'] == false
) {
Log::debug("Not forcing archiving for range period.");
return $isArchivingEnabled;
Expand All @@ -231,8 +231,8 @@ public static function isArchivingEnabledFor(array $idSites, Segment $segment, $
}

if (!$isArchivingEnabled
&& (!self::isBrowserArchivingAvailableForSegments() || self::isSegmentPreProcessed($idSites, $segment))
&& !SettingsServer::isArchivePhpTriggered() // Only applies when we are not running core:archive command
&& (!self::isBrowserArchivingAvailableForSegments() || self::isSegmentPreProcessed($idSites, $segment))
&& !SettingsServer::isArchivePhpTriggered() // Only applies when we are not running core:archive command
) {
Log::debug("Archiving is disabled because of config setting browser_archiving_disabled_enforce=1 or because the segment is selected to be pre-processed.");
return false;
Expand Down
2 changes: 1 addition & 1 deletion core/DataTable/Row.php
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ public static function isEqual(Row $row1, Row $row2)
// or both have a value
if (!(is_null($row1->getIdSubDataTable())
&& is_null($row2->getIdSubDataTable())
)
)
) {
$subtable1 = $row1->getSubtable();
$subtable2 = $row2->getSubtable();
Expand Down
2 changes: 1 addition & 1 deletion core/Nonce.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public static function verifyNonceWithErrorMessage($id, $cnonce, $allowedReferre
// validate origin
$origin = self::getOrigin();
if (!empty($origin) &&
($origin == 'null' ||
($origin == 'null' ||
!in_array($origin, self::getAcceptableOrigins()))
) {
return Piwik::translate('Login_InvalidNonceOrigin') . $additionalErrors;
Expand Down
8 changes: 4 additions & 4 deletions core/Tracker/GoalManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ public function detectGoalMatch($goal, Action $action, VisitProperties $visitor,

// if the attribute to match is not the type of the current action
if ((($attribute == 'url' || $attribute == 'title') && $actionType != Action::TYPE_PAGE_URL)
|| ($attribute == 'file' && $actionType != Action::TYPE_DOWNLOAD)
|| ($attribute == 'external_website' && $actionType != Action::TYPE_OUTLINK)
|| ($attribute == 'manually')
|| self::isEventMatchingGoal($goal) && $actionType != Action::TYPE_EVENT
|| ($attribute == 'file' && $actionType != Action::TYPE_DOWNLOAD)
|| ($attribute == 'external_website' && $actionType != Action::TYPE_OUTLINK)
|| ($attribute == 'manually')
|| self::isEventMatchingGoal($goal) && $actionType != Action::TYPE_EVENT
) {
return null;
}
Expand Down
1 change: 0 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.CloseParenthesisIndent" />
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.CloseParenthesisLine" />
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.FirstExpressionLine" />
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.LineIndent" />
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace" />
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace" />
<exclude name="PSR12.Files.FileHeader" />
Expand Down
2 changes: 1 addition & 1 deletion plugins/CorePluginsAdmin/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function uploadPlugin()
if (!$this->passwordVerify->isPasswordCorrect(
Piwik::getCurrentUserLogin(),
\Piwik\Request::fromRequest()->getStringParameter('confirmPassword')
)) {
)) {
throw new \Exception($this->translator->translate('Login_LoginPasswordNotCorrect'));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ private function getCustomDimensionsInScope($scope, Request $request)
if (is_array($extractions)) {
foreach ($extractions as $extraction) {
if (!array_key_exists('dimension', $extraction)
|| !array_key_exists('pattern', $extraction)
|| empty($extraction['pattern'])) {
|| !array_key_exists('pattern', $extraction)
|| empty($extraction['pattern'])) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/UsersManager/UserAccessFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function filterUsers($users)
public function filterUser($user)
{
if ($this->access->hasSuperUserAccess()
|| (!empty($user['login']) && $this->isNonSuperUserAllowedToSeeThisLogin($user['login']))
|| (!empty($user['login']) && $this->isNonSuperUserAllowedToSeeThisLogin($user['login']))
) {
return $user;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPUnit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function prepareTestDatabaseConfig(Config $config)
function checkPiwikSetupForTests()
{
if (empty($_SERVER['REQUEST_URI'])
|| $_SERVER['REQUEST_URI'] == '@REQUEST_URI@'
|| $_SERVER['REQUEST_URI'] == '@REQUEST_URI@'
) {
echo "WARNING: for tests to pass, you must first:
1) Install webserver on localhost, eg. apache
Expand Down

0 comments on commit 8878b7a

Please sign in to comment.