@@ -124,6 +124,22 @@ jobs:
124124 mv src/Foo.php.orig src/Foo.php
125125 echo -n > phpstan-baseline.neon
126126 ../../bin/phpstan -vvv
127+ - script : |
128+ cd e2e/result-cache-atomic-save
129+ ../../bin/phpstan
130+ INODE=$(ls -i tmp/resultCache.php | awk '{print $1}')
131+ ../../bin/phpstan
132+ # The cache is written next to its final path and renamed into place, so saving it
133+ # again replaces the file rather than truncating and rewriting the one the next run
134+ # reads. That is what keeps a run killed mid-save from leaving a partial cache behind.
135+ REPLACED=$([ "$INODE" != "$(ls -i tmp/resultCache.php | awk '{print $1}')" ] && echo replaced || echo 'written in place')
136+ ../bashunit -a equals 'replaced' "$REPLACED"
137+ # A completed save leaves nothing next to the cache file.
138+ LEFTOVERS=$(ls tmp/ | grep -c '\.tmp$' || true)
139+ ../bashunit -a equals '0' "$LEFTOVERS"
140+ OUTPUT=$(../../bin/phpstan -vvv 2>&1)
141+ echo "$OUTPUT"
142+ ../bashunit -a contains 'Result cache restored. 0 files will be reanalysed.' "$OUTPUT"
127143 - script : |
128144 cd e2e/bug-14514
129145 composer install
@@ -788,6 +804,19 @@ jobs:
788804 /tmp/phpstan-install-1/bin/phpstan analyse -l 8 -vvv test.php
789805 mv /tmp/phpstan-install-1 /tmp/phpstan-install-2
790806 /tmp/phpstan-install-2/bin/phpstan analyse -l 8 -vvv test.php
807+ - script : |
808+ # PHPStan bundles symfony/polyfill-php85 for its own runtime, so array_first()
809+ # and other PHP 8.5 symbols are declared in the PHPStan process. A project
810+ # analysed with PHP 8.4 must not see them
811+ # (https://github.com/phpstan/phpstan/issues/15150).
812+ cd e2e/bug-15150
813+ OUTPUT=$(../bashunit -a exit_code "1" "../../bin/phpstan analyse --error-format=raw")
814+ echo "$OUTPUT"
815+ ../bashunit -a contains 'test.php:11:Function array_first not found.' "$OUTPUT"
816+ ../bashunit -a contains 'test.php:12:Function array_last not found.' "$OUTPUT"
817+ ../bashunit -a contains 'test.php:21:Instantiated class Filter\FilterException not found.' "$OUTPUT"
818+ # array_find() exists in the analysed PHP version, PhpStorm stubs describe it
819+ ../bashunit -a not_contains 'array_find' "$OUTPUT"
791820
792821 steps :
793822 - name : Harden the runner (Audit all outbound calls)
@@ -1153,6 +1182,23 @@ jobs:
11531182 echo "$OUTPUT"
11541183 e2e/bashunit -a contains 'Turbo extension: enabled' "$OUTPUT"
11551184
1185+ - name : " Verify conditional types leave interned types equal to a resolved subject alone"
1186+ # With the extension active TypeCombinator's results are interned, so equal
1187+ # types share one instance. ConditionalType used to narrow the types in its
1188+ # branches identical to the subject even once the subject had resolved to a
1189+ # concrete type, and interning made that hit unrelated types - the `mixed`
1190+ # value type of an `array` branch for a `mixed` subject -
1191+ # https://github.com/phpstan/phpstan/issues/15151
1192+ run : |
1193+ cd e2e/bug-15151
1194+ OUTPUT=$(php ../../bin/phpstan analyse --no-progress --error-format=raw 2>&1 || true)
1195+ echo "$OUTPUT"
1196+ ../bashunit -a contains 'reception_formulaire.php:20:Dumped type: mixed' "$OUTPUT"
1197+ ../bashunit -a contains 'webservice.php:25:Dumped type: mixed' "$OUTPUT"
1198+ ../bashunit -a not_contains 'Dumped type: array' "$OUTPUT"
1199+ # the two dumps are the only errors: count the file:line:message lines
1200+ ../bashunit -a equals '2' "$(echo "$OUTPUT" | grep -Ec '^/.+:[0-9]+:')"
1201+
11561202 - name : " Test"
11571203 # The arena is a per-run POSIX shared-memory object: shm_open() plus an
11581204 # ftruncate() to 256 MB that tmpfs honours sparsely, committing pages on
0 commit comments