33namespace PHPStan \Type ;
44
55use PHPStan \Broker \Broker ;
6+ use PHPStan \Type \Constant \ConstantBooleanType ;
67use PHPStan \Type \Generic \TemplateTypeHelper ;
78use ReflectionNamedType ;
89use ReflectionType ;
@@ -18,6 +19,8 @@ private static function getTypeObjectFromTypehint(string $typeString, ?string $s
1819 return new IntegerType ();
1920 case 'bool ' :
2021 return new BooleanType ();
22+ case 'false ' :
23+ return new ConstantBooleanType (false );
2124 case 'string ' :
2225 return new StringType ();
2326 case 'float ' :
@@ -47,6 +50,8 @@ private static function getTypeObjectFromTypehint(string $typeString, ?string $s
4750 return new NonexistentParentClassType ();
4851 case 'static ' :
4952 return $ selfClass !== null ? new StaticType ($ selfClass ) : new ErrorType ();
53+ case 'null ' :
54+ return new NullType ();
5055 default :
5156 return new ObjectType ($ typeString );
5257 }
@@ -85,6 +90,12 @@ public static function decideTypeFromReflection(
8590 if (\Nette \Utils \Strings::endsWith (strtolower ($ reflectionTypeString ), '\\mixed ' )) {
8691 $ reflectionTypeString = 'mixed ' ;
8792 }
93+ if (\Nette \Utils \Strings::endsWith (strtolower ($ reflectionTypeString ), '\\false ' )) {
94+ $ reflectionTypeString = 'false ' ;
95+ }
96+ if (\Nette \Utils \Strings::endsWith (strtolower ($ reflectionTypeString ), '\\null ' )) {
97+ $ reflectionTypeString = 'null ' ;
98+ }
8899
89100 $ type = self ::getTypeObjectFromTypehint ($ reflectionTypeString , $ selfClass );
90101 if ($ reflectionType ->allowsNull ()) {
0 commit comments