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
orklah
f19cac6ecf
add annotation @psalm-param-out ( #4717 )
...
* add annotation @psalm-param-out
* add tag in documentation
2020-11-27 17:05:26 -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
4e5111f1a8
Fix #4472 - if something flows into a byref var it’s used
2020-11-17 15:30:53 -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
57125c7106
Uses by ref should be assigned that way
2020-11-13 12:50:01 -05:00
Matt Brown
5c784dc7cb
Fix #4435 - ensure casts are always flow-sensitive
2020-10-28 14:06:05 -04:00
Matt Brown
66780716aa
Fix #3625 - getIterator call is used inside loop
2020-10-20 10:59:09 -04:00
Matt Brown
e7d1fa6798
Fix #4372 - count implicitly-used short-closure vars as used
2020-10-20 09:32:08 -04:00
Matt Brown
3803bbfce0
Fix #4368 - improve handling of try with finally
2020-10-20 09:07:10 -04:00
Matt Brown
8a2983e5e9
Fix #4336 - don’t merge sources twice for null coalesce
2020-10-15 09:57:37 -04:00
Matt Brown
4488d5fb1f
Use more accurate arguments count
2020-10-14 18:51:15 -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
4b401f0a77
Add more unused variable tests
2020-09-27 18:12:53 -04:00
Brown
4f28b38556
Fix unused var in finally false-positive
2020-09-25 10:20:22 -04:00
Brown
d879b4d199
Add more tests for unused variables
2020-09-25 00:14:27 -04:00
orklah
37a2f8a33d
unused use statements ( #4228 )
2020-09-22 01:10:46 -04:00
Brown
b501db6dd2
Skip currently-failing undefined variable test
2020-09-21 16:01:14 -04:00
Brown
6334c50c07
Add back necessary suppression
2020-09-20 21:25:35 -04:00
Brown
ef612ea598
Fix tests
2020-09-20 20:58:34 -04:00
Brown
17a0ecb60e
Fix regression – detect unused params with defaults again
2020-09-14 10:58:36 -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
f66d57f19d
add native return types ( #4116 )
...
* add native return types
* remove redundant phpdoc
2020-09-04 16:26:33 -04:00
Brown
92239add4d
Add some backwards-incompatible changes for 4.x
2020-08-30 11:44:14 -04:00
Bruce Weirdan
1cf5153700
Test parallelization ( #4045 )
...
* Run tests in random order
Being able to run tests in any order is a pre-requisite for being able
to run them in parallel.
* Reset type coverage between tests, fix affected tests
* Reset parser and lexer between test runs and on php version change
Previously lexer was reset, but parser kept the reference to the old
one, and reference to the parser was kept by StatementsProvider. This
resulted in order-dependent tests - if the parser was first initialized
with phpVersion set to 7.4 then arrow functions worked fine, but were
failing when the parser was initially constructed with settings for 7.3
This can be demonstrated on current master by upgrading to
nikic/php-parser:4.9 and running:
```
vendor/bin/phpunit --no-coverage --filter="inferredArgArrowFunction" tests/ClosureTest.php
```
Now all tests using PHP 7.4 features must set the PHP version
accordingly.
* Marked more tests using 7.4 syntax
* Reset newline-between-annotation flag between tests
* Resolve real paths before passing them to checkPaths
When checkPaths is called from psalm.php the paths are resolved, so we
just mimicking SUT behaviour here.
* Restore newline-between-annotations in DocCommentTest
* Tweak Appveyor caches
* Tweak TravisCI caches
* Tweak CircleCI caches
* Run tests in parallel
Use `vendor/bin/paratest` instead of `vendor/bin/phpunit`
* Use default paratest runner on Windows
WrapperRunner is not supported on Windows.
* TRAVIS_TAG could be empty
* Restore appveyor conditional caching
2020-08-23 10:32:07 -04:00
Brown
afce2dc66f
Tighten up rules around instantiation a bit more
2020-08-06 10:18:55 -04:00
Brown
fd4ced42a7
Don’t register new assignment inside isset expr
2020-07-31 12:44:01 -04:00
Brown
e55fe0a0e8
Fix #3188 - register global variables as by-reference ones
2020-04-19 13:15:04 -04:00
Matthew Brown
47c1470e3b
Refactor reference checks to use more appropriate properties
2020-03-28 16:30:56 -04:00
Matthew Brown
c85fa9083d
Fix #2915 - prevent "if (true)" and similar
2020-03-15 22:23:31 -04:00
Matthew Brown
b6380ae595
Fix false-positives around unevaluated code
2020-03-15 14:43:05 -04:00
Matthew Brown
aaf74f084a
Fix #2954 - filter out used vars before checking params
2020-03-13 20:21:49 -04:00