-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
303 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
use PhpCsFixer\Config; | ||
USE PhpCsFixer\Finder; | ||
|
||
$header = <<<'EOF' | ||
AJGL Doctrine DBAL Types | ||
Copyright (C) Antonio J. García Lagar <[email protected]> | ||
For the full copyright and license information, please view the LICENSE | ||
file that was distributed with this source code. | ||
EOF; | ||
|
||
return (new Config()) | ||
->setRiskyAllowed(true) | ||
->setRules( | ||
[ | ||
'@PER-CS' => true, | ||
'@PER-CS:risky' => true, | ||
'@PHP81Migration' => true, | ||
'@PHP80Migration:risky' => true, | ||
'header_comment' => ['header' => $header], | ||
] | ||
) | ||
->setFinder(Finder::create()->in(__DIR__)) | ||
; |
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 |
---|---|---|
@@ -1,5 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* AJGL Doctrine DBAL Types | ||
* | ||
* Copyright (C) Antonio J. García Lagar <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ajgl\Doctrine\DBAL\Types; | ||
|
||
use Doctrine\DBAL\Types\Type; | ||
|
@@ -35,7 +46,7 @@ public function canRequireSQLConversion(): bool | |
|
||
public function convertToDatabaseValue($value, AbstractPlatform $platform): string | ||
{ | ||
array_walk_recursive($value, array($this, 'convertToDatabaseCallback'), $platform); | ||
array_walk_recursive($value, [$this, 'convertToDatabaseCallback'], $platform); | ||
|
||
return self::parseArrayToPg($value); | ||
} | ||
|
@@ -44,7 +55,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?array | |
{ | ||
if (null !== $value) { | ||
$value = self::parsePgToArray($value); | ||
array_walk_recursive($value, array($this, 'convertToPhpCallback'), $platform); | ||
array_walk_recursive($value, [$this, 'convertToPhpCallback'], $platform); | ||
} | ||
|
||
return $value; | ||
|
@@ -59,18 +70,18 @@ public function requiresSQLCommentHint(AbstractPlatform $platform): bool | |
* @see https://web.archive.org/web/20120721205048/http://www.php.net/manual/es/ref.pgsql.php#89841 | ||
* @author [email protected] | ||
*/ | ||
protected static function parsePgToArray(string $input, &$output=null, int $limit=null, int $offset=1) | ||
protected static function parsePgToArray(string $input, &$output = null, int $limit = null, int $offset = 1) | ||
{ | ||
if (null === $limit) { | ||
$limit = strlen($input) - 1; | ||
$output = array(); | ||
$output = []; | ||
} | ||
if ('{}' != $input) { | ||
do { | ||
if ('{' != $input[$offset]) { | ||
preg_match("/(\\{?\"([^\"\\\\]|\\\\.)*\"|[^,{}]+)+([,}]+)/", $input, $match, 0, $offset); | ||
$offset += strlen($match[0]); | ||
$output[] = ( '"' != $match[1][0] ? $match[1] : stripcslashes(substr($match[1], 1, -1)) ); | ||
$output[] = ('"' != $match[1][0] ? $match[1] : stripcslashes(substr($match[1], 1, -1))); | ||
if ('},' == $match[3]) { | ||
return $offset; | ||
} | ||
|
@@ -107,7 +118,7 @@ public function getInnerType(): Type | |
* @param mixed $v | ||
* @return mixed | ||
*/ | ||
protected function convertToPhpCallback(&$v, string $k, AbstractPlatform $platform) | ||
protected function convertToPhpCallback(&$v, string $k, AbstractPlatform $platform) | ||
{ | ||
$v = $this->getInnerType()->convertToPHPValue($v, $platform); | ||
} | ||
|
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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* AJGL Doctrine DBAL Types | ||
* | ||
* Copyright (C) Antonio J. García Lagar <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ajgl\Doctrine\DBAL\Types; | ||
|
||
final class BigIntArrayType extends ArrayTypeAbstract | ||
{ | ||
const BIGINTARRAY = 'bigint[]'; | ||
public const BIGINTARRAY = 'bigint[]'; | ||
|
||
protected string $name = self::BIGINTARRAY; | ||
|
||
|
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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* AJGL Doctrine DBAL Types | ||
* | ||
* Copyright (C) Antonio J. García Lagar <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ajgl\Doctrine\DBAL\Types; | ||
|
||
final class BooleanArrayType extends ArrayTypeAbstract | ||
{ | ||
const BOOLEANARRAY = 'boolean[]'; | ||
public const BOOLEANARRAY = 'boolean[]'; | ||
|
||
protected string $name = self::BOOLEANARRAY; | ||
|
||
|
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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* AJGL Doctrine DBAL Types | ||
* | ||
* Copyright (C) Antonio J. García Lagar <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ajgl\Doctrine\DBAL\Types; | ||
|
||
final class IntegerArrayType extends ArrayTypeAbstract | ||
{ | ||
const INTEGERARRAY = 'integer[]'; | ||
public const INTEGERARRAY = 'integer[]'; | ||
|
||
protected string $name = self::INTEGERARRAY; | ||
|
||
|
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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* AJGL Doctrine DBAL Types | ||
* | ||
* Copyright (C) Antonio J. García Lagar <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ajgl\Doctrine\DBAL\Types; | ||
|
||
final class SmallIntArrayType extends ArrayTypeAbstract | ||
{ | ||
const SMALLINTARRAY = 'smallint[]'; | ||
public const SMALLINTARRAY = 'smallint[]'; | ||
|
||
protected string $name = self::SMALLINTARRAY; | ||
|
||
|
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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* AJGL Doctrine DBAL Types | ||
* | ||
* Copyright (C) Antonio J. García Lagar <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ajgl\Doctrine\DBAL\Types; | ||
|
||
final class StringArrayType extends ArrayTypeAbstract | ||
{ | ||
const STRINGARRAY = 'string[]'; | ||
public const STRINGARRAY = 'string[]'; | ||
|
||
protected string $name = self::STRINGARRAY; | ||
|
||
|
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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* AJGL Doctrine DBAL Types | ||
* | ||
* Copyright (C) Antonio J. García Lagar <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ajgl\Doctrine\DBAL\Types; | ||
|
||
final class TextArrayType extends ArrayTypeAbstract | ||
{ | ||
const TEXTARRAY = 'text[]'; | ||
public const TEXTARRAY = 'text[]'; | ||
|
||
protected string $name = self::TEXTARRAY; | ||
|
||
|
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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* AJGL Doctrine DBAL Types | ||
* | ||
* Copyright (C) Antonio J. García Lagar <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ajgl\Doctrine\DBAL\Types; | ||
|
||
final class XmlArrayType extends ArrayTypeAbstract | ||
{ | ||
const XMLARRAY = 'xml[]'; | ||
public const XMLARRAY = 'xml[]'; | ||
|
||
protected string $name = self::XMLARRAY; | ||
|
||
|
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 |
---|---|---|
@@ -1,5 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* AJGL Doctrine DBAL Types | ||
* | ||
* Copyright (C) Antonio J. García Lagar <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ajgl\Doctrine\DBAL\Types; | ||
|
||
|
@@ -11,7 +21,7 @@ | |
|
||
final class XmlType extends TextType | ||
{ | ||
const XML = 'xml'; | ||
public const XML = 'xml'; | ||
|
||
public function getName(): string | ||
{ | ||
|
Oops, something went wrong.