1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-13 17:57:37 +01:00
Commit Graph

239 Commits

Author SHA1 Message Date
Matthew Brown
5395183837 Use more accurate means of determining whether function did return 2020-03-28 23:37:42 -04:00
Matthew Brown
93735712f0 Fix #3032 - always replay docblock issues when analysing files 2020-03-28 19:54:55 -04:00
Matthew Brown
47c1470e3b Refactor reference checks to use more appropriate properties 2020-03-28 16:30:56 -04:00
Brown
971ae50bea Do prep work for #3024 - improve handling of absent class references 2020-03-26 12:35:27 -04:00
Brown
1bfc61d402 Allow final classes to bypass static checks 2020-03-24 18:14:10 -04:00
Brown
ec34a16291 Warn about invalid static returns 2020-03-24 18:00:20 -04:00
Matthew Brown
0aca01faea Improve fix to #2805 2020-03-14 01:09:12 -04:00
Matthew Brown
96fbcd5a64 Break out more methods 2020-03-11 23:38:49 -04:00
Matthew Brown
bfb919d26a Break out methods into their own classes 2020-03-11 23:04:52 -04:00
Matthew Brown
3cc4c2b37e Fix #2721 - only warn about deprecated classes exactly where they are used 2020-02-22 01:12:19 -05:00
Brown
f4485cc529 Fix #2847 - use fully-qualified function name 2020-02-21 16:44:31 -05:00
Matthew Brown
653353709a Use MethodIdentifier object instead of string 2020-02-14 20:54:26 -05:00
Brown
210d65d0d6 Add a few lowercase-string types 2020-02-13 17:52:23 -05:00
Brown
f141f7c526 Improve --diff checks by including trait-using classes in dependents 2020-02-11 16:39:33 -05:00
Brown
d8f5ad190b Improve invalidation of inherited properties 2020-02-10 17:03:51 -05:00
Matthew Brown
da541dbb51 Remove some unnecessary errors 2020-02-06 23:10:18 -05:00
Brown
8fb810350a Don’t cache no-effects hashes when checking for initialisations 2020-02-04 17:53:26 -05:00
Brown
8f95c5679e Fix #2720 - allow throwing self 2020-01-30 18:00:31 -05:00
Brown
da43b8188f Fix #2632 - detect invalid by-ref assignments in pure functions 2020-01-23 14:21:34 -05:00
Brown
eb7c3dcc11 Fix #2611 - fix combination of inferred closure return types 2020-01-13 10:23:58 -05:00
Matthew Brown
9fa2db1b6c Move Union::getTypes to Union::getAtomicTypes 2020-01-04 12:20:26 -05:00
Matthew Brown
55c2f7faa2 Fix #2508 - don’t replace templated types with generic ones inside own function 2019-12-28 18:38:02 -05:00
Matthew Brown
11433dc9d0 Fix references 2019-12-18 14:43:15 +00:00
Matthew Brown
cb797c6159 Fix inherited class methods as well
Ref #2478
2019-12-18 14:39:37 +00:00
Matthew Brown
f40b6625eb Fix #2431 - allow null in template defaults 2019-12-13 21:40:09 -05:00
Matthew Brown
97de060df9 Fix #2279 - add parameter typehint by default 2019-12-03 01:49:43 -05:00
Brown
821f3528d2 Fix #701 - indicate issues fixable with Psalter 2019-12-02 15:24:01 -05:00
Matthew Brown
d1fbd1fa26 Add working arrow-functions implementation 2019-11-26 23:52:26 -05:00
Brown
1f07ea7ee7 Tighten up Psalm’s inference 2019-11-25 15:20:31 -05:00
Brown
0bcb7863f3 Use better system for storing inferred types and assertions 2019-11-25 11:44:54 -05:00
Matthew Brown
2369bac943 Preserve self refs where possible 2019-11-16 19:59:08 -05:00
Brown
55bf6a2db3 Migrate static return types 2019-11-15 16:50:43 -05:00
Brown
4747ba709a Migrate more things 2019-11-15 15:34:25 -05:00
Brown
96586f16c0 Fix phpcs issues 2019-11-11 10:11:42 -05:00
Brown
895737d8be Fix style 2019-11-08 12:49:53 -05:00
Brown
ac6256e645 Fix #2312, improve understanding of template replacement 2019-11-08 11:56:41 -05:00
Brown
1f42843d42 Fix #2296 - use case insensitive closure ids 2019-11-04 14:48:02 -05:00
Matthew Brown
5910a362ea Improve report output of taint analysis 2019-10-19 17:59:10 -04:00
Brown
dda68228f3 Fix #2247 - don’t crash when yielding from class with too many template params 2019-10-18 11:01:16 -04:00
Matthew Brown
c419e0e798 Fix #2222 - check for @throws docblock inheritance 2019-10-10 22:44:21 -04:00
Brown
3658771bff Fix #2221 - variadic args are lists 2019-10-10 17:46:20 -04:00
Matthew Brown
a9d0296252 Fix #2182 - allow modification to cloned objects inside 2019-09-30 22:07:20 -04:00
Matthew Brown
a5f79353ed Fix #2157 - don’t merge closures and callable params 2019-09-22 00:58:30 -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
9ad6c36d9b
Conditionally verify that array offsets exist (#2147)
* Check array offsets idea

* Clean up some issues

* Add a few light fixes

* Add docs
2019-09-18 14:21:06 -04:00
Brown
b49444b8ad Allow immutable objects to be cloned
Fixes #2111
2019-09-09 11:14:40 -04:00
Matthew Brown
4cac8cd70f Don’t complain about mutating call when it was inferred during reflection 2019-09-08 10:36:57 -04:00
Matthew Brown
da1f36b57f Fix #2089 - properly coerce arguments 2019-09-01 10:10:38 -04:00
Brown
b7b4baff8f Add support for @immutable
Fixes #1272
2019-08-30 12:36:35 -04:00
Brown
7797bfd71c Refactor FunctionLikeAnalyzer::analyze 2019-08-22 11:25:13 -04:00
Matthew Brown
43a9ff0735 Prevent erroneous unused suppressions from plugin 2019-08-18 17:18:03 -04:00
Matthew Brown
c5f62d261d Remove redundant @psalm-suppress in Psalm’s codebsae 2019-08-18 16:10:12 -04:00
Matthew Brown
eb50aad3a1 Fix offsets when checking function suppressions 2019-08-18 14:44:45 -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
Matthew Brown
600999a3a8 Add better typing 2019-08-14 00:47:57 -04:00
Brown
2b2988b072 Fix #2019 - allow union in @throws 2019-08-13 15:44:18 -04:00
Brown
da230bc9f1 Change the type of @throws error to UndefinedDocblockClass 2019-08-13 13:41:12 -04:00
Matthew Brown
a4b9b7311b Improve message a bit 2019-08-12 23:58:40 -04:00
Matthew Brown
ef3771d643 Fix #2015 - complain about invalid @throws classes 2019-08-12 23:42:51 -04:00
Matthew Brown
d5b026839c Add support for different taint types ref #1990 2019-08-12 23:16:05 -04:00
Brown
6eb62591ab Specialise calls when functions are pure 2019-08-05 18:33:33 -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
Matthew Brown
1ae9ea5fed Use object instead of by-ref params 2019-07-10 01:35:57 -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
Matthew Brown
d96246a824 Improve template handling robustness 2019-06-25 09:06:23 -04:00
Matthew Brown
7fc11af49e Fix docblocks with @andrew-demb’s suggestions 2019-06-16 09:12:32 -04:00
Matthew Brown
2d5f332ebf Fix #1781 by improving handling of callmap options 2019-06-15 16:10:48 -04:00
Matthew Brown
c0a9ccb385 Fix handling of unused params in threaded mode 2019-06-09 17:02:21 -04:00
Matthew Brown
93f81f599e Fix #1764 - prevent UndefinedInterfaceMethod error when checking initialisation 2019-06-09 09:18:05 -04:00
Brown
4660beb28e Still look at param defaults even without param types 2019-06-07 14:24:15 -04:00
Matthew Brown
20c66f693e Fix handling of class const types 2019-06-06 18:46:40 -04:00
Matthew Brown
4fc5d1d5c8 Rewrite use statements 2019-06-05 22:13:33 -04:00
Matthew Brown
c6063d1378 Only replace same-file param docblock types 2019-06-05 19:32:27 -04:00
Brown
f309c755f8 Add ability to move classes 2019-06-05 08:50:24 -04:00
Marco Pivetta
624c7bc6fb Renamed Fn to TFn to allow for PHP 7.4 compatibility 2019-06-03 08:21:25 -04:00
Matthew Brown
2439a9f6a0 Allow instance method renaming, too 2019-06-02 12:02:39 -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
bee87c25eb Add transformations for new A, param A 2019-06-01 10:32:49 -04:00
Matthew Brown
cd969c51e5 Generate missing param types from callers
Fixes #1707
2019-05-31 01:47:35 -04:00
Matthew Brown
790bc53bfd Fix #1681 - interpret parent annotation properly 2019-05-25 11:51:09 -04:00
Brown
7fbbe964cb Fix #1609 - warn when using covariant template type as input 2019-05-14 18:17:38 -04:00
Matthew Brown
4f8d6a50d8 Don’t emit MissingClosureReturnType when inside call and type can be inferred 2019-05-06 20:47:55 -04:00
Brown
b6e9fba8e6 Track method param uses between diff runs 2019-04-29 17:29:38 -04:00
Brown
3dc3d659f1 Fix #1534 - allow unpacked args to be interpreted properly by overloaded functions 2019-04-09 14:48:51 -04:00
Brown
1348d634ed Improve handling of variadic parameters 2019-04-09 13:58:49 -04:00
bugreportuser
1a4b9ab25f Allow suppressing exception issues inline 2019-03-31 14:22:19 -04:00
bugreportuser
4fc7e4affc Give errors for all uncaught exceptions 2019-03-31 14:22:19 -04:00
Brown
1ab6345bac Fix treatment of PDOStatement::setFetchMode
Fixes #1496
2019-03-29 13:26:13 -04:00
bugreportuser
b71005e199 Make MissingThrowsDocblock codelocation more accurate 2019-03-24 23:03:37 -04:00
bugreportuser
976c2c5ef3 Add an error for throws in global scope 2019-03-24 23:03:37 -04:00
Brown
b9ba24929d Refactor storage of template names to prevent clashes 2019-03-22 15:59:10 -04:00
Brown
29666bf22e Fix #1489 - make sure you’re checking against known params 2019-03-21 18:28:25 -04:00
Matthew Brown
f66af3e267 Fix #1475 - allow self params in traits 2019-03-17 11:31:04 -04:00
Matthew Brown
848b070946 Fix #1413 - don’t complain about byref use param 2019-03-10 16:36:35 -04:00
Brown
9442805763 Mutation checks should not care about return type 2019-03-06 11:12:36 -05:00
Brown
bd372e93af Add config flags for findUnusedVariables and findUnusedCode 2019-03-05 15:45:09 -05:00
Matthew Brown
aeab6e292b Prevent bugs when checking for initialisation 2019-03-04 00:17:45 -05:00
Matthew Brown
17801362f5 Ignore all potentially mixed issues 2019-03-03 18:28:12 -05:00
Matthew Brown
74246c1cf7 Remove errant space 2019-03-03 18:25:14 -05:00
Matthew Brown
a31420be5b Fix checks for existing vars used in by-ref assignments 2019-03-03 18:21:12 -05:00
Matthew Brown
472cdf6bea Fix #1379 - allow @param-out to change type 2019-03-03 15:11:09 -05:00
Matthew Brown
317f790bde
New plugin hooks (#1405)
* Add a bunch of new hooks

* Add more integrations

* Add some broken tests

* Add more things

* Fix remaining interfaces

* Suppress proper issue

* UndefinedMethod should not stop analysis

* Add handlers for two custom method return types
2019-03-01 08:57:10 -05:00
Brown
601f303de2 Fix position of invalid param 2019-02-27 16:00:44 -05:00
Matthew Brown
3ad1abece4 Add generation of json artifacts 2019-02-24 01:33:25 -05:00
Matthew Brown
f87827e812 Fix #1288 - prevent template names from clashing with real-world classes 2019-02-21 21:54:00 -05:00
Brown
079ac44263 Prevent pass by ref when type type is given 2019-02-20 17:43:12 -05:00
bugreportuser
61e086ac7b Ignore more redundant issues 2019-02-18 22:44:26 -05:00
Matthew Brown
41255b42c6 Fix #1325 - allow MissingThrowsDocblock to be suppressed 2019-02-18 16:41:06 -05:00
Bruce Weirdan
8408effe57 Dropped unused uses 2019-02-17 13:17:45 -05:00
Matthew Brown
a428b34a1a Fix #1338 - ignore redundant issues when collecting initialisations 2019-02-16 20:27:42 -05:00
Matthew Brown
62fb8035bf Fix #1309 - no PropertyNotSetInConstructor warnings for grandchild of class 2019-02-10 15:01:10 -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
194bb31221 Fix #204 - allow missing param types to be added with Psalter 2019-02-02 14:16:49 -05:00
Matthew Brown
db89b3cc3f Add initial support for fixing MissingParamType 2019-02-02 11:28:48 -05:00
Brown
3f289731bb Add ability to check descendants in ignored exceptions 2019-01-31 18:40:40 -05:00
Brown
fd88f00526 Fix a few small bugs 2019-01-31 17:48:48 -05:00
Brown
74ebb0b2d5 Don’t copy context unnecessarily when checking methods had no effect 2019-01-31 12:55:48 -05:00
Matthew Brown
22ee72808a Remove a bunch of hacks around generic offsets
Also fixes #1245
2019-01-26 16:58:49 -05:00
Brown
0d52dc4e00 Fix #1232 - allow checking of extended templated function returns 2019-01-24 15:03:13 -05:00
Matthew Brown
075446e7df Fix #1223 - MissingClosureParamType should use all known suppressed issues 2019-01-21 12:36:17 -05:00
Brown
d068f1535d Fix issue with implemented class interface in subclass 2019-01-16 15:08:11 -05:00
Brown
ee366015f7 Fix #1205 - allow traits to override inheritance checks 2019-01-16 10:59:06 -05:00
Brown
b8d822cd26 Prohibit leaking of template params across class boundaries 2019-01-10 12:13:49 -05:00
Matthew Brown
bf8f76671b Don’t crash when suppressing UndefinedClass with bad params 2019-01-05 12:59:12 -05:00
Matthew Brown
602d8a5ade Fix issue inheriting grandparent signature 2019-01-04 08:37:54 -05:00
Matthew Brown
947e3bf0f1 Fix crashes when analysing aliased class instances 2018-12-21 11:32:44 -05:00
Matthew Brown
e89425ad68 Inherit parameters via @inheritdoc 2018-12-21 11:01:24 -05:00
Matthew Brown
ca6149ed17 Improve treatment of templated params within function analysis 2018-12-17 23:29:27 -05:00
Matthew Brown
fd0ab47b80 Fix #1118 - detect possible issues with unions of mixed 2018-12-08 13:18:55 -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
Brown
0254322bed Migrate Codebase-namespaced and FileManipulation-namespaced classes to internals 2018-11-12 11:20:59 -05:00
Matthew Brown
9709263b8d Make many PropertyAnalyzer properties private 2018-11-12 11:20:59 -05:00
Matthew Brown
4d79b61e93 Change _checker to _analyzer 2018-11-12 11:20:59 -05:00
Matthew Brown
4688b25fd9 Move internal classes to own namespace 2018-11-12 11:20:59 -05:00