-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5838 from derrabus/improvement/array-parameter-type
Introduce a `ArrayParameterType` enum
- Loading branch information
Showing
9 changed files
with
128 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Doctrine\DBAL; | ||
|
||
final class ArrayParameterType | ||
{ | ||
/** | ||
* Represents an array of ints to be expanded by Doctrine SQL parsing. | ||
*/ | ||
public const INTEGER = ParameterType::INTEGER + self::ARRAY_PARAM_OFFSET; | ||
|
||
/** | ||
* Represents an array of strings to be expanded by Doctrine SQL parsing. | ||
*/ | ||
public const STRING = ParameterType::STRING + self::ARRAY_PARAM_OFFSET; | ||
|
||
/** | ||
* Represents an array of ascii strings to be expanded by Doctrine SQL parsing. | ||
*/ | ||
public const ASCII = ParameterType::ASCII + self::ARRAY_PARAM_OFFSET; | ||
|
||
/** | ||
* Offset by which PARAM_* constants are detected as arrays of the param type. | ||
*/ | ||
private const ARRAY_PARAM_OFFSET = 100; | ||
|
||
/** | ||
* @internal | ||
* | ||
* @psalm-param self::INTEGER|self::STRING|self::ASCII $type | ||
* | ||
* @psalm-return ParameterType::INTEGER|ParameterType::STRING|ParameterType::ASCII | ||
*/ | ||
public static function toElementParameterType(int $type): int | ||
{ | ||
return $type - self::ARRAY_PARAM_OFFSET; | ||
} | ||
|
||
private function __construct() | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.