Skip to content

Commit 4ff25c8

Browse files
committed
Test that it cannot read variables
1 parent 7c3f635 commit 4ff25c8

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

tests/PHPStan/Rules/Keywords/RequireFileExistsRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,9 @@ public function testFileDoesNotExistButUsesClassProperties(): void
8787
{
8888
$this->analyse([__DIR__ . '/data/file-does-not-exist-but-uses-a-class-property.php'], []);
8989
}
90+
91+
public function testFileDoesNotExistButUsesVariables(): void
92+
{
93+
$this->analyse([__DIR__ . '/data/file-does-not-exist-but-uses-a-variable.php'], []);
94+
}
9095
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php declare(strict_types=1);
2+
3+
$includedFile = 'a-file-that-does-not-exist.php';
4+
5+
include $includedFile;
6+
include_once $includedFile;
7+
require $includedFile;
8+
require_once $includedFile;

0 commit comments

Comments
 (0)