File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55use PhpParser \Node \Expr \MethodCall ;
66use PHPStan \Analyser \Scope ;
77use PHPStan \Reflection \MethodReflection ;
8- use PHPStan \Type \Constant \ConstantBooleanType ;
98use PHPStan \Type \DynamicMethodReturnTypeExtension ;
109use PHPStan \Type \Generic \GenericObjectType ;
1110use PHPStan \Type \ObjectType ;
@@ -41,10 +40,10 @@ public function getTypeFromMethodCall(
4140 $ firstArgType = $ scope ->getType ($ methodCall ->getArgs ()[0 ]->value );
4241 $ secondArgType = $ scope ->getType ($ methodCall ->getArgs ()[1 ]->value );
4342
44- $ firstIsTrueType = ( new ConstantBooleanType ( true ))-> isSuperTypeOf ( $ firstArgType)-> result ;
45- $ firstIsFalseType = ( new ConstantBooleanType ( false ))-> isSuperTypeOf ( $ firstArgType)-> result ;
46- $ secondIsTrueType = ( new ConstantBooleanType ( true ))-> isSuperTypeOf ( $ secondArgType)-> result ;
47- $ secondIsFalseType = ( new ConstantBooleanType ( false ))-> isSuperTypeOf ( $ secondArgType)-> result ;
43+ $ firstIsTrueType = $ firstArgType-> isTrue () ;
44+ $ firstIsFalseType = $ firstArgType-> isFalse () ;
45+ $ secondIsTrueType = $ secondArgType-> isTrue () ;
46+ $ secondIsFalseType = $ secondArgType-> isFalse () ;
4847
4948 $ firstCompareType = $ firstIsTrueType ->compareTo ($ firstIsFalseType );
5049 $ secondCompareType = $ secondIsTrueType ->compareTo ($ secondIsFalseType );
Original file line number Diff line number Diff line change @@ -34,8 +34,8 @@ public function getTypeFromMethodCall(
3434 ): ?Type
3535 {
3636 $ firstArgType = isset ($ methodCall ->getArgs ()[2 ]) ? $ scope ->getType ($ methodCall ->getArgs ()[2 ]->value ) : new ConstantBooleanType (true );
37- $ isTrueType = ( new ConstantBooleanType ( true ))-> isSuperTypeOf ( $ firstArgType)-> result ;
38- $ isFalseType = ( new ConstantBooleanType ( false ))-> isSuperTypeOf ( $ firstArgType)-> result ;
37+ $ isTrueType = $ firstArgType-> isTrue () ;
38+ $ isFalseType = $ firstArgType-> isFalse () ;
3939 $ compareTypes = $ isTrueType ->compareTo ($ isFalseType );
4040
4141 if ($ compareTypes === $ isTrueType ) {
Original file line number Diff line number Diff line change @@ -32,8 +32,8 @@ public function getTypeFromMethodCall(
3232 ): ?Type
3333 {
3434 $ firstArgType = isset ($ methodCall ->getArgs ()[2 ]) ? $ scope ->getType ($ methodCall ->getArgs ()[2 ]->value ) : new ConstantBooleanType (true );
35- $ isTrueType = ( new ConstantBooleanType ( true ))-> isSuperTypeOf ( $ firstArgType)-> result ;
36- $ isFalseType = ( new ConstantBooleanType ( false ))-> isSuperTypeOf ( $ firstArgType)-> result ;
35+ $ isTrueType = $ firstArgType-> isTrue () ;
36+ $ isFalseType = $ firstArgType-> isFalse () ;
3737 $ compareTypes = $ isTrueType ->compareTo ($ isFalseType );
3838
3939 if ($ compareTypes === $ isTrueType ) {
Original file line number Diff line number Diff line change 55use PhpParser \Node \Expr \MethodCall ;
66use PHPStan \Analyser \Scope ;
77use PHPStan \Reflection \MethodReflection ;
8- use PHPStan \Type \Constant \ConstantBooleanType ;
98use PHPStan \Type \DynamicMethodReturnTypeExtension ;
109use PHPStan \Type \ResourceType ;
1110use PHPStan \Type \StringType ;
@@ -35,8 +34,8 @@ public function getTypeFromMethodCall(
3534 }
3635
3736 $ argType = $ scope ->getType ($ methodCall ->getArgs ()[0 ]->value );
38- $ isTrueType = ( new ConstantBooleanType ( true ))-> isSuperTypeOf ( $ argType)-> result ;
39- $ isFalseType = ( new ConstantBooleanType ( false ))-> isSuperTypeOf ( $ argType)-> result ;
37+ $ isTrueType = $ argType-> isTrue () ;
38+ $ isFalseType = $ argType-> isFalse () ;
4039 $ compareTypes = $ isTrueType ->compareTo ($ isFalseType );
4140 if ($ compareTypes === $ isTrueType ) {
4241 return new ResourceType ();
You can’t perform that action at this time.
0 commit comments