Brown
ea0a99d3a8
Fix bad merge
2020-05-18 16:02:10 -04:00
Brown
5ee1487a01
Make ExpressionAnalyzer more beautiful
2020-05-18 15:13:27 -04:00
SignpostMarv
911ac2d363
Infer numeric-string from (string)$numeric ( #3390 )
...
* adding test for vimeo/psalm#3370
* check if typecast will result in numeric-string
* int & float as per examples in vimeo/psalm#3370
* numeric & numeric-string because they shouldn't lose numericness.
* satisfy phpcs
* adjusting assertions to reflect typecasting change
2020-05-18 13:42:47 -04:00
Brown
21798efed2
Fix #3388 - eliminate null after < 0 check
2020-05-18 08:52:44 -04:00
Mark Sch
9aa46221f6
Use pretty print for JSON reporting. ( #3364 )
...
* Use pretty print for JSON reporting.
* Use pretty print for JSON reporting.
* Use pretty-print option on CLI for BC.
* Change static:: const to self::
Co-authored-by: Matthew Brown <github@muglug.com>
2020-05-18 08:40:20 -04:00
orklah
3e7f5df7e1
Solve more cases when docblock rendering is not needed ( #3387 )
2020-05-18 07:16:18 -04:00
Matthew Brown
b0ffaf0077
Fix type coercion
2020-05-17 22:51:48 -04:00
Matthew Brown
3ecef8bee7
Fix #3386 - non-empty-array = non-empty-array<array-key, mixed>
2020-05-17 22:49:20 -04:00
RJ Garcia
fd15bfc65d
Infer Return Types for Arrow Functions #3376 ( #3385 )
...
* Infer Return Types for Arrow Functions #3376
- Made a small patch to check for closure or arrow
function when attempting to infer the functions
params
- Added new isExprClosureLike to start to consolidate
all checks on closure/arrow fns
Signed-off-by: RJ Garcia <ragboyjr@icloud.com>
* Use better check
* Remove unused method
Co-authored-by: Matthew Brown <github@muglug.com>
2020-05-17 22:17:35 -04:00
orklah
dd4927a14c
Avoid regenerating docblock when no modification is made ( #3374 )
...
* Avoid regenerating docblock when no modification is made
* Generate empty docblock before, in case there was no docblock at all
2020-05-16 16:44:47 -04:00
Jefersson Nathan
f824cc380a
Add more test case scenario for @psalm-import-type ( #3375 )
...
* Add test case scenario for @psalm-import-type
Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>
* Add fix for @psalm-import-type test
Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>
* Add test for import ocross namespaces
Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>
* Add tests for failing cases
Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>
2020-05-16 16:43:35 -04:00
Matthew Brown
4dd0a2b775
Fix #3380 - allow comparisons between template param and empty array
2020-05-16 16:41:07 -04:00
Matthew Brown
f6342a40d9
Remove unnecesary conditional check for do
...
Fixes #3378
2020-05-16 16:32:36 -04:00
Nobu Funaki
abef8008bc
Fix InvalidCast after is_callable([$val, '__toString']) check ( #3372 )
...
Support is_callable() with an array argument similar to method_exists()
2020-05-16 08:50:43 -04:00
Brown
e7db21fd44
Fix type method
2020-05-15 16:23:50 -04:00
Brown
c62e08a88e
Support intersection of type aliases
2020-05-15 16:18:52 -04:00
Brown
111303d913
Add non-empty-lowercase-string type
2020-05-15 10:18:05 -04:00
Brown
013467dc0e
Add reference to ensure proper hydration
2020-05-15 00:31:55 -04:00
Brown
0086eb25a2
Remove duplicate types with @psalm-import-type
2020-05-15 00:16:20 -04:00
Brown
2d92943625
Add support for expansion of type aliases
2020-05-15 00:15:48 -04:00
Brown
9f3f7bb946
Consolidate ThreadData types
2020-05-14 23:44:22 -04:00
Brown
c212c03e40
Don’t stop analysing when encountering an UndefinedGlobalVariable
...
Fixes #3366
2020-05-14 22:51:51 -04:00
Brown
ae48c1895f
Fix #3365 - add support for negated empty string checks
2020-05-14 22:09:37 -04:00
Brown
48504aa88c
Pass through typa aliases where appropriate
2020-05-14 00:48:58 -04:00
Brown
006c6e09f1
Add more details to type alias creation
2020-05-14 00:41:50 -04:00
Brown
2327a0db6b
Add TTypeAlias object with a creation path
2020-05-13 19:49:03 -04:00
Brown
190c9ce27e
Use TypeAlias object to allow future extension
2020-05-13 19:29:59 -04:00
Brown
0fc3398631
Move parsing methods into internal namespace
2020-05-13 19:12:45 -04:00
Brown
2af0a17d03
Fix #3236 - allow use-checking of more methods starting with __
2020-05-12 22:39:26 -04:00
Markus Staab
3f3a2267ea
send php native warnings/errors/notices on stderr instead of stdout ( #3355 )
2020-05-12 20:44:09 -04:00
Matthew Brown
8c236f411a
Fix #3353 - allow extending nested when nested as type is mixed
2020-05-12 15:07:16 -04:00
Brown
3e58163180
Prevent empty function id
...
Ref #3354
2020-05-12 12:54:06 -04:00
Brown
d8cd30b34a
Fix #3340 - catch more errors in @method type parsing
2020-05-11 18:39:07 -04:00
Brown
0d5d7c8938
Add null check
2020-05-11 11:56:07 -04:00
Brown
291018034b
Remove unnecessary PHP code
2020-05-11 11:36:50 -04:00
Brown
3554aa4435
Fix crash newly introduced
2020-05-11 09:34:07 -04:00
Brown
813302206a
Improve rendering of tuples
2020-05-11 09:08:53 -04:00
Brown
8bfe91787d
Add the is_list flag to object-like tuples
2020-05-11 08:33:05 -04:00
Brown
eefd2e743b
Use generic function definition for sscanf
...
cc @villfa
2020-05-10 23:58:51 -04:00
Brown
8f2f2617d4
Improve refactor
2020-05-10 22:45:01 -04:00
Brown
5f4d162dd5
Break out type expander into separate class
2020-05-10 22:39:18 -04:00
feek
7dd1823c4c
fix: code location is nullable ( #3334 )
2020-05-10 21:12:10 -04:00
sj-i
fa601f97d7
update proc_open() types for PHP 7.4 ( #3333 )
...
as of PHP 7.4, proc_open() accepts an array for its first argument.
https://www.php.net/manual/en/function.proc-open.php#refsect1-function.proc-open-parameters
2020-05-10 21:11:27 -04:00
Brown
48da7a4be8
Fix issues found with Vimeo’s code
2020-05-10 21:09:48 -04:00
Matthew Brown
f3a6e1a48c
Fix ref
2020-05-10 16:01:45 -04:00
Matthew Brown
733da0e539
Fix #3311 - don’t erroneously mark a class as undefined
...
As they can sometimes only be obvious once an autoloader has been registered
2020-05-10 15:55:44 -04:00
Matthew Brown
4b388a2951
Fix ref
2020-05-10 11:35:35 -04:00
Brown
55222573ea
Mark as possibly-undefined any variable that wasn’t present when the loop began
...
Fixes #3332
2020-05-10 11:17:50 -04:00
Brown
28349c6423
Remove mixin_fqcln hack
2020-05-10 09:04:30 -04:00
Brown
3e16aec33c
Remap generic template params where necessary
...
Fixes #3325
2020-05-08 22:55:18 -04:00
Brown
58c63bd1b2
Migrate generic param comparison method
2020-05-08 22:49:08 -04:00
Brown
75761647c2
Fix #3321 - allow interface methods to be mapped
2020-05-08 14:52:53 -04:00
Brown
640ffdb324
Fix #3323 - make short object-like arrays sealed tuples
2020-05-08 14:36:06 -04:00
Brown
2d5c2a9dd1
Fix #3324 - prevent crash asserting on possibly-undefined variable
2020-05-08 14:21:10 -04:00
Brown
65b4263315
Fix #3320 - add final flag to pseudo methods where appropriate
2020-05-08 07:28:12 -04:00
Brown
4295f9525f
Fix #3313 - add check for very specific pattern
2020-05-07 12:30:15 -04:00
Brad Kent
18ee440e3f
update mysqli_stmt::__construct signature ( #3315 )
2020-05-07 12:08:22 -04:00
Brown
20bcfb096a
Fix #3305 - use the same issue type for short closures as closures
2020-05-06 09:57:02 -04:00
Brown
a089d8bd58
Fix #3296 - propagate final flag to static calls in return types
2020-05-03 20:42:06 -04:00
Matthew Brown
dc64d4b1ca
Support evaluation of boolean conditionals in scanning stage
...
Fixes #3290
2020-05-03 10:44:00 -04:00
Matthew Brown
23b0a18632
Fix property type
2020-05-03 10:22:52 -04:00
Matthew Brown
b69c37acdf
Simplify logic around evaluating expressions a little
2020-05-03 10:19:15 -04:00
Brown
4bfdda597e
Always render ouptut even if no issues found
...
Fixes #3292
2020-05-03 08:44:14 -04:00
Brown
d99fbc0d4d
Remove blank line
2020-05-03 00:26:50 -04:00
Brown
b8a1f5d5c9
Allow destructuring on arrayaccess implementers
2020-05-03 00:08:03 -04:00
Brown
bf5e178d16
Fix #3289 - treat property on non-generic type like actual value
2020-05-02 23:37:59 -04:00
Brown
618a54ff41
Fix #3240 - check arguments when class cannot be found
2020-05-02 22:13:59 -04:00
Brown
aceaf6c356
Fix #3217 - don’t override abstract return type with parent one
2020-05-02 21:57:53 -04:00
Brown
d3fba74f75
Fix false-positive
2020-05-02 21:56:28 -04:00
Brown
3e0c4cfb75
Fix #3210 - prevent possibly-null array access from destructure
2020-05-02 20:36:41 -04:00
Brown
132b5c9358
Fix #3263 - inherit magic properties when using @mixin
2020-05-02 19:57:38 -04:00
Brown
2ce65e1d03
Fix #3270 - support multiple spaces before @param
2020-05-02 19:39:10 -04:00
Brown
29741cd76d
Remove earlier now-unnecessary fix
2020-05-02 19:24:48 -04:00
Matthew Brown
da5e8a4324
Increase type coverage for projects that use assert after mixed
2020-05-02 14:55:30 -04:00
feek
c5319fc379
fix: mixin parameter of self should be properly resolved ( #3280 )
...
Co-authored-by: Matthew Brown <github@muglug.com>
2020-05-02 14:32:43 -04:00
Brown
07e5250292
Fix #3273 - add support for func_num_args() in conditional type
2020-05-01 16:02:53 -04:00
Brown
0d8b56dc78
Fix return type coalescing for conditional return types
2020-05-01 13:04:48 -04:00
Brown
6024447ca0
Expand function-based template types before comparing against inherited
...
Fixes #3276
2020-05-01 12:40:10 -04:00
Brown
5e76467378
Fix #3279 - make sure self/parent references in mixin use existing class
2020-05-01 11:23:02 -04:00
Brown
117a4d4d40
Require callable() have a return type when in conditional
...
Fixes #3260
2020-04-30 23:35:13 -04:00
Brown
bb1c8a9d74
Don’t clobber intersection types after generic in union
...
Fixes #3274
2020-04-30 23:15:16 -04:00
Brown
470bf807b7
Add better handling of expression termination
2020-04-30 22:23:37 -04:00
Brown
9e6797d297
Add protection from ComplicatedExpression
2020-04-30 22:23:07 -04:00
Brown
ce8fb459e9
Allow complex types in conditional is expressions
...
Ref #3277
2020-04-30 22:02:37 -04:00
Brown
8ab5a0f504
Probably safe to un-negate a class string assertion without autoloader
2020-04-30 12:48:21 -04:00
Brown
21f4deed3b
Fix #3268 - infer generator return for closure
2020-04-29 16:52:37 -04:00
Brown
555f525038
Add type
2020-04-29 14:58:48 -04:00
Brown
891c66650b
Prevent unintersectable template lower bounds
...
Ref #3264
2020-04-29 14:57:57 -04:00
Andrii Dembitskyi
d3fd9a6acf
Fix #3265 ( #3267 )
...
We should add function body
2020-04-29 12:30:04 -04:00
Brown
e782329821
Add slashes
2020-04-28 23:42:53 -04:00
Brown
63c190ff83
Fix #3257 - refine as type and clone where necessary
2020-04-28 22:26:54 -04:00
orklah
8571746f8a
Add hook for plugins after FunctionLikeAnalysis ( #3258 )
2020-04-28 15:30:51 -04:00
Brown
a0667f1543
Remove accidentally-added interface
2020-04-28 15:27:09 -04:00
Brown
05ff8d0142
Prevent invalid [] brackets in tree
...
Fixes #3246
2020-04-28 15:18:50 -04:00
Brown
a402d4598b
Define with single argument should not trigger a notice
...
Fixes #3254
2020-04-28 14:43:12 -04:00
Brown
d56c5c9782
Fix #3256 - fix parsing of colons in callable inside conditional
2020-04-28 10:55:17 -04:00
Grégoire Paris
1fb1c2195d
Allow non-string keys ( #3221 )
...
Although it would be stupid to provide an array with exclusively
non-string keys, it's possible to have an array with a bit of both.
See for instance
155d028be0/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php (L263-L276)
2020-04-27 22:49:07 -04:00
Brown
f0487c216d
Add slash
2020-04-27 09:50:27 -04:00
Brown
95dbb93732
Fix #3237 - allow mixin to reference generic params
2020-04-27 09:10:24 -04:00
Brown
189cd2bdc8
Fix key stringg
2020-04-27 00:50:07 -04:00