1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +01:00
Commit Graph

30 Commits

Author SHA1 Message Date
Matt Brown
25505b4b03
Fix #4976 - improve type narrowing 2021-01-29 11:47:31 +01:00
Matt Brown
f8e22ab7ac
Break out array_key_exists tests 2021-01-29 11:47:12 +01:00
Matt Brown
024bbef5cd
Fix #4743 - simplify assertions generated from array_key_exists check 2021-01-29 11:47:09 +01:00
Matt Brown
3b3239635b
Fix #4626 - array_key_exists should infer type for first arg where possible 2021-01-29 11:46:16 +01:00
Matt Brown
7b4f0745f5
Simplify assertion negations, centralising as much as possible
Now the flag passed to scrapeAssertions just determines the errors emitted
2021-01-29 11:46:16 +01:00
Matt Brown
6f9be03789
Revert "Fix #4624 - allow in_array to work with list arrays"
This reverts commit 08ae85a735.
2021-01-29 11:46:16 +01:00
Matt Brown
191f305aec
Fix #4624 - allow in_array to work with list arrays 2021-01-29 11:46:15 +01:00
Matt Brown
01781af718
Fix #4306 - negating positive-numeric is useless, avoid crash 2021-01-29 11:39:51 +01:00
Matt Brown
9bbb11599a
4.x - change/remove some default config values 2021-01-29 11:39:48 +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
eae55eb584
Fix #4093 - prevent redundant condition in presence of positive-int 2021-01-29 11:38:50 +01:00
Brown
5835eec863
Fix #4061 - allow indirect null comparison check 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
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
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
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
ea0a670230 Flesh out class constants in function call return type
Fixes #2884
2020-02-26 17:28:44 -05:00
Matthew Brown
9f13341ef9 Fix #2827 - detect literal numeric values 2020-02-22 00:16:15 -05:00
Brown
b87161785d Be even more permissive 2020-02-13 17:58:15 -05:00
Brown
cecc5ed798 Move constant tests 2020-02-07 10:47:42 -05:00
Matthew Brown
e92656c4cb Fix #2707 - reconcile object equality properly 2020-01-29 21:25:44 -05:00
SignpostMarv
fbf66ba7f6 Typecast bool to int (#2550)
* adding specific checks for typecasting booleans, re: vimeo/psalm#2548

* satisfying phpcs

* amend check to use psalm types rather than php-parser types

* implementing tests for typecasting bools to int

* satisfying phpcs
2020-01-04 16:36:19 -05:00
Matthew Brown
d7fdd9b179 Move more tests into appropriate directory 2019-12-07 13:38:06 -05:00