Skip to content

Commit cf32ebc

Browse files
committed
Add test cases to replicate failures where late static binding can be mistakenly confused as static variable declarations.
1 parent 3d6a188 commit cf32ebc

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Tests/CodeAnalysis/VariableAnalysisUnitTest.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,11 @@ class ClassWithSymbolicRefProperty {
420420
function function_with_pass_by_ref_assign_only_arg(&$return_value) {
421421
$return_value = 42;
422422
}
423+
424+
class ClassWithLateStaticBinding {
425+
static function method_with_late_static($param) {
426+
static::some_method($param);
427+
static::some_method($var);
428+
static::some_method(static::CONSTANT, $param);
429+
}
430+
}

Tests/CodeAnalysis/VariableAnalysisUnitTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ private function _getWarningAndErrorList() {
215215
($base += 10) => 0,
216216
($base + 5) => 1, // $undefined_method
217217
($base + 6) => 1, // $undefined_method
218+
// function_with_pass_by_ref_assign_only_arg() line (+11)
219+
// no warnings.
220+
($base += 11) => 0,
221+
// method_with_late_static_binding() line (+5)
222+
($base += 5) => 0,
223+
($base + 2) => 1, // $var
218224
);
219225
}//end _getWarningAndErrorList()
220226

0 commit comments

Comments
 (0)