1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 17:52:45 +01:00
Commit Graph

388 Commits

Author SHA1 Message Date
Bruce Weirdan
b822c3339d
Suppress UndefinedClass in whatever_exists()
Fixes vimeo/psalm#7395
2024-02-05 20:44:09 +01:00
kkmuffme
551625aa4b Fix https://github.com/vimeo/psalm/issues/10561 numeric input incorrect return type 2024-01-31 14:11:10 +01:00
Bruce Weirdan
67a91e05b2
Do not validate callable arguments in lenient contexts
Fixes vimeo/psalm#10453
2024-01-27 16:38:37 +01:00
kkmuffme
93dc2219e0 fix bugs in tests 2024-01-15 10:11:22 +01:00
kkmuffme
02467fbb6a add support for extract to set variables for keyed arrays and respect EXTR_SKIP 2024-01-14 10:54:02 +01:00
orklah
6c98f25a69
Merge pull request #10500 from kkmuffme/callable-without-args-union-not-handled-correctly
Fix callable without args not handled correctly
2024-01-09 21:58:14 +01:00
kkmuffme
f8a53ebc5d Fix callable without args not handled correctly 2023-12-18 12:48:13 +01:00
kkmuffme
dee555daaf filter_input & filter_var return type more specific 2023-12-17 20:34:10 +01:00
kkmuffme
d04694f4d4 Fix https://github.com/vimeo/psalm/issues/9267 2023-12-13 15:30:43 +01:00
tuqqu
a4cebb2cb8 Disallow never type for parameters 2023-10-08 20:47:37 +02:00
kkmuffme
c2388b4d90 fix failing tests and shepherd 2023-07-02 08:33:43 +02:00
kkmuffme
26eb870e47 fix mixed replace return types for arrays
* remove useless replace return type provider code that returned incorrect type for array replacements and was worse duplicate of existing stubs
* require preg patterns to be non-empty-strings as otherwise it will throw a PHP notice
* improve return type of array replacements to be more correct (not fully correct due to https://github.com/vimeo/psalm/issues/5994#issuecomment-1614601590)
2023-06-30 17:08:03 +02:00
RobChett
bd0ba6ee95 Narrow the type of haystack when strpos != false 2023-05-21 10:35:19 +01:00
Valentin Vion
3d122a745f Removed return type false from date and gmdate 2023-05-09 12:02:44 +08:00
andrew
cfd0f062f7 Fix union argument types check against templated param 2023-05-06 16:01:16 +03:00
andrew
57b3876796 Fix invalid cast for templated class-string 2023-05-04 11:25:52 +03:00
481a5bd61d Fix date return type provider 2023-04-25 11:41:39 +02:00
8078b6dcbf Fixes 2023-04-21 15:58:05 +02:00
orklah
40d4e560bc
Merge pull request #9691 from robchett/date_gmdate_return_type
Add return type provider for date/gmdate
2023-04-21 11:33:02 +02:00
RobChett
1a1d9c9bf5 Add return type provider for date/gmdate 2023-04-21 08:12:49 +01:00
RobChett
74c1576b9c Return a non-empty-(lowercase-)string from mb_strtolower 2023-04-20 15:54:13 +01:00
adrew
aa3b2f2e1d Test anonymous object template replacement 2023-04-17 23:18:03 +03:00
andrew
b0e5df570d Fix iterable template replacement 2023-04-17 11:03:39 +03:00
adrew
f0153721a4 Fix list template replacement 2023-04-15 18:46:22 +03:00
orklah
06e085cf3f fix coercion detection between two keyed arrays 2023-04-04 12:05:48 +02:00
Bruce Weirdan
1c2bc49838
Forbid non-null defaults for callable parameters
Fixes vimeo/psalm#3284
2023-02-16 01:36:06 -04:00
Bruce Weirdan
39c992c255
Emit issues for calls to is_a(string, class-string, false)
Fixes vimeo/psalm#4092
2023-02-14 02:25:46 -04:00
Ryan Bonham
bf62ef8b72
Add assertions to check return types for get_headers 2023-01-09 08:39:19 -05:00
Ryan Bonham
0ba821116e
Fix bad conflict resolution during merge from master. 2023-01-07 19:32:04 -05:00
therealryanbonham
e4e52da218
Merge branch 'master' into 9066_fix_get_headers_signature 2023-01-07 19:27:01 -05:00
Ryan Bonham
ec2f93f33e
Add Test for get_headers associative param in php 7 and php8. 2023-01-07 19:25:04 -05:00
kkmuffme
1341c15edc fix TypeCombiner void => null from docblock missing property
* fix InvalidReturnType "Not all code paths of" when function returns null combined types (void, never) https://psalm.dev/r/db4e313898
* fix false positive InvalidReturnType for void|never phpdoc when function returns void and exits
2023-01-05 09:43:19 +01:00
orklah
790c30959d
Merge pull request #9016 from Ocramius/feature/#5039-more-refined-types-for-explode-core-function
Refined `explode()` types
2022-12-29 10:23:18 +01:00
orklah
a290729087 fix test 2022-12-28 23:33:28 +01:00
orklah
a8fd349e07 fix #7809 2022-12-28 23:29:33 +01:00
Marco Pivetta
c0c0116809 Using list{0: string, 1?: string} syntax for more precise array key types
Thanks to @orklah's feedback, the `explode()` return type is now much more precise too.

Ref: https://github.com/vimeo/psalm/pull/9016#discussion_r1058458616
2022-12-28 17:48:33 +01:00
Marco Pivetta
6341d7fef0 Adjusted existing tests to the new signature of explode()
Note how the signature became `array{0: string, 1?: string, 2?: string, array<int, string>}`,
which may be a side-effect of unions between a defined hashmap structure with array
keys, and `list<string>`.
2022-12-28 17:39:06 +01: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
cca276768e
List refactoring v5 (#8820)
* Squash

* Remove BC break

* Suppress

* Possibly fix

* Fixes

* Fix test

* Trigger build

* Update psl

* Update psl

* Fixes

* Fixes

* Cleanup

* fix

* Fix build

* Do not consider never when getting the max count

* Add assertion

* Cleanup

* Fix

* Cleanup
2022-12-13 21:40:19 +01:00
orklah
e4b64af599
Merge pull request #8861 from VincentLanglet/count
Precise count range
2022-12-09 00:41:00 +01:00
Vincent Langlet
f6051bc417 Precise count range 2022-12-08 16:44:10 +01:00
kkmuffme
694b7d8975 check "never" return type more strictly
* require explicit "never" return type when function always exits, except if it only throws
* error if function does not exit, but return type explicitly contains "never"
* Fix: https://github.com/vimeo/psalm/issues/8175
* Fix: https://github.com/vimeo/psalm/issues/8178
2022-12-01 14:51:58 +01: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
Bruce Weirdan
80750fd579 Implement subtype checks for stringable-object 2022-11-10 19:55:36 -04: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
56805ab089 Fix 2022-10-17 12:54:46 +02:00
15f5c593a7 Fix 2022-10-17 12:40:50 +02:00
8d4d0c0e4a Fixes 2022-10-17 10:33:33 +02:00
34000ca90d Fixes 2022-10-16 13:59:15 +02:00