AndrolGenhald
580278d323
Fix some minor issues with references.
...
References assigned to properties on `$this` should never be unused.
Using a `@var` docblock before a reference should be allowed if it targets a variable instead of the assignment statement.
2022-02-17 09:31:33 -06:00
orklah
5aa06ae64e
fix merge issues
2022-02-14 00:12:31 +01:00
orklah
1142c818c2
Merge remote-tracking branch 'upstream/4.x' into upstream-master9
2022-02-14 00:10:28 +01:00
AndrolGenhald
32c389482c
Fix issue with nested try
block and add more tests.
2022-02-13 15:30:06 -06:00
AndrolGenhald
7b1599d783
Fix false positive for unused variable in try ( fixes #7613 ).
2022-02-13 15:14:59 -06:00
8d0c1c62e8
Ensure all template parameters are specified in classes, interfaces, traits
2022-01-31 10:06:31 +01:00
Matthew Brown
faaf7690f6
Remove mic-drop hack from if analysis ( #7484 )
...
* Remove mic-drop hack from if analysis
* Remove more special handling
* Remove some unnecessary ElseAnalyzer code
* Add back necessary code
* Fix return type of method never returning null
* Add a comment
* Simplify && handling
* Add comments to make stuff clearer
* Move if-specfic logic to more appropriate setting
2022-01-28 18:30:47 -05:00
AndrolGenhald
57b99be519
Improve reference support for assertions, array offsets, and properties.
2022-01-26 12:55:47 -06:00
AndrolGenhald
f9450656e1
Add support for references and improve UnusedVariable checks ( fixes #7254 ).
2022-01-26 12:55:47 -06:00
Matthew Brown
8ab0eec4dd
Fix key
2022-01-25 01:36:23 -05:00
Matthew Brown
302c72d5b1
Add a couple of currently-working tests
2022-01-25 01:32:35 -05:00
orklah
af1888b631
Merge remote-tracking branch 'upstream/4.x' into upstream-master4
2022-01-22 17:48:42 +01:00
Pete Walker
057a99c9f1
fix: Tests / minor bug
2022-01-22 00:00:45 +00:00
orklah
52a7f0694e
drop compatibility aliases
2022-01-19 19:29:16 +01:00
Matthew Brown
b49682a485
Simplify issue suppression in tests
2022-01-13 14:38:17 -05:00
Matthew Brown
f439d6550b
Ensure that all entries in test arrays have explicit keys ( #7386 )
...
* Transformation that updates assertions
* Simplify transformation
* Ensure that all tests have keys
* Fix a few remaining keys
2022-01-13 13:49:37 -05:00
rarila
97e6511fab
Set number of lines before and after namespace.
2021-12-15 04:58:32 +01:00
rarila
39402c233d
Return type hints ( #7065 )
...
Co-authored-by: ralila <>
2021-12-05 19:51:26 +02:00
ralila
8fb2e0f885
Handle some partials
2021-12-04 21:55:53 +01:00
ralila
f833085a15
Fix fqn usage in php-doc
2021-12-04 03:37:19 +01:00
ralila
711be643c6
Import instead of using fqn exceptions
2021-12-03 20:29:06 +01:00
ralila
245920e53c
Import instead of using fqn
2021-12-03 20:11:20 +01:00
Bruce Weirdan
d19aad7db1
Display target PHP version
...
Historically it was often not quite clear to users what PHP version
Psalm assumes, and why. This PR addresses this issue by printing the
version and where we got it from right before scanning the files.
2021-11-27 02:18:09 +02:00
orklah
d1a4975e3d
remove test no longer applicable
2021-07-17 23:20:13 +02:00
orklah
79d0647d19
fix issue when setting a value to a global is considered unused
2021-07-17 22:00:54 +02:00
Ruslan Karimov
8a08489dcc
Merge branch 'master' into fix-5957
...
# Conflicts:
# tests/UnusedVariableTest.php
2021-07-13 10:15:35 +05:00
Ruslan Karimov
cfaca07c6d
added dataflow to stringy bitwise op, bitwise not op (fix 5957)
2021-07-13 10:05:21 +05:00
Matthew Brown
f2bc6913db
Fix #6061 — delay analysis of array value except when unpacking ( #6081 )
2021-07-12 17:05:33 -04:00
Bruce Weirdan
76be96ce53
Drop FakeFileProvider from tests folder
...
And use Psalm\Internal\Provider\FakeFileProvider
2021-07-02 03:57:57 +03:00
Matt Brown
d8f4eb2d6d
Restrict type of implode to prevent Array-to-string conversion;
2021-06-21 19:55:27 -04:00
Bruce Weirdan
e552925af6
Emit separate type of issue when foreach value is unused ( #5932 )
...
* Emit separate type of issue when foreach value is unused
Fixes vimeo/psalm#5929
* Fixed var name case sensitivity
2021-06-17 00:40:24 -04:00
Bruce Weirdan
6abce3525a
Enforce use
sort ( #5900 )
2021-06-07 22:55:21 -04:00
Matt Brown
67c5dc3c79
Fix #5517 - don’t let a variable’s by-refness be overwritten by a @var docblock
2021-04-25 15:11:23 -04:00
Matt Brown
7b7354efa3
Fix #5518 - add type for property with variable name
2021-04-25 14:49:43 -04:00
Matt Brown
642f2f435c
Fix #5640 - improve handling of assignments in conditional
2021-04-18 16:16:54 -04:00
Matt Brown
93743d1465
Also add better message for MixedArgumentTypeCoercion
2021-03-28 11:32:38 -04:00
Matt Brown
929f931c14
Taint mixed keys too
2021-03-24 16:42:30 -04:00
Matt Brown
10ccbdd8be
Add tainting for array keys
...
Fixes #5470
2021-03-24 15:32:56 -04:00
Matt Brown
44c6d3035b
Add more mixed origin information
2021-03-20 21:45:38 -04:00
Matt Brown
d1740394aa
Detect mixed echo argument when unused variable detection is turned on
2021-03-20 20:53:51 -04:00
Matt Brown
42d3bceb4e
Use more accurate return type
2021-03-18 15:19:29 -04:00
Matt Brown
95287d2a41
Fix directory separators
2021-03-18 09:37:31 -04:00
Matt Brown
d19088bb10
Add better origins for calls
2021-03-17 19:37:21 -04:00
Matt Brown
3046468d1e
Add hints for MixedAssignment issues
2021-03-17 01:10:42 -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
Bruce Weirdan
8be77aaa2e
Track variable usage in bool to int casts ( #5349 )
...
Fixes vimeo/psalm#4956
2021-03-11 00:08:32 -05:00
Bruce Weirdan
b72c5a0fa2
Mark variables in throw arguments as used ( #5166 )
...
Fixes vimeo/psalm#5164
2021-02-06 22:07:01 -05:00
Joe Hoyle
a3dcc52e9a
Track references on global variables ( #5122 )
...
* Track references on global variables
Add global type references to the type map, and fix up unused detection on global variables.
* Add null assertions
* PHPCS
2021-01-28 18:58:02 -05:00
Bruce Weirdan
d296c4bb9a
Add missing dataflow population in array spreads ( #5059 )
...
Fixes vimeo/psalm#5057
2021-01-20 17:42:11 -05:00
Matt Brown
0411049559
Mixed array access should mark vars as used just in case
2020-12-03 13:09:08 -05:00