File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,8 @@ public static function isKeyword($type)
137137 * Normalize the case for a single type.
138138 *
139139 * - Types which are recognized PHP "keyword" types will be returned in lowercase.
140+ * - Types which are recognized PHP "keyword" types and can be fully qualified (true/false/null)
141+ * will be returned as unqualified.
140142 * - Class/Interface/Enum names will be returned in their original case.
141143 *
142144 * @since 1.1.0
@@ -152,7 +154,7 @@ public static function normalizeCase($type)
152154 }
153155
154156 if (self ::isKeyword ($ type )) {
155- return \strtolower ($ type );
157+ return \strtolower (\ltrim ( $ type, '\\' ) );
156158 }
157159
158160 return $ type ;
Original file line number Diff line number Diff line change @@ -135,6 +135,31 @@ public static function dataNormalizeCase()
135135 ];
136136 }
137137
138+ $ data ['true: fully qualified ' ] = [
139+ 'type ' => '\true ' ,
140+ 'expected ' => 'true ' ,
141+ ];
142+ $ data ['false: fully qualified ' ] = [
143+ 'type ' => '\false ' ,
144+ 'expected ' => 'false ' ,
145+ ];
146+ $ data ['null: fully qualified ' ] = [
147+ 'type ' => '\null ' ,
148+ 'expected ' => 'null ' ,
149+ ];
150+ $ data ['true: fully qualified, uppercase ' ] = [
151+ 'type ' => '\TRUE ' ,
152+ 'expected ' => 'true ' ,
153+ ];
154+ $ data ['false: fully qualified, uppercase ' ] = [
155+ 'type ' => '\FALSE ' ,
156+ 'expected ' => 'false ' ,
157+ ];
158+ $ data ['null: fully qualified, uppercase ' ] = [
159+ 'type ' => '\NULL ' ,
160+ 'expected ' => 'null ' ,
161+ ];
162+
138163 $ data ['Classname: UnqualifiedName ' ] = [
139164 'type ' => 'UnqualifiedName ' ,
140165 'expected ' => 'UnqualifiedName ' ,
You can’t perform that action at this time.
0 commit comments