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

152 Commits

Author SHA1 Message Date
Brown
0fc3398631 Move parsing methods into internal namespace 2020-05-13 19:12:45 -04:00
Brown
d8cd30b34a Fix #3340 - catch more errors in @method type parsing 2020-05-11 18:39:07 -04:00
Brown
83fe3a2fd9 Complain about malformed @property annotation 2020-04-26 10:10:14 -04:00
Brown
13d9354cde Fix #3107 - prevent bad @method with dash 2020-04-09 12:16:58 -04:00
lhchavez
be87bb7300
Support intersection types for object-like arrays (#3064)
This change allows expressing the intersection of multiple object-like
arrays. The resulting type will contain the (merged via intersection)
properties of all the object-like arrays involved in the intersection.

This should allow to express the resulting type of an `array_merge()`
operation, which is tricky to do in the context of a templated type.
2020-04-08 09:35:53 -04:00
Brown
3c9ec90919 Fix deprecated call 2020-04-03 14:56:11 -04:00
Brown
af4a7cabe9 Fix #3057 and add support for @psalm-yield annotation 2020-04-02 22:38:10 -04:00
iggyvolz
94b246b987
Initial commit (#3013) 2020-03-24 18:32:57 -04:00
Brown
1e480ade12 Fix bugs 2020-03-24 14:49:05 -04:00
leightonthomas
06f7df9974 Fix #1799 - support trailing commas in type aliases 2020-03-05 15:36:28 -05:00
Matthew Brown
f64cdd2ca2 Fix #2798 - strip out trailing commas in object-like @return types 2020-02-12 09:18:43 -05:00
Matthew Brown
b3f6b56f9c Add support for @psalm-readonly-allow-private-mutation 2020-02-02 15:56:08 -05:00
Matthew Brown
93fc1b1cc7 Fix #2729 - allow mutation of otherwise-readonly properties 2020-02-02 15:35:12 -05:00
Matthew Brown
d5d4a1826d Add initial support for @mixin Foo 2020-01-02 23:50:19 -05:00
Matthew Brown
508c2e268a Process phpstan-template in class docblocks 2019-12-29 16:08:09 -05:00
Matthew Brown
1b54d058aa Fix #2488 - add support for @phpstan- annotations 2019-12-20 10:49:10 +00:00
Matthew Brown
15cd62d332 Fix #2484 - add support for spaces in assert-if-true types 2019-12-19 19:24:26 +00:00
Brown
2f9b1ff665 Fix too-long line 2019-12-11 11:40:47 -05:00
Brown
e564d67214 Add support for simple default arrays in @method docblocks
Fixes #2455
2019-12-11 11:29:00 -05:00
Matthew Brown
d6a731be73 Fix #2441 - add error when @template type is missing 2019-12-08 21:19:29 -05:00
Matthew Brown
baef67e0d8 Fix evaluation order of covariant template params before invariant ones 2019-11-30 01:02:23 -05:00
Brown
78a3894403 Fix Psalm errors 2019-11-21 11:03:18 -05:00
Brown
b29227aaf6 Allow taints to be removed via annotation 2019-10-15 16:25:27 -04:00
Matthew Brown
0ae04c9743 Fix #2148 - support arrays properly 2019-09-21 21:50:11 -04:00
Brown
c5ef2516b5 Fix #2150 - add detection for unnecessary @var annotations
And also remove them from codebase
2019-09-19 11:59:43 -04:00
Matthew Brown
78175c9765 Support @psalm-readonly too 2019-09-08 15:12:30 -04:00
Matthew Brown
b61d0c6dcd Fix #2104 - only treat @method returns as separate if attached to method name 2019-09-07 22:30:09 -04:00
Matthew Brown
dcc4de59df Change @immutable to @psalm-immutable 2019-08-31 18:43:45 -04:00
Matthew Brown
f20dc16295 Make @immutable work properly 2019-08-31 10:07:23 -04:00
Matthew Brown
7886d5a408 Add support for @psalm-mutation-free annotation on methods 2019-08-31 00:47:12 -04:00
Brown
b7b4baff8f Add support for @immutable
Fixes #1272
2019-08-30 12:36:35 -04:00
Matthew Brown
c5f62d261d Remove redundant @psalm-suppress in Psalm’s codebsae 2019-08-18 16:10:12 -04:00
Matthew Brown
2a5e0d8f39 Fix #1444 - track unused suppressions 2019-08-18 14:27:50 -04:00
Matthew Brown
2146f73782 Prepare for tracking unused suppressions
Ref #1444
2019-08-18 12:25:48 -04:00
Brown
2b2988b072 Fix #2019 - allow union in @throws 2019-08-13 15:44:18 -04:00
Matthew Brown
7ed30cd5b0 Add support for @readonly annotation 2019-08-11 16:01:37 -04:00
Brown
bdac01582d Fix #1989 - support fully-qualified params in @method annotations 2019-08-08 17:25:56 -04:00
Matthew Brown
b2c0993cdc Add framework for taint analysis to Psalm
Ref #611
2019-08-04 10:37:36 -04:00
Tyson Andre
5d5a9c6eac Remove redundant casts and unused use statements (#1955)
* Remove redundant casts

(not sure about older versions of php-parser)

* Remove unused use statements
2019-07-18 23:37:36 -04:00
Matthew Brown
3df248eea2 Add concept of purity to functions and methods 2019-07-18 01:31:48 -04:00
LeSuisse
f29826b958 Fully qualify constants and function calls (#1849)
This should give a small performance boost.
Part of #1837.

The change is enforced via phpcs and can be autofixed
with phpcbf.
2019-06-26 16:52:29 -04:00
Brown
e4e48d2d06 Add support for templated @var on return statements 2019-06-26 16:33:43 -04:00
Brown
1864d9a2be Allow templated @var on return docblocks 2019-06-26 16:26:14 -04:00
Matthew Brown
31c8a2e4d7 Add offsets to type tokenisation
Ref #1832
2019-06-22 23:30:40 -04:00
Brown
b12f05185a Fix #1799 - support trailing commas in object-like docblock types 2019-06-18 17:47:06 -04:00
Matthew Brown
a0866da88e Strip extranous data 2019-06-16 12:45:02 -04:00
Brown
7a6395490c Allow @property to contain union types 2019-06-14 10:45:00 -04:00
Brown
b1d1ab974c Preserve formatting of callable type 2019-06-06 14:27:49 -04:00
Brown
0221282074 Be resilient to docblock spaces 2019-06-06 13:57:00 -04:00
Brown
20422cf223 Fix #1730 - parse @param * $foo properly 2019-06-03 15:46:25 -04:00
Brown
2f29dcce93 Fix #1728 - remove extra data in template-extends annotation 2019-06-03 10:28:54 -04:00
Matthew Brown
c569f3932c Use separate method for parsing docblocks 2019-06-01 18:44:59 -04:00
Matthew Brown
22b6c8120a Fix spacing issue 2019-06-01 17:22:33 -04:00
Matthew Brown
62be1cc1b0 Add rest of files 2019-06-01 16:57:33 -04:00
Matthew Brown
736f01c29e Store more accurate return type location 2019-06-01 13:02:20 -04:00
Matthew Brown
909e02d441 Move var docblocks within function 2019-06-01 12:25:57 -04:00
Matthew Brown
dc5a5bcd9d Simplify var docblock parsing signature 2019-06-01 11:53:32 -04:00
Matthew Brown
c80f9d8ecd Add class-based support for key-of
Ref #762
2019-05-24 02:12:58 -04:00
Matthew Brown
574545e149 Add initial support for key-of<T>
Ref #762
2019-05-23 23:53:48 -04:00
Brown
66bbe5bb74 Allow space in intersection type
Ref #1645
2019-05-16 13:52:58 -04:00
Barney Laurance
f4c754737f psalm-internal: Prevent use of @psalm-internal without @internal 2019-05-14 18:54:16 -04:00
Barney Laurance
cd673538f1 psalm-internal - refactor - use snake_case not camelCase 2019-05-14 18:54:16 -04:00
Barney Laurance
fcf893d2e8 psalm-internal - disalow use of @psalm-internal property without setting namespace 2019-05-14 18:54:16 -04:00
Barney Laurance
ce5d307f83 psalm-internal - present fetching internal property from other namespace 2019-05-14 18:54:16 -04:00
Barney Laurance
b29e041d3c psalm-internal - prevent call to method marked psalm-internal from other namespace 2019-05-14 18:54:16 -04:00
Barney Laurance
4415ef0dbd psalm-internal - prevent invalid extention of class internal to other namespace 2019-05-14 18:54:16 -04:00
Brown
751253ddf0 Fix #1603 - prevent invalid covariant template classes from being passed 2019-05-06 16:38:08 -04:00
Brown
fb1eba9b61 Fix #1473 - add support for ...&x in docblocks 2019-04-09 14:23:48 -04:00
Brown
b9ba24929d Refactor storage of template names to prevent clashes 2019-03-22 15:59:10 -04:00
Matthew Brown
136429dfd4 Fix location of @method docblocks for issues 2019-03-18 21:05:37 -04:00
bugreportuser
c8fffe362a Allow capitalized @inheritDoc 2019-03-09 20:26:17 -05:00
Matthew Brown
619590aa71 Fix parsing of template of type with spaces
Fixes #1406
2019-03-01 09:20:59 -05:00
bugreportuser
68a135f434 Allow @psalm-property and @psalm-method 2019-02-23 11:04:08 -05:00
bugreportuser
6c7819b438 Allow @psalm-template for classes 2019-02-09 11:15:25 -05:00
Matthew Brown
17541b415f Fix #1191 - allow Psalm to check against different versions of PHP 2019-02-07 12:25:57 -05:00
Matthew Brown
509709d6bc Fix #1267 - flesh out self static property types 2019-02-01 08:59:01 -05:00
Matthew Brown
79544eb289 Fix comment analysis for callable(): returntype 2019-02-01 07:50:48 -05:00
Tyson Andre
53756e7017 Remove redundant catching and rethrowing
I assume these used to have additional logging,
but they're no-ops.
2019-01-31 21:18:00 -05:00
Brown
e060ec35de Fix #1258 - allow static method returns 2019-01-30 11:44:12 -05:00
Matthew Brown
f67bab6d52 Restrict template-extends to actual extends 2019-01-27 21:00:27 -05:00
Matthew Brown
e28bf1a29b Fix null ref 2019-01-19 16:01:43 -05:00
Matthew Brown
44b51cdf8e Support @inherits and @extends keywords too 2019-01-19 15:12:13 -05:00
Matthew Brown
ee2b06ac43 Add initial support for @param-out 2019-01-19 13:32:43 -05:00
Matthew Brown
9bd5f06c7d Allow inheritdoc to propogate param types 2019-01-19 12:19:07 -05:00
Matthew Brown
eddaaea01b Add support for static @method annotations 2019-01-18 11:37:52 -05:00
Matthew Brown
ee97c9dbaf Add support for T of Foo 2019-01-16 09:23:25 -05:00
Brown
f108badd03 Fix #1067 - add support for @template-extends 2019-01-10 16:59:44 -05:00
Brown
b8d822cd26 Prohibit leaking of template params across class boundaries 2019-01-10 12:13:49 -05:00
Brown
d1654b9bf4 Ignore @return with a newline after @return 2019-01-09 11:51:29 -05:00
Matthew Brown
cc26ce682e Don’t crash when encountering empty @throws 2019-01-06 10:01:35 -05:00
Matthew Brown
9d8c2792e2 Add array-key type and improve general type handling
Fixes #1144
2019-01-05 00:15:53 -05:00
Matthew Brown
e89425ad68 Inherit parameters via @inheritdoc 2018-12-21 11:01:24 -05:00
Brown
fb848d62e9 Add checks for if (count($a)) and if (count($a) [operator] [number]) 2018-12-19 16:15:19 -05:00
Matthew Brown
ea89a6ba29 Revert "First pass"
This reverts commit 9ed047234f.
2018-12-19 08:45:14 -05:00
Matthew Brown
9ed047234f First pass 2018-12-19 01:59:14 -05:00
Matthew Brown
ca6149ed17 Improve treatment of templated params within function analysis 2018-12-17 23:29:27 -05:00
Matthew Brown
b32000fa05 Fix #689 - add checks for @internal annotations 2018-12-01 18:37:49 -05:00
Brown
9e4765663d Fix #999 - respect @method annotations to redefine parent methods 2018-11-30 15:13:25 -05:00
Matthew Brown
d90cff8f10 Add support for overriding method visibility too 2018-11-25 11:11:33 -05:00
Matthew Brown
047b096227 Add better support for intersection properties and mocks 2018-11-24 18:31:08 -05:00