Skip to content

Commit 3fedb53

Browse files
committed
Revert all changes in PhpUnit Bridge
1 parent 331b8e9 commit 3fedb53

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/Symfony/Bridge/PhpUnit/ClockMock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public static function register($class)
111111
if (0 < strpos($class, '\\Tests\\')) {
112112
$ns = str_replace('\\Tests\\', '\\', $class);
113113
$mockedNs[] = substr($ns, 0, strrpos($ns, '\\'));
114-
} elseif (str_starts_with($class, 'Tests\\')) {
114+
} elseif (0 === strpos($class, 'Tests\\')) {
115115
$mockedNs[] = substr($class, 6, strrpos($class, '\\') - 6);
116116
}
117117
foreach ($mockedNs as $ns) {

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public static function collectDeprecations($outputFile)
9090
{
9191
$deprecations = [];
9292
$previousErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$deprecations, &$previousErrorHandler) {
93-
if (\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || !str_contains($msg, '" targeting switch is equivalent to "break'))) {
93+
if (\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) {
9494
if ($previousErrorHandler) {
9595
return $previousErrorHandler($type, $msg, $file, $line, $context);
9696
}
@@ -122,7 +122,7 @@ public static function collectDeprecations($outputFile)
122122
*/
123123
public function handleError($type, $msg, $file, $line, $context = [])
124124
{
125-
if ((\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || !str_contains($msg, '" targeting switch is equivalent to "break'))) || !$this->getConfiguration()->isEnabled()) {
125+
if ((\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) || !$this->getConfiguration()->isEnabled()) {
126126
return \call_user_func(self::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
127127
}
128128

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function __construct($message, array $trace, $file, $languageDeprecation
8989
$this->getOriginalFilesStack();
9090
array_splice($this->originalFilesStack, 0, $j, [$this->triggeringFile]);
9191

92-
if (preg_match('/(?|"([^"]++)" that is deprecated|should implement method "(?:static )?([^:]++))/', $message, $m) || (!str_contains($message, '()" will return') && !str_contains($message, 'native return type declaration') && preg_match('/^(?:The|Method) "([^":]++)/', $message, $m))) {
92+
if (preg_match('/(?|"([^"]++)" that is deprecated|should implement method "(?:static )?([^:]++))/', $message, $m) || (false === strpos($message, '()" will return') && false === strpos($message, 'native return type declaration') && preg_match('/^(?:The|Method) "([^":]++)/', $message, $m))) {
9393
$this->triggeringFile = (new \ReflectionClass($m[1]))->getFileName();
9494
array_unshift($this->originalFilesStack, $this->triggeringFile);
9595
}
@@ -176,7 +176,7 @@ public function originatingClass()
176176

177177
$class = $this->originClass;
178178

179-
return str_contains($class, "@anonymous\0") ? (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous' : $class;
179+
return false !== strpos($class, "@anonymous\0") ? (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous' : $class;
180180
}
181181

182182
/**
@@ -230,7 +230,7 @@ public function isMuted()
230230
return 0 === strpos($this->trace[1]['class'], 'PHPUnit\\');
231231
}
232232

233-
return str_contains($this->triggeringFile, \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'phpunit'.\DIRECTORY_SEPARATOR);
233+
return false !== strpos($this->triggeringFile, \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'phpunit'.\DIRECTORY_SEPARATOR);
234234
}
235235

236236
/**

src/Symfony/Bridge/PhpUnit/DnsMock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public static function register($class)
169169
if (0 < strpos($class, '\\Tests\\')) {
170170
$ns = str_replace('\\Tests\\', '\\', $class);
171171
$mockedNs[] = substr($ns, 0, strrpos($ns, '\\'));
172-
} elseif (str_starts_with($class, 'Tests\\')) {
172+
} elseif (0 === strpos($class, 'Tests\\')) {
173173
$mockedNs[] = substr($class, 6, strrpos($class, '\\') - 6);
174174
}
175175
foreach ($mockedNs as $ns) {

0 commit comments

Comments
 (0)