-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
fix: Allow enum param types: ArrayParameterType and ParameterType #1408
Conversation
Fixes doctrine#1407 A bit lame fix, but it looks like we did not really use other int types before anyway With this change we can use DBAL v4 new enum types: `ArrayParameterType` and `ParameterType`. Bumping version of DBAL to 3.6 as before that `ArrayParameterType` did not exist.
Thank you. Please add a test that covers your change. |
@@ -53,7 +55,7 @@ public function formatParameters(array $params, array $types): string | |||
return sprintf('with parameters (%s)', implode(', ', $formattedParameters)); | |||
} | |||
|
|||
private function formatParameter(mixed $value, string|int $type): string|int|bool|float|null | |||
private function formatParameter(mixed $value, string|int|ArrayParameterType|ParameterType $type): string|int|bool|float|null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should change the type to mixed
. After all, the method discards any value that is not a string anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@derrabus pushed - if we ok with mixed, then I can even change back the bump in composer.json, but then we would not have a test case for ArrayParameterType as it does not exist in DBAL 3.5
tests/Doctrine/Migrations/Tests/InlineParameterFormatterTest.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Alexander M. Turek <me@derrabus.de>
@derrabus thanks! |
Thank you! |
* 3.7.x: fix: Allow enum param types: ArrayParameterType and ParameterType (#1408)
Let's do the bump in #1411. |
* 3.8.x: Raise PHPStan level to 8 (doctrine#1409) Remove unused paramaters from DiffCommand and VersionCommand (doctrine#1386) Simplify InlineParameterFormatterTest (doctrine#1411) fix: Allow enum param types: ArrayParameterType and ParameterType (doctrine#1408)
* 3.8.x: Raise PHPStan level to 8 (doctrine#1409) Remove unused paramaters from DiffCommand and VersionCommand (doctrine#1386) Simplify InlineParameterFormatterTest (doctrine#1411) fix: Allow enum param types: ArrayParameterType and ParameterType (doctrine#1408)
* 3.8.x: Fix CS Raise PHPStan level to 8 (doctrine#1409) Remove unused paramaters from DiffCommand and VersionCommand (doctrine#1386) Simplify InlineParameterFormatterTest (doctrine#1411) fix: Allow enum param types: ArrayParameterType and ParameterType (doctrine#1408)
Summary
Fixes #1407
A bit lame fix, but it looks like we did not really use other int types before anyway
With this change we can use DBAL v4 new enum types:
ArrayParameterType
andParameterType
.Bumping version of DBAL to 3.6 as before thatArrayParameterType
did not exist.Just to note - the problem itself is ONLY with DBAL 4.0+ as on 3.6 these types were classes with constants, not enums.