1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00
Commit Graph

37 Commits

Author SHA1 Message Date
Matthew Brown
2358b96f54
Fix merge errors 2022-01-03 04:10:39 +02:00
Philip Hofstetter
e8e968e8c2
recognize Deprecated attribute on enum cases
just like with properties, this recognizes both `Psalm\Deprecated` and
`JetBrains\PhpStorm\Deprecated`
2021-12-22 06:16:42 +01:00
rarila
97e6511fab Set number of lines before and after namespace. 2021-12-15 04:58:32 +01:00
Ricardo Boss
2ec77fe29c Make name property of enum cases return non-empty-strings (vimeo/psalm#6964) 2021-12-06 00:33:57 +01:00
ralila
8fb2e0f885 Handle some partials 2021-12-04 21:55:53 +01:00
Bruce Weirdan
806db287d2
Infer ::from() and ::tryFrom() return types on backed enums
Fixes vimeo/psalm#6429
2021-11-28 09:47:01 +02:00
Bruce Weirdan
ac903c5634
Include enum cases in const wildcards
Refs vimeo/psalm#6471
2021-11-28 05:49:39 +02:00
Bruce Weirdan
97445b52f3
Correctly process constant references on enum-valued variables 2021-11-27 04:32:32 +02:00
Bruce Weirdan
f215ed28d0
Drop special handling of constant references on enums
Internally enum cases are constants, and they should be resolved as
such.

Fixes vimeo/psalm#6994
2021-11-26 06:00:01 +02:00
orklah
049285add2 allow using EnumCase in an Attribute 2021-11-24 19:43:43 +01:00
Bruce Weirdan
0a9154b8bb
Allow references to enum cases in class constants 2021-11-15 05:56:09 +02:00
Bruce Weirdan
68495be147
Forbid declaring enums as attributes
This is in line with current Psalm behavior. We forbid non-instantiable
classlikes as attributes, including abstract classes and classes with
non-public constructors.

Refs vimeo/psalm#6841
2021-11-07 01:47:11 +02:00
Bruce Weirdan
9210bbcdd4
Forbid enum instantiation
Fixes vimeo/psalm#6837
2021-11-07 00:14:37 +02:00
Bruce Weirdan
59e63c3235
Merge pull request #6839 from weirdan/forbid-enum-properties 2021-11-06 23:15:09 +02:00
Bruce Weirdan
f0f085e084
Add test for NoEnumProperties
This was somehow missed from vimeo/psalm#6836
2021-11-06 22:52:17 +02:00
orklah
18677bb108 better understands value and name properties for enum 2021-11-06 21:49:42 +01: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
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
Matt Brown
698adeff07 Rename incorrectly-named test 2021-04-25 18:26:00 -04:00
AndrolGenhald
d4590711d6
Fix object-like array keys when combining string and automatic keys (fixes #5427). (#5428)
* Fix object-like array keys (fixes #5427).

* Fix incorrect return types for tests.

* Fix false positive list with literal int key.
2021-03-19 21:44:44 -04:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
4a434d9a2f Add separate issue for undefined classes in docblocks 2019-05-15 18:41:26 -04:00
Bruce Weirdan
9bdc9f774f More provider typing 2019-03-02 08:43:19 -05:00
Bruce Weirdan
8408effe57 Dropped unused uses 2019-02-17 13:17:45 -05:00
Matthew Brown
09ee6e3d13 Fix #1253 - prevent ints from coercing to literal floats 2019-01-27 23:21:54 -05:00
Matthew Brown
89999fd554 Add suppport for float enums
Fixes #1099
2019-01-27 18:34:13 -05:00
Brown
f5a81249e0 Fix #1202 - don’t allow undefined constants in enums 2019-01-15 11:31:13 -05:00
Matthew Brown
4688b25fd9 Move internal classes to own namespace 2018-11-12 11:20:59 -05:00
Matthew Brown
b9018a4a03 Fix #936 - add support for class constants in enums 2018-08-08 23:12:12 -04:00
Matthew Brown
97bca6d762 Fix const test name 2018-08-08 21:46:37 -04:00
Matthew Brown
9880e2bede Prevent leading-number constants in docblocks 2018-08-08 21:36:33 -04:00
Matthew Brown
d9af167e38 Fix #931 - replace self in enum declaration where possible 2018-08-08 20:59:21 -04:00
Matthew Brown
55be2c3ce4 Fix #934 - allow numbers in class constant enums 2018-08-08 20:36:16 -04:00
Matthew Brown
228337415b Fix #761 - add support for class constants in enums 2018-05-21 00:46:56 -04:00
Matthew Brown
19ca1c9311 Suppress enum redundant conditions too 2018-05-20 18:58:34 -04:00
Matthew Brown
6250c2a14c Fix #16 - add support for enums 2018-05-20 17:19:53 -04:00