Commit b1710f48bad for php.net
commit b1710f48baddb6d980b00157c24371ec92852c15
Author: Daniel Scherzer <daniel.e.scherzer@gmail.com>
Date: Fri Mar 20 15:15:11 2026 -0700
gen_stub: use str_starts_with() and str_ends_with()
diff --git a/build/gen_stub.php b/build/gen_stub.php
index 6522560c24e..31b10ada50b 100755
--- a/build/gen_stub.php
+++ b/build/gen_stub.php
@@ -83,7 +83,7 @@ function processDirectory(string $dir, Context $context): array {
);
foreach ($it as $file) {
$pathName = $file->getPathName();
- if (substr($pathName, -9) === '.stub.php') {
+ if (str_ends_with($pathName, '.stub.php')) {
$pathNames[] = $pathName;
}
}
@@ -5968,7 +5968,7 @@ function initPhpParser() {
}
spl_autoload_register(static function(string $class) use ($phpParserDir) {
- if (strpos($class, "PhpParser\\") === 0) {
+ if (str_starts_with($class, "PhpParser\\")) {
$fileName = $phpParserDir . "/lib/" . str_replace("\\", "/", $class) . ".php";
require $fileName;
}