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

131 Commits

Author SHA1 Message Date
Bruce Weirdan
4a516005a3
Allow 0 for all bitmask types
Fixes vimeo/psalm#6119
2021-07-16 23:20:33 +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
Matthew Brown
832a190dd4
Support enums (#5699)
* Add initial enum preparation

* Support cases method

* Ignore bad use error

cc @weirdan

* Fix type
2021-05-03 17:54:09 -04:00
404db2bb1a
Fix JSON reports with long UTF8 strings (#5300)
* Fix JSON reports with long UTF8 strings

* CS fix

* UTF8-safe snippets
2021-03-01 11:23:21 -05:00
Matt Brown
0624098865 Ensure getId() output can always be parsed as a type
Ref #5105
2021-01-25 23:41:51 -05:00
Matt Brown
5f065d3d74 Turn template bound tuples into object
Ref #4714
2020-11-27 11:43:30 -05:00
Matt Brown
4ea87b9054 Add support for int-mask<...> and int-mask-of<...> 2020-10-30 13:28:45 -04:00
Matt Brown
62c15b2a4f Avoid crash when callable type is missing 2020-10-14 11:01:46 -04:00
Matt Brown
1f2d2764ab Fix #4287 - intersection of regular arrays should not result in crash 2020-10-07 17:47:17 -04:00
Brown
1f3215d36b Support more array intersections in type parsing 2020-09-14 12:13:33 -04:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
orklah
8c7423505a
add native param types (#4137)
* add native param types

* redundant phpdoc

* add more param types and adds "?" to nullable types

* remove redundant phpdoc

* add more param types and remove redundant phpdoc

* add more param types and remove redundant phpdoc
2020-09-06 19:36:47 -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
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
Brown
7253e01000 Fix #3716 - prevent crash for Foo|? return type 2020-06-29 17:52:55 -04:00
Matthew Brown
3d7288afcb Fix #3529 - static intersected with itself is static 2020-06-06 20:10:50 -04:00
Brown
118b700436 Simplify sink mapping for internal calls 2020-05-25 13:10:06 -04:00
Brown
8becefda04 Forbid :: in object-like key name
Ref #3399
2020-05-19 14:38:46 -04:00
Brown
813302206a Improve rendering of tuples 2020-05-11 09:08:53 -04:00
Brown
117a4d4d40 Require callable() have a return type when in conditional
Fixes #3260
2020-04-30 23:35:13 -04:00
Brown
bb1c8a9d74 Don’t clobber intersection types after generic in union
Fixes #3274
2020-04-30 23:15:16 -04:00
Brown
470bf807b7 Add better handling of expression termination 2020-04-30 22:23:37 -04:00
Brown
ce8fb459e9 Allow complex types in conditional is expressions
Ref #3277
2020-04-30 22:02:37 -04:00
Brown
05ff8d0142 Prevent invalid [] brackets in tree
Fixes #3246
2020-04-28 15:18:50 -04:00
Brown
d56c5c9782 Fix #3256 - fix parsing of colons in callable inside conditional 2020-04-28 10:55:17 -04:00
Pierre Grimaud
e7990390a6
Fix typos (#3255) 2020-04-28 09:17:31 -04:00
Brown
5e2af1d7f6 Fix #1518 - add escaping of object-like keys 2020-04-26 17:36:02 -04:00
lhchavez
be87bb7300
Support intersection types for object-like arrays (#3064)
This change allows expressing the intersection of multiple object-like
arrays. The resulting type will contain the (merged via intersection)
properties of all the object-like arrays involved in the intersection.

This should allow to express the resulting type of an `array_merge()`
operation, which is tricky to do in the context of a templated type.
2020-04-08 09:35:53 -04:00
Matthew Brown
6058725256 Add prototype for conditional return type 2020-03-22 10:44:48 -04:00
Matthew Brown
952045e2ba Fix return type checks 2020-02-22 11:28:24 -05:00
Brown
d5f71bf529 Localise template checks to class being tested 2020-02-06 16:38:45 -05:00
Matthew Brown
55c2f7faa2 Fix #2508 - don’t replace templated types with generic ones inside own function 2019-12-28 18:38:02 -05:00
Matthew Brown
068afa09d3 Add very basic implementation for class-string-map
Fixes #1969
2019-12-27 12:49:28 -05:00
Matthew Brown
ab03ac06f4 Add support for spread operator before type as well
Ref #2429
2019-12-19 00:29:01 +00:00
Brown
c9e77d30d6 Add return type 2019-12-11 11:29:26 -05:00
Brown
79f3a5d371 Allow empty string parsing 2019-12-11 10:52:46 -05:00
Matthew Brown
baef66061e Fix class-string test 2019-12-01 23:09:34 -05:00
Matthew Brown
abdf37afb8 Add workarounds for class-string tests 2019-11-30 12:57:18 -05:00
Brown
06653f6322 Fix #2362 - support single value type in docblocks 2019-11-21 10:44:24 -05:00
Jáchym Toušek
f2c82fa212 Add support for Iterator<X> type (#2285)
* Add support for Iterator<X> type

* Fix tests
2019-10-30 18:00:27 +00:00
lhchavez
216f991b0c Normalize stringified type names (#2239)
This change makes stringified types more normalized. Concretely it sorts
all union types, reconciled types, and sorts the keys within object-like
types.
2019-10-17 01:14:33 -04:00
Matthew Brown
a5f79353ed Fix #2157 - don’t merge closures and callable params 2019-09-22 00:58:30 -04:00
Brown
cf53f5d825 Ignore spaces when array keys have $ at start 2019-08-08 18:01:08 -04:00
Matthew Brown
da42be175f Apply PHPCS fixes
Fixes #1880
2019-07-05 16:27:53 -04:00
Matthew Brown
8aadf93402 Fix return type 2019-06-29 21:56:34 -04:00
Matthew Brown
62fb86aef0 Fix #1875 - improve printing of iterable type 2019-06-29 21:46:01 -04:00
Brown
ba121a94e7 Allow union of class-strings in signature
Ref #1851
2019-06-27 11:44:35 -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