Skip to content

Commit 3b3e54f

Browse files
Remove superfluous string casts
1 parent 66b4fe6 commit 3b3e54f

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/TextUI/Configuration/Xml/Loader.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,14 @@ private function extensions(string $filename, DOMXPath $xpath): ExtensionCollect
214214
private function getElementConfigurationParameters(string $filename, DOMElement $element): Extension
215215
{
216216
/** @psalm-var class-string $class */
217-
$class = (string) $element->getAttribute('class');
217+
$class = $element->getAttribute('class');
218218
$file = '';
219219
$arguments = $this->getConfigurationArguments($filename, $element->childNodes);
220220

221221
if ($element->getAttribute('file')) {
222222
$file = $this->toAbsolutePath(
223223
$filename,
224-
(string) $element->getAttribute('file'),
224+
$element->getAttribute('file'),
225225
true
226226
);
227227
}
@@ -555,7 +555,7 @@ private function getBooleanAttribute(DOMElement $element, string $attribute, boo
555555
}
556556

557557
return (bool) $this->getBoolean(
558-
(string) $element->getAttribute($attribute),
558+
$element->getAttribute($attribute),
559559
false
560560
);
561561
}
@@ -567,7 +567,7 @@ private function getIntegerAttribute(DOMElement $element, string $attribute, int
567567
}
568568

569569
return $this->getInteger(
570-
(string) $element->getAttribute($attribute),
570+
$element->getAttribute($attribute),
571571
$default
572572
);
573573
}
@@ -578,7 +578,7 @@ private function getStringAttribute(DOMElement $element, string $attribute, ?str
578578
return $default ?? null;
579579
}
580580

581-
return (string) $element->getAttribute($attribute);
581+
return $element->getAttribute($attribute);
582582
}
583583

584584
private function getInteger(string $value, int $default): int
@@ -608,8 +608,8 @@ private function php(string $filename, DOMXPath $xpath): Php
608608
assert($ini instanceof DOMElement);
609609

610610
$iniSettings[] = new IniSetting(
611-
(string) $ini->getAttribute('name'),
612-
(string) $ini->getAttribute('value')
611+
$ini->getAttribute('name'),
612+
$ini->getAttribute('value')
613613
);
614614
}
615615

@@ -618,10 +618,10 @@ private function php(string $filename, DOMXPath $xpath): Php
618618
foreach ($xpath->query('php/const') as $const) {
619619
assert($const instanceof DOMElement);
620620

621-
$value = (string) $const->getAttribute('value');
621+
$value = $const->getAttribute('value');
622622

623623
$constants[] = new Constant(
624-
(string) $const->getAttribute('name'),
624+
$const->getAttribute('name'),
625625
$this->getBoolean($value, $value)
626626
);
627627
}
@@ -641,8 +641,8 @@ private function php(string $filename, DOMXPath $xpath): Php
641641
foreach ($xpath->query('php/' . $array) as $var) {
642642
assert($var instanceof DOMElement);
643643

644-
$name = (string) $var->getAttribute('name');
645-
$value = (string) $var->getAttribute('value');
644+
$name = $var->getAttribute('name');
645+
$value = $var->getAttribute('value');
646646
$force = false;
647647
$verbatim = false;
648648

@@ -890,25 +890,25 @@ private function testSuite(string $filename, DOMXPath $xpath): TestSuiteCollecti
890890
$prefix = '';
891891

892892
if ($directoryNode->hasAttribute('prefix')) {
893-
$prefix = (string) $directoryNode->getAttribute('prefix');
893+
$prefix = $directoryNode->getAttribute('prefix');
894894
}
895895

896896
$suffix = 'Test.php';
897897

898898
if ($directoryNode->hasAttribute('suffix')) {
899-
$suffix = (string) $directoryNode->getAttribute('suffix');
899+
$suffix = $directoryNode->getAttribute('suffix');
900900
}
901901

902902
$phpVersion = PHP_VERSION;
903903

904904
if ($directoryNode->hasAttribute('phpVersion')) {
905-
$phpVersion = (string) $directoryNode->getAttribute('phpVersion');
905+
$phpVersion = $directoryNode->getAttribute('phpVersion');
906906
}
907907

908908
$phpVersionOperator = new VersionComparisonOperator('>=');
909909

910910
if ($directoryNode->hasAttribute('phpVersionOperator')) {
911-
$phpVersionOperator = new VersionComparisonOperator((string) $directoryNode->getAttribute('phpVersionOperator'));
911+
$phpVersionOperator = new VersionComparisonOperator($directoryNode->getAttribute('phpVersionOperator'));
912912
}
913913

914914
$directories[] = new TestDirectory(
@@ -934,13 +934,13 @@ private function testSuite(string $filename, DOMXPath $xpath): TestSuiteCollecti
934934
$phpVersion = PHP_VERSION;
935935

936936
if ($fileNode->hasAttribute('phpVersion')) {
937-
$phpVersion = (string) $fileNode->getAttribute('phpVersion');
937+
$phpVersion = $fileNode->getAttribute('phpVersion');
938938
}
939939

940940
$phpVersionOperator = new VersionComparisonOperator('>=');
941941

942942
if ($fileNode->hasAttribute('phpVersionOperator')) {
943-
$phpVersionOperator = new VersionComparisonOperator((string) $fileNode->getAttribute('phpVersionOperator'));
943+
$phpVersionOperator = new VersionComparisonOperator($fileNode->getAttribute('phpVersionOperator'));
944944
}
945945

946946
$files[] = new TestFile(
@@ -951,7 +951,7 @@ private function testSuite(string $filename, DOMXPath $xpath): TestSuiteCollecti
951951
}
952952

953953
$testSuites[] = new TestSuiteConfiguration(
954-
(string) $element->getAttribute('name'),
954+
$element->getAttribute('name'),
955955
TestDirectoryCollection::fromArray($directories),
956956
TestFileCollection::fromArray($files),
957957
FileCollection::fromArray($exclude)

0 commit comments

Comments
 (0)