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

85 Commits

Author SHA1 Message Date
AndrolGenhald
cc2334f40d More class const improvements.
Add InvalidClassConstType issue as alternative to LessSpecificClassConstType when type isn't contravariant.
Handle final class consts (#6395).
Use double quotes for types in class const issues.
2022-02-13 17:19:25 -06:00
Bruce Weirdan
11e60fa261
Merge branch '4.x' into upstream-master 2022-02-11 03:51:48 +02:00
Bruce Weirdan
f61193b798
Reinstate MethodSignatureMustProvideReturnType
It's never emitted, but is there for BC.
2022-01-31 23:38:15 +02:00
Bruce Weirdan
603714518b
Revert "PHP 8.1: Report missing typehints in overridden native methods" 2022-01-31 14:37:42 +02:00
AndrolGenhald
b68c6116d8 Use PHP 8.1 when testing AmbiguousConstantInheritance. 2022-01-25 15:49:09 -06:00
orklah
af1888b631 Merge remote-tracking branch 'upstream/4.x' into upstream-master4 2022-01-22 17:48:42 +01:00
orklah
5c4be6bc21
Merge pull request #7435 from orklah/old-phpunit
drop phpunit compatibility aliases
2022-01-19 20:36:44 +01:00
orklah
52a7f0694e drop compatibility aliases 2022-01-19 19:29:16 +01:00
1914be4ca1
Rollback 2022-01-19 12:44:55 +01:00
orklah
dceaa117cf remove forbidEcho 2022-01-18 18:25:18 +01:00
orklah
b633619a2c Merge remote-tracking branch 'upstream/4.x' into upstream-master 2022-01-14 21:01:25 +01:00
AndrolGenhald
ceb5644d5b Add script to generate issues.md. 2022-01-12 15:22:21 -06:00
AndrolGenhald
240032568c Add test for issues.md to ensure all documented issues are listed. 2022-01-12 14:29:23 -06:00
Bruce Weirdan
8726065d21
Applied ClosureToArrowFunctionRector 2022-01-06 00:48:04 +02:00
Philip Hofstetter
fdeb1954c2
update docs for enum case deprecation 2021-12-22 06:16:42 +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
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