Skip to content

Commit a94b2f7

Browse files
committed
[CLEANUP] Make variable acces in DeclarationBlock more obvious (#448)
1 parent f0a35a5 commit a94b2f7

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

config/phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ parameters:
1010
count: 2
1111
path: ../src/RuleSet/DeclarationBlock.php
1212

13-
-
14-
message: "#^Variable \\$oRule might not be defined\\.$#"
15-
count: 2
16-
path: ../src/RuleSet/DeclarationBlock.php
17-
1813
-
1914
message: "#^Variable \\$oVal might not be defined\\.$#"
2015
count: 1

src/RuleSet/DeclarationBlock.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ public function expandListStyleShorthand()
565565
public function createShorthandProperties(array $aProperties, $sShorthand)
566566
{
567567
$aRules = $this->getRulesAssoc();
568+
$oRule = null;
568569
$aNewValues = [];
569570
foreach ($aProperties as $sProperty) {
570571
if (!isset($aRules[$sProperty])) {
@@ -585,7 +586,7 @@ public function createShorthandProperties(array $aProperties, $sShorthand)
585586
$this->removeRule($sProperty);
586587
}
587588
}
588-
if (count($aNewValues)) {
589+
if ($aNewValues !== [] && $oRule instanceof Rule) {
589590
$oNewRule = new Rule($sShorthand, $oRule->getLineNo(), $oRule->getColNo());
590591
foreach ($aNewValues as $mValue) {
591592
$oNewRule->addValue($mValue);

0 commit comments

Comments
 (0)