Skip to content

Commit 6686dc2

Browse files
authored
Add test for internal error when calling undefined functions (#273)
Follow up to #272
1 parent f7beb13 commit 6686dc2

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

tests/HookCallbackRuleTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public function testRule(): void
5454
$this->analyse(
5555
[
5656
__DIR__ . '/data/hook-callback.php',
57+
__DIR__ . '/data/internal-error.php',
5758
],
5859
self::EXPECTED_ERRORS
5960
);

tests/HookDocsRuleTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function testRule(): void
3131
$this->analyse(
3232
[
3333
__DIR__ . '/data/hook-docs.php',
34+
__DIR__ . '/data/internal-error.php',
3435
],
3536
[
3637
[

tests/data/internal-error.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
/*
4+
* Intentionally call an undefined function to ensure it does not trigger an internal error.
5+
* Related issue: https://github.com/szepeviktor/phpstan-wordpress/issues/271
6+
*/
7+
callingUndefinedFunction();

0 commit comments

Comments
 (0)