Skip to content

Commit c6d60e9

Browse files
committed
Add test cases for compact() support.
1 parent cf32ebc commit c6d60e9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Tests/CodeAnalysis/VariableAnalysisUnitTest.inc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,3 +428,13 @@ class ClassWithLateStaticBinding {
428428
static::some_method(static::CONSTANT, $param);
429429
}
430430
}
431+
432+
function function_with_compact($param1, $param2, $param3) {
433+
$var1 = 'value1';
434+
$var2 = 'value2';
435+
$squish1 = compact('var1');
436+
$squish2 = compact('var3');
437+
$squish3 = compact('param1');
438+
$squish4 = compact('var2', 'param3');
439+
echo $squish1, $squish2, $squish3, $squish4;
440+
}

Tests/CodeAnalysis/VariableAnalysisUnitTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ private function _getWarningAndErrorList() {
221221
// method_with_late_static_binding() line (+5)
222222
($base += 5) => 0,
223223
($base + 2) => 1, // $var
224+
// function_with_compact() line (+7)
225+
($base += 7) => 0,
226+
($base + 0) => 1, // unused $param2
227+
($base + 4) => 1, // undefined $var3
224228
);
225229
}//end _getWarningAndErrorList()
226230

0 commit comments

Comments
 (0)