File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 30
30
use PHPStan \Reflection \Type \UnresolvedPropertyPrototypeReflection ;
31
31
use PHPStan \ShouldNotHappenException ;
32
32
use PHPStan \TrinaryLogic ;
33
+ use PHPStan \Type \Accessory \AccessoryLowercaseStringType ;
34
+ use PHPStan \Type \Accessory \AccessoryNumericStringType ;
33
35
use PHPStan \Type \Constant \ConstantArrayType ;
34
36
use PHPStan \Type \Constant \ConstantBooleanType ;
35
37
use PHPStan \Type \Constant \ConstantStringType ;
@@ -542,6 +544,10 @@ private function describeCache(): string
542
544
543
545
public function toNumber (): Type
544
546
{
547
+ // if ($this->isInstanceOf('BcMath\Number')->yes()) {
548
+ // return $this;
549
+ // }
550
+
545
551
if ($ this ->isInstanceOf ('SimpleXMLElement ' )->yes ()) {
546
552
return new UnionType ([
547
553
new FloatType (),
@@ -580,6 +586,14 @@ public function toFloat(): Type
580
586
581
587
public function toString (): Type
582
588
{
589
+ if ($ this ->isInstanceOf ('BcMath\Number ' )->yes ()) {
590
+ return new IntersectionType ([
591
+ new StringType (),
592
+ new AccessoryLowercaseStringType (),
593
+ new AccessoryNumericStringType (),
594
+ ]);
595
+ }
596
+
583
597
$ classReflection = $ this ->getClassReflection ();
584
598
if ($ classReflection === null ) {
585
599
return new ErrorType ();
You can’t perform that action at this time.
0 commit comments