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

130 Commits

Author SHA1 Message Date
Yannick Gottschalk
a4de6d9dc0 Fix #9997
- make SimpleXmlElement and SimpleXmlIterator not a universal object crate
- added typed magic __get method to SimpleXmlElement
- adjusted tests to reflect new behaviour of SimpleXmlElement
- added tests
2023-08-05 17:07:08 +02:00
robchett
7792b6c36c Don't update types of the outer scope when in an elseif conditional 2023-06-17 13:36:29 +01:00
kkmuffme
16aaa3ae2b regex cleanup 2023-06-13 22:07:51 +02:00
Bruce Weirdan
963dd5d43d
Additional test
This was actually fixed previously
2023-03-18 03:45:09 -04:00
Bruce Weirdan
5a14f84fc7
Clarify testsss 2023-03-18 02:17:36 -04:00
Bruce Weirdan
2a84a63483
Prevent assertion leaks from else
Fixes vimeo/psalm#9395
2023-03-18 02:09:56 -04:00
Bruce Weirdan
38cc316ce9
Update tests/TypeReconciliation/ConditionalTest.php 2023-02-19 06:02:12 -04:00
Evan Shaw
a25fe35584 Negated is_numeric narrows scalar type 2023-02-19 22:38:34 +13:00
Corey Taylor
66ee278de8 Update conditional test to use filter_input with mixed return 2023-01-15 07:43:26 -06:00
kkmuffme
25cadb6776 add null to tests to fix invalid return type 2023-01-05 09:44:23 +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
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