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

159 Commits

Author SHA1 Message Date
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
Matt Brown
a069cf4ea9 Don‘t turn a string into an array|string by accident 2017-11-20 17:10:05 -05:00
Matt Brown
0c2ea418e3 Fix #327 - prevent null array value from killing assignment 2017-11-20 16:19:40 -05:00
Matt Brown
f46fd0b79f Fix array access on objects 2017-11-20 11:49:26 -05:00
Matthew Brown
ae799da8d0 Add root array var when updating array key type in if 2017-11-19 23:25:14 -05:00
Matthew Brown
5698b2d363 Update root var with more accurate object-like type 2017-11-19 22:28:52 -05:00
Matthew Brown
8b2df09f0f Fix issue with object-like reassignment 2017-11-19 21:24:29 -05:00
Matthew Brown
3418eb494a Always set a fallback mixed type on a mixed property fetch 2017-11-19 14:58:48 -05:00
Matthew Brown
942bc0a663 Add new MixedTypeCoercion issue, fixes #320 2017-11-19 13:42:48 -05:00
Matthew Brown
5ff4badf33
Refactor array analysis to improve reliability and accuracy (#325) 2017-11-19 12:33:43 -05:00
Matthew Brown
abe7c003ab Fix #309 - borrowing fix from @TysonAndre 2017-11-15 20:45:53 -05:00
Matthew Brown
2f1e3652b7 Fix #274 - improve array addition inference for objectlike arrays 2017-11-11 14:19:57 -05:00
Matthew Brown
44c40dff4f Fix #270 by looking at root ids when analysing array assignment in loops 2017-11-08 08:23:34 -05:00
Matthew Brown
d422bc85d6 Add (skipped) test for #270 2017-11-07 23:49:04 -05:00
Matthew Brown
e29dd140e3 Refactor scanning and analysis, introducing multithreading (#191)
* Add failing test

* Add visitor to soup up classlike references

* Move a whole bunch of code into the visitor

* Move some methods back, move onto analysis stage

* Use the getAliases method everywhere

* Fix refs

* Fix more refs

* Fix some tests

* Fix more tests

* Fix include tests

* Shift config class finding to project checker and fix bugs

* Fix a few more tests

* transition test to new syntax

* Remove var_dump

* Delete a bunch of code and fix mutation test

* Remove unnecessary visitation

* Transition to better mocked out file provider, breaking some cached statement loading

* Use different scheme for naming anonymous classes

* Fix anonymous class issues

* Refactor file/statement loading

* Add specific property types

* Fix mapped property assignment

* Improve how we deal with traits

* Fix trait checking

* Pass Psalm checks

* Add multi-process support

* Delay console output until the end

* Remove PHP 7 syntax

* Update file storage with classes

* Fix scanning individual files and add reflection return types

* Always turn XDebug off

* Add quicker method of getting method mutations

* Queue return types for crawling

* Interpret all strings as possible classes once we see a `get_class` call

* Check invalid return types again

* Fix template namespacing issues

* Default to class-insensitive file names for includes

* Don’t overwrite existing issues data

* Add var docblocks for scanning

* Add null check

* Fix loading of external classes in templates

* Only try to populate class when we haven’t yet seen it’s not a class

* Fix trait property accessibility

* Only ever improve docblock param type

* Make param replacement more robust

* Fix static const missing inferred type

* Fix a few more tests

* Register constant definitions

* Fix trait aliasing

* Skip constant type tests for now

* Fix linting issues

* Make sure caching is off for tests

* Remove unnecessary return

* Use emulative parser if on PHP 5.6

* Cache parser for faster first-time parse

* Fix constant resolution when scanning classes

* Remove test that’s beyond a practical scope

* Add back --diff support

* Add --help for --threads

* Remove unused vars
2017-07-25 16:11:02 -04:00
Matt Brown
ac70ea31b2 Change test assertion keying 2017-06-29 10:22:49 -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
9dd94d099f Fix issue with possibly-redefined switch vars 2017-03-14 02:00:38 -04:00
Matthew Brown
50b629e88e Update context types after switch statement without default case 2017-03-13 21:17:21 -04:00
Matt Brown
0049e4deb4 Fix #105 and also the issues found in its wake 2017-02-23 19:36:51 -05:00
Matthew Brown
9137727993 Fix #99 - treat null coalesce more respectfully 2017-02-17 20:50:47 -05:00
Matt Brown
a7872472be Add stubbing tests and modify config initialisation 2017-01-31 19:22:05 -05:00
Matthew Brown
ea63fd7ae3 Fix #75 - allow inteeger offsets for object-like arrays 2017-01-25 00:11:24 -07:00
Matthew Brown
374dc65de1 Fix #39 by checking for ArrayAcces interface 2017-01-20 00:23:58 -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
e7568f8400 Fix type coercion issues 2017-01-09 01:27:35 -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
883ca6a5db Fix #30 by consolidating properties into single storage array 2017-01-01 19:09:17 -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
Matt Brown
c91e457c28 Add psalm.xml support for checking tests 2016-12-14 12:55:23 -05:00
Matthew Brown
4c21a5af7c Add so many new tests 2016-12-11 23:41:11 -05:00
Matthew Brown
73b1ab1411 Support int offsets in dealing with type inference 2016-12-10 18:24:28 -05:00
Matthew Brown
f0939952d4 Add extra array assignment tests 2016-12-04 19:33:42 -05:00
Matthew Brown
2a9e138a14 Add failing array addition tests 2016-11-13 14:36:29 -05:00
Matthew Brown
3b1dfd0942 Fix issue combining generic and object-like 2016-11-13 11:54:40 -05:00
Matthew Brown
6d7dc41756 Update tests with spaces 2016-11-13 11:24:25 -05:00
Matthew Brown
7d6ac4719f Fix offset assignment creation 2016-11-05 20:17:22 -04:00
Matthew Brown
c5591adf10 Add support for global in functions and mixed inferred return errors 2016-11-05 17:54:34 -04:00
Jon Ursenbach
27c2db1d1d PSR-2 2016-11-02 17:50:54 -04:00
Matthew Brown
b31ac4a862 Removed object-like type descriptor in favour of array{} syntax 2016-10-28 13:24:06 -04:00
Matthew Brown
2fe46b08b4 Add additional array check 2016-10-15 13:11:08 -04:00
Matthew Brown
18a55e2854 Also inspect arrays from strings 2016-10-15 13:10:05 -04:00
Matthew Brown
c178e5c882 Add tests for nested assignment 2016-10-03 00:44:05 -04:00
Matthew Brown
8730c67d2a Fix tests 2016-10-02 22:01:01 -04:00
Matthew Brown
9f37dc8626 Check for arrayAccess erroneous vars 2016-09-22 13:45:47 -04:00