@@ -96,11 +96,12 @@ public static function findAllImportUses(File $file, int $position): array
9696 {
9797 // phpcs:enable Generic.Metrics.CyclomaticComplexity
9898 $ usePositions = [];
99- $ nextUse = $ file ->findPrevious (T_NAMESPACE , $ position - 1 ) ?: 0 ;
99+ $ nextUse = $ file ->findPrevious (T_NAMESPACE , $ position - 1 );
100+ ($ nextUse === false ) and $ nextUse = 0 ;
100101
101102 while (true ) {
102103 $ nextUse = $ file ->findNext (T_USE , $ nextUse + 1 , $ position - 1 );
103- if (! $ nextUse ) {
104+ if ($ nextUse === false ) {
104105 break ;
105106 }
106107 if (!UseStatements::isImportUse ($ file , $ nextUse )) {
@@ -121,14 +122,14 @@ public static function findAllImportUses(File $file, int $position): array
121122 $ asPos = $ file ->findNext (T_AS , $ usePosition + 1 , $ end , false , null , true );
122123 $ useName = Misc::tokensSubsetToString (
123124 $ usePosition + 1 ,
124- ($ asPos ? : $ end ) - 1 ,
125+ (( $ asPos !== false ) ? $ asPos : $ end ) - 1 ,
125126 $ file ,
126127 [T_STRING , T_NS_SEPARATOR ]
127128 );
128129 $ useName = trim ($ useName , '\\' );
129130 $ useNameParts = explode ('\\' , $ useName );
130131 $ key = end ($ useNameParts );
131- if ($ asPos ) {
132+ if ($ asPos !== false ) {
132133 $ keyPos = $ file ->findNext (T_STRING , $ asPos + 1 , null , false , null , true );
133134 /** @var string $key */
134135 $ key = $ tokens [$ keyPos ]['content ' ] ?? '' ;
@@ -153,7 +154,7 @@ public static function allInterfacesFullyQualifiedNames(File $file, int $positio
153154 }
154155
155156 $ implementsPos = $ file ->findNext (T_IMPLEMENTS , $ position , null , false , null , true );
156- if (! $ implementsPos ) {
157+ if ($ implementsPos === false ) {
157158 return null ;
158159 }
159160
@@ -166,7 +167,7 @@ public static function allInterfacesFullyQualifiedNames(File $file, int $positio
166167 true
167168 );
168169
169- if (! $ namesEnd ) {
170+ if ($ namesEnd === false ) {
170171 return null ;
171172 }
172173
0 commit comments