1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00
Commit Graph

138 Commits

Author SHA1 Message Date
Matt Brown
0f8b017384
Prevent features pre-php-8 2021-01-29 11:39:54 +01:00
Matt Brown
278a306681
Do arithmetic for preg_split arguments 2021-01-29 11:39:53 +01:00
Matt Brown
01781af718
Fix #4306 - negating positive-numeric is useless, avoid crash 2021-01-29 11:39:51 +01:00
Matt Brown
3f5cb4db1f
Warn about impossible/redundant conditions in RHS of || 2021-01-29 11:39:50 +01:00
Matt Brown
d1b81e9b80
Improve error message 2021-01-29 11:39:50 +01:00
Matt Brown
2a755cce8c
Always check LHS of or condition before applying to RHS 2021-01-29 11:39:49 +01:00
Matt Brown
9bbb11599a
4.x - change/remove some default config values 2021-01-29 11:39:48 +01:00
Matt Brown
956199c688
4.x - add support for the nullsafe operator 2021-01-29 11:39:47 +01:00
orklah
e3e5a55907
unused use statements (#4228) 2021-01-29 11:39:42 +01:00
Brown
ec64ae930a
Fix a couple of false-positive redundant conditions 2021-01-29 11:39:38 +01:00
orklah
db45ff1ba4
More return types (#4173)
* add native return types

* redundant phpdoc
2021-01-29 11:38:57 +01:00
Brown
568cbfb1be
Fix tests 2021-01-29 11:38:56 +01:00
Brown
b84e88f342
Fix #4154 - treat literal numeric strings as numeric 2021-01-29 11:38:56 +01:00
orklah
61512da144
add native return types (#4116)
* add native return types

* remove redundant phpdoc
2021-01-29 11:38:53 +01:00
Brown
e3d7d0315a
Fix #4109 - detect duplicate match condition 2021-01-29 11:38:52 +01:00
Brown
eae55eb584
Fix #4093 - prevent redundant condition in presence of positive-int 2021-01-29 11:38:50 +01:00
Brown
c96ba8d1f5
Add some backwards-incompatible changes for 4.x 2021-01-29 11:38:48 +01:00
Brown
5835eec863
Fix #4061 - allow indirect null comparison check 2021-01-29 11:38:46 +01:00
Brown
6d43a6696c
Make clause fully immutable 2021-01-29 11:38:46 +01:00
Bruce Weirdan
dabfb16e34
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
2021-01-29 11:38:04 +01:00
Matthew Brown
cb243778d2 Fix #3917 - allow comparisons between classes and interfaces 2020-08-16 16:25:59 -04:00
Tom Klingenberg
04b6dfdc5b
Fix PSR-4 deprecation notices on composer install (#3959)
Previously when checking out the repository and installing the source
package via `$ composer install` composer did spill deprecation notices for
four files not complying with the PSR-4 auto-loading standard.

This is a minor issue, composer install works and can be addressed by
fixing name-spaces (all of those three are in tests).

For the one function test, fixing the directory structure / dirname of the
(single) affected function test (fourth file).
2020-08-07 23:22:30 -04:00
Brown
c0b0036109 Fix #3934 - prevent unsafe use of new static 2020-08-05 19:39:27 -04:00
Brown
e0f5595307 Fix #3932 - try to get assertions of negated expression if instant negation fails 2020-08-05 16:53:30 -04:00
Brown
fd4ced42a7 Don’t register new assignment inside isset expr 2020-07-31 12:44:01 -04:00
Brown
57cd21346c Fix #3914 - treat $i++ like $i = $i + 1 2020-07-31 11:26:54 -04:00
Brown
a8c0d81dc1 Prevent bool > 1 in strict mode 2020-07-30 11:25:47 -04:00
Brown
74eea18563 Add better checks 2020-07-26 19:09:26 -04:00
Brown
d9d5fdd6c9 Add more rules around positive ints 2020-07-26 18:29:17 -04:00
Matthew Brown
1d077cc48e Fix #3894 - don’t alter class-string during erroneous emptiness check 2020-07-25 22:49:19 -04:00
Brown
7ef3d4711f Fix some more tests 2020-07-21 23:16:56 -04:00
Brown
76bd5b6278 Refactor type comparison 2020-07-21 19:40:35 -04:00
ygottschalk
de2109234d
fixes wrong return type of key() #3838 (#3839)
* fixes wrong return type of key() #3838
fixed/added tests for key

* fixed test again
2020-07-20 04:49:36 -04:00
Brown
06ee1b71c7 Improve check for empty array 2020-07-15 09:49:30 -04:00
Brown
0ab163fd78 Skip dodgy tests 2020-07-15 01:53:31 -04:00
Brown
f0a5463834 Catch string subtypes that cannot be identical 2020-07-14 10:08:31 -04:00
Brown
68fe66fcf6 Fix tests 2020-06-25 01:33:02 -04:00
Brown
7a7cd91c24 Fix #3631 - better treatment for assignments in complex conditionals 2020-06-24 13:16:52 -04:00
Brown
4d6fc4d0ca Fix get_class($foo) === static::class checks 2020-06-23 13:11:19 -04:00
Brown
1f86afece7 Revert "Fix #3631 - apply assertions to RHS of equality in conditional"
This reverts commit 9c17795545.
2020-06-22 20:01:27 -04:00
Brown
9c17795545 Fix #3631 - apply assertions to RHS of equality in conditional 2020-06-22 15:16:16 -04:00
Brown
9ca6c868b7 Fix #3563 - add workaround for == true 2020-06-12 10:58:44 -04:00
Matthew Brown
806db80d63 Fix #3440 - literal string doesn’t contain numeric-string 2020-05-24 22:42:08 -04:00
SignpostMarv
911ac2d363
Infer numeric-string from (string)$numeric (#3390)
* adding test for vimeo/psalm#3370

* check if typecast will result in numeric-string

* int & float as per examples in vimeo/psalm#3370
* numeric & numeric-string because they shouldn't lose numericness.

* satisfy phpcs

* adjusting assertions to reflect typecasting change
2020-05-18 13:42:47 -04:00
Brown
21798efed2 Fix #3388 - eliminate null after < 0 check 2020-05-18 08:52:44 -04:00
Brown
ae48c1895f Fix #3365 - add support for negated empty string checks 2020-05-14 22:09:37 -04:00
Brown
2d5c2a9dd1 Fix #3324 - prevent crash asserting on possibly-undefined variable 2020-05-08 14:21:10 -04:00
Pierre Grimaud
e7990390a6
Fix typos (#3255) 2020-04-28 09:17:31 -04:00
Brown
a25610cefd Fix #3133 - prevent crash when analysing isset 2020-04-13 08:34:38 -04:00
Brown
73f8f963fa Expand out class constants as early as possible
Fixes #3128
2020-04-12 20:38:36 -04:00