-
Notifications
You must be signed in to change notification settings - Fork 112
Enum support in query type inference #348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
7ffe41d
3a892cb
6562f27
499653f
37d7f7b
f416eeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ | |
| "doctrine/persistence": "^1.3.8 || ^2.2.1", | ||
| "nesbot/carbon": "^2.49", | ||
| "nikic/php-parser": "^4.13.2", | ||
| "ocramius/package-versions": "*", | ||
|
||
| "php-parallel-lint/php-parallel-lint": "^1.2", | ||
| "phpstan/phpstan-phpunit": "^1.0", | ||
| "phpstan/phpstan-strict-rules": "^1.0", | ||
|
|
@@ -41,7 +42,8 @@ | |
| }, | ||
| "sort-packages": true, | ||
| "allow-plugins": { | ||
| "composer/package-versions-deprecated": true | ||
| "composer/package-versions-deprecated": true, | ||
| "ocramius/package-versions": true | ||
| } | ||
| }, | ||
| "extra": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,10 @@ parameters: | |
|
|
||
| reportUnmatchedIgnoredErrors: false | ||
|
|
||
| bootstrapFiles: | ||
| - stubs/runtime/Enum/UnitEnum.php | ||
| - stubs/runtime/Enum/BackedEnum.php | ||
|
Comment on lines
+20
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes supporting PHP versions bellow 8.1 much easier Specifically, this allows code such as these to pass analysis: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to ignore these runtime stubs in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, done 👍 |
||
|
|
||
| ignoreErrors: | ||
| - | ||
| message: '~^Variable method call on Doctrine\\ORM\\QueryBuilder~' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <?php | ||
|
|
||
| if (\PHP_VERSION_ID < 80100) { | ||
| if (interface_exists('BackedEnum', false)) { | ||
| return; | ||
| } | ||
|
|
||
| interface BackedEnum extends UnitEnum | ||
|
Comment on lines
+3
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| { | ||
| /** | ||
| * @param int|string $value | ||
| * @return static | ||
| */ | ||
| public static function from($value); | ||
|
|
||
| /** | ||
| * @param int|string $value | ||
| * @return ?static | ||
| */ | ||
| public static function tryFrom($value); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <?php | ||
|
|
||
| if (\PHP_VERSION_ID < 80100) { | ||
| if (interface_exists('UnitEnum', false)) { | ||
| return; | ||
| } | ||
|
|
||
| interface UnitEnum | ||
| { | ||
| /** | ||
| * @return static[] | ||
| */ | ||
| public static function cases(): array; | ||
| } | ||
| } |