@@ -61,7 +61,7 @@ public function __construct(callable $classLoader)
6161 if (false === $ test || false === $ i ) {
6262 // filesystem is case sensitive
6363 self ::$ caseCheck = 0 ;
64- } elseif (str_ends_with ($ test , $ file )) {
64+ } elseif (substr ($ test , - \strlen ( $ file )) === $ file ) {
6565 // filesystem is case insensitive and realpath() normalizes the case of characters
6666 self ::$ caseCheck = 1 ;
6767 } elseif (false !== stripos (\PHP_OS , 'darwin ' )) {
@@ -210,7 +210,7 @@ private function checkClass(string $class, string $file = null)
210210 }
211211
212212 if (!$ exists ) {
213- if (str_contains ($ class , '/ ' )) {
213+ if (false !== strpos ($ class , '/ ' )) {
214214 throw new \RuntimeException (sprintf ('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/". ' , $ class ));
215215 }
216216
@@ -237,17 +237,17 @@ public function checkAnnotations(\ReflectionClass $refl, $class)
237237 // Detect annotations on the class
238238 if (false !== $ doc = $ refl ->getDocComment ()) {
239239 foreach (['final ' , 'deprecated ' , 'internal ' ] as $ annotation ) {
240- if (str_contains ($ doc , $ annotation ) && preg_match ('#\n\s+\* @ ' .$ annotation .'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s ' , $ doc , $ notice )) {
240+ if (false !== strpos ($ doc , $ annotation ) && preg_match ('#\n\s+\* @ ' .$ annotation .'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s ' , $ doc , $ notice )) {
241241 self ::$ {$ annotation }[$ class ] = isset ($ notice [1 ]) ? preg_replace ('#\.?\r?\n( \*)? *(?= |\r?\n|$)# ' , '' , $ notice [1 ]) : '' ;
242242 }
243243 }
244244
245- if ($ refl ->isInterface () && str_contains ($ doc , 'method ' ) && preg_match_all ('#\n \* @method\s+(static\s+)?+(?:[\w\|&\[\] \\\]+\s+)?(\w+(?:\s*\([^\)]*\))?)+(.+?([[:punct:]]\s*)?)?(?=\r?\n \*(?: @|/$|\r?\n))# ' , $ doc , $ notice , \PREG_SET_ORDER )) {
245+ if ($ refl ->isInterface () && false !== strpos ($ doc , 'method ' ) && preg_match_all ('#\n \* @method\s+(static\s+)?+(?:[\w\|&\[\] \\\]+\s+)?(\w+(?:\s*\([^\)]*\))?)+(.+?([[:punct:]]\s*)?)?(?=\r?\n \*(?: @|/$|\r?\n))# ' , $ doc , $ notice , \PREG_SET_ORDER )) {
246246 foreach ($ notice as $ method ) {
247247 $ static = '' !== $ method [1 ];
248248 $ name = $ method [2 ];
249249 $ description = $ method [3 ] ?? null ;
250- if (! str_contains ($ name , '( ' )) {
250+ if (false === strpos ($ name , '( ' )) {
251251 $ name .= '() ' ;
252252 }
253253 if (null !== $ description ) {
@@ -369,14 +369,14 @@ public function checkAnnotations(\ReflectionClass $refl, $class)
369369 $ finalOrInternal = false ;
370370
371371 foreach (['final ' , 'internal ' ] as $ annotation ) {
372- if (str_contains ($ doc , $ annotation ) && preg_match ('#\n\s+\* @ ' .$ annotation .'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s ' , $ doc , $ notice )) {
372+ if (false !== strpos ($ doc , $ annotation ) && preg_match ('#\n\s+\* @ ' .$ annotation .'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s ' , $ doc , $ notice )) {
373373 $ message = isset ($ notice [1 ]) ? preg_replace ('#\.?\r?\n( \*)? *(?= |\r?\n|$)# ' , '' , $ notice [1 ]) : '' ;
374374 self ::$ {$ annotation .'Methods ' }[$ class ][$ method ->name ] = [$ class , $ message ];
375375 $ finalOrInternal = true ;
376376 }
377377 }
378378
379- if ($ finalOrInternal || $ method ->isConstructor () || ! str_contains ($ doc , '@param ' ) || StatelessInvocation::class === $ class ) {
379+ if ($ finalOrInternal || $ method ->isConstructor () || false === strpos ($ doc , '@param ' ) || StatelessInvocation::class === $ class ) {
380380 continue ;
381381 }
382382 if (!preg_match_all ('#\n\s+\* @param +((?(?!callable *\().*?|callable *\(.*\).*?))(?<= )\$([a-zA-Z0-9_\x7f-\xff]++)# ' , $ doc , $ matches , \PREG_SET_ORDER )) {
0 commit comments