1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-06 05:29:00 +01:00
Commit Graph

73 Commits

Author SHA1 Message Date
1986c8b4a8
Add support for strict arrays, fix type alias intersection, fix array_is_list assertion on non-lists (#8395)
* Immutable CodeLocation

* Remove excess clones

* Remove external clones

* Remove leftover clones

* Fix final clone issue

* Immutable storages

* Refactoring

* Fixes

* Fixes

* Fix

* Fix

* Fixes

* Simplify

* Fixes

* Fix

* Fixes

* Update

* Fix

* Cache global types

* Fix

* Update

* Update

* Fixes

* Fixes

* Refactor

* Fixes

* Fix

* Fix

* More caching

* Fix

* Fix

* Update

* Update

* Fix

* Fixes

* Update

* Refactor

* Update

* Fixes

* Break one more test

* Fix

* FIx

* Fix

* Fix

* Fix

* Fix

* Improve performance and readability

* Equivalent logic

* Fixes

* Revert

* Revert "Revert"

This reverts commit f9175100c8452c80559234200663fd4c4f4dd889.

* Fix

* Fix reference bug

* Make default TypeVisitor immutable

* Bugfix

* Remove clones

* Partial refactoring

* Refactoring

* Fixes

* Fix

* Fixes

* Fixes

* cs-fix

* Fix final bugs

* Add test

* Misc fixes

* Update

* Fixes

* Experiment with removing different property

* revert "Experiment with removing different property"

This reverts commit ac1156e077fc4ea633530d51096d27b6e88bfdf9.

* Uniform naming

* Uniform naming

* Hack hotfix

* Clean up $_FILES ref #8621

* Undo hack, try fixing properly

* Helper method

* Remove redundant call

* Partially fix bugs

* Cleanup

* Change defaults

* Fix bug

* Fix (?, hope this doesn't break anything else)

* cs-fix

* Review fixes

* Bugfix

* Bugfix

* Improve logic

* Add support for list{} and callable-list{} types, properly implement array_is_list assertions (fixes #8389)

* Default to sealed arrays

* Fix array_merge bug

* Fixes

* Fix

* Sealed type checks

* Properly infer properties-of and get_object_vars on final classes

* Fix array_map zipping

* Fix tests

* Fixes

* Fixes

* Fix more stuff

* Recursively resolve type aliases

* Fix typo

* Fixes

* Fix array_is_list assertion on keyed array

* Add BC docs

* Fixes

* fix

* Update

* Update

* Update

* Update

* Seal arrays with count assertions

* Fix #8528

* Fix

* Update

* Improve sealed array foreach logic

* get_object_vars on template properties

* Fix sealed array assertion reconciler logic

* Improved reconciler

* Add tests

* Single source of truth for test types

* Fix tests

* Fixup tests

* Fixup tests

* Fixup tests

* Update

* Fix tests

* Fix tests

* Final fixes

* Fixes

* Use list syntax only when needed

* Fix tests

* Cs-fix

* Update docs

* Update docs

* Update docs

* Update docs

* Update docs

* Document missing types

* Update docs

* Improve class-string-map docs

* Update

* Update

* I love working on psalm :)

* Keep arrays unsealed by default

* Fixup tests

* Fix syntax mistake

* cs-fix

* Fix typo

* Re-import missing types

* Keep strict types only in return types

* argc/argv fixes

* argc/argv fixes

* Fix test

* Comment-out valinor code, pinging @romm pls merge https://github.com/CuyZ/Valinor/pull/246 so we can add valinor to the psalm docs :)
2022-11-05 22:34:42 +01:00
Matthew Brown
b49682a485 Simplify issue suppression in tests 2022-01-13 14:38:17 -05:00
Matthew Brown
f439d6550b
Ensure that all entries in test arrays have explicit keys (#7386)
* Transformation that updates assertions

* Simplify transformation

* Ensure that all tests have keys

* Fix a few remaining keys
2022-01-13 13:49:37 -05:00
orklah
2c9541c1ed flag the context as "inside_conditional" when analyzing leftover cases to prevent emitting unused error 2021-12-23 22:18:27 +01:00
rarila
97e6511fab Set number of lines before and after namespace. 2021-12-15 04:58:32 +01:00
rarila
39402c233d
Return type hints (#7065)
Co-authored-by: ralila <>
2021-12-05 19:51:26 +02:00
ralila
8fb2e0f885 Handle some partials 2021-12-04 21:55:53 +01:00
Matthew Brown
0a7d254689 Fix #5911 - improve non-terminating switch type inference 2021-06-09 09:06:23 -04:00
Matt Brown
3c43bc1522 Fix #5789 - prevent incorrect return type inference when all cases return 2021-05-18 08:52:41 -04:00
Matt Brown
f6bdeb6234 Fix switch-with-continue bug 2021-05-17 07:27:58 -05:00
Matthew Brown
5e8219b613 Fix #5327 - add check to prevent OOMing on very large conditionals 2021-05-14 14:53:53 -04:00
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
Matt Brown
dff2943096 Fix #4794 - invvalidate dependent types when their variables change 2020-12-06 18:16:22 -05:00
Matt Brown
d8d17a6587 Fix #4327 - make sure loop always returns 2020-10-14 20:19:55 -04:00
Brown
c17bacd682 Prevent duplicate switch return types 2020-09-25 09:45:20 -04:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
Bruce Weirdan
4dcb7183f5
Fix windows tests (#4040)
* Fix windows tests by not mangling the expectations

* Use platform-dependent directory separator in expected messages

* fix CS
2020-08-22 10:00:36 -04:00
Brown
e61765ff9b Fix #3954 - catch ComplicatedExpressionException with added workaround 2020-08-07 08:20:35 -04:00
Brown
26a61c47c0 Prevent mixed erasure in get_class call 2020-07-16 13:56:42 -04:00
Brown
3c9028c182 Fix #3808 - allow detection of paradoxes in switch condition function calls 2020-07-14 10:51:12 -04:00
Brown
bf7bcc0dca Fix #3779 - allow ParadoxicalCondition of default to be suppressed 2020-07-08 14:51:20 -04:00
Brown
05cb39814c Improve performance of long switch checks 2020-06-15 16:23:19 -04:00
Brown
45ea5d0bfe Add a couple more shortcuts for common pattern
Fixes #3563
2020-06-12 11:18:34 -04:00
Matthew Brown
b46e147735 Add some limits on switch case assertion calculation
Ref #2728
2020-03-30 00:20:00 -04:00
Brown
54efbbe831 Fix bad assertion 2020-02-06 16:32:26 -05:00
Brown
0bcb7863f3 Use better system for storing inferred types and assertions 2019-11-25 11:44:54 -05: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
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
SignpostMarv
4a56688800 adding DIRECTORY_SEPARATOR to tests that fail under windows 2019-02-06 14:29:10 -05:00
Matthew Brown
f54a50ec7d Fix #1116 - provide slightly clearer message when comparing a class string to a string 2018-12-05 22:29:06 -05:00
Matthew Brown
47f5f309ad Remove support for get_class($a) === "somestring"
But it works with class constants
2018-11-28 23:59:43 -05:00
Brown
c378079db8 Make the length of possible string unions unlimited in conditionals
Fixes #1103
2018-11-28 15:12:08 -05:00
Matthew Brown
4688b25fd9 Move internal classes to own namespace 2018-11-12 11:20:59 -05:00
Matthew Brown
c7016d9232 Unset new var if it doesn’t appear in break vars 2018-11-11 22:03:08 -05:00
Matthew Brown
12e3ab11ad Improve handling of breaks in switch statements 2018-11-10 20:34:53 -05:00
Matt Brown
086b6d0372 Seal the output of switch statments 2018-05-24 14:26:29 -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
Matt Brown
a0281e5716 Improve clause eradication after ifs 2018-05-14 16:29:51 -04:00
Matthew Brown
05c3d1ab03 Improve reporting of duplicate case statements 2018-05-13 22:02:10 -04:00
Matthew Brown
d46997b196 Make sure weak equality clauses don’t generate ParadoxicalCondition 2018-05-13 01:27:45 -04:00
Matthew Brown
9f28be415a Fix reconciliation of ored types 2018-05-13 00:54:12 -04:00
Matthew Brown
69338abf7c Allow rough equality assertions to be negated too 2018-05-12 20:08:22 -04:00
Matthew Brown
7dd86efa13 Add support for checking negative values 2018-05-12 18:46:47 -04:00
Matthew Brown
4fe5ac87b6 Fix #712 - rewrite switch statement fallthroughs to understand logic better 2018-05-12 12:55:24 -04:00
Matthew Brown
318220a1bf Fix #728 - remove statement return type when re-analysing 2018-05-09 09:30:23 -04:00
Matt Brown
93ac3eaadb Fix #213 by evaluating switch statements better 2018-01-24 16:15:53 -05:00
Matthew Brown
b06cfd025a Allow continue inside case statement as alias for break
Fixes #464
2018-01-24 00:01:08 -05:00
Matt Brown
2120d258a4 Fix formatting of return type adder 2018-01-11 15:50:58 -05:00