Skip to content

Commit 91fd918

Browse files
style: improve rector config, static calls invocation in tests, and add missing @throws in phpdocs (#278)
1 parent 4a26400 commit 91fd918

File tree

14 files changed

+30
-25
lines changed

14 files changed

+30
-25
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/bin/
2+
/var/
23
/vendor/
34
composer.lock

ci/rector/config.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
declare(strict_types=1);
44

5-
use Rector\CodingStyle\Rector\FuncCall\ArraySpreadInsteadOfArrayMergeRector;
65
use Rector\Config\RectorConfig;
76
use Rector\Doctrine\Set\DoctrineSetList;
87
use Rector\Naming\Rector\Class_\RenamePropertyToMatchTypeRector;
@@ -21,7 +20,6 @@
2120
$rectorConfig->parallel();
2221
$rectorConfig->phpstanConfig($basePath.'ci/phpstan/config.neon');
2322
$rectorConfig->skip([
24-
ArraySpreadInsteadOfArrayMergeRector::class,
2523
RenamePropertyToMatchTypeRector::class,
2624
]);
2725
$rectorConfig->importShortClasses(false);

src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunction.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Doctrine\ORM\Query\Parser;
1010
use Doctrine\ORM\Query\SqlWalker;
1111
use Doctrine\ORM\Query\TokenType;
12+
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\InvalidArgumentForVariadicFunctionException;
1213
use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Exception\ParserException;
1314
use MartinGeorgiev\Utils\DoctrineOrm;
1415

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

23+
/**
24+
* @throws ParserException
25+
*/
2226
public function feedParserWithNodes(Parser $parser): void
2327
{
2428
$lexer = $parser->getLexer();
@@ -56,6 +60,8 @@ public function getSql(SqlWalker $sqlWalker): string
5660
* Validates the arguments passed to the function.
5761
*
5862
* @param mixed[] $arguments The array of arguments to validate
63+
*
64+
* @throws InvalidArgumentForVariadicFunctionException
5965
*/
6066
abstract protected function validateArguments(array $arguments): void;
6167
}

tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function can_transform_from_php_value(?array $phpValue, ?string $postgres
4343
->method('isValidArrayItemForDatabase')
4444
->willReturn(true);
4545

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

4949
/**
@@ -53,7 +53,7 @@ public function can_transform_from_php_value(?array $phpValue, ?string $postgres
5353
*/
5454
public function can_transform_to_php_value(?array $phpValue, ?string $postgresValue): void
5555
{
56-
$this->assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
56+
self::assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
5757
}
5858

5959
/**

tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ abstract class BaseIntegerArrayTestCase extends TestCase
2222
*/
2323
public function can_detect_invalid_for_transformation_php_value(mixed $phpValue): void
2424
{
25-
$this->assertFalse($this->fixture->isValidArrayItemForDatabase($phpValue));
25+
self::assertFalse($this->fixture->isValidArrayItemForDatabase($phpValue));
2626
}
2727

2828
/**
@@ -47,7 +47,7 @@ public static function provideInvalidTransformations(): array
4747
*/
4848
public function can_transform_from_php_value(int $phpValue, string $postgresValue): void
4949
{
50-
$this->assertTrue($this->fixture->isValidArrayItemForDatabase($phpValue));
50+
self::assertTrue($this->fixture->isValidArrayItemForDatabase($phpValue));
5151
}
5252

5353
/**
@@ -57,7 +57,7 @@ public function can_transform_from_php_value(int $phpValue, string $postgresValu
5757
*/
5858
public function can_transform_to_php_value(int $phpValue, string $postgresValue): void
5959
{
60-
$this->assertEquals($phpValue, $this->fixture->transformArrayItemForPHP($postgresValue));
60+
self::assertEquals($phpValue, $this->fixture->transformArrayItemForPHP($postgresValue));
6161
}
6262

6363
/**

tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected function setUp(): void
2020
*/
2121
public function has_name(): void
2222
{
23-
$this->assertEquals('bigint[]', $this->fixture->getName());
23+
self::assertEquals('bigint[]', $this->fixture->getName());
2424
}
2525

2626
public static function provideInvalidTransformations(): array

tests/MartinGeorgiev/Doctrine/DBAL/Types/BooleanArrayTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function setUp(): void
3030
*/
3131
public function has_name(): void
3232
{
33-
$this->assertEquals('bool[]', $this->fixture->getName());
33+
self::assertEquals('bool[]', $this->fixture->getName());
3434
}
3535

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

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

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

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

6464
/**

tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected function setUp(): void
2020
*/
2121
public function has_name(): void
2222
{
23-
$this->assertEquals('integer[]', $this->fixture->getName());
23+
self::assertEquals('integer[]', $this->fixture->getName());
2424
}
2525

2626
/**

tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected function setUp(): void
3131
*/
3232
public function has_name(): void
3333
{
34-
$this->assertEquals('jsonb[]', $this->fixture->getName());
34+
self::assertEquals('jsonb[]', $this->fixture->getName());
3535
}
3636

3737
/**
@@ -41,7 +41,7 @@ public function has_name(): void
4141
*/
4242
public function can_transform_from_php_value(?array $phpValue, ?string $postgresValue): void
4343
{
44-
$this->assertEquals($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
44+
self::assertEquals($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
4545
}
4646

4747
/**
@@ -51,7 +51,7 @@ public function can_transform_from_php_value(?array $phpValue, ?string $postgres
5151
*/
5252
public function can_transform_to_php_value(?array $phpValue, ?string $postgresValue): void
5353
{
54-
$this->assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
54+
self::assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
5555
}
5656

5757
/**

tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function setUp(): void
3030
*/
3131
public function has_name(): void
3232
{
33-
$this->assertEquals('jsonb', $this->fixture->getName());
33+
self::assertEquals('jsonb', $this->fixture->getName());
3434
}
3535

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

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

5656
/**

0 commit comments

Comments
 (0)