Summary
From the PHP 8.5 support audit (PR #597); user-approved modernization batch. Includes two latent bugs found on the way.
Latent bugs (fix regardless)
src/Instrument/FileSystem/Enumerator.php:158:
if (strpos($path, $this->rootDirectory, 0) === false) {
This is a substring-anywhere test posing as a prefix test — /other/app passes validation if it merely contains the root path string. Intent is !str_starts_with($path, $this->rootDirectory).
tests/Instrument/Transformer/WeavingTransformerTest.php:136:
$this->assertFalse(strpos($proxyContent, '\\\\Exception'));
Passes when the needle sits at offset 0 (the classic pre-8.0 trap). Should be assertStringNotContainsString.
Modernizations
src/Instrument/FileSystem/Enumerator.php:84 — strpos(PHP_OS, 'WIN') === 0 → PHP_OS_FAMILY === 'Windows'; :108 — strpos(...) !== 0 → !str_starts_with(...)
src/Instrument/PathResolver.php:66, src/Core/AdviceMatcher.php:90 — strpos(...) !== false → str_contains(...)
array_any/array_all/array_find (8.4) for hand-rolled loops:
src/Aop/Pointcut/OrPointcut.php:56-62 → array_any
src/Aop/Pointcut/AndPointcut.php:59-65 → array_all
src/Instrument/FileSystem/Enumerator.php:112-129 include/exclude loops → array_any
src/Proxy/Part/AbstractInterceptedPropertyGenerator.php:101-103 union-type scan → array_any
src/Instrument/Transformer/WeavingTransformer.php:567-572 flag loop → array_any; :513-527 comma scans → array_find
src/Instrument/Transformer/WeavingTransformer.php:492 — end($groupPositions) + @var annotation; array_last() is 8.5-only, so keep end() until the floor rises (note in code), or drop the annotation via a local typed helper.
tests/Functional/ReflectionFilenameTest.php:49 — ReflectionProperty::setValue(null) single-arg form is deprecated since 8.3 (the suite's only deprecation); pass the object/null pair explicitly.
Pipe-operator (|>) rewrites of internal call chains stay blocked until the package floor is ^8.5 — not part of this issue.
Summary
From the PHP 8.5 support audit (PR #597); user-approved modernization batch. Includes two latent bugs found on the way.
Latent bugs (fix regardless)
src/Instrument/FileSystem/Enumerator.php:158:/other/apppasses validation if it merely contains the root path string. Intent is!str_starts_with($path, $this->rootDirectory).tests/Instrument/Transformer/WeavingTransformerTest.php:136:assertStringNotContainsString.Modernizations
src/Instrument/FileSystem/Enumerator.php:84—strpos(PHP_OS, 'WIN') === 0→PHP_OS_FAMILY === 'Windows';:108—strpos(...) !== 0→!str_starts_with(...)src/Instrument/PathResolver.php:66,src/Core/AdviceMatcher.php:90—strpos(...) !== false→str_contains(...)array_any/array_all/array_find(8.4) for hand-rolled loops:src/Aop/Pointcut/OrPointcut.php:56-62→array_anysrc/Aop/Pointcut/AndPointcut.php:59-65→array_allsrc/Instrument/FileSystem/Enumerator.php:112-129include/exclude loops →array_anysrc/Proxy/Part/AbstractInterceptedPropertyGenerator.php:101-103union-type scan →array_anysrc/Instrument/Transformer/WeavingTransformer.php:567-572flag loop →array_any;:513-527comma scans →array_findsrc/Instrument/Transformer/WeavingTransformer.php:492—end($groupPositions)+@varannotation;array_last()is 8.5-only, so keepend()until the floor rises (note in code), or drop the annotation via a local typed helper.tests/Functional/ReflectionFilenameTest.php:49—ReflectionProperty::setValue(null)single-arg form is deprecated since 8.3 (the suite's only deprecation); pass the object/nullpair explicitly.Pipe-operator (
|>) rewrites of internal call chains stay blocked until the package floor is ^8.5 — not part of this issue.