Skip to content

Commit 11708b2

Browse files
committedOct 20, 2023
Merge branch '6.4' into 7.0
* 6.4: Partially revert "DX: PHP CS Fixer - update excluded paths and apply some minor CS" [AssetMapper] Allowing for files to be written to some non-local location [HttpKernel] Resolve EBADP error on flock with LOCK_SH with NFS [AssetMapper] Fixing bug of bad parsing of imports when an import then export are adjacent add missing basque translations [FrameworkBundle][Validator] Allow implementing validation groups provider outside DTOs [Notifier][Novu] Implement overrides [Validator] Handle `null` case [Workflow] List place or transition listeners in profiler [Intl] Add support for emoji 15.1 Replace Tickets by Issues [Validator] Add missing arabic translations [Validator] Added missing translations for Romanian language for Validator component [Messenger] Fix graceful exit with ids [HttpKernel] Add parameters `kernel.runtime_mode` and `kernel.runtime_mode.*`, all set from env var `APP_RUNTIME_MODE`
2 parents e3bd13f + 447e284 commit 11708b2

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed
 

‎DeprecationErrorHandler.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static function collectDeprecations($outputFile)
9696
{
9797
$deprecations = [];
9898
$previousErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$deprecations, &$previousErrorHandler) {
99-
if (\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || !str_contains($msg, '" targeting switch is equivalent to "break'))) {
99+
if (\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) {
100100
if ($previousErrorHandler) {
101101
return $previousErrorHandler($type, $msg, $file, $line, $context);
102102
}
@@ -128,7 +128,7 @@ public static function collectDeprecations($outputFile)
128128
*/
129129
public function handleError($type, $msg, $file, $line, $context = [])
130130
{
131-
if ((\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || !str_contains($msg, '" targeting switch is equivalent to "break'))) || !$this->getConfiguration()->isEnabled()) {
131+
if ((\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) || !$this->getConfiguration()->isEnabled()) {
132132
return \call_user_func(self::getPhpUnitErrorHandler(), $type, $msg, $file, $line, $context);
133133
}
134134

‎DeprecationErrorHandler/Deprecation.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function __construct(string $message, array $trace, string $file, bool $l
9999
$this->getOriginalFilesStack();
100100
array_splice($this->originalFilesStack, 0, $j, [$this->triggeringFile]);
101101

102-
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))) {
102+
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))) {
103103
$this->triggeringFile = (new \ReflectionClass($m[1]))->getFileName();
104104
array_unshift($this->originalFilesStack, $this->triggeringFile);
105105
}
@@ -137,7 +137,7 @@ public function __construct(string $message, array $trace, string $file, bool $l
137137
return;
138138
}
139139

140-
if (!isset($line['class'], $trace[$i - 2]['function']) || !str_starts_with($line['class'], SymfonyTestsListenerFor::class)) {
140+
if (!isset($line['class'], $trace[$i - 2]['function']) || 0 !== strpos($line['class'], SymfonyTestsListenerFor::class)) {
141141
$this->originClass = isset($line['object']) ? \get_class($line['object']) : $line['class'];
142142
$this->originMethod = $line['function'];
143143

@@ -161,7 +161,7 @@ private function lineShouldBeSkipped(array $line): bool
161161
}
162162
$class = $line['class'];
163163

164-
return 'ReflectionMethod' === $class || str_starts_with($class, 'PHPUnit\\');
164+
return 'ReflectionMethod' === $class || 0 === strpos($class, 'PHPUnit\\');
165165
}
166166

167167
public function originatesFromDebugClassLoader(): bool
@@ -191,7 +191,7 @@ public function originatingClass(): string
191191

192192
$class = $this->originClass;
193193

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

197197
public function originatingMethod(): string
@@ -217,9 +217,9 @@ public function isLegacy(): bool
217217
$method = $this->originatingMethod();
218218
$groups = class_exists(Groups::class, false) ? [new Groups(), 'groups'] : [Test::class, 'getGroups'];
219219

