kkmuffme
0d7c5a2d8e
Fix docblock mixed escape hatch
...
revert https://github.com/vimeo/psalm/pull/7663 including previous from_docblock Mixed assignments, as the tests required 2 suppressions and created an escape hatch via mixed on higher psalm error levels, where mixed isn't reported, thus hiding potentially fatal bugs.
It's still possible to run the validation of docblock docs though: a @var declaration that contains both possible types, to ensure later code won't escape any checks (and no @psalm-suppress needed at all)
This is also a required preparation to fix some isset issues of https://github.com/vimeo/psalm/issues/9759
2023-11-21 13:01:55 +01:00
Jack Worman
f41da745d1
UnsupportedPropertyReferenceUsage
2023-05-12 14:12:12 -05:00
Maximilian Bösing
707a0bac6c
qa: add another test to verify required arguments are not being reported
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-04-10 01:53:45 +02:00
Maximilian Bösing
3a9817aa74
qa: introduce failing test for #8095
...
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-04-10 00:53:50 +02:00
Maximilian Bösing
803786e44e
qa: restructure UnusedVariableTest
...
This aligns with most recent tests which do consume `InvalidCodeAnalysisTestTrait` and `ValidCodeAnalysisTestTrait`.
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2023-04-10 00:53:33 +02:00
Evan Shaw
ce3f7fccd6
Set inside_call for eval expressions
2023-03-15 22:06:36 +13:00
Jack Worman
1c19260cdd
Require trailing commas
2022-12-18 13:20:31 -06:00
Jack Worman
a52f35e5e1
Even more property typehints
2022-12-16 13:24:21 -06:00
Jack Worman
2b5407d2fb
Added SlevomatCodingStandard.TypeHints.ParameterTypeHint sniff and removed php-cs-fixer
2022-12-14 20:26:17 -06:00
Jack Worman
69658e8315
SlevomatCodingStandard.Commenting.DocCommentSpacing
2022-12-14 13:34:41 -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
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
d0be59e16e
Immutable unions ( #8627 )
...
* 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
* Update
2022-11-04 19:04:23 +01:00
7b6e09afc9
Merge branch 'merge_4.x' into immutable_readonly_3
2022-10-17 12:58:41 +02:00
748a74bb2c
Merge remote-tracking branch 'origin/4.x' into HEAD
2022-10-16 13:41:27 +02:00
45452c7125
Immutable readonly 2
2022-10-03 14:02:41 +02:00
kkmuffme
d2be169ce5
update tests
2022-08-03 20:12:18 +02:00
AndrolGenhald
580278d323
Fix some minor issues with references.
...
References assigned to properties on `$this` should never be unused.
Using a `@var` docblock before a reference should be allowed if it targets a variable instead of the assignment statement.
2022-02-17 09:31:33 -06:00
orklah
5aa06ae64e
fix merge issues
2022-02-14 00:12:31 +01:00
orklah
1142c818c2
Merge remote-tracking branch 'upstream/4.x' into upstream-master9
2022-02-14 00:10:28 +01:00
AndrolGenhald
32c389482c
Fix issue with nested try
block and add more tests.
2022-02-13 15:30:06 -06:00
AndrolGenhald
7b1599d783
Fix false positive for unused variable in try ( fixes #7613 ).
2022-02-13 15:14:59 -06:00
8d0c1c62e8
Ensure all template parameters are specified in classes, interfaces, traits
2022-01-31 10:06:31 +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
AndrolGenhald
f9450656e1
Add support for references and improve UnusedVariable checks ( fixes #7254 ).
2022-01-26 12:55:47 -06:00
Matthew Brown
8ab0eec4dd
Fix key
2022-01-25 01:36:23 -05:00
Matthew Brown
302c72d5b1
Add a couple of currently-working tests
2022-01-25 01:32:35 -05:00
orklah
af1888b631
Merge remote-tracking branch 'upstream/4.x' into upstream-master4
2022-01-22 17:48:42 +01:00
Pete Walker
057a99c9f1
fix: Tests / minor bug
2022-01-22 00:00:45 +00:00
orklah
52a7f0694e
drop compatibility aliases
2022-01-19 19:29:16 +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
f833085a15
Fix fqn usage in php-doc
2021-12-04 03:37:19 +01:00
ralila
711be643c6
Import instead of using fqn exceptions
2021-12-03 20:29:06 +01:00
ralila
245920e53c
Import instead of using fqn
2021-12-03 20:11:20 +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
orklah
d1a4975e3d
remove test no longer applicable
2021-07-17 23:20:13 +02:00
orklah
79d0647d19
fix issue when setting a value to a global is considered unused
2021-07-17 22:00:54 +02:00
Ruslan Karimov
8a08489dcc
Merge branch 'master' into fix-5957
...
# Conflicts:
# tests/UnusedVariableTest.php
2021-07-13 10:15:35 +05:00
Ruslan Karimov
cfaca07c6d
added dataflow to stringy bitwise op, bitwise not op (fix 5957)
2021-07-13 10:05:21 +05:00
Matthew Brown
f2bc6913db
Fix #6061 — delay analysis of array value except when unpacking ( #6081 )
2021-07-12 17:05:33 -04:00
Bruce Weirdan
76be96ce53
Drop FakeFileProvider from tests folder
...
And use Psalm\Internal\Provider\FakeFileProvider
2021-07-02 03:57:57 +03:00
Matt Brown
d8f4eb2d6d
Restrict type of implode to prevent Array-to-string conversion;
2021-06-21 19:55:27 -04:00
Bruce Weirdan
e552925af6
Emit separate type of issue when foreach value is unused ( #5932 )
...
* Emit separate type of issue when foreach value is unused
Fixes vimeo/psalm#5929
* Fixed var name case sensitivity
2021-06-17 00:40:24 -04:00
Bruce Weirdan
6abce3525a
Enforce use
sort ( #5900 )
2021-06-07 22:55:21 -04:00