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

212 Commits

Author SHA1 Message Date
AndrolGenhald
d4590711d6
Fix object-like array keys when combining string and automatic keys (fixes #5427). (#5428)
* Fix object-like array keys (fixes #5427).

* Fix incorrect return types for tests.

* Fix false positive list with literal int key.
2021-03-19 21:44:44 -04:00
orklah
7a40443ffb
don't throw InvalidArrayOffset when dealing with templates (#5019) 2021-01-14 16:35:06 -05:00
orklah
f9fccb2b2d
implement DTO for plugins (#4881)
* implement DTO for plugins

* introduce EventHandler + reintroduce legacy API for plugins
2021-01-06 09:05:53 -05:00
orklah
3684ceff4c
Illegal offset (#4865)
* Illegal offset access

* add tests

* fix tests
2020-12-26 10:33:49 +00:00
Matt Brown
6eae582763 Prevent mixed array offset in array creation
Fixes #4846
2020-12-16 08:18:18 -05:00
Matt Brown
e702e472fc Support simple list assignment in foreach
Ref #4741
2020-12-06 19:14:52 -05:00
Matt Brown
b64eb6d716 Break out array_key_exists tests 2020-12-02 14:42:16 -05:00
Matt Brown
e7f9ce6da0 Break out RedundantCast issues 2020-12-01 17:25:45 -05:00
orklah
4bbb72329e
Fix PHPMAXINT offset (#4707) 2020-11-26 09:24:32 -05:00
orklah
b6a3282589
Detect redundant cast (#4695)
* detect redundant cast

* fix redundant cast issues

* fix redundant cast in tests
2020-11-25 12:04:48 -05:00
Matt Brown
2c5f767098 Fix tests 2020-11-23 15:51:58 -05:00
orklah
b6cb9785ac
Prevent illegal array keys (#4660)
* Emit an issue when an array-key is not legal

* tests
2020-11-23 15:20:39 -05:00
Axel H
271e0d86be
Fix type inference when unpacking typed iterables (#4487)
* Add test for unpacking typed iterables

* Fix type inference when unpacking typed iterables into arrays

* Fix possibly undefined array offset
2020-11-06 17:24:01 -05:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
92239add4d Add some backwards-incompatible changes for 4.x 2020-08-30 11:44:14 -04:00
Brown
c13b0efd49 Improve understanding of negated count queries 2020-08-30 11:32:01 -04:00
Brown
6ab3e732fb Fix #4038 - don’t remove null types unnecessarily in mixed union 2020-08-25 15:50:33 -04:00
Brown
bcf0df4170 Fix a bug with lowercase-string unions 2020-08-05 20:05:57 -04:00
Brown
bc053e5ee8 Fix #3923 - remember class name when appending array with key 2020-08-03 01:34:46 -04:00
Brown
fd4ced42a7 Don’t register new assignment inside isset expr 2020-07-31 12:44:01 -04:00
Brown
82a85791f2 Fix #3764 - preserve sealed-ness of array into array_map 2020-07-07 09:31:43 -04:00
Brown
70ab4c18f4 Fix #3720 - allow literal unions in keys to map to object-like arrays 2020-07-01 18:57:19 -04:00
Matthew Brown
1d17c02fba Fix #3442 - support broader type after initial array assignment 2020-05-23 23:23:50 -04:00
Brown
813302206a Improve rendering of tuples 2020-05-11 09:08:53 -04:00
Brown
68cdbda8c7 Fix test 2020-04-18 13:19:25 -04:00
Brown
7dfa37beb2 Improve ergonomics of array assignment 2020-04-11 17:50:24 -04:00
Brown
bd92ec6cd3 Detect nested issues 2020-04-09 10:42:54 -04:00
Brown
bd2104c5ba Merge with mixed in nested arrays 2020-04-09 09:27:21 -04:00
Brown
b2e010b431 Fix #3102 - identify issues with possibly-mixed output 2020-04-08 14:07:09 -04:00
Brown
f6759c3d16 Check return statement types for inherited docblocks 2020-03-24 17:59:48 -04:00
Matthew Brown
b01bc9ab12 Fix union-of-mixed array key creation 2020-02-22 21:13:14 -05:00
Matthew Brown
4dae5b3190 Prevent more mixed array keys 2020-02-22 20:52:39 -05:00
Matthew Brown
6ad3d039df Prevent more array<mixed,...> creation 2020-02-22 12:12:40 -05:00
Brown
c77f2cd7a2 Treat array key int literals same way we treat string literals 2020-01-14 10:40:16 -05:00
Matthew Brown
85966d8a21 Fix #2577 - fix list cast to array 2020-01-11 11:42:09 -05:00
Matthew Brown
af28d650f3 Fix #2408 - existing offsets checked with isset should be valid 2019-12-18 23:48:25 +00:00
Brown
05783eb616 Find issues with impossible property values 2019-12-11 17:08:02 -05:00
Matthew Brown
3f2d57c7a3 Fix #2379 - support spread array RFC 2019-11-27 02:07:17 -05:00
Brown
ac6256e645 Fix #2312, improve understanding of template replacement 2019-11-08 11:56:41 -05:00
Matthew Brown
cbaf050bd2 Fix #2307 - allow setting of array string offset 2019-11-05 19:03:59 -05:00
lhchavez
216f991b0c Normalize stringified type names (#2239)
This change makes stringified types more normalized. Concretely it sorts
all union types, reconciled types, and sorts the keys within object-like
types.
2019-10-17 01:14:33 -04:00
Brown
3658771bff Fix #2221 - variadic args are lists 2019-10-10 17:46:20 -04:00
Brown
b75720c32b Add more list types 2019-10-09 10:04:34 -04:00
Matthew Brown
6a07757b9a Fix tests 2019-10-08 22:41:23 -04:00
Brown
16c33d1565 Add support for list type
Fixes #2209
2019-10-08 18:44:46 -04:00
Brown
648dda67ed Fix Psalm issues 2019-09-25 13:12:29 -04:00
Brown
1a48be8e9c Fix #2165 - coerce null array offset to zero 2019-09-25 12:17:37 -04:00
Brown
be4894c8e0 Fix #2155 - coerce false to 0, true to 1 in array offset 2019-09-20 15:21:38 -04:00
Matthew Brown
d27935d109 Improve accuracy around array addition 2019-09-08 10:23:12 -04:00
Brown
095ea1a554 Properly clone array when changing value 2019-08-27 17:00:00 -04:00
Brown
3b865f6509 Fix #2048 - allow mixed array to be assigned specific string keys 2019-08-27 10:18:58 -04:00
Matthew Brown
5d94e340ee Remove unused suppressions in tests 2019-08-18 15:34:32 -04:00
Matthew Brown
a553adb232 Fix test array spacing 2019-06-16 09:42:34 -04:00
Brown
56daa390fc Allow array access on @template T as array
Ref #1607
2019-05-23 18:06:22 -04:00
Matthew Brown
fe0f352132 Fix #1628 - improve behaviour of unset in loops 2019-05-13 11:00:17 -04:00
Brown
0e4c8ce482 Split apart TypeCoercion issues, allowing more granular issue filtering 2019-04-25 18:02:19 -04:00
Matthew Brown
c772914910 Add some formatting 2019-03-23 14:27:54 -04:00
Matthew Brown
a0659a02f1 Fix #1418 - support templated union types 2019-03-16 11:15:25 -04:00
Matthew Brown
b73dd8ebe4 Fix #1447 - always inherit docs from parents 2019-03-16 00:31:17 -04:00
Bruce Weirdan
9bdc9f774f More provider typing 2019-03-02 08:43:19 -05:00
Matthew Brown
b310cc07b5 Array access on objects should always be treated as method call 2019-02-26 21:24:30 -05:00
Brown
dca8bf9d36 Fix #1329 - improve handling arrays with string offsets 2019-02-15 14:42:17 -05:00
Matthew Brown
ed4ed957c8 Use more specific templated argument 2019-02-07 15:21:34 -05:00
Brown
2054e3753f Fix #1260 - improve handling of ArrayAccess assignment 2019-01-31 12:45:47 -05:00
Matthew Brown
a89a201c71 Fix #1180 - array key maths was wrong 2019-01-08 09:56:54 -05:00
Matthew Brown
9d8c2792e2 Add array-key type and improve general type handling
Fixes #1144
2019-01-05 00:15:53 -05:00
Matthew Brown
602d8a5ade Fix issue inheriting grandparent signature 2019-01-04 08:37:54 -05:00
Brown
72c50be4b0 Fix build 2018-12-19 20:01:27 -05:00
Brown
fb848d62e9 Add checks for if (count($a)) and if (count($a) [operator] [number]) 2018-12-19 16:15:19 -05:00
Matthew Brown
ea89a6ba29 Revert "First pass"
This reverts commit 9ed047234f.
2018-12-19 08:45:14 -05:00
Matthew Brown
9ed047234f First pass 2018-12-19 01:59:14 -05:00
Matthew Brown
fd0ab47b80 Fix #1118 - detect possible issues with unions of mixed 2018-12-08 13:18:55 -05:00
Matthew Brown
4688b25fd9 Move internal classes to own namespace 2018-11-12 11:20:59 -05:00
Brown
b7099aaf3f Make sure array changes are noticed 2018-11-09 11:19:44 -05:00
Matt Brown
dce8d14e1b Fix syntax errors in tests 2018-09-17 12:15:45 -04:00
Matthew Brown
4ad3522448 Fix #918 - improve handling of associative array offsets 2018-08-21 00:28:39 -04:00
Matthew Brown
8814dff3c1 Fix #947 - interpret type hints of unpacked args 2018-08-20 22:11:01 -04:00
Matt Brown
af14d6982f Fix #863 - MixedTypeCoercion is more appropriate in many cases 2018-07-05 10:11:04 -04:00
Matt Brown
c31d963918 Allow constants in array offsets to be reasoned about 2018-05-31 16:49:01 -04:00
Matthew Brown
1a4891c2e0 Fix #781 - prevent DuplicateArrayKey warning unnecessarily 2018-05-30 07:42:00 -04:00
Matthew Brown
b0733254bb
Use individual type objects for each string (#757)
* Experiment with individual types for each string

* Fix bunch of errors

* Fix a few more issues

* Fix a whole bunch of bugs

* Fix most remaining bugs

* Fix isset warnings

* Fix psalm errors in psalm

* Limit big string size

* Fix falsiness of ints

* Fix issue with type widening, allowing value set in nested if to be altered

* Don’t complain if type is mixed

* Add skipped-for-now test

* Add specific test to address issue
2018-05-18 11:02:50 -04:00
Matthew Brown
4fe5ac87b6 Fix #712 - rewrite switch statement fallthroughs to understand logic better 2018-05-12 12:55:24 -04:00
Matt Brown
6460d907f9 Improve array handling when offsets hard to define 2018-05-07 16:22:04 -04:00
Matthew Brown
0181fce46f Fix #711 - concat ops contribute to loop map 2018-05-05 16:17:54 -04:00
Matthew Brown
7ccc17cd98 Fix #324 - improve undefined array handling 2018-05-02 20:10:08 -04:00
Matt Brown
5a2f6ff0e0 Fix #624 - change some innaccurate issue names 2018-04-17 14:07:02 -04:00
Matthew Brown
8dcb878af4 Fix #606 - fatal error when evaluating array_key_exists 2018-03-19 19:14:55 -04:00
Matthew Brown
b0b3c9287e Fix array_key_exists calls on possibly undefined objectlike 2018-03-17 19:03:46 -04:00
Matthew Brown
4175d1a887 Add PossiblyUndefinedVariable warning when using possibly undefined array key 2018-03-17 17:35:36 -04:00
Matthew Brown
61af2a924c Fix #575 - generated possibly-undefined keys when scanning objectlike return types
Ref #458
2018-03-17 16:53:11 -04:00
Matthew Brown
af1155239e Fix bug when assigning nested arrays with variable offsets 2018-02-17 12:32:19 -05:00
Matthew Brown
40efa9e8aa Fix #503 - make sure mixed array type is set for MixedMethodCall 2018-02-08 23:22:29 -05:00
Matthew Brown
9b6b03ff9f Create Config before ProjectChecker, and remove test-specific code from FileChecker 2018-01-21 10:22:04 -05:00
Matthew Brown
799aef628e Fix type assignment checks 2018-01-20 11:48:16 -05:00
Tyson Andre
d688b51534 Be strict about matching word boundaries for expected messages
E.g. don't allow InvalidPropertyAssignmentValue where
InvalidPropertyAssignment was expected
2018-01-11 18:04:11 -05:00
Matt Brown
2120d258a4 Fix formatting of return type adder 2018-01-11 15:50:58 -05:00
Matt Brown
edde8930af Speed up Psalm by caching result of Union::getId 2018-01-09 15:05:48 -05:00
Matthew Brown
17edb2bbe6
Add better understanding of arrays with keyed integer offsets (#400)
* Add tests for keyed integer assignemnt

* First pass to get keyed integer assignment working

* Fix array assignment to object-like with different key type

* Improve treatment of objectlikes for callable and iterable comparisons

* Fix array assignment to strings and addition

* Convert expression to CNF

* Do better at merging property types

* Fix array_rand key type
2017-12-18 18:47:17 -05:00
Matt Brown
a6f3781452 Fix #340 - give up with mixed type when accessing unknown key on objectlike 2017-11-27 12:01:23 -05:00
Matthew Brown
afcbc113c9 Fix #228, fix #336 by improving checking of inherited signatures 2017-11-26 16:03:17 -05:00