1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-04 18:48:03 +01:00
Commit Graph

118 Commits

Author SHA1 Message Date
orklah
b53a9c322c Fix test incompatible with PHP 7.4 2022-11-24 20:06:02 +01:00
orklah
ea4b099c66 Fix #8745 2022-11-24 20:02:04 +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
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
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
kkmuffme
b701c7074b fix tests for detailed $_SERVER 2022-09-15 19:39:02 +02:00
Semyon
f0a8810cf5 Fix ctype_digit assertion bug 2022-09-07 15:49:35 +03:00
Semyon
969c7a098b Make ctype_digit and ctype_lower work as assertions 2022-09-02 17:37:10 +03:00
24f7920e9a
Fix if propagation (#8326)
* Add failing unit test

* Fix test

* Revert "Add comment for skipped test"

This reverts commit e4f73beb08.

* Revert "Simplify context updates even more"

This reverts commit a32e63f131.

* Revert "Remove special handling for elseifs that breaks for else if"

This reverts commit d7d9ddc653.

* Fix test
2022-07-30 19:20:05 -04:00
Matt Brown
fccc366c1e Merge pull request #7887 from ging-dev/lsp-fixes
improve LSP
2022-04-27 10:13:17 -04:00
Matt Brown
402280d4f9 Merge pull request #7791 from ohader/issue-7771-4x
Avoid json_encode when serializing non-UTF8 literals
2022-04-27 01:44:06 -04:00
Matt Brown
20351c6667 Avoid json_encode when serializing non-UTF8 literals
`\Psalm\Internal\Clause::$hash` basically holds a hash on
arbitrary input literals, used for later comparison. Using
`json_encode` fails when dealing with non-UTF8 literals,
which has been replaced by plain PHP `serialize`.

Resolves: #7771
2022-04-27 01:42:37 -04:00
Oliver Hader
9e4e468907
Adjust test case format
Related: #7771
2022-03-16 10:35:36 +01:00
Oliver Hader
b00d9e9514
Add test case reproducing issue #7771
Related: #7771
2022-03-15 10:34:46 +01:00
Matthew Brown
faaf7690f6
Remove mic-drop hack from if analysis (#7484)
* Remove mic-drop hack from if analysis

* Remove more special handling

* Remove some unnecessary ElseAnalyzer code

* Add back necessary code

* Fix return type of method never returning null

* Add a comment

* Simplify && handling

* Add comments to make stuff clearer

* Move if-specfic logic to more appropriate setting
2022-01-28 18:30:47 -05:00
AndrolGenhald
57b99be519 Improve reference support for assertions, array offsets, and properties. 2022-01-26 12:55:47 -06: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
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
cf962eebc2
Promote conditional tests to always-running 2022-01-04 11:40:55 +02:00
Matthew Brown
2e32a18222 Fix callable negation 2021-12-18 19:42:43 +00: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
245920e53c Import instead of using fqn 2021-12-03 20:11:20 +01:00
Jonathan Vollebregt
f5d7f6c405 SimpleXMLIterator is not always truthy
Fixes #6865
2021-11-12 13:49:31 +01:00
orklah
5282e4728b allow assertion to work on $var::class 2021-11-04 20:33:30 +01:00
orklah
a7c44a1a19 fix local variable defined too early 2021-10-28 19:33:27 +02:00
orklah
f0f0b4a8a8
Merge pull request #6708 from orklah/skipped
skipped tests
2021-10-21 13:17:03 +02:00
orklah
8b98e645eb skipped tests 2021-10-20 23:37:52 +02:00
orklah
7ce0c3a6e3 improve falsy on non-empty-string 2021-10-20 22:31:03 +02:00
orklah
04813bf556 fix test 2021-10-12 15:58:06 +02:00
orklah
233fe11d12 SimpleXMLElement is not always truthy 2021-10-12 15:46:02 +02:00
orklah
ac6a75ea7f
Merge pull request #6473 from orklah/double-assert2
assert both sides of an equality
2021-10-04 13:30:38 +02:00
orklah
597e9a99d7 Makes BooleanNot smarter 2021-10-02 10:01:04 +02:00
orklah
83ad836e88 assert both sides of an equality 2021-10-02 09:52:19 +02:00
orklah
edff17134d improve test 2021-09-19 19:30:00 +02:00
orklah
d9d9fa67a6 remove faulty test 2021-09-19 19:29:59 +02:00
Bruce Weirdan
5dfd157d72
Merge pull request #6420 from orklah/ternary-override-type
Ternary override type when reassigning
2021-09-04 21:58:32 +03:00
orklah
e2b594820e fix test 2021-09-04 20:27:25 +02:00
orklah
0825f220fe allow ternary to override previous type when reassigning 2021-09-04 20:22:06 +02:00
orklah
ea50e5db4d add test 2021-09-04 14:19:49 +02:00
Andrey Klimenko
3ad3375777
Fix generic destruction in assertion (#5888) 2021-06-04 15:33:37 -04:00
Andrey Klimenko
e5e397a6c5
Type negation in generic context (#5879)
* Type negation in generic context

* Fix cs
2021-06-03 01:06:25 -04:00
AndrolGenhald
518d0af895
Strict int/float comparison for conditional types, improve range return type (#5601) 2021-04-09 11:28:48 -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
03665b9646 Revert "Correct Psalm’s concept of string emptiness"
This reverts commit 331ce8ead4.

It was too hasty
2021-02-03 01:09:58 -05:00
Matt Brown
331ce8ead4 Correct Psalm’s concept of string emptiness
It contrasted with PHP’s idea
2021-02-02 23:07:51 -05:00
Matt Brown
b64eb6d716 Break out array_key_exists tests 2020-12-02 14:42:16 -05:00