1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00
Commit Graph

70 Commits

Author SHA1 Message Date
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
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
Bruce Weirdan
b49c25ae76
Fixed tests
* Added new issue to the config.xsd
* Marked NoEnumProperties as PHP 8.1 issue
2021-11-06 22:22:38 +02:00
5fae548e62
Add template support to @psalm-self-out 2021-10-28 10:44:37 +02:00
Bruce Weirdan
b4f024b1fe
Basic enum checks
* Duplicate cases
* Duplicate case values
* Invalid case values: value on a pure enum case, missing value on a
backed enum case, backing type / case type mismatch
* Literal expression evaluation for case values

Fixes vimeo/psalm#6426
Fixes vimeo/psalm#6427
2021-09-07 12:35:38 +03:00
Bruce Weirdan
7b11024886
Flag invalid backing types for enums
Fixes vimeo/psalm#6428
2021-09-05 20:12:24 +03: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
6abce3525a
Enforce use sort (#5900) 2021-06-07 22:55:21 -04:00
Bruce Weirdan
86050df4d0
Formally deprecate allowCoercionFromStringToClassConst (#5897)
* Mark allowCoercionFromStringToClassConst as deprecated in xml schema

* Emit deprecation warning for `allowCoercionFromStringToClassConst`
2021-06-07 10:46:26 -04:00
Bruce Weirdan
fc29d26879
Added test to enforce that all supported annotations are documented (#4723)
* Added test to enforce that all supported annotations are documented

Well, at least mentioned.

Refs vimeo/psalm#3816

* Type things

* Make things pretty

* Only check @psalm- annotations, group

* Add documentation for `@psalm-require-extends` and `@psalm-require-implements`

* Dropped logicalOr that has become redundant

* Add explicit tag

* Document @psalm-template

* Add @psalm-template-covariant

* Document `@psalm-method`

* Add list of undocumented docblock annotations

Co-authored-by: Matthew Brown <github@muglug.com>
2020-11-27 21:48:16 -05:00
Matt Brown
ffabce19c5 Add complex issue error 2020-11-27 17:02:37 -05:00
Matt Brown
43af3b1a57 Break out TaintedInput issues into a lot of separate ones 2020-11-17 12:44:31 -05:00
Matt Brown
82f35c1454 Ensure Stringable is always available to tests that need it 2020-10-29 19:41:10 -04:00
Matt Brown
8f490f0f88 Skip faulty documentation key 2020-10-03 23:22:26 -04:00
orklah
37a2f8a33d
unused use statements (#4228) 2020-09-22 01:10:46 -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
940459787a Catch unmatched matches 2020-08-31 22:59:47 -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
Bruce Weirdan
22d8f5a0bc
Fixed duplicate shortcodes (#3996)
Also added an utility to help assign new shortcodes and a test to
prevent duplicate shortcodes.
2020-08-16 16:26:54 -04:00
Brown
6949a34ded Put RedundantIdentityWithTrue behind a flag cc @greg0ire 2020-07-30 10:25:59 -04:00
Bruce Weirdan
e569f08f23
Drop missing issues from XSD schema (#3657)
Two unknown issues (that were only present in schema) are dropped and a
test to validate that all issues are covered by XSD schema is added.
2020-06-23 16:56:39 -04:00
Matthew Brown
47c1470e3b Refactor reference checks to use more appropriate properties 2020-03-28 16:30:56 -04:00
Matthew Brown
51f92dd1e5 Don’t add php tag unnecessarily 2020-03-20 19:15:06 -04:00
Matthew Brown
7ba0d27d6c Fix formatting 2020-03-19 12:42:41 -04:00
Matthew Brown
2f62e2d9f5 Move issues to separate pages 2020-03-19 12:32:49 -04:00
Matthew Brown
933dff9e20 Fix #2712 - allow __toString to have more specific type 2020-01-29 22:28:40 -05:00
Brown
821f3528d2 Fix #701 - indicate issues fixable with Psalter 2019-12-02 15:24:01 -05:00
Brown
96586f16c0 Fix phpcs issues 2019-11-11 10:11:42 -05:00
Brown
af5f83602e Break out more specific possibly defined offset errors 2019-11-11 09:59:56 -05:00
Brown
c5ef2516b5 Fix #2150 - add detection for unnecessary @var annotations
And also remove them from codebase
2019-09-19 11:59:43 -04:00
Matthew Brown
2a5e0d8f39 Fix #1444 - track unused suppressions 2019-08-18 14:27:50 -04:00
Matthew Brown
b2c0993cdc Add framework for taint analysis to Psalm
Ref #611
2019-08-04 10:37:36 -04:00
Matthew Brown
da42be175f Apply PHPCS fixes
Fixes #1880
2019-07-05 16:27:53 -04:00
LeSuisse
f29826b958 Fully qualify constants and function calls (#1849)
This should give a small performance boost.
Part of #1837.

The change is enforced via phpcs and can be autofixed
with phpcbf.
2019-06-26 16:52:29 -04:00
Matthew Brown
7a1a728cee Move docs into subfolders 2019-06-09 00:54:13 -04:00
Brown
b00d51b7db Allow misplaced required params so Psalm still inspects the code 2019-06-07 09:25:12 -04:00
Brown
0bd4dbcbc4 Bump to PHP 7.1
Fixes #1650
2019-05-16 18:36:36 -04:00
Brown
d1574a64a4 Move issue type listing 2019-05-03 15:29:44 -04:00
Brown
0e4c8ce482 Split apart TypeCoercion issues, allowing more granular issue filtering 2019-04-25 18:02:19 -04:00
bugreportuser
976c2c5ef3 Add an error for throws in global scope 2019-03-24 23:03:37 -04:00
Matthew Brown
c772914910 Add some formatting 2019-03-23 14:27:54 -04:00
Bruce Weirdan
ec85096c96 Fixed identified issues 2019-03-02 08:43:19 -05:00
Matthew Brown
a6755cc523 Fix default test versions to 7.3 2019-02-07 15:27:43 -05:00