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

138 Commits

Author SHA1 Message Date
robchett
70a83c8e2a Skip inline docblocks like {@see ...} 2023-11-03 21:41:48 +00:00
71483b72aa Merge remote-tracking branch 'origin/5.x' into v6_fixes 2023-10-22 20:08:39 +02:00
394e38599d Strict types everywhere 2023-10-19 13:12:06 +02:00
tuqqu
9f9e5f1e18 Emit MethodSignatureMismatch when descendant does not return by reference 2023-10-03 03:41:11 +02:00
Bruce Weirdan
52da29e389
Do not require return type on destructors in interfaces
Fixes vimeo/psalm#9008
2022-12-26 15:45:44 -04: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
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
5c2336f4d0 skip a test because we removed the feature for now 2022-02-11 21:53:29 +01:00
8d0c1c62e8
Ensure all template parameters are specified in classes, interfaces, traits 2022-01-31 10:06:31 +01:00
AndrolGenhald
2fe4fc397c Enable extensions based on composer.json instead of those loaded at runtime (fixes #5482). 2022-01-27 16:30:14 -06:00
orklah
070a1cc7a3 fix merge induced errors 2022-01-22 18:05:32 +01:00
orklah
af1888b631 Merge remote-tracking branch 'upstream/4.x' into upstream-master4 2022-01-22 17:48:42 +01:00
78a125ab95
Fix 2022-01-19 12:33:16 +01:00
d970661182
Add separate issue 2022-01-19 12:20:50 +01:00
cee9eb0ead
PHP 8.1: Report missing typehints in overridden native methods 2022-01-19 12:06:35 +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
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
711be643c6 Import instead of using fqn exceptions 2021-12-03 20:29:06 +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
ralila
fdaed941ad use return type hints instead of php doc "@return void" 2021-11-26 20:59:41 +01:00
orklah
e2bb9859e4 fix tests 2021-11-01 22:27:43 +01:00
Aleksandr Zhuravlev
65407cc10d Got rid of test 2021-09-16 23:07:32 +12:00
Bruce Weirdan
6abce3525a
Enforce use sort (#5900) 2021-06-07 22:55:21 -04:00
orklah
55079e92fe
Mixed contains everything (#5763) 2021-05-14 20:23:54 -04:00
Vincent Langlet
587b144f0e
Check for ParamName even for method with only one param (#5732)
* Check for ParamName even for method with only one param

* Fix tests
2021-05-08 19:33:48 -04:00
Bruce Weirdan
93946d0827
Forbid rejecting named arguments when parent allows them (#5627)
Fixes vimeo/psalm#5622
2021-04-15 06:55:13 -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
cafbdb6831 Fix #5264 - use accurate static type when calling parent method in trait 2021-02-23 20:48:22 -05:00
Matt Brown
def7326ae1 Remove static from return type when final
Fixes #5244
2021-02-23 19:06:45 -05:00
Matt Brown
6f30399189 Fix #5070 – fix static return type inference in static methods 2021-01-22 09:58:09 -05:00
Matt Brown
e6dad6e65f Be smarter when choosing inherited param types
Ref #4803
2020-12-10 00:15:37 -05:00
Matt Brown
387ab14bda Use better stubs for Serializable and SoapClient 2020-12-08 11:27:51 -05:00
Matt Brown
db8a3ab846 Fix #4751 - allow MethodSignatureMismatch to be overridable when info comes from docblock 2020-12-02 15:13:28 -05:00
orklah
b6a3282589
Detect redundant cast (#4695)
* detect redundant cast

* fix redundant cast issues

* fix redundant cast in tests
2020-11-25 12:04:48 -05:00
Matt Brown
3dd185e395 Fix #4537 - use more rigorous inerhitance for return and param types 2020-11-12 13:54:27 -05:00
Matt Brown
ec3501b244 Ensure PHP 8 continuation of 7.4 method signature features 2020-10-03 23:34:29 -04:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
877a81f808 Always detect return type mismatches from docblock parents 2020-09-07 16:42:25 -04:00
Brown
6def99d653 Add ConstructorSignatureMismatch issue distinct from MethodSignatureMismatch 2020-08-10 12:26:25 -04:00
Matthew Brown
6085e42fc1 Detect mismatching param names effectively 2020-08-10 09:58:43 -04:00
Brown
c0b0036109 Fix #3934 - prevent unsafe use of new static 2020-08-05 19:39:27 -04:00
Brown
cb94764d22 Prevent false-positive for Exception::__toString overriding 2020-07-02 14:09:56 -04:00
Grégoire Paris
e7b8983b7e
Make Throwable methods overridable (#3203)
Methods from \Exception cannot be overriden, but that does not mean
methods from \Throwable cannot be.

Closes #3202
2020-04-20 17:17:47 -04:00
Brown
4f07a8fc5d Fix false positive in trait comparison in 7.4
Fixes #3042
2020-04-03 15:11:37 -04:00
Brown
467da32f84 Fix instanceof static and isa (static::class) handling 2020-03-24 18:58:15 -04:00
Brown
dbdf7473f4 Fix abstract trait method implementation errors when using self 2020-01-24 11:15:35 -05:00