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
748a74bb2c
Merge remote-tracking branch 'origin/4.x' into HEAD
2022-10-16 13:41:27 +02:00
kkmuffme
7cdad99645
add RiskyCast
2022-09-19 21:54:16 +02:00
AndrolGenhald
285740a753
Merge branch '4.x'
2022-07-07 15:01:38 -05:00
AndrolGenhald
b671117417
Improve @psalm-internal and prevent usage of IssueBuffer::add().
2022-06-25 02:09:40 -05:00
AndrolGenhald
31b4dceaf4
Improve handling of unsupported references ( fixes #8018 ).
2022-05-26 18:28:23 -05:00
AndrolGenhald
d09e420939
Add @psalm-check-type
and @psalm-check-type-exact
.
...
I initially added these as part of my TryAnalyzer rewrite to allow testing complicated `finally` types like this:
```
$foo = 1;
try {
$foo = 2;
} catch (Exception $_) {
$foo = 3;
} finally {
$bar = $foo;
/** @psalm-check-type-exact $bar = 1|2|3 */;
}
/** @psalm-check-type-exact $bar = 2|3 */;
```
Using the `'assertions'` in tests doesn't work since the type is different inside the `finally`.
I decided to extract the new annotation from the rest of my changes and do a separate pull request since I think others may find it useful, and it should be much easier to review than the entire TryAnalyzer rewrite.
2022-02-17 10:37:13 -06:00
AndrolGenhald
cc2334f40d
More class const improvements.
...
Add InvalidClassConstType issue as alternative to LessSpecificClassConstType when type isn't contravariant.
Handle final class consts (#6395 ).
Use double quotes for types in class const issues.
2022-02-13 17:19:25 -06:00
Bruce Weirdan
a331ac0b21
Finalize issues
2022-02-06 00:27:18 +02:00
AndrolGenhald
e268a05307
Minor fixes after rebasing.
2022-01-26 12:57:19 -06:00
AndrolGenhald
f9450656e1
Add support for references and improve UnusedVariable checks ( fixes #7254 ).
2022-01-26 12:55:47 -06:00
AndrolGenhald
0b81f46bb1
Fixes after rebasing.
2022-01-25 15:31:09 -06:00
AndrolGenhald
0edf260d8b
Improve class constant static analysis.
...
Add class const covariance support (fixes #5589 ).
Add check for overriding const from interface in PHP < 8.1 (fixes #7108 ).
Add check for ambiguous const inheritance.
2022-01-25 15:20:17 -06:00
AndrolGenhald
7d256975e4
Fix cs/psalm errors after rebase.
2022-01-22 17:06:54 -06:00
AndrolGenhald
558208e44e
Add type checking for class const assignments, fix several other const issues.
2022-01-22 17:06:54 -06:00
AndrolGenhald
c18a155f77
Support type annotations for class consts ( fixes #942 ).
2022-01-22 17:06:53 -06:00
orklah
af1888b631
Merge remote-tracking branch 'upstream/4.x' into upstream-master4
2022-01-22 17:48:42 +01:00
d970661182
Add separate issue
2022-01-19 12:20:50 +01:00
orklah
dceaa117cf
remove forbidEcho
2022-01-18 18:25:18 +01:00
Bruce Weirdan
ba69f4fb31
Dropped deprecated CodeIssue
methods
2022-01-03 19:14:58 +02:00
915ddcc620
Add new RedundantFunctionCall issues
2021-12-30 11:36:32 +01:00
orklah
07bbd3f402
missing visibility
2021-12-27 22:30:10 +01:00
rarila
97e6511fab
Set number of lines before and after namespace.
2021-12-15 04:58:32 +01:00
adrew
de0d3a3be3
Allow IssueBuffer::remove to remove recorded issues
2021-12-13 01:42:33 +03: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
Bruce Weirdan
45e1a1c69a
Merge pull request #6850 from gharlan/hyperlink
2021-11-14 23:20:09 +02:00
Bruce Weirdan
85f2083acb
Flag duplicate constants
...
Fixes vimeo/psalm#6882
Addresses p1 from vimeo/psalm#6471
2021-11-11 00:44:17 +02:00
Gregor Harlan
ab0049d0ff
ConsoleReport: Add links to open file in editor
2021-11-07 15:04:14 +01:00
Bruce Weirdan
0f8ef45110
Forbid properties on enums
...
Fixes vimeo/psalm#6472
2021-11-06 21:57:49 +02:00
orklah
8b07e69645
Merge pull request #6514 from zoonru/if-this-is
...
Add if-this-is
2021-10-04 09:49:26 +02:00
orklah
f788fec540
static::class
2021-09-26 23:34:31 +02:00
orklah
fce60a018a
param defaults
2021-09-26 22:37:16 +02:00
7e0b489efe
Merge remote-tracking branch 'origin/master' into if-this-is
2021-09-21 12:12:15 +02:00
Bruce Weirdan
b4f024b1fe
Basic enum checks
...
* Duplicate cases
* Duplicate case values
* Invalid case values: value on a pure enum case, missing value on a
backed enum case, backing type / case type mismatch
* Literal expression evaluation for case values
Fixes vimeo/psalm#6426
Fixes vimeo/psalm#6427
2021-09-07 12:35:38 +03:00
Bruce Weirdan
7b11024886
Flag invalid backing types for enums
...
Fixes vimeo/psalm#6428
2021-09-05 20:12:24 +03:00
Bruce Weirdan
0a57c86549
Announce removal of deprecated methods ( #5956 )
...
Refs vimeo/psalm#4700
2021-06-20 14:12:20 -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
Matt Brown
47bf5ed567
Fix #5918 - add new issue to detect unquoted strings
2021-06-10 17:43:04 -04:00
Matthew Brown
6d09418a23
Detect unused return values ( #5917 )
...
* Detect unused return values
* Allow static-returning instance methods (presumed to be fluent)
* Make $is_used the default for Codebase::methodExists
2021-06-10 14:18:15 -04:00
Bruce Weirdan
6abce3525a
Enforce use
sort ( #5900 )
2021-06-07 22:55:21 -04:00
Bruce Weirdan
86050df4d0
Formally deprecate allowCoercionFromStringToClassConst
( #5897 )
...
* Mark allowCoercionFromStringToClassConst as deprecated in xml schema
* Emit deprecation warning for `allowCoercionFromStringToClassConst`
2021-06-07 10:46:26 -04:00
Bruce Weirdan
c98b20247b
Flag unexpected tags on function docblocks ( #5845 )
...
* Flag unexpected tags on function docblocks
Fixes vimeo/psalm#5782
* Document new issue
* Fix spacing
Co-authored-by: Matthew Brown <github@muglug.com>
2021-05-28 09:47:39 -04:00
Matt Brown
4f9067f5c8
Fix unused properties in Psalm’s own codebase
2021-05-21 09:15:23 -04:00
Bruce Weirdan
105c6f3a1c
Remove (and prevent) unused uses ( #5704 )
...
* Updates `slevomat/coding-standard`
* Removes unused uses
* Prevents unused uses
* Fixes a number of symbol case mismatches
2021-05-03 17:22:15 -04:00
Matt Brown
012dafad79
Fix #5383 - prevent unsound use of new static for generics
2021-04-10 13:16:19 -04:00
AndrolGenhald
de5a031088
Improve @no-named-arguments support and variadics. ( #5455 )
...
* Improve @no-named-arguments support and variadics.
Handling of argument unpacking and variadics still needs a pretty big makeover, but this is a good start.
Fixes #5420
Improves #5453 (iterable works, array still causes issues)
* Remove unneeded imports.
2021-03-22 19:58:22 -04:00
Matt Brown
b73223f9c1
Add use statements
2021-03-20 22:17:22 -04:00
Matt Brown
7f8d522912
Make all mixed issues implement MixedIssue
2021-03-20 21:44:04 -04:00