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

93 Commits

Author SHA1 Message Date
Matt Brown
9dde8eed9d Add support for literal-int annotations as well 2021-06-14 23:24:09 -04:00
Matt Brown
5ae8b2a23f Add preliminary support for literal-string 2021-06-14 15:30:25 -04:00
Bruce Weirdan
6abce3525a
Enforce use sort (#5900) 2021-06-07 22:55:21 -04:00
orklah
ab1732de66
combining never/empty twice gives never (#5756) 2021-05-12 18:46:37 -04:00
Matt Brown
0f7aaa5405 Fix #5696 - combinations of scalars should remove empty-scalar 2021-05-01 20:13:49 -04:00
AndrolGenhald
d022910599
ConcatAnalyzer improvements and non-falsy-string fixes. (#5544)
* ConcatAnalyzer improvements.

Deduplicate code.
Improve type inference.
Allow literal type inference when only one side has multiple types (fixes #5483).
Fix invalid type inference with negative int as right operand.

* Fix inference to be lowercase-string when concatenating int.

* Fix TNonEmptyLowercaseString to not be subtype of TNonFalsyString.

'0' is a non-empty-lowercase-string that is falsy.

* Fix other issues with non-falsy-string.

* Nest ands and ors

Co-authored-by: Matthew Brown <github@muglug.com>
2021-03-31 23:16:21 -04:00
Bruce Weirdan
ec7de89f0c
Do not let string subtypes subsume class-strings (#5497)
Previously, Psalm would treat unions like `class-string|numeric-string`
as `numeric-string`, while the only case when string should subsume
`class-string` is when we're combining `class-string` with non-specific
`string`.

Fixes vimeo/psalm#5491
2021-03-28 23:12:23 -04:00
Matt Brown
ff325b3e70 Fix #5141 - combine numeric-string and non-empty-string to non-empty-string 2021-02-03 17:40:41 -05:00
Matt Brown
a0420fb704 Add non-falsy-string to allow more accurate checks 2021-02-03 17:19:48 -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
bca58863ad Fix #5017 - handle combining literal and non-empty strings 2021-01-17 12:22:29 -05:00
Matt Brown
df2ec48018 Don’t erase already-known literal ints
Fixes #4644
2020-11-21 18:26:13 -05:00
Matt Brown
f0ae0e5cb4 Break aparat type combiner 2020-11-21 18:11:29 -05:00
Brown
0ae436d335 Fix a couple of false-positive redundant conditions 2020-09-19 18:12:14 -04:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
92239add4d Add some backwards-incompatible changes for 4.x 2020-08-30 11:44:14 -04:00
Brown
7fc4a85534 Fix CI 2020-08-03 02:45:55 -04:00
Brown
74eea18563 Add better checks 2020-07-26 19:09:26 -04:00
Brown
7ef3d4711f Fix some more tests 2020-07-21 23:16:56 -04:00
Brown
2312523318 Support merging of numeric-string with literal 2020-05-18 16:56:09 -04:00
Brown
7dfa37beb2 Improve ergonomics of array assignment 2020-04-11 17:50:24 -04:00
Brown
bd2104c5ba Merge with mixed in nested arrays 2020-04-09 09:27:21 -04:00
Matthew Brown
43189b3d55 Allow types to be traversed 2020-03-14 23:54:51 -04:00
Brown
3c416482ec Fix #2932 - don’t crash when trying to expand callable object-like array 2020-03-09 10:56:37 -04:00
Matthew Brown
952045e2ba Fix return type checks 2020-02-22 11:28:24 -05:00
Matthew Brown
365236a6bb Replace assertion with type 2020-01-29 23:55:27 -05:00
Matthew Brown
5eb2ebc508 Add more type-system protections for bad array args 2020-01-29 23:41:17 -05:00
Matthew Brown
9fa2db1b6c Move Union::getTypes to Union::getAtomicTypes 2020-01-04 12:20:26 -05:00
Brown
9177b410cb Fix reconciliation of callable 2020-01-02 16:59:19 -05:00
Matthew Brown
d5f4c24ee0 Fix combining class string types with explicit ones 2019-12-01 23:03:09 -05:00
Matthew Brown
a8c2b7a525 Fix #2400 - string should subsume class-string 2019-11-30 12:32:31 -05: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
Brown
16c33d1565 Add support for list type
Fixes #2209
2019-10-08 18:44:46 -04:00
Matthew Brown
a5f79353ed Fix #2157 - don’t merge closures and callable params 2019-09-22 00:58:30 -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
Brown
7b4dbb1c85 Fix #1826 - don’t allow mixed unions when combining with object-like array 2019-06-20 20:13:36 -04:00
Matthew Brown
a553adb232 Fix test array spacing 2019-06-16 09:42:34 -04:00
Matthew Brown
fe0f352132 Fix #1628 - improve behaviour of unset in loops 2019-05-13 11:00:17 -04:00
Brown
b7529e872b Consider intersections when combining generic types 2019-05-08 13:23:47 -04:00
Brown
751253ddf0 Fix #1603 - prevent invalid covariant template classes from being passed 2019-05-06 16:38:08 -04:00
Matthew Brown
c772914910 Add some formatting 2019-03-23 14:27:54 -04:00
Bruce Weirdan
9bdc9f774f More provider typing 2019-03-02 08:43:19 -05:00
Bruce Weirdan
ec85096c96 Fixed identified issues 2019-03-02 08:43:19 -05:00
Brown
0f45d14fea Only collapse Traversable|array when we’re super sure it’s safe
Fixes #1333
2019-02-15 11:07:08 -05:00
Brown
0bb5143efd Fix #1254 - merge literal and class-strings types into string 2019-01-29 10:34:31 -05:00
Matthew Brown
22ee72808a Remove a bunch of hacks around generic offsets
Also fixes #1245
2019-01-26 16:58:49 -05:00
Brown
55913699d3 Allow iterable to subsume array and traversable
Fixes #1242
2019-01-25 14:43:16 -05:00
Matthew Brown
9d8c2792e2 Add array-key type and improve general type handling
Fixes #1144
2019-01-05 00:15:53 -05:00
Brown
72c50be4b0 Fix build 2018-12-19 20:01:27 -05:00