Brown
dbcf154036
Add fixer for mismatching param names
2020-08-14 15:25:21 -04:00
Brown
c0b0036109
Fix #3934 - prevent unsafe use of new static
2020-08-05 19:39:27 -04:00
Brown
6919e88423
Add performance logging under a --debug-performance flag
2020-07-30 15:30:19 -04:00
Matthew Brown
ab714a40c4
Allow binding of static to current final class
...
Ref #3892
2020-07-25 17:26:07 -04:00
Brown
344a732829
Warn about simple assignments
2020-07-23 02:40:35 -04:00
Brown
3848fa6872
Fix #3870 - mark properties as reference-free only for externally-immutable classes
2020-07-23 01:48:06 -04:00
Brown
76bd5b6278
Refactor type comparison
2020-07-21 19:40:35 -04:00
Joe Hoyle
0b6d682964
Fix going to definition on return type ( #3806 )
...
* Fix going to definition on return type
If a return type of a method or function is set incorrectly (with the PHP doc), then the references are not added for the `function() : MyClass` symbol, so the "Go to definition" feature of the LSP won't work. I don't believe an invalid return type or not should stop the symbol location being tracked (and not allowing code navigation).
In moved the symbol location tracking to be before the return early short circuit.
* Update SymbolLookupTest.php
Co-authored-by: Matthew Brown <github@muglug.com>
2020-07-11 17:14:39 -04:00
Joe Hoyle
11af82a97f
Fix jumping to definition on nullable parameters ( #3804 )
...
Currently it's not possible to "Go to definition" (LSP) on nullable args like `function( ?MyClass )` as the reference is stored a `MyClass|null` in the reference map, which will now resolve to a class name.
This PR removed any nullable type from the union before adding it to the reference map (as the reference map is only use to indicate a symbol was used in a given location, I think this makes sense).
2020-07-11 17:12:03 -04:00
Brown
95bf7f835b
Improve handling of array_map, faking out calls where nececssary
2020-06-25 13:05:34 -04:00
Brown
9aa0aca949
Fix handling of coerced callmap args
2020-06-24 11:51:31 -04:00
Brown
c29b3744ec
Change storage of out types
2020-06-24 11:51:31 -04:00
Brown
96d05ab06b
Fix #3654 - use correct function id for namespaced functions
2020-06-23 16:53:11 -04:00
Brown
b1c836e5f3
Improve specialisation after call
2020-06-19 01:59:45 -04:00
Brown
8f2e28c36b
Improve tainting of specializable classes
2020-06-19 01:22:51 -04:00
Matthew Brown
081a284759
Fix #3567 - remember which variables a callable sets byref in use
2020-06-14 11:58:50 -04:00
Matthew Brown
187b944680
Add faster taint analysis
2020-05-22 12:33:29 -04:00
Brown
a4141a7581
Fix #3327 - convert void to null when comparing conditional type with nullable
2020-05-19 19:48:11 -04:00
Brown
111303d913
Add non-empty-lowercase-string type
2020-05-15 10:18:05 -04:00
Brown
8f2f2617d4
Improve refactor
2020-05-10 22:45:01 -04:00
Brown
5f4d162dd5
Break out type expander into separate class
2020-05-10 22:39:18 -04:00
Brown
20bcfb096a
Fix #3305 - use the same issue type for short closures as closures
2020-05-06 09:57:02 -04:00
Brown
21f4deed3b
Fix #3268 - infer generator return for closure
2020-04-29 16:52:37 -04:00
orklah
8571746f8a
Add hook for plugins after FunctionLikeAnalysis ( #3258 )
2020-04-28 15:30:51 -04:00
Brown
8f57d0c738
Fix #3204 - normalise function ids where possible
2020-04-20 21:38:35 -04:00
Brown
35d376cbe7
Fix #3164 - allow nested templates in conditional classes
2020-04-17 00:46:27 -04:00
Brown
da729cfbc6
Don’t check params when mutations are being collected
2020-03-31 15:49:43 -04:00
Matthew Brown
194f02507d
Allow conditional types to reference class constants
2020-03-29 13:37:37 -04:00
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