ralila
30a65685a2
Import instead of using fqn classes
2021-12-03 21:40:18 +01:00
ralila
2a956498bf
Import instead of using fqn functions
2021-12-03 21:07:25 +01:00
ralila
245920e53c
Import instead of using fqn
2021-12-03 20:11:20 +01:00
Matthew Brown
175ba83332
Migrate most IssueBuffer::accepts calls to IssueBuffer::maybeAdd ( #7020 )
2021-11-29 14:54:17 -05:00
orklah
ab61eae5c9
Taint can't transmit through numerics nor bool
2021-11-25 22:51:35 +01:00
orklah
3bc06a8eab
Taint can't transmit through numerics nor bool
2021-11-25 22:40:01 +01:00
Bruce Weirdan
c556920352
Revert "Merge remote-tracking branch 'upstream/master' into test5"
...
This reverts commit 043a0262f7
, reversing
changes made to cc4c29837d
.
2021-10-16 00:20:38 +03:00
orklah
99d8f92e4f
what would that do?
2021-10-15 22:33:04 +02:00
orklah
c4ebc34695
suppress or use the return type
2021-10-11 17:27:52 +02:00
orklah
5d6d3df4cf
unnecessary identical child method
2021-09-26 23:34:32 +02:00
Matthew Brown
6d09418a23
Detect unused return values ( #5917 )
...
* Detect unused return values
* Allow static-returning instance methods (presumed to be fluent)
* Make $is_used the default for Codebase::methodExists
2021-06-10 14:18:15 -04:00
Bruce Weirdan
6abce3525a
Enforce use
sort ( #5900 )
2021-06-07 22:55:21 -04:00
Matt Brown
4f9067f5c8
Fix unused properties in Psalm’s own codebase
2021-05-21 09:15:23 -04:00
Matt Brown
f6bdeb6234
Fix switch-with-continue bug
2021-05-17 07:27:58 -05:00
Bruce Weirdan
0189420814
Inherit class-level suppressions when checking methods ( #5708 )
...
Fixes vimeo/psalm#5687
May fix vimeo/psalm#3357
2021-05-03 22:26:56 -04:00
Matthew Brown
832a190dd4
Support enums ( #5699 )
...
* Add initial enum preparation
* Support cases method
* Ignore bad use error
cc @weirdan
* Fix type
2021-05-03 17:54:09 -04:00
Bruce Weirdan
105c6f3a1c
Remove (and prevent) unused uses ( #5704 )
...
* Updates `slevomat/coding-standard`
* Removes unused uses
* Prevents unused uses
* Fixes a number of symbol case mismatches
2021-05-03 17:22:15 -04:00
Matt Brown
0f5b117534
Migrate ClassLikeName options to object
2021-04-30 15:01:33 -04:00
Bruce Weirdan
93946d0827
Forbid rejecting named arguments when parent allows them ( #5627 )
...
Fixes vimeo/psalm#5622
2021-04-15 06:55:13 -04:00
Matt Brown
c64e879178
Only check param-out when no exception is thrown
2021-03-27 09:50:20 -04:00
AndrolGenhald
de5a031088
Improve @no-named-arguments support and variadics. ( #5455 )
...
* Improve @no-named-arguments support and variadics.
Handling of argument unpacking and variadics still needs a pretty big makeover, but this is a good start.
Fixes #5420
Improves #5453 (iterable works, array still causes issues)
* Remove unneeded imports.
2021-03-22 19:58:22 -04:00
Bruce Weirdan
ae247d09a3
Don't mark promoted properties as unused params ( #5404 )
...
If anything, they should be marked as unused properties.
Fixes vimeo/psalm#4964
2021-03-16 13:41:43 -04:00
Matt Brown
817d1cf3fe
Fix #5408 - avoid nullref when parser param cannot be found
2021-03-16 13:40:16 -04:00
Matt Brown
8834a54934
Fix #5219 - invalidate cache for changed params
2021-02-14 12:07:15 -05:00
Matt Brown
61478bb003
Use generics to allow property subclassing
...
cc @bdsl
2021-02-09 11:40:52 -05:00
Barney Laurance
509aadc08a
Remove all (but one) properity declarations that needed NonInvariantDocblockPropertyType suppressed ( #5174 )
...
The remaining property
\Psalm\Internal\Analyzer\NamespaceAnalyzer::$source seems a bit harder
to fix
2021-02-08 09:36:42 -05:00
Matt Brown
8b5e0fc754
Fix #5172 - prevent calling function with implicitly-broader type
2021-02-07 11:07:22 -05:00
Matt Brown
f2d202e2bb
Add less severe issue for docblock property type invariance cc @bdsl
...
This is less likely to break everything
2021-02-07 00:52:29 -05:00
Barney Laurance
0cd5442c47
Enforce property type invariance ( #5131 )
...
* Implement NonInvariantChildProperty detection
See https://github.com/vimeo/psalm/issues/4184
* Delete test cases with 'parentSetsWiderTypeInConstructor'
As I understand it these are not valid test cases. They
emit NonInvariantPropertyType issues which seems correct - the property
type variation is I think a latent bug in the sample code.
* Reduce shortcode for NonInvariantPropertyType to 1+max used shortcode on master
2021-01-31 11:32:24 -05:00
Matt Brown
76269658ca
Fix #5107 - treat function-bound templated parameters the same
...
Previously they were treated differently depending on whether or not they were inside a method
2021-01-26 22:43:42 -05:00
orklah
1bbcbddfcf
pass args through event ( #4864 )
2021-01-07 09:02:05 -05:00
orklah
f9fccb2b2d
implement DTO for plugins ( #4881 )
...
* implement DTO for plugins
* introduce EventHandler + reintroduce legacy API for plugins
2021-01-06 09:05:53 -05:00
Matthew Brown
b1028adc5a
Break out large chunk to simplify function
2021-01-05 17:50:23 -05:00
orklah
1d9987e0ed
fix phpdoc ( #4905 )
2020-12-29 11:42:41 +00:00
orklah
09fb141e49
Document lowercase-string when possible ( #4904 )
...
* document lowercase-string
* fix missing strtolower
2020-12-29 11:42:12 +00:00
Matt Brown
1e0bcc1876
Fix #4803 - always derive method params the same way
2020-12-08 11:27:51 -05:00
Matt Brown
ca915e5028
Fix redundancies
2020-12-04 15:10:50 -05:00
Matt Brown
4a0e2f543e
Fix implicit void closure not getting recognised
2020-12-04 13:16:05 -05:00
Matt Brown
5f065d3d74
Turn template bound tuples into object
...
Ref #4714
2020-11-27 11:43:30 -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
Matt Brown
95de6cf177
Allow immutable classes to be specialised through calls
2020-11-19 01:38:20 -05:00
Matt Brown
f65868c023
Fix style
2020-11-13 16:43:36 -05:00
Matt Brown
d97c8b750a
Add closure-use termination for byref flows
2020-11-13 13:37:27 -05:00
Matt Brown
2e47ca51d5
Fix #4547 - mark unused uses
2020-11-13 13:13:29 -05:00
Matt Brown
579327a470
Detect when targets are incorrectly targeted
2020-10-30 13:28:45 -04:00
Matt Brown
f8eee22f77
Add basic support for PHP attributes
...
Ref #4367 - supports creation and argument checks
2020-10-24 00:10:22 -04:00
Matt Brown
724b25b918
Change control_flow_graph to data_flow_graph
2020-10-13 17:28:12 -04:00
Matt Brown
516141a380
Rename ControlFlowGraph to more appropriate DataFlowGraph
2020-10-13 16:49:03 -04:00
orklah
10f2966dcb
return types ( #4311 )
...
* return types
* remove willReturn for void methods
2020-10-12 15:02:52 -04:00
Matt Brown
939297484c
4.x - rename TFn to TClosure
2020-10-04 23:32:01 -04:00
Matt Brown
fc001cdf65
Treat func_get_args as using function params
2020-09-30 13:08:01 -04:00
Matt Brown
14efde286f
4.x - refactor unused variable detection
...
This turns unused variable detection into an explicit control-flow problem, where before we had a more simplistic mark-and-sweep algorithm
2020-09-30 12:28:13 -04:00
Brown
19f88a2e31
Add improvements from unused variable checks
2020-09-28 00:45:02 -04:00
Brown
da65a4327f
Move taint graph functionality into its own object
2020-09-25 00:37:40 -04:00
Brown
56cddd16bf
Rename TaintGraph to ControlFlowGraph because it’s about to do more
2020-09-20 23:59:52 -04:00
Brown
abb9502921
Rename Taint object to TaintGraph
2020-09-20 18:27:02 -04:00
orklah
a9a364e363
Misc improvements ( #4216 )
...
* misc changes
* fix CI
2020-09-20 08:55:28 -04:00
Brown
f973937aec
Fix #4209 - allow hinting arrow function return type
2020-09-19 14:59:19 -04:00
orklah
191495328a
Fix errors in return types ( #4189 )
...
* FunctionLikeAnalyzer::verifyReturnType returns void
* ArrayFunctionArgumentsAnalyzer::checkArgumentsMatch returns void
* AssertionFinder::scrapeAssertions can't return null
2020-09-16 17:35:55 -04:00
orklah
da47588f91
replace return;
by return null;
in every non-void method, add return null;
when mising, add return types, remove redundant phpdoc ( #4176 )
2020-09-13 16:39:06 -04:00
Brown
9ed09d2679
Fix #4127 - improve error message for unused closure var
2020-09-12 17:03:11 -04:00
orklah
ead107fa9e
More return types ( #4173 )
...
* add native return types
* redundant phpdoc
2020-09-12 11:24:05 -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
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
Brown
efe143a396
Fix #4077 - always track closure purity
2020-08-28 12:42:55 -04:00
Saif Eddin G
5a20092fbd
add pure-callable type ( #4066 )
2020-08-26 16:51:22 -04:00
Brown
4e10a0ed6f
Fix #4036 - add immutable annotations automatically too
2020-08-24 19:29:00 -04:00
Brown
94cec15598
Only add pure when not overriding upstream
2020-08-23 22:16:03 -04:00
Brown
02a2e99d42
Only add pure to functions with params
2020-08-23 18:41:31 -04:00
Brown
10f7031080
Prevent use of $this
in pure functions
2020-08-23 18:37:46 -04:00
Brown
4026b717b9
Allow function manipulators to work in threaded mode
2020-08-23 18:05:48 -04:00
Matthew Brown
8a975d7c20
Don’t add pure annotation when closure is impure
2020-08-23 14:07:19 -04:00
Matthew Brown
6efaf474d4
Don’t add @psalm-pure for void-returning functions
2020-08-23 13:58:34 -04:00
Matthew Brown
9418be79cc
Restrict pure annotation addition a little more
2020-08-23 13:34:32 -04:00
Brown
67f9adb33c
Allow adding pure annotations to functions
...
Ref #4036
2020-08-23 10:28:26 -04:00
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