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

189 Commits

Author SHA1 Message Date
Matthew Brown
6af222f36a Fix #1393 - support analysing non-empty-array calls 2019-02-27 09:08:27 -05:00
Matthew Brown
fff56f7b26 Use better heuristic to determine missing types 2019-02-23 11:39:00 -05:00
Matthew Brown
6671e0dc7c Fix #1382 - flag unused docblocks 2019-02-23 11:02:04 -05:00
Brown
1e2c29041f @param-out should not override @param byref type def
when checking for unuitialised vars
2019-02-20 18:53:42 -05:00
Brown
d2968081f8 Fix #1370 - allow phpstorm generic iterator 2019-02-20 11:13:40 -05:00
Brown
0f45d14fea Only collapse Traversable|array when we’re super sure it’s safe
Fixes #1333
2019-02-15 11:07:08 -05:00
Matthew Brown
0bca8db561 Don’t throw exception when property is missing type 2019-02-07 18:10:32 -05:00
Matthew Brown
db89b3cc3f Add initial support for fixing MissingParamType 2019-02-02 11:28:48 -05:00
Matthew Brown
16c2a0f899 Fix #1246 - check @var annotations 2019-01-26 17:30:44 -05:00
Matthew Brown
22ee72808a Remove a bunch of hacks around generic offsets
Also fixes #1245
2019-01-26 16:58:49 -05:00
Matthew Brown
5eb0bb8126 Make foreach var annotation use more cautious 2019-01-20 11:49:13 -05:00
Matthew Brown
ee2b06ac43 Add initial support for @param-out 2019-01-19 13:32:43 -05:00
Matthew Brown
545c7e3cba Fix #1211 - allow docblocks to override foreach type earlier 2019-01-19 11:31:51 -05:00
Matthew Brown
4ec7903e8b Fix #390 - add support for object{foo:int, bar:string} annotation 2019-01-18 00:56:24 -05:00
Brown
d1654b9bf4 Ignore @return with a newline after @return 2019-01-09 11:51:29 -05:00
Brown
73770c085e Prevent crash when @template as type is missing 2019-01-08 15:11:57 -05:00
Brown
f3133aac84 Prevent more crashes 2019-01-08 14:50:45 -05:00
Matthew Brown
5f34f6c478 Fix #1115 - allow a parent @throws to capture children 2018-12-05 22:50:16 -05:00
Matthew Brown
b32000fa05 Fix #689 - add checks for @internal annotations 2018-12-01 18:37:49 -05:00
Matthew Brown
af041abdcb Fix #1093 - add exception type to list of scanned classes 2018-11-25 16:14:50 -05:00
Matthew Brown
4688b25fd9 Move internal classes to own namespace 2018-11-12 11:20:59 -05:00
Brown
f017599b3f Fix how InvalidDocblock is treated
Fixes #1051 (hopefully)
2018-11-01 17:03:08 -04:00
Matt Brown
e323d15174 Fix #972 - allow type aliases to be used within functions 2018-09-24 13:08:23 -04:00
Matt Brown
dce8d14e1b Fix syntax errors in tests 2018-09-17 12:15:45 -04:00
Matthew Brown
84459286ac Fix #973 - allow types to reference other new types in a given docblock 2018-09-04 22:27:55 -04:00
Matthew Brown
867ebd4441 Fix #953 - support spaces either side of | 2018-08-22 22:53:44 -04:00
Matt Brown
91100edcc9 Fix issue mixing class strings and class string constants 2018-08-21 14:47:28 -04:00
Matthew Brown
8814dff3c1 Fix #947 - interpret type hints of unpacked args 2018-08-20 22:11:01 -04:00
Matthew Brown
695ececc22 Add tests for 7c10a09 2018-08-08 22:44:02 -04:00
Matthew Brown
cc28ff7ad6 Fix #904 - scan all docblocks for possible @psalm-type annotations 2018-07-21 22:24:33 -04:00
Matthew Brown
1e54c61fde Fix #18 - add support for @psalm-type 2018-07-15 17:23:17 -04:00
Matthew Brown
0d62431cfb Fix #870 - improve magic method type handling 2018-07-07 00:06:05 -04:00
Matt Brown
71b2420c83 Fix #865 - support literals in return types 2018-07-05 17:25:26 -04:00
Matt Brown
c872f9179e Remove mixed in @method param types 2018-06-28 17:39:25 -04:00
Matthew Brown
e3ae1bf26f Fix #15 - check for uncaught throws if config flag is set 2018-06-22 01:13:49 -04:00
Matt Brown
47a40b2ffc Fix #817 - allow methods named "global" in @method annotations 2018-06-14 17:20:02 -04:00
Matt Brown
54893fdd55 Fix #808 - detect badly-placed ampersand early 2018-06-11 17:23:28 -04:00
Matthew Brown
068dc50b21 Fix #792 - allow docblock array form of variadic arg 2018-06-08 21:18:49 -04:00
Matthew Brown
c1586ee347 Remove union types in magic methods for now 2018-06-07 19:56:28 -04:00
Matt Brown
f030f4f40d Allow docblock types to be merged with param default ones 2018-06-07 12:23:21 -04:00
Matt Brown
51e7042022 Fix #789 - allow union types in @method params 2018-06-05 17:59:32 -04:00
Matt Brown
d55afc1fb1 Fix #779 - allow docblock to take on nullablility of typehint 2018-05-29 09:44:38 -04:00
Matthew Brown
81ae1ca222 Fix #747 - allow Generator to replace Traversable in templated params 2018-05-28 22:26:43 +01:00
Matt Brown
a30d229040 Fix issue with slashes after ? in type 2018-05-21 12:55:44 -04:00
Matt Brown
aebbd473d9 Fix issues reconciling class-string params to actual types 2018-05-21 12:40:39 -04:00
Matthew Brown
228337415b Fix #761 - add support for class constants in enums 2018-05-21 00:46:56 -04:00
Matthew Brown
5bd9ba6207 Make TClassString inherit from TLiteralString 2018-05-20 00:27:53 -04:00
Matthew Brown
c1440c11dc Create separate file for magic properties 2018-05-08 20:25:39 -04:00
Matt Brown
6b3759a266 Fix #699 - prevent stubs from overriding known functions 2018-04-27 15:00:22 -04:00
Matthew Brown
e2400920b9 Fix #693 - add @TysonAndre’s fix for atomic type checks 2018-04-24 21:27:31 -04:00
Matthew Brown
668cf2c0be Fix #692 - remove text after the end of a method 2018-04-23 09:52:40 -04:00
Matthew Brown
2fabdf3353 Fix #314 - add a way to indicate @method list is comprehensive 2018-04-22 00:40:30 -04:00
Matthew Brown
1c7568e612 Fix #642 - allow @method to override existing methods
behind usePhpDocMethodsWithoutMagicCall="true"
2018-04-21 23:08:08 -04:00
Matthew Brown
8b50cdf315 Fix #632 - add support for @method annotations when method can’t be found 2018-04-21 22:44:54 -04:00
Matthew Brown
d02b148820 Fix #633 - support @method for magic __call methods 2018-04-21 22:13:10 -04:00
Matt Brown
8b9753a235 Fix parsing of nested callable without args 2018-04-20 15:22:48 -04:00
Matthew Brown
7345a44494 Fix callable parse issue 2018-04-15 18:16:31 -04:00
Radosław Kowalewski
15c1a82d8c Few fixes to make tests pass on windows
* changed / to DIRECTORY_SEPARATOR in expected messages
* cahnged most occurences PHP_EOL to "\n" in tests and src
* added output buffering in test to avoid marking test as risky
2018-04-12 22:41:13 -04:00
Matt Brown
6d572096d6 Prohibit bad characters from types 2018-04-05 14:11:57 -04:00
Matt Brown
b4fba8f805 Allow capitalised reserved words 2018-04-04 12:39:05 -04:00
Matthew Brown
2a544c3076 Fix #560 - ignore @param $var annotations 2018-03-30 17:46:12 -04:00
Matthew Brown
7a0c7f4d1e Improve handling of ||
Ref #630
2018-03-29 02:20:19 -04:00
Matt Brown
fd9e783a37 Emit InvalidDocblock for bad static keyword in @var
Ref #623
2018-03-27 11:34:48 -04:00
Matthew Brown
74aa376ec7 Fix #617 - catch exception on bad square brackets 2018-03-24 21:02:44 -04:00
Matthew Brown
bc0c4322d5 Allow object-like with all optional vars to be compared to empty array 2018-03-21 10:46:21 -04:00
Matthew Brown
def0d87782 Add test for phpstorm generic property 2018-03-17 15:40:57 -04:00
Matt Brown
b664c85642 Add new issue conditional on config flag 2018-03-06 12:19:50 -05:00
Matt Brown
357ad1aa82 Add config flags to allow stricter class invocation checks 2018-03-06 11:20:59 -05:00
Matt Brown
7c5986de01 Add return type checks for missing classes 2018-03-05 17:46:13 -05:00
Matt Brown
57c2adb923 Fix #558 - add extra tests around functionality 2018-03-05 17:10:52 -05:00
Matt Brown
850998ed1a Add class-string type for enforcing use of ::class constants 2018-03-05 16:06:06 -05:00
Matt Brown
2846e549dd Fix #546 - allow iterable phpstorm generics 2018-03-01 11:19:23 -05:00
Matt Brown
09d708981a Add mixed checks to property __set calls 2018-02-21 19:34:21 -05:00
Nicky Robinson
8e77ff1ce9 Throw error if magic getter or setter called for undefined property or invalid type specified with annotations (#500)
* Fix path to psalm

* If a magic getter or setter is used to access a property on a class
that is not defined but a `@property` annotation for the property
exists, throw an error. If no `@property` annotation exists, it's not
an error because you're allowed to make magic getters and setters do
crazy things.

Fixes #480

* Move logic to a better place to avoid duplicate checks

* Move logic into function

* Remove some nesting

* Check psalm-seal-properties and property type correctly
2018-02-09 19:37:09 -05:00
Matthew Brown
6955f77e2e Fix #493 - add support for multiple @var lines per docblock 2018-02-07 23:33:31 -05:00
Matt Brown
7f4be858c2 Fix #498 - add better issue type for docblock contradiction 2018-02-07 15:20:47 -05:00
Matt Brown
1df4c3d196 Add DocblockTypeContradiction to find possible issues with docblock types
Fixes #491
2018-02-06 18:44:53 -05:00
Matthew Brown
645602a38e Properly namespace @property types 2018-02-03 23:10:22 -05:00
Matthew Brown
861d907845 Add more information to TooMany/TooFewArguments issues
Fixes #481
2018-02-02 11:26:55 -05:00
Matthew Brown
8d2baf584e Fix #479 - allow PhpStorm generic syntax behind a config flag 2018-02-01 01:10:27 -05:00
Matthew Brown
3482ee3b39 Split UntypedParam into MissingParamType and MissingClosureParamType 2018-01-28 20:03:47 -05:00
Matthew Brown
507007a2bf Add DeprecatedInterface and emit DeprecatedClass in more places
Fixes #463
2018-01-23 09:09:43 -05:00
Matthew Brown
9b6b03ff9f Create Config before ProjectChecker, and remove test-specific code from FileChecker 2018-01-21 10:22:04 -05:00
Matthew Brown
799aef628e Fix type assignment checks 2018-01-20 11:48:16 -05:00
Matt Brown
9f2a0847a4 Fix #453 - catch bad objectlike type when analysing docblock 2018-01-19 16:06:30 -05:00
Tyson Andre
d688b51534 Be strict about matching word boundaries for expected messages
E.g. don't allow InvalidPropertyAssignmentValue where
InvalidPropertyAssignment was expected
2018-01-11 18:04:11 -05:00
Matt Brown
2120d258a4 Fix formatting of return type adder 2018-01-11 15:50:58 -05:00
Matthew Brown
75daea5f04 Fix #382 - improve reserved word checks 2018-01-10 00:07:47 -05:00
Matthew Brown
6b68da0e4d Always check typehints for bad classes 2018-01-09 22:46:55 -05:00
Matt Brown
b373d6093a Be more lenient with nullable docblock types, allow no return statements 2018-01-08 17:17:49 -05:00
Matt Brown
a76fde5b98 Break out mismatching param/return type issues from InvalidDocblock 2018-01-05 12:11:12 -05:00
Matthew Brown
17d208bdd5 Increase test coverage 2017-12-30 10:54:01 -05:00
Matthew Brown
3b7c84f484 Detect instances where loop invariants are invalidated
Fixes #389
2017-12-17 10:58:03 -05:00
Tyson Andre
136d48f77c Support @property-read and @property-write as new tags. (#317)
In combination with `@psalm-seal-properties`, this can be used to
have in-depth checking of magic properties.
2017-12-14 14:22:27 -05:00
Matthew Brown
1a39224abc Fix issues that improved array checks found 2017-11-19 12:14:02 -05:00
Tyson Andre
1c25ca1a0c Fix false positives, add tests of @psalm-seal-properties (#318) 2017-11-17 16:19:48 -05:00
Matthew Brown
a08306973a Fix #302 - add a way to seal objects with magic properties 2017-11-16 20:47:58 -05:00
Matthew Brown
b2ae9a2892 Fix #291, #292 and #297 by improving docblock parsing 2017-11-14 21:43:31 -05:00
Matt Brown
81493a639e Add more robust property assignment when property not defined 2017-11-03 12:27:01 -04:00
Matthew Brown
a651fad6f0 Fix #263 - add support for @psalm-param and @psalm-var annotations 2017-11-02 21:45:17 -04:00