Skip to content

Commit 496c541

Browse files
committed
Test that it cannot read functions
1 parent 1625225 commit 496c541

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

tests/PHPStan/Rules/Keywords/RequireFileExistsRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,9 @@ public function testFileDoesNotExistButUsesClassMethods(): void
9797
{
9898
$this->analyse([__DIR__ . '/data/file-does-not-exist-but-uses-a-class-method.php'], []);
9999
}
100+
101+
public function testFileDoesNotExistButUsesAFunction(): void
102+
{
103+
$this->analyse([__DIR__ . '/data/file-does-not-exist-but-uses-a-function.php'], []);
104+
}
100105
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php declare(strict_types=1);
2+
3+
function getFileThatDoesNotExist(): string
4+
{
5+
return 'a_file_that_does_not_exist.txt';
6+
}
7+
8+
include __DIR__ . '/' . getFileThatDoesNotExist();
9+
include_once __DIR__ . '/' . getFileThatDoesNotExist();
10+
require __DIR__ . '/' . getFileThatDoesNotExist();
11+
require_once __DIR__ . '/' . getFileThatDoesNotExist();

0 commit comments

Comments
 (0)