Skip to content

Commit

Permalink
Merge pull request #5842 from derrabus/bugfix/restore-offset-constant
Browse files Browse the repository at this point in the history
Restore `Connection::ARRAY_PARAM_OFFSET`
  • Loading branch information
derrabus authored Dec 30, 2022
2 parents 7e0d352 + 8a36759 commit d54b3d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/ArrayParameterType.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@ final class ArrayParameterType
/**
* Represents an array of ints to be expanded by Doctrine SQL parsing.
*/
public const INTEGER = ParameterType::INTEGER + self::ARRAY_PARAM_OFFSET;
public const INTEGER = ParameterType::INTEGER + Connection::ARRAY_PARAM_OFFSET;

/**
* Represents an array of strings to be expanded by Doctrine SQL parsing.
*/
public const STRING = ParameterType::STRING + self::ARRAY_PARAM_OFFSET;
public const STRING = ParameterType::STRING + Connection::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;
public const ASCII = ParameterType::ASCII + Connection::ARRAY_PARAM_OFFSET;

/**
* @internal
Expand All @@ -33,7 +28,7 @@ final class ArrayParameterType
*/
public static function toElementParameterType(int $type): int
{
return $type - self::ARRAY_PARAM_OFFSET;
return $type - Connection::ARRAY_PARAM_OFFSET;
}

private function __construct()
Expand Down
7 changes: 7 additions & 0 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ class Connection
*/
public const PARAM_ASCII_STR_ARRAY = ArrayParameterType::ASCII;

/**
* Offset by which PARAM_* constants are detected as arrays of the param type.
*
* @internal Should be used only within the wrapper layer.
*/
public const ARRAY_PARAM_OFFSET = 100;

/**
* The wrapped driver connection.
*
Expand Down

0 comments on commit d54b3d0

Please sign in to comment.