Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/bin/
/var/
/vendor/
composer.lock
2 changes: 0 additions & 2 deletions ci/rector/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

declare(strict_types=1);

use Rector\CodingStyle\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector;
use Rector\Config\RectorConfig;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Naming\Rector\Class_\RenamePropertyToMatchTypeRector;
Expand All @@ -21,7 +20,6 @@
$rectorConfig->parallel();
$rectorConfig->phpstanConfig($basePath.'ci/phpstan/config.neon');
$rectorConfig->skip([
ArraySpreadInsteadOfArrayMergeRector::class,
RenamePropertyToMatchTypeRector::class,
]);
$rectorConfig->importShortClasses(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TokenType;
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException;
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\ParserException;
use MartinGeorgiev\Utils\DoctrineOrm;

Expand All @@ -19,6 +20,9 @@ abstract class BaseVariadicFunction extends BaseFunction
{
protected string $commonNodeMapping = 'StringPrimary';

/**
* @throws ParserException
*/
public function feedParserWithNodes(Parser $parser): void
{
$lexer = $parser->getLexer();
Expand Down Expand Up @@ -56,6 +60,8 @@ public function getSql(SqlWalker $sqlWalker): string
* Validates the arguments passed to the function.
*
* @param mixed[] $arguments The array of arguments to validate
*
* @throws InvalidArgumentForVariadicFunctionException
*/
abstract protected function validateArguments(array $arguments): void;
}
4 changes: 2 additions & 2 deletions tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function can_transform_from_php_value(?array $phpValue, ?string $postgres
->method('isValidArrayItemForDatabase')
->willReturn(true);

$this->assertSame($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
self::assertSame($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
}

/**
Expand All @@ -53,7 +53,7 @@ public function can_transform_from_php_value(?array $phpValue, ?string $postgres
*/
public function can_transform_to_php_value(?array $phpValue, ?string $postgresValue): void
{
$this->assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
self::assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class BaseIntegerArrayTestCase extends TestCase
*/
public function can_detect_invalid_for_transformation_php_value(mixed $phpValue): void
{
$this->assertFalse($this->fixture->isValidArrayItemForDatabase($phpValue));
self::assertFalse($this->fixture->isValidArrayItemForDatabase($phpValue));
}

/**
Expand All @@ -47,7 +47,7 @@ public static function provideInvalidTransformations(): array
*/
public function can_transform_from_php_value(int $phpValue, string $postgresValue): void
{
$this->assertTrue($this->fixture->isValidArrayItemForDatabase($phpValue));
self::assertTrue($this->fixture->isValidArrayItemForDatabase($phpValue));
}

/**
Expand All @@ -57,7 +57,7 @@ public function can_transform_from_php_value(int $phpValue, string $postgresValu
*/
public function can_transform_to_php_value(int $phpValue, string $postgresValue): void
{
$this->assertEquals($phpValue, $this->fixture->transformArrayItemForPHP($postgresValue));
self::assertEquals($phpValue, $this->fixture->transformArrayItemForPHP($postgresValue));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function setUp(): void
*/
public function has_name(): void
{
$this->assertEquals('bigint[]', $this->fixture->getName());
self::assertEquals('bigint[]', $this->fixture->getName());
}

public static function provideInvalidTransformations(): array
Expand Down
6 changes: 3 additions & 3 deletions tests/MartinGeorgiev/Doctrine/DBAL/Types/BooleanArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function setUp(): void
*/
public function has_name(): void
{
$this->assertEquals('bool[]', $this->fixture->getName());
self::assertEquals('bool[]', $this->fixture->getName());
}

/**
Expand All @@ -44,7 +44,7 @@ public function can_transform_from_php_value(?array $phpValue, ?string $postgres
->with($phpValue)
->willReturn($platformValue);

$this->assertEquals($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
self::assertEquals($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
}

/**
Expand All @@ -58,7 +58,7 @@ public function can_transform_to_php_value(?array $phpValue, ?string $postgresVa
->with($this->anything())
->willReturnCallback('boolval');

$this->assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
self::assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function setUp(): void
*/
public function has_name(): void
{
$this->assertEquals('integer[]', $this->fixture->getName());
self::assertEquals('integer[]', $this->fixture->getName());
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function setUp(): void
*/
public function has_name(): void
{
$this->assertEquals('jsonb[]', $this->fixture->getName());
self::assertEquals('jsonb[]', $this->fixture->getName());
}

/**
Expand All @@ -41,7 +41,7 @@ public function has_name(): void
*/
public function can_transform_from_php_value(?array $phpValue, ?string $postgresValue): void
{
$this->assertEquals($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
self::assertEquals($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
}

/**
Expand All @@ -51,7 +51,7 @@ public function can_transform_from_php_value(?array $phpValue, ?string $postgres
*/
public function can_transform_to_php_value(?array $phpValue, ?string $postgresValue): void
{
$this->assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
self::assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function setUp(): void
*/
public function has_name(): void
{
$this->assertEquals('jsonb', $this->fixture->getName());
self::assertEquals('jsonb', $this->fixture->getName());
}

/**
Expand All @@ -40,7 +40,7 @@ public function has_name(): void
*/
public function can_transform_from_php_value(null|array|bool|float|int|string $phpValue, ?string $postgresValue): void
{
$this->assertEquals($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
self::assertEquals($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
}

/**
Expand All @@ -50,7 +50,7 @@ public function can_transform_from_php_value(null|array|bool|float|int|string $p
*/
public function can_transform_to_php_value(null|array|bool|float|int|string $phpValue, ?string $postgresValue): void
{
$this->assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
self::assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function setUp(): void
*/
public function has_name(): void
{
$this->assertEquals('smallint[]', $this->fixture->getName());
self::assertEquals('smallint[]', $this->fixture->getName());
}

public static function provideInvalidTransformations(): array
Expand Down
6 changes: 3 additions & 3 deletions tests/MartinGeorgiev/Doctrine/DBAL/Types/TextArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function setUp(): void
*/
public function has_name(): void
{
$this->assertEquals('text[]', $this->fixture->getName());
self::assertEquals('text[]', $this->fixture->getName());
}

/**
Expand All @@ -40,7 +40,7 @@ public function has_name(): void
*/
public function can_transform_from_php_value(?array $phpValue, ?string $postgresValue): void
{
$this->assertEquals($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
self::assertEquals($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
}

/**
Expand All @@ -50,7 +50,7 @@ public function can_transform_from_php_value(?array $phpValue, ?string $postgres
*/
public function can_transform_to_php_value(?array $phpValue, ?string $postgresValue): void
{
$this->assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
self::assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function dql_is_transformed_to_valid_sql(): void
protected function assertSqlFromDql(string $expectedSql, string $dql, string $message = ''): void
{
$query = $this->buildEntityManager()->createQuery($dql);
$this->assertEquals($expectedSql, $query->getSQL(), $message);
self::assertEquals($expectedSql, $query->getSQL(), $message);
}

private function buildEntityManager(): EntityManager
Expand Down
4 changes: 2 additions & 2 deletions tests/MartinGeorgiev/Utils/DataStructureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DataStructureTest extends TestCase
*/
public function can_transform_from_php_value(array $phpValue, string $postgresValue): void
{
$this->assertEquals($postgresValue, DataStructure::transformPHPArrayToPostgresTextArray($phpValue));
self::assertEquals($postgresValue, DataStructure::transformPHPArrayToPostgresTextArray($phpValue));
}

/**
Expand All @@ -30,7 +30,7 @@ public function can_transform_from_php_value(array $phpValue, string $postgresVa
*/
public function can_transform_to_php_value(array $phpValue, string $postgresValue): void
{
$this->assertEquals($phpValue, DataStructure::transformPostgresTextArrayToPHPArray($postgresValue));
self::assertEquals($phpValue, DataStructure::transformPostgresTextArrayToPHPArray($postgresValue));
}

/**
Expand Down
Loading