1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 17:52:45 +01:00
Commit Graph

59 Commits

Author SHA1 Message Date
orklah
b633619a2c Merge remote-tracking branch 'upstream/4.x' into upstream-master 2022-01-14 21:01:25 +01:00
orklah
d52c3f0117
Merge pull request #7163 from dvz/explicit-symlink-resolution
Add explicit `resolveSymlinks` option for project directories
2022-01-10 21:50:08 +01:00
orklah
611583c481
Merge pull request #7354 from wouterj/issue-7353/issuehandlers-elements
Support multiple <issueHandlers> elements
2022-01-10 21:34:43 +01:00
Wouter de Jong
f92841f2df Only pass existing paths to realpath()
`realpath()` returns `false` if the path does not exists. This caused
these tests to not test what they were expected to (due to `false` being
transformed into `""`, which never matches the project paths).
2022-01-09 14:23:48 +01:00
Wouter de Jong
e4e9edda27 Support multiple <issueHandlers> elements
This is likely to occur when including multiple Psalm config files.
2022-01-09 14:11:03 +01:00
Bruce Weirdan
1a1b5a9e6a
Merge branch '4.x' into upstream-master 2022-01-08 23:38:29 +02:00
Stefan Vetsch
7f2f0d99ec Issue #7243: Do not throw exception on xinclude with fallbacks 2022-01-07 09:40:19 +01:00
Bruce Weirdan
8726065d21
Applied ClosureToArrowFunctionRector 2022-01-06 00:48:04 +02:00
Bruce Weirdan
5758d31161
Apply literal number separator rector
I opted for customary 3-digit groups, except version id, where 2-digit
groups are used to match the version id encoding.
2022-01-05 01:00:05 +02:00
orklah
b658b2738f
remove exitFunctions 2022-01-02 15:20:01 +02:00
Tomasz Mlynski
daaa74ce41 Merge branch 'master' into explicit-symlink-resolution 2021-12-22 18:42:55 +01:00
S.M. Ataur Rahman
e408abf119 Fixed ignoreTypeStats & useStrictTypes flag value detection for directories in config 2021-12-18 19:59:25 +06:00
rarila
97e6511fab Set number of lines before and after namespace. 2021-12-15 04:58:32 +01:00
Tomasz Mlynski
1da6893451
Add resolveSymlinks condition for project directories 2021-12-14 20:25:27 +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
30a65685a2 Import instead of using fqn classes 2021-12-03 21:40:18 +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
7660dc2f3e
Merge pull request #7009 from rarila/fix-symlink-test-error 2021-11-28 01:47:33 +02:00
ralila
2e56fcac93 Fix test on Windows 2021-11-28 00:18:13 +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
ralila
fdaed941ad use return type hints instead of php doc "@return void" 2021-11-26 20:59:41 +01:00
orklah
96ae8e7600
Merge pull request #6793 from orklah/unevaluatedCode
emit UnevaluatedCode after exit or never returning functionlike
2021-11-01 23:41:36 +01:00
orklah
e2bb9859e4 fix tests 2021-11-01 22:27:43 +01:00
Bruce Weirdan
f660ff4f83
Move ForbiddenCode-related tests to the corresponding test file 2021-10-31 02:43:17 +03:00
Guillaume Messier
666367fbd5 Add unit test 2021-09-23 15:30:30 +00:00
Roland Franssen :)
9a6ae5a27a test 2021-09-02 20:53:23 +02:00
Bruce Weirdan
76be96ce53
Drop FakeFileProvider from tests folder
And use Psalm\Internal\Provider\FakeFileProvider
2021-07-02 03:57:57 +03:00
Bruce Weirdan
f24f361a95
Add documentation and schema entry for inferPropertyTypesFromConstructor
Fixes vimeo/psalm#5974
2021-06-22 21:20:10 +03:00
Bruce Weirdan
6abce3525a
Enforce use sort (#5900) 2021-06-07 22:55:21 -04:00
Oliver Hader
e457a7d5af
[FEATURE] Allow plugins to declare their custom scanner or analyzer (#5883)
* [FEATURE] Allow plugins to declare their custom scanner or analyzer

Related: #5882

* [TEST] Check plugin declaring own scanner/analyzer

* [TASK] Document plugins declaring scanner or analyzer

* [TEST] Clean up code

* [!!!][TASK] Extend Psalm\Plugin\RegistrationInterface

* add method `addFileTypeScanner(string $fileExtension, string $className): void`
* add method `addFileTypeAnalyzer(string $fileExtension, string $className): void`

* [TASK] Ignore IntelliJ/PhpStorm workspace folder in VCS

* [TASK] Remove superfluous class import
2021-06-04 15:32:53 -04:00
orklah
ff0c1ce567
update hardcoded Psalm version (#5783)
* change hardcoded Psalm version to something more recent

* change hardcoded Psalm version to something more recent
2021-05-17 08:27:08 -05:00
Bruce Weirdan
e3d73a3166
Allow suppressing thrown interfaces and their descendants (#5178)
Fixes vimeo/psalm#5177
2021-02-07 21:08:29 -05:00
feek
cc684eeccd
feature: ensure universal object crate class exists (#4375) 2020-10-20 17:17:49 -04:00
feek
8d2db4e673
feature: universal object crates (#3948)
* feature: universal object crates

* docs: document universal object crate config option

Co-authored-by: Matthew Brown <github@muglug.com>
2020-10-07 09:56:21 -04:00
Matt Brown
db4d5bca95 Fix tests 2020-10-05 10:14:39 -04:00
orklah
37a2f8a33d
unused use statements (#4228) 2020-09-22 01:10:46 -04:00
orklah
b19f0a7034
Remove empty() and use strict comparison when safe (#4211)
* replace empty usage with stricter checks

* use strict comparison when safe

* replace is_null with === null for consistency
2020-09-19 18:26:51 -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
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
Nat Zimmermann
a1a403e046
make meta path optional (#3833) 2020-07-17 10:09:42 -04:00
kesselb
aaba3a08ec
Add option to supress a referenced but undefined global variable. (#3827) 2020-07-16 09:49:59 -04:00
Brown
f6aa9cb11b Relocate tests 2020-06-04 16:07:00 -04:00
Brown
4b1c3db760 Don’t memoize method call where we have a getter standin
Fixes #3427
2020-05-22 15:54:32 -04:00
Matthew Brown
43189b3d55 Allow types to be traversed 2020-03-14 23:54:51 -04:00
Matthew Brown
ced092874a Make config generation smarter 2020-02-17 22:05:58 -05:00
Philip Hofstetter
f6983fd883 allow setting php version from config or composer.json
if a composer.json is present and a PHP version requirement is
configured, we set the php version to the minimal PHP version that
satisfies the composer requirement.

Additionally, this adds a `phpVersion` attribute to the <psalm> tag. If
that's set, it takes precedence over what has been detected in
composer.json.

And finally, the --php-version command line flag continues to work and
takes precedence over the setting in the <psalm> tag

this fixes #2628
2020-01-30 08:48:53 -05:00