1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-14 02:07:37 +01:00
Commit Graph

5489 Commits

Author SHA1 Message Date
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
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