From 96dd7243120c9f2bbfe43118cb5d076bd26340b2 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 26 Oct 2026 08:58:32 +0100 Subject: [PATCH 1/7] Added regression test --- .../CallToNonExistentFunctionRuleTest.php | 16 ++++++++++++++++ tests/PHPStan/Rules/Functions/data/bug-11359.php | 3 +++ 2 files changed, 19 insertions(+) create mode 100644 tests/PHPStan/Rules/Functions/data/bug-11359.php diff --git a/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php b/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php index 54081d235c7..7c1b27e9a34 100644 --- a/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php +++ b/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php @@ -280,4 +280,20 @@ public function testBug8980(): void ]); } + public function testBug11359(): void + { + $errors = []; + if (PHP_VERSION_ID < 80400) { + $errors = [ + [ + 'Function mb_ucfirst not found.', + 3, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', + ] + ]; + } + $this->analyse([__DIR__ . '/data/bug-11359.php'], $errors); + } + + } diff --git a/tests/PHPStan/Rules/Functions/data/bug-11359.php b/tests/PHPStan/Rules/Functions/data/bug-11359.php new file mode 100644 index 00000000000..498665bb712 --- /dev/null +++ b/tests/PHPStan/Rules/Functions/data/bug-11359.php @@ -0,0 +1,3 @@ + Date: Mon, 26 Oct 2026 09:03:48 +0100 Subject: [PATCH 2/7] cs --- .../Rules/Functions/CallToNonExistentFunctionRuleTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php b/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php index 7c1b27e9a34..44cb762dad5 100644 --- a/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php +++ b/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php @@ -5,6 +5,7 @@ use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\RequiresPhp; +use const PHP_VERSION_ID; /** * @extends RuleTestCase @@ -289,11 +290,10 @@ public function testBug11359(): void 'Function mb_ucfirst not found.', 3, 'Learn more at https://phpstan.org/user-guide/discovering-symbols', - ] + ], ]; } $this->analyse([__DIR__ . '/data/bug-11359.php'], $errors); } - } From 5b43ab3045a815bcc0936bd86e2ba599818830d0 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 26 Oct 2026 09:10:48 +0100 Subject: [PATCH 3/7] turn into e2e test --- .github/workflows/e2e-tests.yml | 14 +++++++++++++- .../CallToNonExistentFunctionRuleTest.php | 16 ---------------- .../Rules/Functions => e2e}/data/bug-11359.php | 0 3 files changed, 13 insertions(+), 17 deletions(-) rename tests/{PHPStan/Rules/Functions => e2e}/data/bug-11359.php (100%) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 667ef51b010..f27c81cf939 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1836,6 +1836,18 @@ jobs: extensions: ":curl" - script: "bin/phpstan analyse -l 8 tests/e2e/anon-class/Granularity.php" extensions: "" + - script: | + OUTPUT=$(e2e/bashunit assert exit_code "1" "bin/phpstan analyse --no-progress --error-format raw --level=8 -c tests/e2e/data/empty.neon tests/e2e/data/bug-11359.php") + echo "$OUTPUT" + e2e/bashunit assert contains 'tests/e2e/data/bug-11359.php:3:Function mb_ucfirst not found.' "$OUTPUT" + php-version: "8.2" + extensions: mbstring + - script: | + OUTPUT=$(e2e/bashunit assert exit_code "0" "bin/phpstan analyse --no-progress --error-format raw --level=8 -c tests/e2e/data/empty.neon tests/e2e/data/bug-11359.php") + echo "$OUTPUT" + e2e/bashunit assert not_contains 'Function mb_ucfirst not found.' "$OUTPUT" + php-version: "8.4" + extensions: mbstring - script: "bin/phpstan analyse -l 8 e2e/phpstan-phpunit-190/test.php -c e2e/phpstan-phpunit-190/test.neon" extensions: "" - script: "bin/phpstan analyse e2e/only-files-not-analysed-trait/src -c e2e/only-files-not-analysed-trait/ignore.neon" @@ -2086,7 +2098,7 @@ jobs: with: coverage: ${{ matrix.coverage || 'none' }} ini-values: ${{ matrix.ini-values || '' }} - php-version: "8.2" + php-version: ${{ matrix.php-version || '8.2' }} tools: ${{ matrix.tools }} extensions: ${{ matrix.extensions }} diff --git a/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php b/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php index 44cb762dad5..54081d235c7 100644 --- a/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php +++ b/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php @@ -5,7 +5,6 @@ use PHPStan\Rules\Rule; use PHPStan\Testing\RuleTestCase; use PHPUnit\Framework\Attributes\RequiresPhp; -use const PHP_VERSION_ID; /** * @extends RuleTestCase @@ -281,19 +280,4 @@ public function testBug8980(): void ]); } - public function testBug11359(): void - { - $errors = []; - if (PHP_VERSION_ID < 80400) { - $errors = [ - [ - 'Function mb_ucfirst not found.', - 3, - 'Learn more at https://phpstan.org/user-guide/discovering-symbols', - ], - ]; - } - $this->analyse([__DIR__ . '/data/bug-11359.php'], $errors); - } - } diff --git a/tests/PHPStan/Rules/Functions/data/bug-11359.php b/tests/e2e/data/bug-11359.php similarity index 100% rename from tests/PHPStan/Rules/Functions/data/bug-11359.php rename to tests/e2e/data/bug-11359.php From ab6cb8dd854d24c1337883b1f9028aa617523766 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 26 Oct 2026 09:43:28 +0100 Subject: [PATCH 4/7] fix test --- .github/workflows/e2e-tests.yml | 10 ++++++---- {tests/e2e/data => e2e/bug-11359}/bug-11359.php | 0 2 files changed, 6 insertions(+), 4 deletions(-) rename {tests/e2e/data => e2e/bug-11359}/bug-11359.php (100%) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index f27c81cf939..783c26bc707 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1837,15 +1837,17 @@ jobs: - script: "bin/phpstan analyse -l 8 tests/e2e/anon-class/Granularity.php" extensions: "" - script: | - OUTPUT=$(e2e/bashunit assert exit_code "1" "bin/phpstan analyse --no-progress --error-format raw --level=8 -c tests/e2e/data/empty.neon tests/e2e/data/bug-11359.php") + cd e2e/bug-11359 + OUTPUT=$(../bashunit assert exit_code "1" "../../bin/phpstan analyse --no-progress --error-format raw --level=8 bug-11359.php") echo "$OUTPUT" - e2e/bashunit assert contains 'tests/e2e/data/bug-11359.php:3:Function mb_ucfirst not found.' "$OUTPUT" + ../bashunit assert contains 'tests/e2e/data/bug-11359.php:3:Function mb_ucfirst not found.' "$OUTPUT" php-version: "8.2" extensions: mbstring - script: | - OUTPUT=$(e2e/bashunit assert exit_code "0" "bin/phpstan analyse --no-progress --error-format raw --level=8 -c tests/e2e/data/empty.neon tests/e2e/data/bug-11359.php") + cd e2e/bug-11359 + OUTPUT=$(../bashunit assert exit_code "0" "../../bin/phpstan analyse --no-progress --error-format raw --level=8 -c bug-11359.php") echo "$OUTPUT" - e2e/bashunit assert not_contains 'Function mb_ucfirst not found.' "$OUTPUT" + ../bashunit assert not_contains 'Function mb_ucfirst not found.' "$OUTPUT" php-version: "8.4" extensions: mbstring - script: "bin/phpstan analyse -l 8 e2e/phpstan-phpunit-190/test.php -c e2e/phpstan-phpunit-190/test.neon" diff --git a/tests/e2e/data/bug-11359.php b/e2e/bug-11359/bug-11359.php similarity index 100% rename from tests/e2e/data/bug-11359.php rename to e2e/bug-11359/bug-11359.php From b07cebd1dea61a5f0e6c502b1177d2a1dbb4c5a2 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 26 Oct 2026 09:43:47 +0100 Subject: [PATCH 5/7] Update e2e-tests.yml --- .github/workflows/e2e-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 783c26bc707..4705732c9ed 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1840,7 +1840,7 @@ jobs: cd e2e/bug-11359 OUTPUT=$(../bashunit assert exit_code "1" "../../bin/phpstan analyse --no-progress --error-format raw --level=8 bug-11359.php") echo "$OUTPUT" - ../bashunit assert contains 'tests/e2e/data/bug-11359.php:3:Function mb_ucfirst not found.' "$OUTPUT" + ../bashunit assert contains 'e2e/data/bug-11359.php:3:Function mb_ucfirst not found.' "$OUTPUT" php-version: "8.2" extensions: mbstring - script: | From f3dd4aba2c0ee7f749dae109b35075ba896483d9 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 26 Oct 2026 09:44:06 +0100 Subject: [PATCH 6/7] Update e2e-tests.yml --- .github/workflows/e2e-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 4705732c9ed..71f2755cc4b 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1840,7 +1840,7 @@ jobs: cd e2e/bug-11359 OUTPUT=$(../bashunit assert exit_code "1" "../../bin/phpstan analyse --no-progress --error-format raw --level=8 bug-11359.php") echo "$OUTPUT" - ../bashunit assert contains 'e2e/data/bug-11359.php:3:Function mb_ucfirst not found.' "$OUTPUT" + ../bashunit assert contains 'e2e/bug-11359/bug-11359.php:3:Function mb_ucfirst not found.' "$OUTPUT" php-version: "8.2" extensions: mbstring - script: | From cce554442e99c6f1456369ff03aa4e220ef21685 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 26 Oct 2026 09:47:55 +0100 Subject: [PATCH 7/7] Update e2e-tests.yml --- .github/workflows/e2e-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 71f2755cc4b..007a8d510a5 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1845,7 +1845,7 @@ jobs: extensions: mbstring - script: | cd e2e/bug-11359 - OUTPUT=$(../bashunit assert exit_code "0" "../../bin/phpstan analyse --no-progress --error-format raw --level=8 -c bug-11359.php") + OUTPUT=$(../bashunit assert exit_code "0" "../../bin/phpstan analyse --no-progress --error-format raw --level=8 bug-11359.php") echo "$OUTPUT" ../bashunit assert not_contains 'Function mb_ucfirst not found.' "$OUTPUT" php-version: "8.4"