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 3030use PHPStan \Reflection \Type \UnresolvedPropertyPrototypeReflection ;
3131use PHPStan \ShouldNotHappenException ;
3232use PHPStan \TrinaryLogic ;
33+ use PHPStan \Type \Accessory \AccessoryLowercaseStringType ;
34+ use PHPStan \Type \Accessory \AccessoryNumericStringType ;
3335use PHPStan \Type \Constant \ConstantArrayType ;
3436use PHPStan \Type \Constant \ConstantBooleanType ;
3537use PHPStan \Type \Constant \ConstantStringType ;
@@ -542,6 +544,10 @@ private function describeCache(): string
542544
543545 public function toNumber (): Type
544546 {
547+ // if ($this->isInstanceOf('BcMath\Number')->yes()) {
548+ // return $this;
549+ // }
550+
545551 if ($ this ->isInstanceOf ('SimpleXMLElement ' )->yes ()) {
546552 return new UnionType ([
547553 new FloatType (),
@@ -580,6 +586,14 @@ public function toFloat(): Type
580586
581587 public function toString (): Type
582588 {
589+ if ($ this ->isInstanceOf ('BcMath\Number ' )->yes ()) {
590+ return new IntersectionType ([
591+ new StringType (),
592+ new AccessoryLowercaseStringType (),
593+ new AccessoryNumericStringType (),
594+ ]);
595+ }
596+
583597 $ classReflection = $ this ->getClassReflection ();
584598 if ($ classReflection === null ) {
585599 return new ErrorType ();
You can’t perform that action at this time.
0 commit comments