Skip to content

Commit 05e840e

Browse files
committed
Fix PHP 7.4 compatibility: replace str_contains and str_ends_with
1 parent efce507 commit 05e840e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Formatter/FilterOutUnmatchedInlineIgnoresFormatter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
use PHPStan\Command\Output;
1010
use PHPStan\DependencyInjection\Container;
1111
use PHPStan\DependencyInjection\MissingServiceException;
12-
use function str_contains;
13-
use function str_ends_with;
12+
use function strpos;
13+
use function substr;
1414

1515
/**
1616
* This formatter solves the following issue https://github.com/phpstan/phpstan/issues/12328
@@ -94,7 +94,7 @@ private function filterErrors(array $errors): array
9494
private function isDeadCodeIdentifier(string $message): bool
9595
{
9696
foreach ($this->identifiers as $identifier) {
97-
if (str_contains($message, $identifier)) {
97+
if (strpos($message, $identifier) !== false) {
9898
return true;
9999
}
100100
}
@@ -106,7 +106,7 @@ private function isPartialAnalysis(): bool
106106
/** @var array<string> $argv */
107107
$argv = $_SERVER['argv'] ?? [];
108108
foreach ($argv as $arg) {
109-
if (str_ends_with($arg, '.php')) {
109+
if (substr($arg, -4) === '.php') {
110110
return true;
111111
}
112112
}

0 commit comments

Comments
 (0)