220-
return str_starts_with($method, 'testLegacy')
221-
|| str_starts_with($method, 'provideLegacy')
222-
|| str_starts_with($method, 'getLegacy')
220+
return 0 === strpos($method, 'testLegacy')
221+
|| 0 === strpos($method, 'provideLegacy')
222+
|| 0 === strpos($method, 'getLegacy')
223223
|| strpos($this->originClass, '\Legacy')
224224
|| \in_array('legacy', $groups($this->originClass, $method), true);
225225
}
@@ -230,10 +230,10 @@ public function isMuted(): bool
230230
return false;
231231
}
232232
if (isset($this->trace[1]['class'])) {
233-
return str_starts_with($this->trace[1]['class'], 'PHPUnit\\');
233+
return 0 === strpos($this->trace[1]['class'], 'PHPUnit\\');
234234
}
235235

236-
return str_contains($this->triggeringFile, \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'phpunit'.\DIRECTORY_SEPARATOR);
236+
return false !== strpos($this->triggeringFile, \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR.'phpunit'.\DIRECTORY_SEPARATOR);
237237
}
238238

239239
/**
@@ -302,7 +302,7 @@ private function getPackage(string $path): string
302302
{
303303
$path = realpath($path) ?: $path;
304304
foreach (self::getVendors() as $vendorRoot) {
305-
if (str_starts_with($path, $vendorRoot)) {
305+
if (0 === strpos($path, $vendorRoot)) {
306306
$relativePath = substr($path, \strlen($vendorRoot) + 1);
307307
$vendor = strstr($relativePath, \DIRECTORY_SEPARATOR, true);
308308
if (false === $vendor) {
@@ -328,7 +328,7 @@ private static function getVendors(): array
328328
self::$vendors[] = \dirname((new \ReflectionClass(DebugClassLoader::class))->getFileName());
329329
}
330330
foreach (get_declared_classes() as $class) {
331-
if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) {
331+
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
332332
$r = new \ReflectionClass($class);
333333
$v = \dirname($r->getFileName(), 2);
334334
if (file_exists($v.'/composer/installed.json')) {
@@ -343,7 +343,7 @@ private static function getVendors(): array
343343
}
344344
foreach ($paths as $path) {
345345
foreach (self::$vendors as $vendor) {
346-
if (!str_starts_with($path, $vendor)) {
346+
if (0 !== strpos($path, $vendor)) {
347347
self::$internalPaths[] = $path;
348348
}
349349
}
@@ -373,13 +373,13 @@ private function getPathType(string $path): string
373373
return self::PATH_TYPE_UNDETERMINED;
374374
}
375375
foreach (self::getVendors() as $vendor) {
376-
if (str_starts_with($realPath, $vendor) && false !== strpbrk(substr($realPath, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) {
376+
if (0 === strpos($realPath, $vendor) && false !== strpbrk(substr($realPath, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) {
377377
return self::PATH_TYPE_VENDOR;
378378
}
379379
}
380380

381381
foreach (self::$internalPaths as $internalPath) {
382-
if (str_starts_with($realPath, $internalPath)) {
382+
if (0 === strpos($realPath, $internalPath)) {
383383
return self::PATH_TYPE_SELF;
384384
}
385385
}

‎Tests/CoverageListenerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function test()
4343
exec("$php $phpunit -c $dir/phpunit-with-listener.xml.dist $dir/tests/ --coverage-text --colors=never 2> /dev/null", $output);
4444
$output = implode("\n", $output);
4545

46-
if (!str_contains($output, 'FooCov')) {
46+
if (false === strpos($output, 'FooCov')) {
4747
$this->addToAssertionCount(1);
4848
} else {
4949
$this->assertMatchesRegularExpression('/FooCov\n\s*Methods:\s+0.00%[^\n]+Lines:\s+0.00%/', $output);

‎bin/simple-phpunit.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
break;
5858
}
5959
// short option
60-
if (str_starts_with($cliArgument, '-c')) {
60+
if (0 === strpos($cliArgument, '-c')) {
6161
if ('-c' === $cliArgument && array_key_exists($cliArgumentIndex + 1, $argv)) {
6262
$phpunitConfigFilename = $getPhpUnitConfig($argv[$cliArgumentIndex + 1]);
6363
} else {

‎composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"require-dev": {
2424
"symfony/deprecation-contracts": "^2.5|^3.0",
2525
"symfony/error-handler": "^5.4|^6.4|^7.0",
26-
"symfony/polyfill-php80": "^1.27",
2726
"symfony/polyfill-php81": "^1.27"
2827
},
2928
"conflict": {

0 commit comments

Comments
 (0)
Please sign in to comment.