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

172 Commits

Author SHA1 Message Date
Mark McEver
dcafc2e53d Documented suggestions for HTML user input 2023-05-12 13:02:13 -05:00
RobChett
aa85669645 Change the Issue type and add documentation 2023-05-07 11:34:33 +01:00
RobChett
de877f1dcf Add support for @psalm-inheritors 2023-05-07 11:33:38 +01:00
Grégoire Paris
09dd8c370f
Make it easier to find how to promote Trace
I have used this once before then forgot how to do it, which is a shame
because this is super handy.
2023-04-26 21:41:24 +02:00
Bruce Weirdan
98d96fbe9c
Forbid private final methods
Fixes vimeo/psalm#8374
2023-03-03 02:00:09 -04:00
Bruce Weirdan
e6aa63731d
Flag docblock parameters that have no counterparts in function signature
Fixes vimeo/psalm#3166
2023-02-15 22:04:26 -04:00
Bruce Weirdan
ee823619b8
Flag direct constructor calls
Fixes vimeo/psalm#2975
2023-02-15 20:14:00 -04:00
Bruce Weirdan
07dfb5f2aa
Update docs/running_psalm/issues/UnusedProperty.md
Co-authored-by: Theodore Brown <theodorejb@outlook.com>
2023-02-14 22:00:17 -04:00
Bruce Weirdan
38e15c9817
Added note on properties used in constructor only
Fixes vimeo/psalm#7955
2023-02-14 21:01:52 -04:00
Bruce Weirdan
085e8f6fb2
Forbid implementing some interfaces
- `Throwable` can only be implemented when classes extend one of
  `Exception` or `Error`
- `UnitEnum` and `BackedEnum` cannot be implemented by user-defined
  classes

Refs vimeo/psalm#7722
2023-02-12 02:48:50 -04:00
Matthew Brown
d450b40da8
Remove some logic that didn't need to be there (#9209)
* Remove check to see what breaks

* Simplify following logic

* Add tests from @kkmuffme‘s branch

* Reduce scope of fix

* Clean up logic a little

* Add failing test

* Improvements

* Fix for non-Paradoxical Condition result
2023-02-03 21:08:16 -05:00
Jack Worman
56f6dfecc8 Report unused baseline entries 2023-01-17 22:02:21 -05:00
Jack Worman
f9aa2d5ad3 Support constants in traits 2023-01-17 16:37:44 -05:00
maniaba
d9c66c93ca
Update ForbiddenCode.md 2023-01-13 11:21:34 +01:00
Jack Worman
703a1e1698 @psalm-api 2022-12-23 16:13:46 -06:00
Bruce Weirdan
19a1005bc3
Forbid most magic methods on enums
Fixes vimeo/psalm#8889

Additionally this fixes case-sensitivity of
MethodSignatureMustOmitReturnType issue

Fixes vimeo/psalm#8888
2022-12-12 03:03:20 -04:00
orklah
763556745b improve docs and phrasing about NoValue 2022-11-24 20:56:49 +01:00
orklah
b3fadbc5c1 improve docs and phrasing about NoValue 2022-11-24 20:52:49 +01:00
orklah
4d358c4be9 improve docs and phrasing about NoValue 2022-11-24 20:49:34 +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
Bruce Weirdan
0f528d05f7
Update docs/running_psalm/issues/InvalidEnumCaseValue.md 2022-11-10 20:26:37 -04:00
Bruce Weirdan
6effd1bd2d Flag invalid enum case value types
Fixes vimeo/psalm#8267
2022-11-10 19:55:18 -04:00
Thomas Landauer
c51d3665eb
Removing list
see https://github.com/vimeo/psalm/pull/8696#issuecomment-1310677110
2022-11-10 20:19:02 +01:00
Thomas Landauer
0c102a244e
Fixing code formatting 2022-11-10 16:59:04 +01: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
webmaster777
c6c6d083e1
Update PossiblyFalseReference.md
Typo than -> that
2022-10-26 19:52:31 +02:00
Zena Hirsch
459fdcd588
Fix typo: "unitialized" 2022-10-19 14:36:43 -04:00
Pavel Chaplygin
48da8342ad Docs: Fix minor php syntax issues in code examples 2022-10-18 14:57:50 +03: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
orklah
3b7e508c78
Merge pull request #8473 from kkmuffme/detailed-superglobal-types
make superglobals more specific
2022-09-19 10:48:44 +02:00
HypeMC
ee16caf596 Make template constraints examples in docs consistent 2022-09-17 22:20:01 +02:00
kkmuffme
5c39e66b15 fix tests 2022-09-15 19:38:51 +02:00
Daniel Schmelz
9c67b85f39
Fix typos 2022-08-20 23:29:03 +02:00
Thomas Landauer
3bca297fba
Bringing back <?php 2022-06-21 22:45:45 +02:00
Thomas Landauer
80bcc8b5e3
Improving second link too :-) 2022-06-21 21:55:32 +02:00
Thomas Landauer
7201f0941b
Improving link syntax 2022-06-21 20:56:20 +02:00
Thomas Landauer
fd2683fcc6
Adding common problem cases and possible solutions
See https://github.com/vimeo/psalm/issues/8133#issuecomment-1162010190

Don't know if this is the best way to explain this, but it's a start :-)

Is there a better way to add the link to https://psalm.dev/docs/annotating_code/supported_annotations/#psalm-mutation-free ?

I also removed the `<?php` tag from the code block.
2022-06-21 20:23:23 +02:00
orklah
ec9a9994f5
Merge pull request #8022 from AndrolGenhald/bugfix/8018-improve-failure-case-for-references
Improve handling of unsupported references (fixes #8018).
2022-05-27 19:09:05 +02:00
Rudolph Gottesheim
6f00a72446
Fix a typo in MissingConstructor.md 2022-05-27 11:04:00 +02:00
AndrolGenhald
31b4dceaf4 Improve handling of unsupported references (fixes #8018). 2022-05-26 18:28:23 -05:00
AndrolGenhald
c1077f32d3 Improve documentation for InvalidGlobal to explain that it's sometimes valid. 2022-02-18 11:36:25 -06:00
AndrolGenhald
bd963e4baa Fix issue documentation links. 2022-02-17 13:04:25 -06: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
11e60fa261
Merge branch '4.x' into upstream-master 2022-02-11 03:51:48 +02:00
Bruce Weirdan
8a41d61925
Apply suggestions from code review
Co-authored-by: AndrolGenhald <AndrolGenhald@users.noreply.github.com>
2022-02-06 00:49:27 +02:00
orklah
e40bcc2d29 doc about property initialization 2022-02-05 12:27:53 +01:00
AndrolGenhald
94eda1a9f9 Fix bullet indentation in documentation. 2022-02-02 14:48:24 -06:00
Bruce Weirdan
f61193b798
Reinstate MethodSignatureMustProvideReturnType
It's never emitted, but is there for BC.
2022-01-31 23:38:15 +02:00