1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 17:27:28 +01:00
Commit Graph

149 Commits

Author SHA1 Message Date
Brown
3e0c4cfb75 Fix #3210 - prevent possibly-null array access from destructure 2020-05-02 20:36:41 -04:00
Brown
5bc9b095d1 Allow memoisation of ArrayAccess::offsetGet 2020-04-12 14:43:12 -04:00
Brown
547efcc022 Prevent ArrayAccess on object from being memoised 2020-04-12 14:00:12 -04:00
Matthew Brown
db17c85dd6 Fix #2787 - make accessing undefined objectlike key an error 2020-02-22 00:29:59 -05:00
Brown
0e23fab5d2 Detect bugs similar to that which caused #2832 2020-02-18 12:53:54 -05:00
Brown
6e8088776d Use better return type for SimpleXMLElement::offsetGet 2020-02-18 10:58:56 -05:00
Matthew Brown
966336a475 Improve byref array handling 2020-02-06 23:52:27 -05:00
Matthew Brown
26876b9a13 array_push shouldn’t change list type 2019-12-29 10:20:44 -05:00
Brown
f97a8f0d5b Use more accurate way to determine list size 2019-11-26 16:34:19 -05:00
Brown
589ab5400a Fix ArrayAccess test 2019-11-11 10:48:14 -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
Matthew Brown
54a31f8cff Be more scrupulous about mixed vars 2019-10-17 00:29:51 -04:00
Brown
e822ec7541 Unsetting list elements should turn to an array 2019-10-09 12:49:31 -04:00
Brown
54d5a25077 Remove known array offsets after altering array 2019-10-09 10:36:55 -04:00
Matthew Brown
38de68f507 array_values should preserve array non-emptiness 2019-10-08 22:22:58 -04:00
Brown
16c33d1565 Add support for list type
Fixes #2209
2019-10-08 18:44:46 -04:00
Brown
b0aaede9e1 Add support for checking integer array offsets 2019-10-04 11:08:08 -04:00
Matthew Brown
d85fbaec09 Add stricter checks after first isset 2019-10-03 21:34:56 -04:00
Brown
2c9a082b3e Fix #2172 - only complain about missing offset if it’s really missing 2019-09-25 19:02:49 -04:00
Matthew Brown
9ad6c36d9b
Conditionally verify that array offsets exist (#2147)
* Check array offsets idea

* Clean up some issues

* Add a few light fixes

* Add docs
2019-09-18 14:21:06 -04:00
Matthew Brown
5d94e340ee Remove unused suppressions in tests 2019-08-18 15:34:32 -04:00
Matthew Brown
b5eb63bb2d Revert "Coerce value with array-offset to array|ArrayAccess"
This reverts commit a8a67bc7e7.
2019-08-07 00:36:45 -04:00
Matthew Brown
a8a67bc7e7 Coerce value with array-offset to array|ArrayAccess
Fixes #1986
2019-08-07 00:31:53 -04:00
Matthew Brown
da42be175f Apply PHPCS fixes
Fixes #1880
2019-07-05 16:27:53 -04:00
LeSuisse
f29826b958 Fully qualify constants and function calls (#1849)
This should give a small performance boost.
Part of #1837.

The change is enforced via phpcs and can be autofixed
with phpcbf.
2019-06-26 16:52:29 -04:00
Brown
7b4dbb1c85 Fix #1826 - don’t allow mixed unions when combining with object-like array 2019-06-20 20:13:36 -04:00
Matthew Brown
53506fb879 Fix #1770 - fix notice that should not be 2019-06-12 09:13:59 -04:00
Matthew Brown
c38108f95d Fix byref array assignment
Fixes #1702
2019-06-08 10:32:46 -04:00
Brown
81b6a6f496 Support assertions on class constants 2019-05-28 12:31:46 -04:00
Matthew Brown
518330dcf4 Fix class constant assertions on self/static 2019-05-27 13:33:14 -04:00
Matthew Brown
97eab1a2e6 Fix bad string key assertion 2019-05-27 10:10:21 -04:00
Brown
56daa390fc Allow array access on @template T as array
Ref #1607
2019-05-23 18:06:22 -04:00
bugreportuser
1c160dab13 Fix typo in isAtomicContainedBy 2019-04-30 00:52:56 -04:00
Brown
0e4c8ce482 Split apart TypeCoercion issues, allowing more granular issue filtering 2019-04-25 18:02:19 -04:00
Brown
8f1dbc072d Allow empty offset sets on arrayaccess objects 2019-04-10 17:25:25 -04:00
Matthew Brown
ef8292cfc7 Fix #1510 - analyse mixed array offsets 2019-03-31 15:42:15 -04:00
Matthew Brown
c772914910 Add some formatting 2019-03-23 14:27:54 -04:00
Bruce Weirdan
9bdc9f774f More provider typing 2019-03-02 08:43:19 -05:00
Brown
601f303de2 Fix position of invalid param 2019-02-27 16:00:44 -05:00
bugreportuser
7f7125f334 Fix crash for empty string array access 2019-02-25 08:26:12 -05:00
Brown
348b8eef1f Fix #1366 - don’t complain about invalid array offset when possibly mixed 2019-02-19 11:42:24 -05:00
Brown
c195e8fd21 Add more nuanced analysis of array access fetch 2019-01-30 15:40:37 -05:00
Brown
c9e1df510e Fix #1241 - allow negative string offsets on a string 2019-01-25 10:23:50 -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
2dc3d9651f Separate iterable into its own type
Fixes #1151
2019-01-04 14:54:40 -05:00
Matthew Brown
10a36def96 Fix issue with by-ref args 2018-12-21 13:53:22 -05:00
Brown
5842ac1517 Fix internal error with property fetches on undefined classes 2018-12-20 14:26:55 -05:00
Matthew Brown
13e14b3162 Remove code that was breaking things 2018-12-19 00:28:11 -05:00
Brown
b7d4db892c Fix #1130 - improve handling of invalid array offsets 2018-12-14 15:10:10 -05:00
Brown
15320430db Don’t combine empty array with mixed
Ref #1126
2018-12-14 12:30:13 -05:00
Brown
d9945a0ced Fix issue re-asserting non-empty-mixed 2018-12-10 18:33:26 -05:00
Matthew Brown
b7710f7cb9 Fix #1107 - be more lenient with possibly undefined array access when suppressed 2018-12-05 22:35:08 -05:00
Brown
b6446824be Fix #1107 - emit PossiblyUndefinedArrayOffset where applicable 2018-11-30 13:27:21 -05:00
Matthew Brown
4688b25fd9 Move internal classes to own namespace 2018-11-12 11:20:59 -05:00
Matthew Brown
84d7504036 Fix #834 - warn about __toString in array offset 2018-08-31 20:24:50 -04:00
Matthew Brown
d5b0d5a996 Fix #964 - warn about imposible offsets 2018-08-31 20:02:36 -04:00
Matt Brown
699a34fc9d Fix #952 - improve checks for string array offsets 2018-08-21 11:40:29 -04:00
Matthew Brown
16e270f0ee Improve loading of stub file and autoload file information
Ref #849
2018-06-30 15:29:37 -04:00
Matthew Brown
071558ec83 Fix #733 - DomNodeList implements ArrayAccess 2018-05-11 23:21:53 -04:00
Matthew Brown
fa95dede08 Fix #455 - allow unset to alter object-like arrays 2018-05-02 19:39:11 -04:00
Radosław Kowalewski
15c1a82d8c Few fixes to make tests pass on windows
* changed / to DIRECTORY_SEPARATOR in expected messages
* cahnged most occurences PHP_EOL to "\n" in tests and src
* added output buffering in test to avoid marking test as risky
2018-04-12 22:41:13 -04:00
Matthew Brown
faa2d6f2e1 Fix #634 - prevent prefixing objectlike keys with namespaces 2018-04-02 00:39:59 -04:00
Matthew Brown
9404de699d Allow list vars to have array keys 2018-03-21 08:48:30 -04:00
Matt Brown
a253463ba8 Use strings for numeric string key offsets 2018-03-15 10:16:11 -04:00
Matt Brown
4b87612bb4 Add better issue message for bad array offset
Fixes #492
2018-02-06 11:27:01 -05:00
Matt Brown
2120d258a4 Fix formatting of return type adder 2018-01-11 15:50:58 -05:00
Matthew Brown
5ff4badf33
Refactor array analysis to improve reliability and accuracy (#325) 2017-11-19 12:33:43 -05:00
Matt Brown
39baa00fd3 Fix issue with nested object-like array updating 2017-11-17 16:33:36 -05:00
Matt Brown
2a96e323e7 Fix assignment to arrays after object-like 2017-11-17 12:27:16 -05:00
Matthew Brown
965352c711 Fix #312 - support parsing object-like arrays without keys 2017-11-17 01:18:13 -05:00
Matthew Brown
7d33db0d19 Fix issue with array unification after scanning 2017-11-16 01:11:46 -05:00
Matthew Brown
36a760657d Fix #311 and introduce PossiblyInvalidArrayOffset 2017-11-16 00:27:11 -05:00
Matthew Brown
6c9cdd896b Separate InvalidArrayAccess and InvalidArrayOffset 2017-11-15 21:10:07 -05:00
Matthew Brown
f136fc3296 Fix #305 by making test error message checks more accurate 2017-11-15 21:04:25 -05:00
Matthew Brown
abe7c003ab Fix #309 - borrowing fix from @TysonAndre 2017-11-15 20:45:53 -05:00
Matthew Brown
a0a9128375 Fix #285 - add PossiblyInvalidArrayAccess 2017-11-11 21:22:11 -05:00
Matt Brown
fef589fb68 Fix issue with array access on property 2017-06-29 17:39:46 -04:00
Matt Brown
ac70ea31b2 Change test assertion keying 2017-06-29 10:22:49 -04:00
Matthew Brown
8fd671bdc4 Fix #167 - prevent Empty type in assignment 2017-06-28 23:37:02 -04:00
Matthew Brown
d6909193ea Add additional formatting changes 2017-05-26 20:05:57 -04:00
Jon Ursenbach
11bc153deb Rewriting and streamlining every unit test with data providers. (#147)
* Rewriting and streamlining every unit test with data providers.

All unit tests have been rewritten into PHPUnit data providers
to reduce the amount of unnecessary code-reuse through out the
test suite.
2017-04-24 23:45:02 -04:00
Matthew Brown
9061d36566 Don’t emit InvalidArrayAccess if ignoring null arrays 2017-02-12 17:13:03 -05:00
Matthew Brown
35e4b380cc Add collection of PossiblyNull* issues 2017-02-11 17:55:08 -05:00
Matt Brown
a7872472be Add stubbing tests and modify config initialisation 2017-01-31 19:22:05 -05:00
Matthew Brown
b3726c9de5 Use getcwd() for the project’s base, not the config file parent directory 2017-01-16 18:33:04 -05:00
Matt Brown
6e6106c080 Add docblocks to tests 2017-01-13 14:07:23 -05:00
Matthew Brown
17329015dc Discriminate between checking, visiting and analyzing in method names 2017-01-07 15:09:47 -05:00
Matthew Brown
7609ca02c0 Fix #32 by evaluating all class references in files lazily 2017-01-04 23:42:58 -05:00
Matthew Brown
8b5e066ba6 Add case-sensitive function names 2016-12-30 13:09:00 -05:00
Matthew Brown
685eaeb4fe Reimagine XML schema, fixes #21 2016-12-29 20:10:06 -05:00
Matthew Brown
749735a3ec Update config file API still further 2016-12-29 10:24:10 -05:00
Matthew Brown
ff466b7992 Change config API 2016-12-29 08:42:39 -05:00
Matthew Brown
52b3e1ba8c Simplify test config setup; 2016-12-18 19:00:32 -05:00
Matthew Brown
d88bb4e135 Finish adding tests for all issues 2016-12-16 22:16:29 -05:00
Matt Brown
6755c8724a Add tests for M* issues, fixing bugs along the way 2016-12-16 18:56:23 -05:00
Matthew Brown
dcec735d11 Fix generation of MixedArrayAccess issue 2016-12-15 01:28:36 -05:00
Matt Brown
c91e457c28 Add psalm.xml support for checking tests 2016-12-14 12:55:23 -05:00
Matt Brown
154d023a9d Add more robust config testing 2016-12-14 12:28:38 -05:00
Matthew Brown
4c21a5af7c Add so many new tests 2016-12-11 23:41:11 -05:00