You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeFunctionCallRuleTest.php
+47-39
Original file line number
Diff line number
Diff line change
@@ -96,169 +96,177 @@ public function testImpossibleCheckTypeFunctionCall(): void
96
96
'Call to function method_exists() with CheckTypeFunctionCall\Foo and \'doFoo\' will always evaluate to true.',
97
97
179,
98
98
],
99
+
[
100
+
'Call to function method_exists() with CheckTypeFunctionCall\Foo and \'doFoo\' will always evaluate to true.',
101
+
189,
102
+
],
99
103
[
100
104
'Call to function method_exists() with $this(CheckTypeFunctionCall\FinalClassWithMethodExists) and \'doFoo\' will always evaluate to true.',
101
-
191,
105
+
201,
102
106
],
103
107
[
104
108
'Call to function method_exists() with $this(CheckTypeFunctionCall\FinalClassWithMethodExists) and \'doBar\' will always evaluate to false.',
105
-
194,
109
+
204,
106
110
],
107
111
[
108
112
'Call to function property_exists() with $this(CheckTypeFunctionCall\FinalClassWithPropertyExists) and \'fooProperty\' will always evaluate to true.',
109
-
210,
113
+
220,
110
114
],
111
115
[
112
116
'Call to function in_array() with arguments int, array{\'foo\', \'bar\'} and true will always evaluate to false.',
113
-
236,
117
+
246,
114
118
],
115
119
[
116
120
'Call to function in_array() with arguments \'bar\'|\'foo\', array{\'baz\', \'lorem\'} and true will always evaluate to false.',
117
-
245,
121
+
255,
118
122
],
119
123
[
120
124
'Call to function in_array() with arguments \'foo\', array{\'foo\'} and true will always evaluate to true.',
121
-
253,
125
+
263,
122
126
],
123
127
[
124
128
'Call to function in_array() with arguments \'foo\', array{\'foo\', \'bar\'} and true will always evaluate to true.',
125
-
257,
129
+
267,
126
130
],
127
131
[
128
132
'Call to function in_array() with arguments \'bar\', array{}|array{\'foo\'} and true will always evaluate to false.',
129
-
321,
133
+
331,
130
134
],
131
135
[
132
136
'Call to function in_array() with arguments \'baz\', array{0: \'bar\', 1?: \'foo\'} and true will always evaluate to false.',
133
-
337,
137
+
347,
134
138
],
135
139
[
136
140
'Call to function in_array() with arguments \'foo\', array{} and true will always evaluate to false.',
137
-
344,
141
+
354,
138
142
],
139
143
[
140
144
'Call to function array_key_exists() with \'a\' and array{a: 1, b?: 2} will always evaluate to true.',
141
-
361,
145
+
371,
142
146
],
143
147
[
144
148
'Call to function array_key_exists() with \'c\' and array{a: 1, b?: 2} will always evaluate to false.',
145
-
367,
149
+
377,
146
150
],
147
151
[
148
152
'Call to function is_string() with mixed will always evaluate to false.',
149
-
561,
153
+
571,
150
154
],
151
155
[
152
156
'Call to function is_callable() with mixed will always evaluate to false.',
153
-
572,
157
+
582,
154
158
],
155
159
[
156
160
'Call to function method_exists() with \'CheckTypeFunctionCall\\\\MethodExists\' and \'testWithStringFirst…\' will always evaluate to true.',
157
-
586,
161
+
596,
158
162
],
159
163
[
160
164
'Call to function method_exists() with \'UndefinedClass\' and string will always evaluate to false.',
161
-
595,
165
+
605,
162
166
],
163
167
[
164
168
'Call to function method_exists() with \'UndefinedClass\' and \'test\' will always evaluate to false.',
165
-
598,
169
+
608,
170
+
],
171
+
[
172
+
'Call to function method_exists() with CheckTypeFunctionCall\MethodExists and \'testWithNewObjectIn…\' will always evaluate to true.',
173
+
620,
166
174
],
167
175
[
168
176
'Call to function method_exists() with CheckTypeFunctionCall\MethodExists and \'testWithNewObjectIn…\' will always evaluate to true.',
169
-
610,
177
+
635,
170
178
],
171
179
[
172
180
'Call to function method_exists() with $this(CheckTypeFunctionCall\MethodExistsWithTrait) and \'method\' will always evaluate to true.',
173
-
625,
181
+
650,
174
182
],
175
183
[
176
184
'Call to function method_exists() with $this(CheckTypeFunctionCall\MethodExistsWithTrait) and \'someAnother\' will always evaluate to true.',
177
-
628,
185
+
653,
178
186
],
179
187
[
180
188
'Call to function method_exists() with $this(CheckTypeFunctionCall\MethodExistsWithTrait) and \'unknown\' will always evaluate to false.',
181
-
631,
189
+
656,
182
190
],
183
191
[
184
192
'Call to function method_exists() with \'CheckTypeFunctionCall\\\\MethodExistsWithTrait\' and \'method\' will always evaluate to true.',
185
-
634,
193
+
659,
186
194
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
187
195
],
188
196
[
189
197
'Call to function method_exists() with \'CheckTypeFunctionCall\\\\MethodExistsWithTrait\' and \'someAnother\' will always evaluate to true.',
190
-
637,
198
+
662,
191
199
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
192
200
],
193
201
[
194
202
'Call to function method_exists() with \'CheckTypeFunctionCall\\\\MethodExistsWithTrait\' and \'unknown\' will always evaluate to false.',
195
-
640,
203
+
665,
196
204
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
197
205
],
198
206
[
199
207
'Call to function method_exists() with \'CheckTypeFunctionCall\\\\MethodExistsWithTrait\' and \'method\' will always evaluate to true.',
200
-
643,
208
+
668,
201
209
],
202
210
[
203
211
'Call to function method_exists() with \'CheckTypeFunctionCall\\\\MethodExistsWithTrait\' and \'someAnother\' will always evaluate to true.',
204
-
646,
212
+
671,
205
213
],
206
214
[
207
215
'Call to function method_exists() with \'CheckTypeFunctionCall\\\\MethodExistsWithTrait\' and \'unknown\' will always evaluate to false.',
208
-
649,
216
+
674,
209
217
],
210
218
[
211
219
'Call to function is_string() with string will always evaluate to true.',
212
-
678,
220
+
703,
213
221
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
214
222
],
215
223
[
216
224
'Call to function assert() with true will always evaluate to true.',
217
-
693,
225
+
718,
218
226
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
219
227
],
220
228
[
221
229
'Call to function is_numeric() with \'123\' will always evaluate to true.',
222
-
693,
230
+
718,
223
231
],
224
232
[
225
233
'Call to function assert() with false will always evaluate to false.',
226
-
694,
234
+
719,
227
235
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
228
236
],
229
237
[
230
238
'Call to function is_numeric() with \'blabla\' will always evaluate to false.',
231
-
694,
239
+
719,
232
240
],
233
241
[
234
242
'Call to function assert() with true will always evaluate to true.',
235
-
701,
243
+
726,
236
244
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
237
245
],
238
246
[
239
247
'Call to function is_numeric() with 123|float will always evaluate to true.',
240
-
701,
248
+
726,
241
249
],
242
250
[
243
251
'Call to function property_exists() with CheckTypeFunctionCall\Bug2221 and \'foo\' will always evaluate to true.',
244
-
784,
252
+
809,
245
253
],
246
254
[
247
255
'Call to function property_exists() with CheckTypeFunctionCall\Bug2221 and \'foo\' will always evaluate to true.',
248
-
788,
256
+
813,
249
257
],
250
258
[
251
259
'Call to function testIsInt() with int will always evaluate to true.',
252
-
875,
260
+
900,
253
261
],
254
262
[
255
263
'Call to function is_int() with int will always evaluate to true.',
256
-
889,
264
+
914,
257
265
'Remove remaining cases below this one and this error will disappear too.',
258
266
],
259
267
[
260
268
'Call to function in_array() with arguments 1, array<string> and true will always evaluate to false.',
261
-
927,
269
+
952,
262
270
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
0 commit comments