Skip to content

Commit 528a26f

Browse files
committed
Update test tools
1 parent ecf93a2 commit 528a26f

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

composer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@
2828
"inspirum/arrayable": "^1.2"
2929
},
3030
"require-dev": {
31-
"inspirum/coding-standard": "^1.5",
32-
"phpstan/phpstan": "^1.10",
33-
"phpunit/phpunit": "^10.5",
34-
"shipmonk/composer-dependency-analyser": "^1.5",
35-
"squizlabs/php_codesniffer": "^3.9"
31+
"ext-simplexml": "*",
32+
"inspirum/coding-standard": "^1.6",
33+
"phpstan/phpstan": "^2.0",
34+
"phpunit/phpunit": "^11.0",
35+
"shipmonk/composer-dependency-analyser": "^1.8",
36+
"squizlabs/php_codesniffer": "^3.11"
3637
},
3738
"autoload": {
3839
"psr-4": {

src/Reader/DefaultReader.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,16 @@ private function createNode(string $name, mixed $text, array $attributes, array
174174
{
175175
$usedNamespaces = $this->getUsedNamespaces($name, $attributes);
176176

177-
$namespaces = array_merge($namespaces, ...array_map(static fn(ReadResult $element) => $element->namespaces, $elements));
178-
$usedNamespaces = array_merge($usedNamespaces, ...array_map(static fn(ReadResult $element) => $element->usedNamespaces, $elements));
177+
$namespaces = array_merge($namespaces, ...array_map(static fn (ReadResult $element) => $element->namespaces, $elements));
178+
$usedNamespaces = array_merge($usedNamespaces, ...array_map(static fn (ReadResult $element) => $element->usedNamespaces, $elements));
179179

180180
$withNamespace = $rootNamespaces !== null;
181181

182182
if ($withNamespace) {
183183
$namespaceAttributes = $this->namespacesToAttributes($namespaces, $rootNamespaces);
184184
$namespaceAttributes = array_filter(
185185
$namespaceAttributes,
186-
static fn($namespaceLocalName) => in_array(Parser::getLocalName($namespaceLocalName), $usedNamespaces),
186+
static fn ($namespaceLocalName) => in_array(Parser::getLocalName($namespaceLocalName), $usedNamespaces),
187187
ARRAY_FILTER_USE_KEY,
188188
);
189189

@@ -208,8 +208,8 @@ private function getUsedNamespaces(string $name, array $attributes): array
208208
{
209209
return array_values(array_filter([
210210
Parser::getNamespacePrefix($name),
211-
...array_map(static fn($attributeName) => Parser::getNamespacePrefix($attributeName), array_keys($attributes)),
212-
], static fn($ns) => $ns !== null && $ns !== 'xmlns'));
211+
...array_map(static fn ($attributeName) => Parser::getNamespacePrefix($attributeName), array_keys($attributes)),
212+
], static fn ($ns) => $ns !== null && $ns !== 'xmlns'));
213213
}
214214

215215
/**
@@ -231,7 +231,7 @@ private function namespacesToAttributes(array $namespaces, array $rootNamespaces
231231
*/
232232
private function read(): bool
233233
{
234-
return Handler::withErrorHandlerForXMLReader(fn(): bool => $this->reader->read());
234+
return Handler::withErrorHandlerForXMLReader(fn (): bool => $this->reader->read());
235235
}
236236

237237
private function next(?string $name = null): bool

tests/Reader/DefaultReaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public function testIterateWithSimpleLoadString(string $file, bool $withNamespac
395395
throw $exception;
396396
}
397397

398-
self::assertSame($expectedItem, array_map(static fn(SimpleXMLElement $element): string => trim((string) preg_replace('/<\?xml[^>]*\?>/', '', (string) $element->asXML(), 1)), $elements));
398+
self::assertSame($expectedItem, array_map(static fn (SimpleXMLElement $element): string => trim((string) preg_replace('/<\?xml[^>]*\?>/', '', (string) $element->asXML(), 1)), $elements));
399399
}
400400
}
401401

@@ -428,7 +428,7 @@ public function testIterateWithXpath(string $file, bool $withNamespaces, string
428428
throw $exception;
429429
}
430430

431-
self::assertSame($expected[$i], array_map(static fn(Node $element): string => $element->toString(), $elements));
431+
self::assertSame($expected[$i], array_map(static fn (Node $element): string => $element->toString(), $elements));
432432
}
433433
}
434434

0 commit comments

Comments
 (0)