Skip to content

Commit ec22fa2

Browse files
Merge branch '8.5' into 9.5
2 parents 0979089 + 5ea9eb5 commit ec22fa2

33 files changed

+109
-54
lines changed

.php-cs-fixer.dist.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@
6363
'yield',
6464
],
6565
],
66-
'braces' => true,
66+
'braces' => [
67+
'position_after_anonymous_constructs' => 'next',
68+
],
6769
'cast_spaces' => true,
6870
'class_attributes_separation' => [
6971
'elements' => [

src/Framework/Constraint/Operator/BinaryOperator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public static function fromConstraints(Constraint ...$constraints): self
3737
*/
3838
public function setConstraints(array $constraints): void
3939
{
40-
$this->constraints = array_map(function ($constraint): Constraint {
40+
$this->constraints = array_map(function ($constraint): Constraint
41+
{
4142
return $this->checkConstraint($constraint);
4243
}, array_values($constraints));
4344
}

src/Framework/Constraint/Operator/LogicalNot.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public static function negate(string $string): string
5050

5151
preg_match('/(\'[\w\W]*\')([\w\W]*)("[\w\W]*")/i', $string, $matches);
5252

53-
$positives = array_map(static function (string $s) {
53+
$positives = array_map(static function (string $s)
54+
{
5455
return '/\\b' . preg_quote($s, '/') . '/';
5556
}, $positives);
5657

src/Framework/Constraint/Operator/LogicalXor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public function matches($other): bool
5353

5454
return array_reduce(
5555
$constraints,
56-
static function (bool $matches, Constraint $constraint) use ($other): bool {
56+
static function (bool $matches, Constraint $constraint) use ($other): bool
57+
{
5758
return $matches xor $constraint->evaluate($other, '', true);
5859
},
5960
$initial->evaluate($other, '', true)

src/Framework/ExecutionOrderDependency.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public static function filterInvalid(array $dependencies): array
7474
return array_values(
7575
array_filter(
7676
$dependencies,
77-
static function (self $d) {
77+
static function (self $d)
78+
{
7879
return $d->isValid();
7980
}
8081
)
@@ -90,7 +91,8 @@ static function (self $d) {
9091
public static function mergeUnique(array $existing, array $additional): array
9192
{
9293
$existingTargets = array_map(
93-
static function ($dependency) {
94+
static function ($dependency)
95+
{
9496
return $dependency->getTarget();
9597
},
9698
$existing
@@ -126,7 +128,8 @@ public static function diff(array $left, array $right): array
126128

127129
$diff = [];
128130
$rightTargets = array_map(
129-
static function ($dependency) {
131+
static function ($dependency)
132+
{
130133
return $dependency->getTarget();
131134
},
132135
$right

src/Framework/MockObject/Builder/InvocationMocker.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ public function method($constraint): self
235235
}
236236

237237
$configurableMethodNames = array_map(
238-
static function (ConfigurableMethod $configurable) {
238+
static function (ConfigurableMethod $configurable)
239+
{
239240
return strtolower($configurable->getName());
240241
},
241242
$this->configurableMethods

src/Framework/MockObject/Invocation.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,16 @@ public function generateReturnValue()
178178

179179
if (in_array('callable', $types, true) ||
180180
in_array('closure', $types, true)) {
181-
return static function (): void {
181+
return static function (): void
182+
{
182183
};
183184
}
184185

185186
if (in_array('traversable', $types, true) ||
186187
in_array('generator', $types, true) ||
187188
in_array('iterable', $types, true)) {
188-
$generator = static function (): \Generator {
189+
$generator = static function (): \Generator
190+
{
189191
yield from [];
190192
};
191193

src/Framework/TestCase.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,8 @@ protected function createPartialMock(string $originalClassName, array $methods):
17441744

17451745
$mockedMethodsThatDontExist = array_filter(
17461746
$methods,
1747-
static function (string $method) use ($reflector) {
1747+
static function (string $method) use ($reflector)
1748+
{
17481749
return !$reflector->hasMethod($method);
17491750
}
17501751
);

src/Framework/TestSuite.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,8 @@ public function getName(): string
563563
public function getGroups(): array
564564
{
565565
return array_map(
566-
static function ($key): string {
566+
static function ($key): string
567+
{
567568
return (string) $key;
568569
},
569570
array_keys($this->groups)

src/Runner/TestSuiteSorter.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ private function sortDefectsFirst(array $tests): array
237237
/**
238238
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
239239
*/
240-
function ($left, $right) {
240+
function ($left, $right)
241+
{
241242
return $this->cmpDefectPriorityAndTime($left, $right);
242243
}
243244
);
@@ -252,7 +253,8 @@ private function sortByDuration(array $tests): array
252253
/**
253254
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
254255
*/
255-
function ($left, $right) {
256+
function ($left, $right)
257+
{
256258
return $this->cmpDuration($left, $right);
257259
}
258260
);
@@ -267,7 +269,8 @@ private function sortBySize(array $tests): array
267269
/**
268270
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
269271
*/
270-
function ($left, $right) {
272+
function ($left, $right)
273+
{
271274
return $this->cmpSize($left, $right);
272275
}
273276
);

src/TextUI/Help.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ private function writeWithColor(): void
243243
$arg = Color::colorize('fg-green', str_pad($option['arg'], $this->maxArgLength));
244244
$arg = preg_replace_callback(
245245
'/(<[^>]+>)/',
246-
static function ($matches) {
246+
static function ($matches)
247+
{
247248
return Color::colorize('fg-cyan', $matches[0]);
248249
},
249250
$arg

src/TextUI/TestRunner.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,8 @@ private function processSuiteFilters(TestSuite $suite, array $arguments): void
11741174
$filterFactory->addFilter(
11751175
new ReflectionClass(IncludeGroupFilterIterator::class),
11761176
array_map(
1177-
static function (string $name): string {
1177+
static function (string $name): string
1178+
{
11781179
return '__phpunit_covers_' . $name;
11791180
},
11801181
$arguments['testsCovering']
@@ -1186,7 +1187,8 @@ static function (string $name): string {
11861187
$filterFactory->addFilter(
11871188
new ReflectionClass(IncludeGroupFilterIterator::class),
11881189
array_map(
1189-
static function (string $name): string {
1190+
static function (string $name): string
1191+
{
11901192
return '__phpunit_uses_' . $name;
11911193
},
11921194
$arguments['testsUsing']

src/Util/Annotation/DocBlock.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,8 @@ private static function extractAnnotationsFromReflector(Reflector $reflector): a
534534
$annotations = array_merge(
535535
$annotations,
536536
...array_map(
537-
static function (ReflectionClass $trait): array {
537+
static function (ReflectionClass $trait): array
538+
{
538539
return self::parseDocBlock((string) $trait->getDocComment());
539540
},
540541
array_values($reflector->getTraits())

src/Util/Color.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ public static function colorizePath(string $path, ?string $prevPath = null, bool
116116
$last = count($path) - 1;
117117
$path[$last] = preg_replace_callback(
118118
'/([\-_\.]+|phpt$)/',
119-
static function ($matches) {
119+
static function ($matches)
120+
{
120121
return self::dim($matches[0]);
121122
},
122123
$path[$last]
@@ -139,7 +140,8 @@ public static function visualizeWhitespace(string $buffer, bool $visualizeEOL =
139140
{
140141
$replaceMap = $visualizeEOL ? self::WHITESPACE_EOL_MAP : self::WHITESPACE_MAP;
141142

142-
return preg_replace_callback('/\s+/', static function ($matches) use ($replaceMap) {
143+
return preg_replace_callback('/\s+/', static function ($matches) use ($replaceMap)
144+
{
143145
return self::dim(strtr($matches[0], $replaceMap));
144146
}, $buffer);
145147
}

src/Util/ErrorHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ final class ErrorHandler
5757
public static function invokeIgnoringWarnings(callable $callable)
5858
{
5959
set_error_handler(
60-
static function ($errorNumber, $errorString) {
60+
static function ($errorNumber, $errorString)
61+
{
6162
if ($errorNumber === E_WARNING) {
6263
return;
6364
}

src/Util/PHP/AbstractPhpProcess.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ private function processChildResult(Test $test, TestResult $result, string $stdo
275275
/**
276276
* @throws ErrorException
277277
*/
278-
static function ($errno, $errstr, $errfile, $errline): void {
278+
static function ($errno, $errstr, $errfile, $errline): void
279+
{
279280
throw new ErrorException($errstr, $errno, $errno, $errfile, $errline);
280281
}
281282
);

src/Util/RegularExpression.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ final class RegularExpression
2222
public static function safeMatch(string $pattern, string $subject)
2323
{
2424
return ErrorHandler::invokeIgnoringWarnings(
25-
static function () use ($pattern, $subject) {
25+
static function () use ($pattern, $subject)
26+
{
2627
return preg_match($pattern, $subject);
2728
}
2829
);

src/Util/TestDox/CliTestDoxPrinter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,8 @@ protected function formatTestResultMessage(Throwable $t, array $result, ?string
301301

302302
if ($this->colors) {
303303
$color = self::STATUS_STYLES[$result['status']]['color'] ?? '';
304-
$prefix = array_map(static function ($p) use ($color) {
304+
$prefix = array_map(static function ($p) use ($color)
305+
{
305306
return Color::colorize($color, $p);
306307
}, self::PREFIX_DECORATED);
307308
}

src/Util/TestDox/NamePrettifier.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ public function prettifyTestCase(TestCase $test): string
147147

148148
$annotationWithPlaceholders = false;
149149

150-
$callback = static function (string $variable): string {
150+
$callback = static function (string $variable): string
151+
{
151152
return sprintf('/%s(?=\b)/', preg_quote($variable, '/'));
152153
};
153154

@@ -318,7 +319,8 @@ private function mapTestMethodParameterNamesToProvidedDataValues(TestCase $test)
318319
}
319320

320321
if ($this->useColor) {
321-
$providedData = array_map(static function ($value) {
322+
$providedData = array_map(static function ($value)
323+
{
322324
return Color::colorize('fg-cyan', Color::visualizeWhitespace((string) $value, true));
323325
}, $providedData);
324326
}

src/Util/TestDox/TestDoxPrinter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@ protected function prefixLines(string $prefix, string $message): string
377377
return implode(
378378
PHP_EOL,
379379
array_map(
380-
static function (string $text) use ($prefix) {
380+
static function (string $text) use ($prefix)
381+
{
381382
return ' ' . $prefix . ($text ? ' ' . $text : '');
382383
},
383384
preg_split('/\r\n|\r|\n/', $message)

src/Util/TestDox/XmlResultPrinter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ public function endTest(Test $test, float $time): void
161161

162162
$groups = array_filter(
163163
$test->getGroups(),
164-
static function ($group) {
164+
static function ($group)
165+
{
165166
return !($group === 'small' || $group === 'medium' || $group === 'large' || strpos($group, '__phpunit_') === 0);
166167
}
167168
);

src/Util/XdebugFilterScriptGenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ final class XdebugFilterScriptGenerator
2828
public function generate(FilterConfiguration $filter): string
2929
{
3030
$files = array_map(
31-
static function ($item) {
31+
static function ($item)
32+
{
3233
return sprintf(
3334
" '%s'",
3435
$item

tests/unit/Framework/Assert/FunctionsTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public function provideStaticAssertionMethodNames(): array
5454

5555
return array_reduce(
5656
$matches[1],
57-
static function (array $functionNames, string $functionName) {
57+
static function (array $functionNames, string $functionName)
58+
{
5859
$functionNames[$functionName] = [$functionName];
5960

6061
return $functionNames;

tests/unit/Framework/AssertTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,8 @@ public function testAssertThatCallback(): void
13391339
{
13401340
$this->assertThat(
13411341
null,
1342-
$this->callback(static function ($other) {
1342+
$this->callback(static function ($other)
1343+
{
13431344
return true;
13441345
})
13451346
);
@@ -2029,7 +2030,8 @@ public function testScalarTypeCanBeAsserted(): void
20292030

20302031
public function testCallableTypeCanBeAsserted(): void
20312032
{
2032-
$this->assertIsCallable(static function (): void {
2033+
$this->assertIsCallable(static function (): void
2034+
{
20332035
});
20342036

20352037
try {
@@ -2198,7 +2200,8 @@ public function testNotCallableTypeCanBeAsserted(): void
21982200
$this->assertIsNotCallable(null);
21992201

22002202
try {
2201-
$this->assertIsNotCallable(static function (): void {
2203+
$this->assertIsNotCallable(static function (): void
2204+
{
22022205
});
22032206
} catch (AssertionFailedError $e) {
22042207
return;

0 commit comments

Comments
 (0)