Skip to content

Commit b1710f4

Browse files
gen_stub: use str_starts_with() and str_ends_with()
1 parent 5b2df3b commit b1710f4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

build/gen_stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function processDirectory(string $dir, Context $context): array {
8383
);
8484
foreach ($it as $file) {
8585
$pathName = $file->getPathName();
86-
if (substr($pathName, -9) === '.stub.php') {
86+
if (str_ends_with($pathName, '.stub.php')) {
8787
$pathNames[] = $pathName;
8888
}
8989
}
@@ -5968,7 +5968,7 @@ function initPhpParser() {
59685968
}
59695969

59705970
spl_autoload_register(static function(string $class) use ($phpParserDir) {
5971-
if (strpos($class, "PhpParser\\") === 0) {
5971+
if (str_starts_with($class, "PhpParser\\")) {
59725972
$fileName = $phpParserDir . "/lib/" . str_replace("\\", "/", $class) . ".php";
59735973
require $fileName;
59745974
}

0 commit comments

Comments
 (0)