diff --git a/src/Changes/v5dot6/IncompPropertyArray.php b/src/Changes/v5dot6/IncompPropertyArray.php index 8d74c9e..3824119 100644 --- a/src/Changes/v5dot6/IncompPropertyArray.php +++ b/src/Changes/v5dot6/IncompPropertyArray.php @@ -41,7 +41,9 @@ public function leaveNode($node) } } elseif ($stmt instanceof Stmt\ClassConst) { foreach ($stmt->consts as $const) { - if ($const->value instanceof Scalar) { + if ($const->value instanceof Scalar\MagicConst) { + $const_table['self::'.$const->name] = $const->value->getName(); + } elseif ($const->value instanceof Scalar) { $const_table['self::'.$const->name] = $const->value->value; } } diff --git a/tests/Changes/v5dot6/IncompPropertyArrayTest.php b/tests/Changes/v5dot6/IncompPropertyArrayTest.php index eb58329..115e331 100644 --- a/tests/Changes/v5dot6/IncompPropertyArrayTest.php +++ b/tests/Changes/v5dot6/IncompPropertyArrayTest.php @@ -91,6 +91,18 @@ class Sample 'third' => 0, ); } +EOC; + $this->assertNotSpot($code); + + // MagicConst trigger warning + $code = <<<'EOC' +class Sample +{ + const LOGTAG = __FUNCTION__; + public $data = array( + self::LOGTAG => 1 + ); +} EOC; $this->assertNotSpot($code); }