diff --git a/src/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php b/src/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php index 618b32a8c9..76c4a6306a 100644 --- a/src/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php +++ b/src/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php @@ -28,6 +28,9 @@ public function register() T_STRING, T_VARIABLE, T_ANON_CLASS, + T_PARENT, + T_SELF, + T_STATIC, ]; }//end register() diff --git a/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.1.inc b/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.1.inc index eabef57cdf..9360680ce7 100644 --- a/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.1.inc +++ b/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.1.inc @@ -52,3 +52,15 @@ $instance = new MyClass(&$a); $anon = new class($a) {}; $anon = new class(&$a) {}; + +class Foo extends Bar { + function myMethod() { + $a = new static($var); + $b = new self($var); + $c = new parent($var); + + $d = new static(&$var); + $e = new self(&$var); + $f = new parent(&$var); + } +} diff --git a/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.php b/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.php index 8fdea95ea5..b0819dac2a 100644 --- a/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.php +++ b/src/Standards/Generic/Tests/Functions/CallTimePassByReferenceUnitTest.php @@ -45,11 +45,14 @@ public function getErrorList($testFile='CallTimePassByReferenceUnitTest.1.inc') 50 => 1, 51 => 1, 54 => 1, + 62 => 1, + 63 => 1, + 64 => 1, ]; default: return []; - } + }//end switch }//end getErrorList()