@@ -474,7 +474,7 @@ private function codeCoverage(string $filename, DOMXPath $xpath): CodeCoverage
474
474
);
475
475
}
476
476
477
- private function getBoolean (string $ value , bool | string $ default ): bool | string
477
+ private function getBoolean (string $ value , bool $ default ): bool
478
478
{
479
479
if (strtolower ($ value ) === 'false ' ) {
480
480
return false ;
@@ -487,6 +487,19 @@ private function getBoolean(string $value, bool|string $default): bool|string
487
487
return $ default ;
488
488
}
489
489
490
+ private function getValue (string $ value ): bool |string
491
+ {
492
+ if (strtolower ($ value ) === 'false ' ) {
493
+ return false ;
494
+ }
495
+
496
+ if (strtolower ($ value ) === 'true ' ) {
497
+ return true ;
498
+ }
499
+
500
+ return $ value ;
501
+ }
502
+
490
503
private function readFilterDirectories (string $ filename , DOMXPath $ xpath , string $ query ): FilterDirectoryCollection
491
504
{
492
505
$ directories = [];
@@ -556,7 +569,7 @@ private function getBooleanAttribute(DOMElement $element, string $attribute, boo
556
569
return $ default ;
557
570
}
558
571
559
- return ( bool ) $ this ->getBoolean (
572
+ return $ this ->getBoolean (
560
573
$ element ->getAttribute ($ attribute ),
561
574
false ,
562
575
);
@@ -635,7 +648,7 @@ private function php(string $filename, DOMXPath $xpath): Php
635
648
636
649
$ constants [] = new Constant (
637
650
$ const ->getAttribute ('name ' ),
638
- $ this ->getBoolean ( $ value , $ value ),
651
+ $ this ->getValue ( $ value ),
639
652
);
640
653
}
641
654
@@ -660,15 +673,15 @@ private function php(string $filename, DOMXPath $xpath): Php
660
673
$ verbatim = false ;
661
674
662
675
if ($ var ->hasAttribute ('force ' )) {
663
- $ force = ( bool ) $ this ->getBoolean ($ var ->getAttribute ('force ' ), false );
676
+ $ force = $ this ->getBoolean ($ var ->getAttribute ('force ' ), false );
664
677
}
665
678
666
679
if ($ var ->hasAttribute ('verbatim ' )) {
667
680
$ verbatim = $ this ->getBoolean ($ var ->getAttribute ('verbatim ' ), false );
668
681
}
669
682
670
683
if (!$ verbatim ) {
671
- $ value = $ this ->getBoolean ( $ value , $ value );
684
+ $ value = $ this ->getValue ( $ value );
672
685
}
673
686
674
687
$ variables [$ array ][] = new Variable ($ name , $ value , $ force );
0 commit comments