1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-13 09:47:29 +01:00
Commit Graph

81 Commits

Author SHA1 Message Date
Jeremiasz Major
5717516f2f
Remove @psalm-generator-return annotation 2022-04-09 22:15:37 +02: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
Bruce Weirdan
3e837cabd0
Finalize (and internalize) more classes 2022-02-05 23:51:03 +02:00
Bruce Weirdan
e04d545328
Dropped deprecated DocComment methods 2022-01-03 20:00:56 +02: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
5fae548e62
Add template support to @psalm-self-out 2021-10-28 10:44:37 +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
46801c4b98 clearer string operations 2021-09-26 23:34:31 +02:00
7e0b489efe
Merge remote-tracking branch 'origin/master' into if-this-is 2021-09-21 12:12:15 +02:00
orklah
b194291bb3 try to fix offsets 2021-08-07 00:08:19 +02:00
Bruce Weirdan
0a57c86549
Announce removal of deprecated methods (#5956)
Refs vimeo/psalm#4700
2021-06-20 14:12:20 -04:00
Bruce Weirdan
6abce3525a
Enforce use sort (#5900) 2021-06-07 22:55:21 -04:00
Matt Brown
012dafad79 Fix #5383 - prevent unsound use of new static for generics 2021-04-10 13:16:19 -04:00
sji
19554de6f6
Add @ignore-var and @psalm-ignore-var (#5488)
* add `@ignore-var` and `@psalm-ignore-var`

* Change two words

Co-authored-by: Matthew Brown <github@muglug.com>
2021-03-26 21:20:23 -04:00
orklah
1d9987e0ed
fix phpdoc (#4905) 2020-12-29 11:42:41 +00:00
Bruce Weirdan
fc29d26879
Added test to enforce that all supported annotations are documented (#4723)
* Added test to enforce that all supported annotations are documented

Well, at least mentioned.

Refs vimeo/psalm#3816

* Type things

* Make things pretty

* Only check @psalm- annotations, group

* Add documentation for `@psalm-require-extends` and `@psalm-require-implements`

* Dropped logicalOr that has become redundant

* Add explicit tag

* Document @psalm-template

* Add @psalm-template-covariant

* Document `@psalm-method`

* Add list of undocumented docblock annotations

Co-authored-by: Matthew Brown <github@muglug.com>
2020-11-27 21:48:16 -05:00
orklah
f19cac6ecf
add annotation @psalm-param-out (#4717)
* add annotation @psalm-param-out

* add tag in documentation
2020-11-27 17:05:26 -05:00
orklah
b6a3282589
Detect redundant cast (#4695)
* detect redundant cast

* fix redundant cast issues

* fix redundant cast in tests
2020-11-25 12:04:48 -05:00
Niclas van Eyk
0261024aa6
Initial proposal for psalm-require-{extends, implements} (#4361)
* initial implementation of psalm-require-extends

* Added @psalm-require-implements

* Added shortcode for ExtensionRequirementViolation

* Docs & cofig entries for @pasalm-require-{implements,extends}

* Added requirement violations to issues.md
2020-10-19 15:08:18 -04:00
orklah
ffe7874906
Misc improvements (#4314)
* extract the operation out of the loop when possible

* remove unnecessary interfaces when already inherited in parent

* simplify expressions

* avoid using alias functions

* redundant phpdoc

* unused imports
2020-10-15 13:23:35 -04:00
orklah
37a2f8a33d
unused use statements (#4228) 2020-09-22 01:10:46 -04:00
orklah
b19f0a7034
Remove empty() and use strict comparison when safe (#4211)
* replace empty usage with stricter checks

* use strict comparison when safe

* replace is_null with === null for consistency
2020-09-19 18:26:51 -04:00
Brown
249903e18a Fix style issues 2020-09-13 21:45:07 -04:00
Bruce Weirdan
689027c92d
Support multiple issue types in @psalm-suppress (#4179)
* Accept multiple issue names in `@psalm-suppress`

Fixes vimeo/psalm#1575

* Accept multiple issue types on statement docblocks as well

* Proper highlighting of individual issues in compound suppressions
2020-09-13 16:41:14 -04:00
Bruce Weirdan
cd110c7e2f
Added @psalm-stub-override for classlikes and methods (#4177)
Fixes vimeo/psalm#1252
2020-09-13 16:40:31 -04:00
orklah
8c7423505a
add native param types (#4137)
* add native param types

* redundant phpdoc

* add more param types and adds "?" to nullable types

* remove redundant phpdoc

* add more param types and remove redundant phpdoc

* add more param types and remove redundant phpdoc
2020-09-06 19:36:47 -04:00
Matthew Brown
00df5cf875 Fix unnecessary var 2020-09-04 21:57:53 -04:00
orklah
f66d57f19d
add native return types (#4116)
* add native return types

* remove redundant phpdoc
2020-09-04 16:26:33 -04:00
orklah
73f6fcde48
Short list syntax (#4102)
* Short list syntax

* revert unrelated CS
2020-09-02 00:17:41 -04:00
Matthew Brown
ef0486ce35 Add some pure annotations 2020-08-23 13:52:31 -04:00
Olle
3630b4a2f9 Merge remote-tracking branch 'remotes/upstream/master' 2020-08-18 15:59:46 +00:00
Brown
c0b0036109 Fix #3934 - prevent unsafe use of new static 2020-08-05 19:39:27 -04:00
Olle
285348efe9 New annotation: @psalm-if-this-is 2020-07-08 19:51:02 +00:00
Olle Härstedt
d8e8ce428e
Add new annotation: @psalm-self-out (#3650)
* Add new config: sealAllMethods

* Add some more tests

* Fix codesniffer issue with preg_quote

* Fix missing method in test

* New tag @self-out (WIP)

* Add self_out_type to method storage

* Add some notes

* More work on self-out (WIP)

* More work on self-out (WIP)

* Use psalm-self-out instead of self-out

* Remove extra file

* Cleanup

* Wrap around try-catch - how to check if a method has/should have storage?

* New method hasStorage()

* Fix indentation

* Fix some errors

* Fix indentation

* Cast storage type to type

* Add proper use-statement in method storage

* Correct test class name

* Allow self_out to be null

* method_id can be string (why, when?)

Co-authored-by: Olle <noemail>
2020-07-01 18:10:24 -04:00
Olle
79d2e25084 Merge remote-tracking branch 'upstream/master' 2020-06-23 17:08:12 +00:00
Olle
fffbccdacb More work on self-out (WIP) 2020-06-21 22:18:14 +00:00
Brown
fbe3433edd Use escape terminology 2020-06-21 11:43:08 -04:00
Brown
30907f0269 Clean up comment parsing 2020-05-28 22:14:41 -04:00
Brown
a2b6326a84 Change specialize-call to taint-specialize 2020-05-26 14:18:43 -04:00
Matthew Brown
187b944680 Add faster taint analysis 2020-05-22 12:33:29 -04:00
Brown
006c6e09f1 Add more details to type alias creation 2020-05-14 00:41:50 -04:00
Brown
2ce65e1d03 Fix #3270 - support multiple spaces before @param 2020-05-02 19:39:10 -04:00
m0003r
11edb22c72
Implement @psalm-trace annotation, fixes #3079 (#3080) 2020-04-06 12:42:22 -04:00
Brown
af4a7cabe9 Fix #3057 and add support for @psalm-yield annotation 2020-04-02 22:38:10 -04:00
Brown
467da32f84 Fix instanceof static and isa (static::class) handling 2020-03-24 18:58:15 -04:00
iggyvolz
94b246b987
Initial commit (#3013) 2020-03-24 18:32:57 -04:00
Kolja Zuelsdorf
08855c806f
Dont add newline before return (#2969)
* Added method to not add newline before return in docblock.

* Made setting of newline before return statically setable on docblock.

* Created psalter parameter for setting of newline before return in doc block annotation.

* Added tests to cover adding new line or not before return annotation in doc block via psalter.

* Psalm and style fixes.

* Changed flag for new lines between annotations to be considered for all annotations.

* Extended tests to reflect changed behavior for new lines between annotations in psalter.
2020-03-13 12:40:08 -04:00
Brown
8527bb9861 Remove line in block 2020-03-10 13:29:39 -04:00