1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-11 16:59:45 +01:00
Commit Graph

137 Commits

Author SHA1 Message Date
Bruce Weirdan
4266a8e044
Merge pull request #10839 from kkmuffme/misc-class-callable-errors-not-reported 2024-03-20 05:51:34 +01:00
Bruce Weirdan
375fe32992
Update tests/CallableTest.php 2024-03-20 05:32:13 +01:00
Bruce Weirdan
e3d55268f9
Merge pull request #10838 from kkmuffme/undefined-parent-not-reported-in-callable 2024-03-20 01:08:45 +01:00
kkmuffme
e83530a6c1 report invalid callable if callable cannot be called like this from current context
Fix https://github.com/vimeo/psalm/issues/10823
Fix https://github.com/vimeo/psalm/issues/8509
2024-03-20 01:02:54 +01:00
kkmuffme
a59248f5a1 self, parent and static in callable are deprecated since PHP 8.2
Fix https://github.com/vimeo/psalm/issues/10837
2024-03-20 01:02:54 +01:00
kkmuffme
ff168a9c7a Fix undefined parent not reported in callable
Fix https://github.com/vimeo/psalm/issues/10836
2024-03-16 21:45:24 +01:00
Bruce Weirdan
20c788911f Allow more callable types as subtypes of callable
Fixes vimeo/psalm#10461
2024-03-10 22:23:01 +01:00
Bruce Weirdan
ceb290891b Initial support for named parameters for callables
Fixes vimeo/psalm#10766
2024-03-02 19:17:48 +01:00
kkmuffme
3c045b30a7 fix false positive ArgumentTypeCoercion for callback param when unsealed and all optional 2023-12-12 14:13:32 +01:00
18a6c0b6e9 Implement by-ref closure use analysis 2023-12-03 15:28:51 +01:00
kkmuffme
adb8677f20 Fix optional args not enforced in callable (fix for non-closure/arrow functions of https://github.com/vimeo/psalm/issues/8438) Fix array callables not treated as callable https://psalm.dev/r/23f3787207 (this is needed to fix the optional args enforcement for array callables too) 2023-11-18 08:55:20 +01:00
kkmuffme
0ca2d4f597 Fix https://github.com/vimeo/psalm/issues/6085 2023-11-18 08:55:20 +01:00
klimick
a3df6505f0 Type check nested templates 2023-10-09 17:07:52 +03:00
klimick
809b27c499 Fix variadic callable type check 2023-07-30 11:43:07 +03:00
klimick
e9445cd422 Test inference with omitted closure param 2023-07-11 11:34:06 +03:00
kkmuffme
ad7be63c0b fix tests/internal code
@var comments needed due to https://github.com/vimeo/psalm/issues/9754 and https://github.com/vimeo/psalm/issues/9753
2023-05-06 19:18:27 +02:00
klimick
cf0ca8b57a Test contextual closure arg inference for class methods 2023-04-24 00:00:15 +03:00
andrew
2f7a7178ca Docs for HighOrderFunctionArgHandler::remapLowerBounds 2023-04-06 18:23:50 +03:00
adrew
a3aed2fc61 Analyse const callable like first-class-callable 2023-04-04 22:17:17 +03:00
andrew
72e5709ef2 Handle partially templated first-class-callables 2023-03-27 18:29:22 +03:00
adrew
62a79eeff3 Test with invalid first-class-callable 2023-03-26 22:47:17 +03:00
adrew
f26c16d2ab Contextually resolve templates of first-class-callable arg during call 2023-03-26 19:07:20 +03:00
Jack Worman
1c19260cdd Require trailing commas 2022-12-18 13:20:31 -06:00
Jack Worman
643542346b Add codesniffer rules and expand php-cs-fixer to bin and test 2022-12-14 13:29:09 -06:00
Matthew Brown
8d36bdc3ed
Make array shapes strict by default (#8701)
* Make array shapes strict by default

* Fix PSL tests
2022-11-11 20:14:21 -05:00
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
orklah
0e891f25ad refactor description of types in Atomic 2022-01-22 19:34:57 +01:00
orklah
eb53f7e99c fix tests 2022-01-20 22:18:03 +01:00
orklah
6f1a5e8a47
Merge pull request #7417 from klimick/partially-applied-closure-inference
Contextual type inference for high order function arg
2022-01-20 21:03:46 +01:00
adrew
7e623ed48e Upcast invokable to callable during hof arg analysis 2022-01-19 00:37:05 +03:00
adrew
379d0d6c49 Add tests 2022-01-18 18:54:47 +03:00
adrew
3886d5b4c6 Add test for high order function arg inference in class context 2022-01-18 13:12:13 +03:00
adrew
fac7115eae Add simple test for high order function arg inference 2022-01-18 12:48:53 +03:00
adrew
00ce1107d3 Infer partially applied closure arg by previous function arg 2022-01-18 03:02:21 +03: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
Bruce Weirdan
762ef8dab4
Merge branch '4.x' into upstream-master 2022-01-07 08:44:32 +02:00
Fabien Villepinte
b9d8dd9d3f
Fix analysis when __invoke() exists 2022-01-06 21:22:18 +01:00
Matthew Brown
b419c299e3
Use InvalidScalarArgument only when we can be sure PHP attempts coercion 2022-01-02 14:56:18 +02:00
adrew
87deb19a87 Remove dead code from test 2021-12-27 19:43:06 +03:00
adrew
c0ca383020 Contextual inference for closure param types 2021-12-27 19:35:37 +03:00
adrew
3d212c642c
Add test for mismatch param type from docblock 2021-12-27 00:45:26 +02:00
adrew
d6d0fc6704
Remove undefined variables 2021-12-27 00:45:25 +02:00
adrew
2e4d75d6bd
Fix closure param type inference in generic context 2021-12-27 00:45:22 +02:00
rarila
97e6511fab Set number of lines before and after namespace. 2021-12-15 04:58:32 +01:00
adrew
a8d23538b7 Fix closure param type inference with named params 2021-12-12 13:17:15 +03:00
adrew
603e1c944b Fix type inference of closure params 2021-12-11 23:00:18 +03:00
adrew
989c3ada2e Fix type inference of closure params 2021-12-11 22:51:18 +03:00
ralila
8fb2e0f885 Handle some partials 2021-12-04 21:55:53 +01:00
orklah
7c6b86cef3 suppress error and add test 2021-11-23 20:04:52 +01:00