1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00
Commit Graph

5865 Commits

Author SHA1 Message Date
Isaac Rozas García
84130770f4
Improve details of functions to get the last errors parsing a date (#3953) 2020-08-07 12:17:08 -04:00
Brown
b6d9ee5eb1 Fix things 2020-08-07 12:16:35 -04:00
Brown
e61765ff9b Fix #3954 - catch ComplicatedExpressionException with added workaround 2020-08-07 08:20:35 -04:00
Brown
afce2dc66f Tighten up rules around instantiation a bit more 2020-08-06 10:18:55 -04:00
Matthew Brown
ccd4eaa8e7 Clarify language a little 2020-08-06 09:02:24 -04:00
feek
ec7876b8d6
feature: allow specifying memory limit (#3947) 2020-08-06 08:51:57 -04:00
Brown
278addd93d Fix strtolower calls and docs 2020-08-05 21:46:15 -04:00
Brown
bcf0df4170 Fix a bug with lowercase-string unions 2020-08-05 20:05:57 -04:00
Brown
488a899823 Fix Psalm issues 2020-08-05 19:49:09 -04:00
Brown
c0b0036109 Fix #3934 - prevent unsafe use of new static 2020-08-05 19:39:27 -04:00
Brown
e0f5595307 Fix #3932 - try to get assertions of negated expression if instant negation fails 2020-08-05 16:53:30 -04:00
Brown
e808391f56 Fix #3943 - understand trait return types a bit better 2020-08-05 15:58:26 -04:00
Daniel Melchior
fa73c7c9d9
Fix #3757 - allow multiple mixins (#3772) 2020-08-05 15:49:19 -04:00
Brown
38bfc12b98 Fix array_shift behaviour to be more accurate with lists
Fixes #3941
2020-08-05 12:43:37 -04:00
Matthew Brown
9dfdcbef31 Fix #3928 - preserve list-ness when assigning with no offset 2020-08-03 12:30:58 -04:00
SignpostMarv
06d4b9d6dd
mark bcscale as impure, re: vimeo/psalm#3918 (#3926) 2020-08-03 10:15:59 -04:00
Brown
7fc4a85534 Fix CI 2020-08-03 02:45:55 -04:00
Brown
20a9b103ec Restrict narrowing fix 2020-08-03 02:20:58 -04:00
Brown
b168777236 Fix #3924 - remove descendants after reconciled change 2020-08-03 02:06:42 -04:00
Brown
bc053e5ee8 Fix #3923 - remember class name when appending array with key 2020-08-03 01:34:46 -04:00
Brown
855a4b8456 Make type combination of object-like arrays with class-string-keys work
Ref #3923
2020-08-03 01:34:46 -04:00
Nicolas CARPi
593a9063bb
Fix hash_file signature. See https://3v4l.org/E0BeU (#3920)
hash_file can return false if the file is not readable.
2020-08-02 15:18:42 -04:00
Matthew Brown
ab64ccab88 Fix #3913 properly 2020-07-31 14:56:29 -04:00
Matthew Brown
6e699836ff Fix #3913 - improve resolution of array_filter checks 2020-07-31 14:39:03 -04:00
Brown
fd4ced42a7 Don’t register new assignment inside isset expr 2020-07-31 12:44:01 -04:00
Brown
57cd21346c Fix #3914 - treat $i++ like $i = $i + 1 2020-07-31 11:26:54 -04:00
Brown
afd8874a9e Don’t get stuck in recursive loop
Fixes #3912
2020-07-30 15:42:34 -04:00
Brown
6919e88423 Add performance logging under a --debug-performance flag 2020-07-30 15:30:19 -04:00
Brown
ad1920c3a2 Fix #3910 - improve handling of fgetcsv 2020-07-30 14:21:55 -04:00
Brown
a8c0d81dc1 Prevent bool > 1 in strict mode 2020-07-30 11:25:47 -04:00
Brown
6949a34ded Put RedundantIdentityWithTrue behind a flag cc @greg0ire 2020-07-30 10:25:59 -04:00
Brown
abe91adbe7 Fix #3801 - convert static to Foo&static when @method is given 2020-07-30 09:42:23 -04:00
Brown
96ce488241 Generic key type cannot be undefined
Fixes #3905
2020-07-29 18:46:21 -04:00
Brown
7367e8e6c2 Allow assertions of non-empty lists on typed lists
Fixes #3906
2020-07-29 18:10:43 -04:00
Brown
1c8f9e94b1 Fix #3907 - allow template as types to be refined via instanceof 2020-07-29 17:46:45 -04:00
Brown
1b81ce9921 Revert string changes 2020-07-26 19:55:49 -04:00
Brown
74eea18563 Add better checks 2020-07-26 19:09:26 -04:00
Brown
d9d5fdd6c9 Add more rules around positive ints 2020-07-26 18:29:17 -04:00
Brown
4a5f74c091 Add positive-int type 2020-07-26 15:51:55 -04:00
Brown
8c5e4edab0 Fix extra test 2020-07-26 15:50:07 -04:00
Brown
657f9db2e0 Fix bugs 2020-07-26 15:21:05 -04:00
Brown
23f5d66516 Fix #3897 - support aliasing final methods 2020-07-26 14:46:52 -04:00
Brown
eddd7b8c11 Fix #1916 - support @var docblock annotations in more places 2020-07-26 13:23:21 -04:00
Brown
42ad366dc8 psalm-internal no longer requires internal annotation
cc @bdsl
2020-07-26 10:47:48 -04:00
Brown
e398535f9f Fix #3872 - detect namespace violations in non-methods 2020-07-26 10:42:04 -04:00
Matthew Brown
1d077cc48e Fix #3894 - don’t alter class-string during erroneous emptiness check 2020-07-25 22:49:19 -04:00
Grégoire Paris
2f673fbbd7
Detect redundant identity with true (#3893)
Using === true on a known boolean results in the same boolean.
2020-07-25 17:27:45 -04:00
Matthew Brown
ab714a40c4 Allow binding of static to current final class
Ref #3892
2020-07-25 17:26:07 -04:00
Brown
b1e583ebed Detect concat operation on property
Ref #3870
2020-07-24 16:01:45 -04:00
Brown
3687d34a5a Detect bad class constants more explicitly 2020-07-24 15:38:56 -04:00
Brown
873970a4d1 Recursively transform template types before comparison
Fixes #3887
2020-07-24 14:47:24 -04:00
Brown
92fe9898a1 Fix #3879 - ensure interface templates are extended where nececssary 2020-07-24 11:29:36 -04:00
Brown
cb979262c7 Add slash 2020-07-24 10:51:04 -04:00
Matthew Brown
84945a7d1b Fix #3877 - prevent impossible subtr comparisons 2020-07-24 10:08:57 -04:00
Matthew Brown
b88b169464 Fix #3882 - prevent crash when comparing object{...} to missing class 2020-07-24 09:38:51 -04:00
kazusuke sasezaki
94002367ba
fixed typo (#3883) 2020-07-24 09:34:05 -04:00
Barney Laurance
ff432ff73d
Simplify error messages and implementation for internal errors (#3881)
* Use more consistent language for Internal errors

There's no meaningful distinction between something being internal and
being 'marked as internal'.

* Rename property psalm_internal to internal in all storage classes

This property holds metadata that can be set using either @internal
or @psalm-internal in docblocks

* Change types of internal properties in storage from ?string to string

Simpler type is easier to handle. Non-internal methods can be considered
to be internal to the entire universe of PHP code, i.e. that code whose
namespace starts with the empty string. It's not a special case.
2020-07-24 09:32:54 -04:00
Brown
344a732829 Warn about simple assignments 2020-07-23 02:40:35 -04:00
Brown
3848fa6872 Fix #3870 - mark properties as reference-free only for externally-immutable classes 2020-07-23 01:48:06 -04:00
Barney Laurance
3bc91b9944
Fix multiple issues with @internal and @psalm-internal (#3841)
* Add passing tests for property fetch on an @internal class

I'm trying to work out why the equivilent InvalidCodeParse test is
failing for PsalmInternal

* Treat all properties of a psalm-internal class as psalm-internal

* Remove all $internal properties from storage - use psalm_internal instead

@internal can be represented as internal to the namespace root, avoiding
the need to check for both properties in storage later.

* Raise InternalClass issue when an internal class is used with e.g. instanceOf

* fix docs and tests

* Add return type declartion to code example in doc

* Don't allow class psalm-internal to overide a tighter method psalm-internal

* Break up long line

* Code style - move && from EOL to SOL

* Restore misplaced &&

* Fix code style

* Fix namespace fetching so it works

Co-authored-by: Matthew Brown <github@muglug.com>
2020-07-22 19:27:35 -04:00
Brown
9430a9b204 Add file to namespace 2020-07-22 18:03:17 -04:00
Brown
ced264620c Move things a little 2020-07-22 16:04:46 -04:00
Brown
1e01e90fba Namespace base files 2020-07-22 15:57:24 -04:00
Brown
eaae243905 Fix #3857 - allow reconciliation on magic properties 2020-07-22 09:55:22 -04:00
Brown
983f233026 Improve unpacking 2020-07-22 00:35:18 -04:00
Brown
962265e98e Hopefully final fixes 2020-07-21 23:59:11 -04:00
Brown
7ef3d4711f Fix some more tests 2020-07-21 23:16:56 -04:00
Brown
fc8c899b3a Fix test 2020-07-21 20:51:37 -04:00
Brown
5415a379d2 Fix style things 2020-07-21 19:44:59 -04:00
Brown
76bd5b6278 Refactor type comparison 2020-07-21 19:40:35 -04:00
Brown
3ce5478e5e Fix what source we give the afterMethodCall analysis hook 2020-07-21 15:00:47 -04:00
Brown
295adb5763 Fix #3860 - use correct trait element positions for nested error 2020-07-21 14:17:07 -04:00
Brown
8ed9007355 Allow false to be removed from scalar
Fixes #3829
2020-07-21 13:02:13 -04:00
Brown
ae89a71c84 Prevent false-positive comparing template to true 2020-07-21 12:59:50 -04:00
Brown
223b0619c5 Fix #3858 - support @psalm-assert falsy for abort_if expressions 2020-07-21 12:55:11 -04:00
othercorey
1524b62181
Allow null for locale, datetime and typetime of datefmt_create (#3851) 2020-07-20 04:52:27 -04:00
Gregor Harlan
5212bd1f9c
Readonly: allow assignments in __unserialize (#3845) 2020-07-20 04:50:50 -04:00
Evgeniy
2c51f47ff6
Fix invalid UndefinedClass using array|callable (#3842)
* Do not treat string array argument as callable if it can be traeted just as string array.

* cs
2020-07-20 04:50:07 -04:00
ygottschalk
de2109234d
fixes wrong return type of key() #3838 (#3839)
* fixes wrong return type of key() #3838
fixed/added tests for key

* fixed test again
2020-07-20 04:49:36 -04:00
Tyson Andre
060ae61f31
Remove an if statement that repeats the previous if statement (#3840)
They're the exact same variables.
2020-07-17 19:46:06 -04:00
Brown
9ca8fb80b7 Carry over taints after @var docblock type hints 2020-07-17 11:30:44 -04:00
Adrien LUCAS
d44130191b
Allow taint through strval sprintf (#3836)
* Add psalm-flow to strval

* Unexpected behavior with implode
2020-07-17 10:12:04 -04:00
Nat Zimmermann
a1a403e046
make meta path optional (#3833) 2020-07-17 10:09:42 -04:00
Nat Zimmermann
2ee126c567
correct *getcsv return types (#3832) 2020-07-17 10:09:21 -04:00
Brown
5392ae0b39 Fix UnusedMethodCall examples 2020-07-16 18:14:15 -04:00
Brown
d950ddfff6 Fix adding sink method 2020-07-16 16:04:17 -04:00
Brown
d1e62f1413 Add programattic sink method
Ref #3828
2020-07-16 16:02:26 -04:00
Brown
26a61c47c0 Prevent mixed erasure in get_class call 2020-07-16 13:56:42 -04:00
Brown
a2dbd31371 Fix usage of array_push results 2020-07-16 13:44:51 -04:00
Brown
262bb9fd89 Invalidate memoized getter method results after property assignment 2020-07-16 12:59:49 -04:00
Brown
b361b44889 Rip out plain getter property logic cc @m0003r
It gets in the way of the other IMO more useful memoisation logic (e.g. when a getter is declared final)
2020-07-16 12:42:59 -04:00
Brown
96bfd144df Fix #3825 - ensure final getters are treated as mutation free 2020-07-16 11:58:27 -04:00
kesselb
aaba3a08ec
Add option to supress a referenced but undefined global variable. (#3827) 2020-07-16 09:49:59 -04:00
Brown
8fbc8de98a Fix #3820 - don’t treat a method call as memoisable if it has assertions 2020-07-15 15:09:19 -04:00
Brown
06ee1b71c7 Improve check for empty array 2020-07-15 09:49:30 -04:00
ygottschalk
94e2552d1c
Fix #3810 removing ignore-nullable-return (#3817)
* Fix #3810 removing ignore-nullable-return form stubs of key, array_key_first, array_key_last

* fixed test failing due to changes to key()

* Improve key return type

* Remove unnecessary check

Co-authored-by: Matthew Brown <github@muglug.com>
2020-07-14 17:43:26 -04:00
Tyson Andre
f17a4911d5
Add more impure functions (#3814) 2020-07-14 17:14:09 -04:00
Evgeniy
fcd2ac3078
array_column check result non-emptyness (#3813)
* Update

* Update test

* Fix test

* Fix test

* inline function res in test

* cs
2020-07-14 17:13:45 -04:00
Brown
3c9028c182 Fix #3808 - allow detection of paradoxes in switch condition function calls 2020-07-14 10:51:12 -04:00
Brown
f0a5463834 Catch string subtypes that cannot be identical 2020-07-14 10:08:31 -04:00