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
748a74bb2c
Merge remote-tracking branch 'origin/4.x' into HEAD
2022-10-16 13:41:27 +02:00
Ricardo Boss
bf1c0320fd
Cherry-pick: Try to provide literal int types when possible ( fixes #6966 ) ( #7071 )
...
* Fixed vimeo/psalm#6966
* Only accept >= 0 values for mode argument in round()
* Made round() only return float or literal float values and remove unneeded test
* Registered RoundReturnTypeProvider
* Updated cast analyzer to handle single string literal int values as literal ints
* Fixed psalm errors
* Fix invalid property accesses
* Addressed comments
* Added Tests
* Marked RoundReturnTypeProvider as internal
* Fixed CS
2022-09-19 21:54:16 +02:00
kkmuffme
5c39e66b15
fix tests
2022-09-15 19:38:51 +02:00
Aleksandr Zhuravlev
d7097281ba
trim(), ltrim(), rtrim() now keep lowercase string attribute
2022-08-31 21:02:20 +12:00
AndrolGenhald
9310a4ff5a
Fix issues with int range unpacking and with min/max.
2022-02-18 15:55:26 -06:00
8d0c1c62e8
Ensure all template parameters are specified in classes, interfaces, traits
2022-01-31 10:06:31 +01:00
orklah
a7b72b865f
remove TPositiveInt usage for TIntRange
2022-01-23 22:04:18 +01:00
orklah
0e891f25ad
refactor description of types in Atomic
2022-01-22 19:34:57 +01:00
orklah
841d4f4429
improve support for enum_exists
2022-01-22 18:27:24 +01:00
Matthew Brown
0a81f8cd6c
Use objects, not strings, for assertions ( #7410 )
...
* Use objects, not strings, for assertions
* Remove unnecessary param
* Remove some unnecessary checks
* Fix bad find/replace
* Add note about assertions no longer stored as strings in UPGRADING.md
2022-01-20 17:33:06 -05:00
Ricardo Boss
26dd4c5b8f
Try to provide literal int types when possible ( fixes #6966 ) ( #7071 )
...
* Fixed vimeo/psalm#6966
* Only accept >= 0 values for mode argument in round()
* Made round() only return float or literal float values and remove unneeded test
* Registered RoundReturnTypeProvider
* Updated cast analyzer to handle single string literal int values as literal ints
* Fixed psalm errors
* Fix invalid property accesses
* Addressed comments
* Added Tests
* Marked RoundReturnTypeProvider as internal
* Fixed CS
2022-01-16 21:33:04 +01:00
orklah
b633619a2c
Merge remote-tracking branch 'upstream/4.x' into upstream-master
2022-01-14 21:01:25 +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
80f617decd
fix test
2022-01-09 00:37:16 +01:00
orklah
48ebbe8c4b
fix test
2022-01-08 22:52:22 +01:00
Bruce Weirdan
f5dc2ee964
Merge branch '4.x' into upstream-master
2022-01-04 19:42:08 +02:00
Fabien Villepinte
1fa6b612b1
Fix parse_url() return type
2022-01-04 16:09:18 +01:00
Bruce Weirdan
cf962eebc2
Promote conditional tests to always-running
2022-01-04 11:40:55 +02:00
Bruce Weirdan
ab60d311c2
Merge pull request #7188 from vimeo/muglug-use-invalidscalarargument-less
2022-01-03 06:04:42 +02:00
orklah
0747b48d06
remove TEmpty
2022-01-03 04:09:59 +02:00
Matthew Brown
b419c299e3
Use InvalidScalarArgument only when we can be sure PHP attempts coercion
2022-01-02 14:56:18 +02:00
rarila
97e6511fab
Set number of lines before and after namespace.
2021-12-15 04:58:32 +01:00
AndrolGenhald
10b6b9aef0
Fix optional arguments in number_format ( fixes #7158 ).
2021-12-14 09:10:05 -06:00
adrew
989c3ada2e
Fix type inference of closure params
2021-12-11 22:51:18 +03:00