Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2059f12

Browse files
feat: add more tests
1 parent 41e40a5 commit 2059f12

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)

AltStyle によって変換されたページ (->オリジナル) /