Peter van Dommelen
c72edefc9e
Do not strip the last )
bracket when parsing phpdoc type aliases.
...
Fixes https://github.com/vimeo/psalm/issues/6782
Reworked the regex logic to not check each grouping character separately. Removed the `^` character from the character list, which was likely unintended.
2023-03-05 22:28:22 +01:00
Bruce Weirdan
caac14c4a4
Consistently report docblock issues on all classlikes
...
Fixes vimeo/psalm#9365
2023-02-24 03:31:00 -04: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
Anner Visser
d10b1f91bb
Allow using imported types in other types within the same file
...
In the test case (from issue #7116 ) both the type definition and the
import of the typed lived in the same file. This caused `OpeningTypes`
to be an `InlineTypeAlias` instead of a `LinkableTypeAlias`, in turn
causing an 'Invalid type alias' exception[^1].
By replacing the array union (+) with an array_merge, the import of the
type overrides the initial type declaration within the `Main` class.
This means type imports within one file act more like they would when in
separate files.
Fixes #7116
[^1]: [src/Psalm/Type/Atomic.php:407](1986c8b4a8/src/Psalm/Type/Atomic.php (L407)
)
2022-11-15 14:46:31 +01:00
Bruce Weirdan
dd253b755b
Conserve some vertical space
2022-11-14 14:54:55 -04:00
Anner Visser
5bafc9512c
Add support for type aliases in @psalm-assert(-*) annotations
...
Fixes #8263
2022-11-14 16:03:35 +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
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
ralila
8fb2e0f885
Handle some partials
2021-12-04 21:55:53 +01:00
Sebastian Kehr
511ed99e46
expand type aliases when comparing unions
2021-11-19 14:15:38 +01:00
Vincent Langlet
39e61ae942
Add support for phpstan import-type and type annotations ( #5648 )
...
* Add support for phpstan import-type and type annotations
* Add test
* Fix cs
2021-04-19 22:56:08 -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
Leighton Thomas
e476625c1e
Allow @psalm-type and @psalm-import-type to be used in extends/implements ( #5205 )
...
* Fix #4240 - allow type aliases to be used as type parameters
* Fix issues that phpcs found
* Fix #4240 - stop type aliases being everywhere in the same file
* Fix #4240- re-add stuff that was deleted unnecessarily
2021-02-12 17:02:24 -05:00
Matt Brown
6b1112e6ea
Fix #4653 - prevent crash with recursive type in root namespace
2020-11-22 00:26:14 -05:00
orklah
ead107fa9e
More return types ( #4173 )
...
* add native return types
* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
92239add4d
Add some backwards-incompatible changes for 4.x
2020-08-30 11:44:14 -04:00
Brown
3f50fbc116
Expand object-with-properties
...
Fixes #4057
2020-08-25 10:15:56 -04:00
Bruce Weirdan
5bf7cc6434
Resolve typedefs that are used in var docblocks of foreach ( #4037 )
...
Fixes vimeo/psalm#4029
2020-08-22 08:20:05 -04:00
Brown
1468a28273
Fix #3999 - allow @psalm-type to reference imported type right above
2020-08-18 09:34:07 -04:00
Bruce Weirdan
7adc25c421
Improve import errors ( #3997 )
...
* Better errors for invalid type imports
Fixes vimeo/psalm#3885
* Finishing touches
Docs, schema, CS
* Drop unused import
* Drop more unused imports
2020-08-16 22:53:53 -04:00
Matthew Brown
38af5db8f0
Fix #3929 - merge expanded types where necessary
2020-08-16 16:12:29 -04:00
Matthew Brown
ec2178d14a
Fix #3927 - prevent crash with bad type ref
2020-08-16 12:43:46 -04:00
Brown
a6c0991073
Fix #3532 - expand type alias types recursively
2020-06-07 12:01:04 -04:00
Jefersson Nathan
f824cc380a
Add more test case scenario for @psalm-import-type ( #3375 )
...
* Add test case scenario for @psalm-import-type
Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>
* Add fix for @psalm-import-type test
Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>
* Add test for import ocross namespaces
Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>
* Add tests for failing cases
Signed-off-by: Jefersson Nathan <malukenho.dev@gmail.com>
2020-05-16 16:43:35 -04:00
Brown
c62e08a88e
Support intersection of type aliases
2020-05-15 16:18:52 -04:00
Matthew Brown
c772914910
Add some formatting
2019-03-23 14:27:54 -04:00
Bruce Weirdan
9bdc9f774f
More provider typing
2019-03-02 08:43:19 -05:00
Bruce Weirdan
8408effe57
Dropped unused uses
2019-02-17 13:17:45 -05:00
Matthew Brown
b15bf8afef
Remove failing test
2018-12-20 01:16:11 -05:00
Matthew Brown
c3a1e77a53
Fix errors in doctrine/dbal
2018-12-20 01:06:43 -05:00