Skip to content

Commit 3182d3e

Browse files
committed
feat: add more tests
1 parent cfe14f4 commit 3182d3e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

tests/PHPStan/Rules/Variables/DefinedVariableRuleTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,14 +1169,19 @@ public function testBug8719(): void
11691169
$this->analyse([__DIR__ . '/data/bug-8719.php'], []);
11701170
}
11711171

1172-
public function testDynamicVariable(): void
1172+
public function testDynamicVariableInsideIsset(): void
11731173
{
11741174
$this->cliArgumentsVariablesRegistered = true;
11751175
$this->polluteScopeWithLoopInitialAssignments = true;
11761176
$this->checkMaybeUndefinedVariables = true;
11771177
$this->polluteScopeWithAlwaysIterableForeach = true;
11781178

1179-
$this->analyse([__DIR__ . '/data/dynamic-variable.php'], []);
1179+
$this->analyse([__DIR__ . '/data/dynamic-variable-inside-isset.php'], [
1180+
[
1181+
'Variable $bar might not be defined.',
1182+
9,
1183+
],
1184+
]);
11801185
}
11811186

11821187
}

tests/PHPStan/Rules/Variables/data/dynamic-variable.php renamed to tests/PHPStan/Rules/Variables/data/dynamic-variable-inside-isset.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
if (!isset($$foo)) {
66
echo 'Wololo';
77
}
8+
9+
echo $$foo;

0 commit comments

Comments
 (0)