Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8c84365

Browse filesBrowse files
bug #42223 [Debug][ErrorHandler] Do not use the php80 polyfill (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [Debug][ErrorHandler] Do not use the php80 polyfill | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- dd6bb2c [ErrorHandler][Debug] Do not use the php80 polyfill
2 parents 855232f + dd6bb2c commit 8c84365
Copy full SHA for 8c84365

18 files changed

+51
-53
lines changed

‎src/Symfony/Component/Debug/DebugClassLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/DebugClassLoader.php
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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)) {

‎src/Symfony/Component/Debug/ErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/ErrorHandler.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ private function reRegister(int $prev)
385385
*/
386386
public function handleError($type, $message, $file, $line)
387387
{
388-
if (\PHP_VERSION_ID >= 70300 && \E_WARNING === $type && '"' === $message[0] && str_contains($message, '" targeting switch is equivalent to "break')) {
388+
if (\PHP_VERSION_ID >= 70300 && \E_WARNING === $type && '"' === $message[0] && false !== strpos($message, '" targeting switch is equivalent to "break')) {
389389
$type = \E_DEPRECATED;
390390
}
391391

@@ -403,7 +403,7 @@ public function handleError($type, $message, $file, $line)
403403
}
404404
$scope = $this->scopedErrors & $type;
405405

406-
if (str_contains($message, "@anonymous\0")) {
406+
if (false !== strpos($message, "@anonymous\0")) {
407407
$logMessage = $this->levels[$type].': '.(new FlattenException())->setMessage($message)->getMessage();
408408
} else {
409409
$logMessage = $this->levels[$type].': '.$message;
@@ -530,7 +530,7 @@ public function handleException($exception, array $error = null)
530530
$handlerException = null;
531531

532532
if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
533-
if (str_contains($message = $exception->getMessage(), "@anonymous\0")) {
533+
if (false !== strpos($message = $exception->getMessage(), "@anonymous\0")) {
534534
$message = (new FlattenException())->setMessage($message)->getMessage();
535535
}
536536
if ($exception instanceof FatalErrorException) {
@@ -638,7 +638,7 @@ public static function handleFatalError(array $error = null)
638638
$handler->throwAt(0, true);
639639
$trace = $error['backtrace'] ?? null;
640640

641-
if (str_starts_with($error['message'], 'Allowed memory') || str_starts_with($error['message'], 'Out of memory')) {
641+
if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
642642
$exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
643643
} else {
644644
$exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);

‎src/Symfony/Component/Debug/Exception/FatalThrowableError.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/Exception/FatalThrowableError.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class FatalThrowableError extends FatalErrorException
2626

2727
public function __construct(\Throwable $e)
2828
{
29-
$this->originalClassName = get_debug_type($e);
29+
$this->originalClassName = \get_class($e);
3030

3131
if ($e instanceof \ParseError) {
3232
$severity = \E_PARSE;

‎src/Symfony/Component/Debug/Exception/FlattenException.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/Exception/FlattenException.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static function createFromThrowable(\Throwable $exception, int $statusCod
6767
$e->setStatusCode($statusCode);
6868
$e->setHeaders($headers);
6969
$e->setTraceFromThrowable($exception);
70-
$e->setClass($exception instanceof FatalThrowableError ? $exception->getOriginalClassName() : get_debug_type($exception));
70+
$e->setClass($exception instanceof FatalThrowableError ? $exception->getOriginalClassName() : \get_class($exception));
7171
$e->setFile($exception->getFile());
7272
$e->setLine($exception->getLine());
7373

@@ -134,7 +134,7 @@ public function getClass()
134134
*/
135135
public function setClass($class)
136136
{
137-
$this->class = str_contains($class, "@anonymous\0") ? (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous' : $class;
137+
$this->class = false !== strpos($class, "@anonymous\0") ? (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous' : $class;
138138

139139
return $this;
140140
}
@@ -179,7 +179,7 @@ public function getMessage()
179179
*/
180180
public function setMessage($message)
181181
{
182-
if (str_contains($message, "@anonymous\0")) {
182+
if (false !== strpos($message, "@anonymous\0")) {
183183
$message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
184184
return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
185185
}, $message);

‎src/Symfony/Component/Debug/ExceptionHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/ExceptionHandler.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ private function formatPath(string $path, int $line): string
401401
$fmt = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, \PREG_SPLIT_DELIM_CAPTURE);
402402

403403
for ($i = 1; isset($fmt[$i]); ++$i) {
404-
if (str_starts_with($path, $k = $fmt[$i++])) {
404+
if (0 === strpos($path, $k = $fmt[$i++])) {
405405
$path = substr_replace($path, $fmt[$i], 0, \strlen($k));
406406
break;
407407
}

‎src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private function convertFileToClass(string $path, string $file, string $prefix):
149149
];
150150

151151
if ($prefix) {
152-
$candidates = array_filter($candidates, function ($candidate) use ($prefix) { return str_starts_with($candidate, $prefix); });
152+
$candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
153153
}
154154

155155
// We cannot use the autoloader here as most of them use require; but if the class

‎src/Symfony/Component/Debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function handleError(array $error, FatalErrorException $exception)
4343

4444
$prefix = 'Call to undefined function ';
4545
$prefixLen = \strlen($prefix);
46-
if (!str_starts_with($error['message'], $prefix)) {
46+
if (0 !== strpos($error['message'], $prefix)) {
4747
return null;
4848
}
4949

‎src/Symfony/Component/Debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function handleError(array $error, FatalErrorException $exception)
4848
$candidates = [];
4949
foreach ($methods as $definedMethodName) {
5050
$lev = levenshtein($methodName, $definedMethodName);
51-
if ($lev <= \strlen($methodName) / 3 || str_contains($definedMethodName, $methodName)) {
51+
if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
5252
$candidates[] = $definedMethodName;
5353
}
5454
}

‎src/Symfony/Component/Debug/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Debug/composer.json
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=7.1.3",
20-
"psr/log": "^1|^2|^3",
21-
"symfony/polyfill-php80": "^1.16"
20+
"psr/log": "^1|^2|^3"
2221
},
2322
"conflict": {
2423
"symfony/http-kernel": "<3.4"

‎src/Symfony/Component/ErrorHandler/BufferingLogger.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ErrorHandler/BufferingLogger.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __wakeup()
4848
public function __destruct()
4949
{
5050
foreach ($this->logs as [$level, $message, $context]) {
51-
if (str_contains($message, '{')) {
51+
if (false !== strpos($message, '{')) {
5252
foreach ($context as $key => $val) {
5353
if (null === $val || is_scalar($val) || (\is_object($val) && \is_callable([$val, '__toString']))) {
5454
$message = str_replace("{{$key}}", $val, $message);

‎src/Symfony/Component/ErrorHandler/DebugClassLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/ErrorHandler/DebugClassLoader.php
+18-18Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function __construct(callable $classLoader)
205205
if (false === $test || false === $i) {
206206
// filesystem is case sensitive
207207
self::$caseCheck = 0;
208-
} elseif (str_ends_with($test, $file)) {
208+
} elseif (substr($test, -\strlen($file)) === $file) {
209209
// filesystem is case insensitive and realpath() normalizes the case of characters
210210
self::$caseCheck = 1;
211211
} elseif (false !== stripos(\PHP_OS, 'darwin')) {
@@ -396,7 +396,7 @@ private function checkClass(string $class, string $file = null): void
396396
}
397397

398398
if (!$exists) {
399-
if (str_contains($class, '/')) {
399+
if (false !== strpos($class, '/')) {
400400
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));
401401
}
402402

@@ -419,7 +419,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
419419
}
420420
$deprecations = [];
421421

422-
$className = str_contains($class, "@anonymous\0") ? (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous' : $class;
422+
$className = false !== strpos($class, "@anonymous\0") ? (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous' : $class;
423423

424424
// Don't trigger deprecations for classes in the same vendor
425425
if ($class !== $className) {
@@ -435,17 +435,17 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
435435
// Detect annotations on the class
436436
if (false !== $doc = $refl->getDocComment()) {
437437
foreach (['final', 'deprecated', 'internal'] as $annotation) {
438-
if (str_contains($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
438+
if (false !== strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
439439
self::${$annotation}[$class] = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : '';
440440
}
441441
}
442442

443-
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)) {
443+
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)) {
444444
foreach ($notice as $method) {
445445
$static = '' !== $method[1] && !empty($method[2]);
446446
$name = $method[3];
447447
$description = $method[4] ?? null;
448-
if (!str_contains($name, '(')) {
448+
if (false === strpos($name, '(')) {
449449
$name .= '()';
450450
}
451451
if (null !== $description) {
@@ -496,7 +496,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
496496
}
497497
} elseif (!$refl->isInterface()) {
498498
if (!strncmp($vendor, str_replace('_', '\\', $use), $vendorLen)
499-
&& str_starts_with($className, 'Symfony\\')
499+
&& 0 === strpos($className, 'Symfony\\')
500500
&& (!class_exists(InstalledVersions::class)
501501
|| 'symfony/symfony' !== InstalledVersions::getRootPackage()['name'])
502502
) {
@@ -597,12 +597,12 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
597597

598598
$forcePatchTypes = $this->patchTypes['force'];
599599

600-
if ($canAddReturnType = null !== $forcePatchTypes && !str_contains($method->getFileName(), \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR)) {
600+
if ($canAddReturnType = null !== $forcePatchTypes && false === strpos($method->getFileName(), \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR)) {
601601
if ('void' !== (self::MAGIC_METHODS[$method->name] ?? 'void')) {
602602
$this->patchTypes['force'] = $forcePatchTypes ?: 'docblock';
603603
}
604604

605-
$canAddReturnType = str_contains($refl->getFileName(), \DIRECTORY_SEPARATOR.'Tests'.\DIRECTORY_SEPARATOR)
605+
$canAddReturnType = false !== strpos($refl->getFileName(), \DIRECTORY_SEPARATOR.'Tests'.\DIRECTORY_SEPARATOR)
606606
|| $refl->isFinal()
607607
|| $method->isFinal()
608608
|| $method->isPrivate()
@@ -623,8 +623,8 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
623623
$this->patchMethod($method, $returnType, $declaringFile, $normalizedType);
624624
}
625625

626-
if (!str_contains($doc, '* @deprecated') && strncmp($ns, $declaringClass, $len)) {
627-
if ($canAddReturnType && 'docblock' === $this->patchTypes['force'] && !str_contains($method->getFileName(), \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR)) {
626+
if (false === strpos($doc, '* @deprecated') && strncmp($ns, $declaringClass, $len)) {
627+
if ($canAddReturnType && 'docblock' === $this->patchTypes['force'] && false === strpos($method->getFileName(), \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR)) {
628628
$this->patchMethod($method, $returnType, $declaringFile, $normalizedType);
629629
} elseif ('' !== $declaringClass && $this->patchTypes['deprecations']) {
630630
$deprecations[] = sprintf('Method "%s::%s()" will return "%s" as of its next major version. Doing the same in %s "%s" will be required when upgrading.', $declaringClass, $method->name, $normalizedType, interface_exists($declaringClass) ? 'implementation' : 'child class', $className);
@@ -640,7 +640,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
640640

641641
$matches = [];
642642

643-
if (!$method->hasReturnType() && ((str_contains($doc, '@return') && preg_match('/\n\s+\* @return +([^\s<(]+)/', $doc, $matches)) || 'void' !== (self::MAGIC_METHODS[$method->name] ?? 'void'))) {
643+
if (!$method->hasReturnType() && ((false !== strpos($doc, '@return') && preg_match('/\n\s+\* @return +([^\s<(]+)/', $doc, $matches)) || 'void' !== (self::MAGIC_METHODS[$method->name] ?? 'void'))) {
644644
$matches = $matches ?: [1 => self::MAGIC_METHODS[$method->name]];
645645
$this->setReturnType($matches[1], $method, $parent);
646646

@@ -662,14 +662,14 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
662662
$finalOrInternal = false;
663663

664664
foreach (['final', 'internal'] as $annotation) {
665-
if (str_contains($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
665+
if (false !== strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) {
666666
$message = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : '';
667667
self::${$annotation.'Methods'}[$class][$method->name] = [$class, $message];
668668
$finalOrInternal = true;
669669
}
670670
}
671671

672-
if ($finalOrInternal || $method->isConstructor() || !str_contains($doc, '@param') || StatelessInvocation::class === $class) {
672+
if ($finalOrInternal || $method->isConstructor() || false === strpos($doc, '@param') || StatelessInvocation::class === $class) {
673673
continue;
674674
}
675675
if (!preg_match_all('#\n\s+\* @param +((?(?!callable *\().*?|callable *\(.*\).*?))(?<= )\$([a-zA-Z0-9_\x7f-\xff]++)#', $doc, $matches, \PREG_SET_ORDER)) {
@@ -850,7 +850,7 @@ private function setReturnType(string $types, \ReflectionMethod $method, ?string
850850
$iterable = $object = true;
851851
foreach ($typesMap as $n => $t) {
852852
if ('null' !== $n) {
853-
$iterable = $iterable && (\in_array($n, ['array', 'iterable']) || str_contains($n, 'Iterator'));
853+
$iterable = $iterable && (\in_array($n, ['array', 'iterable']) || false !== strpos($n, 'Iterator'));
854854
$object = $object && (\in_array($n, ['callable', 'object', '$this', 'static']) || !isset(self::SPECIAL_RETURN_TYPES[$n]));
855855
}
856856
}
@@ -1034,15 +1034,15 @@ private static function getUseStatements(string $file): array
10341034
break;
10351035
}
10361036

1037-
if (str_starts_with($file[$i], 'namespace ')) {
1037+
if (0 === strpos($file[$i], 'namespace ')) {
10381038
$namespace = substr($file[$i], \strlen('namespace '), -2).'\\';
10391039
$useOffset = $i + 2;
10401040
}
10411041

1042-
if (str_starts_with($file[$i], 'use ')) {
1042+
if (0 === strpos($file[$i], 'use ')) {
10431043
$useOffset = $i;
10441044

1045-
for (; str_starts_with($file[$i], 'use '); ++$i) {
1045+
for (; 0 === strpos($file[$i], 'use '); ++$i) {
10461046
$u = explode(' as ', substr($file[$i], 4, -2), 2);
10471047

10481048
if (1 === \count($u)) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.