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

183 Commits

Author SHA1 Message Date
Yannick Gottschalk
85a1c83591 Added to documentation and tests that api can be used instead of psalm-api 2023-03-20 13:34:44 +01:00
Evan Shaw
ce3f7fccd6 Set inside_call for eval expressions 2023-03-15 22:06:36 +13:00
Bruce Weirdan
2e90cb6c6a
Process @psalm-api tags on methods 2023-02-23 03:52:10 -04:00
Evan Shaw
a03299f3d0 Include setrawcookie as an impure function 2023-02-21 14:24:05 +13:00
Bruce Weirdan
e6aa63731d
Flag docblock parameters that have no counterparts in function signature
Fixes vimeo/psalm#3166
2023-02-15 22:04:26 -04:00
Jack Worman
703a1e1698 @psalm-api 2022-12-23 16:13:46 -06:00
Jack Worman
1c19260cdd Require trailing commas 2022-12-18 13:20:31 -06:00
Jack Worman
a52f35e5e1 Even more property typehints 2022-12-16 13:24:21 -06:00
Jack Worman
2b5407d2fb Added SlevomatCodingStandard.TypeHints.ParameterTypeHint sniff and removed php-cs-fixer 2022-12-14 20:26:17 -06:00
Jack Worman
69658e8315 SlevomatCodingStandard.Commenting.DocCommentSpacing 2022-12-14 13:34:41 -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
Bruce Weirdan
4d8af74d92
Don't crash when accessing immutable static property
Fixes vimeo/psalm#8313
2022-12-03 00:51:22 -04: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
65d6a469b6 Fix tests 2022-11-08 10:45:21 +01:00
68a5511057 Merge remote-tracking branch 'origin/4.x' into HEAD 2022-11-08 10:25:04 +01: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
Vincent Langlet
fbaf6afb30 Try 2022-11-03 18:11:01 +01:00
Vincent Langlet
b2f095f1b8 Add tests 2022-11-03 14:39:48 +01:00
Vincent Langlet
4a27322144 serialize is not pure for array of object 2022-11-03 11:48:33 +01:00
Vincent Langlet
ef0a17ee11 Do not report serialize as unused 2022-11-02 22:52:42 +01:00
8d0c1c62e8
Ensure all template parameters are specified in classes, interfaces, traits 2022-01-31 10:06:31 +01:00
orklah
af1888b631 Merge remote-tracking branch 'upstream/4.x' into upstream-master4 2022-01-22 17:48:42 +01:00
orklah
52a7f0694e drop compatibility aliases 2022-01-19 19:29:16 +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
rarila
97e6511fab Set number of lines before and after namespace. 2021-12-15 04:58:32 +01:00
Matthew Brown
b558748db2 Detect unused properties that are written to inside arrays 2021-12-11 11:42:05 -05: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
ralila
f833085a15 Fix fqn usage in php-doc 2021-12-04 03:37:19 +01:00
ralila
7c32325e03 Import instead of using fqn constants 2021-12-03 21:25:22 +01:00
ralila
2a956498bf Import instead of using fqn functions 2021-12-03 21:07:25 +01:00
ralila
711be643c6 Import instead of using fqn exceptions 2021-12-03 20:29:06 +01:00
ralila
245920e53c Import instead of using fqn 2021-12-03 20:11:20 +01:00
Bruce Weirdan
d19aad7db1
Display target PHP version
Historically it was often not quite clear to users what PHP version
Psalm assumes, and why. This PR addresses this issue by printing the
version and where we got it from right before scanning the files.
2021-11-27 02:18:09 +02:00
orklah
d8fcd783c8 fix parse 2021-11-22 21:38:25 +01:00
orklah
1c1e352e5f prevent Psalm from considering throwing methods as unused just because they're immutable 2021-11-22 21:29:57 +01:00
Philip Hofstetter
ece2bccf76
don't stop processing for class usage after raising an issue
this fixes #6887
2021-11-12 09:24:39 +01:00
Philip Hofstetter
038df9cebe
detect unevaluated inline-html code after an rearly return
this is a followup after #6876

this fixes #6877
2021-11-10 13:11:50 +01:00
Philip Hofstetter
f407ac846a
do not treat __halt_compiler() as an expression being executed
this fixes #6875
2021-11-10 12:45:12 +01:00
orklah
65c41e7543 don't consider calls to methods with assertions as Unused 2021-11-06 20:00:31 +01:00
orklah
9c9669ea44 don't consider calls to methods with assertions as Unused 2021-11-06 19:54:17 +01:00
orklah
f4f9bd6711 allow declaring functions and classLikes after a never-returning call 2021-11-05 18:34:59 +01:00
orklah
6e8bd2b207 allow declaring functions and classLikes after a never-returning call 2021-11-05 18:18:34 +01:00
orklah
33aab6cc40 allow declaring functions and classLikes after a never-returning call 2021-11-05 18:09:40 +01:00
orklah
500571b9da move tests to enable config 2021-11-01 22:45:17 +01:00
orklah
88dd4eace3 add test 2021-10-11 17:33:02 +02:00
orklah
10c20dc8f3 mark variable used in backticks as used 2021-08-29 00:26:52 +02:00
Bruce Weirdan
052c7478cc
Unary plus and minus mark operand as used
Fixes vimeo/psalm#6145
2021-07-21 01:15:51 +03:00
Bruce Weirdan
a180dc6099
Flag staticness mismatch
This handles two new cases:
1. Accessing static property with `->` (produces notices and warnings: https://3v4l.org/TiGan)
2. Accessing non-static property with `::` (causes fatal error: https://3v4l.org/IdYSh)

Fixes vimeo/psalm#6117
2021-07-18 02:51:33 +03:00