Skip to content

Commit 7b9ea00

Browse files
style: update some of the QA tools configurations and enforce more modern code style (e.g. use of native annotations for fixtures)
1 parent 6bb84e7 commit 7b9ea00

27 files changed

+117
-67
lines changed

ci/phpstan/config.neon

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
includes:
22
- ../../vendor/ekino/phpstan-banned-code/extension.neon
3+
- ../../vendor/phpstan/phpstan-deprecation-rules/rules.neon
4+
- ../../vendor/phpstan/phpstan-doctrine/extension.neon
35
- ../../vendor/phpstan/phpstan-phpunit/extension.neon
46

57
parameters:
@@ -9,6 +11,13 @@ parameters:
911
- ../../src
1012
- ../../tests
1113

14+
tmpDir: ../../var/cache/phpstan
15+
16+
parallel:
17+
maximumNumberOfProcesses: 4
18+
19+
errorFormat: table
20+
1221
reportUnmatchedIgnoredErrors: false
1322

1423
ignoreErrors:

ci/phpunit/config.xml

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" stopOnFailure="false" bootstrap="../../vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache">
3-
<testsuites>
4-
<testsuite name="PostgreSQL-for-Doctrine Test Suite">
5-
<directory>../../tests</directory>
6-
</testsuite>
7-
</testsuites>
8-
<source>
9-
<include>
10-
<directory suffix=".php">../../src</directory>
11-
</include>
12-
</source>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
colors="true"
4+
stopOnFailure="false"
5+
bootstrap="../../vendor/autoload.php"
6+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
7+
cacheDirectory="../../var/cache/phpunit/"
8+
executionOrder="random"
9+
failOnRisky="true"
10+
failOnWarning="true"
11+
beStrictAboutOutputDuringTests="true"
12+
beStrictAboutTodoAnnotatedTests="true">
13+
<testsuites>
14+
<testsuite name="PostgreSQL-for-Doctrine Test Suite">
15+
<directory>../../tests</directory>
16+
</testsuite>
17+
</testsuites>
18+
<coverage>
19+
<report>
20+
<html outputDirectory="../../var/coverage/html"/>
21+
<clover outputFile="../../var/coverage/clover.xml"/>
22+
</report>
23+
</coverage>
24+
<source>
25+
<include>
26+
<directory suffix=".php">../../src</directory>
27+
</include>
28+
</source>
1329
</phpunit>

ci/rector/config.php

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,36 @@
1212
$basePath = __DIR__.'/../../';
1313
$paths = [
1414
$basePath.'ci',
15+
$basePath.'fixtures',
1516
$basePath.'src',
1617
$basePath.'tests',
1718
];
1819
$rectorConfig->paths($paths);
1920

21+
$rectorConfig->cacheDirectory($basePath.'var/cache/rector/');
22+
2023
$rectorConfig->parallel();
2124
$rectorConfig->phpstanConfig($basePath.'ci/phpstan/config.neon');
25+
26+
$rectorConfig->sets([
27+
SetList::CODE_QUALITY,
28+
SetList::DEAD_CODE,
29+
SetList::EARLY_RETURN,
30+
SetList::NAMING,
31+
SetList::PHP_80,
32+
SetList::PHP_81,
33+
SetList::TYPE_DECLARATION,
34+
SetList::PRIVATIZATION,
35+
SetList::CODING_STYLE,
36+
DoctrineSetList::DOCTRINE_ORM_25,
37+
DoctrineSetList::DOCTRINE_CODE_QUALITY,
38+
LevelSetList::UP_TO_PHP_81,
39+
]);
40+
2241
$rectorConfig->skip([
2342
RenamePropertyToMatchTypeRector::class,
2443
]);
25-
$rectorConfig->importShortClasses(false);
26-
$rectorConfig->importNames(false, false); // @todo Enable once Rector introduces better support for function imports.
27-
28-
$rectorConfig->import(SetList::CODE_QUALITY);
29-
$rectorConfig->import(SetList::DEAD_CODE);
30-
$rectorConfig->import(SetList::EARLY_RETURN);
31-
$rectorConfig->import(SetList::NAMING);
32-
$rectorConfig->import(SetList::PHP_80);
33-
$rectorConfig->import(SetList::PHP_81);
34-
$rectorConfig->import(SetList::TYPE_DECLARATION);
3544

36-
$rectorConfig->import(DoctrineSetList::DOCTRINE_ORM_25);
37-
$rectorConfig->import(DoctrineSetList::DOCTRINE_CODE_QUALITY);
38-
39-
$rectorConfig->import(LevelSetList::UP_TO_PHP_81);
45+
$rectorConfig->importShortClasses(false);
46+
$rectorConfig->importNames(false, false);
4047
};

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@
4848
"ekino/phpstan-banned-code": "^1.0",
4949
"friendsofphp/php-cs-fixer": "^3.72.0",
5050
"phpstan/phpstan": "^1.12.21",
51+
"phpstan/phpstan-deprecation-rules": "^1.2",
52+
"phpstan/phpstan-doctrine": "^1.5",
5153
"phpstan/phpstan-phpunit": "^1.4.2",
5254
"phpunit/phpunit": "^10.5.45",
53-
"rector/rector": "^1.2.10",
55+
"rector/rector": "^1.2",
5456
"symfony/cache": "^6.4||^7.0"
5557
},
5658
"suggest": {

fixtures/MartinGeorgiev/Doctrine/Entity/ContainsArrays.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
namespace Fixtures\MartinGeorgiev\Doctrine\Entity;
66

7+
use Doctrine\DBAL\Types\Types;
78
use Doctrine\ORM\Mapping as ORM;
89

910
#[ORM\Entity()]
1011
class ContainsArrays extends Entity
1112
{
12-
#[ORM\Column(type: 'json')]
13+
#[ORM\Column(type: Types::JSON)]
1314
public array $array1;
1415

15-
#[ORM\Column(type: 'json')]
16+
#[ORM\Column(type: Types::JSON)]
1617
public array $array2;
1718
}

fixtures/MartinGeorgiev/Doctrine/Entity/ContainsDates.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,27 @@
44

55
namespace Fixtures\MartinGeorgiev\Doctrine\Entity;
66

7+
use Doctrine\DBAL\Types\Types;
78
use Doctrine\ORM\Mapping as ORM;
89

910
#[ORM\Entity()]
1011
class ContainsDates extends Entity
1112
{
12-
#[ORM\Column(type: 'date_immutable')]
13+
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
1314
public \DateTimeImmutable $date1;
1415

15-
#[ORM\Column(type: 'date_immutable')]
16+
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
1617
public \DateTimeImmutable $date2;
1718

18-
#[ORM\Column(type: 'datetime_immutable')]
19+
#[ORM\Column(type: Types::DATETIME_IMMUTABLE)]
1920
public \DateTimeImmutable $datetime1;
2021

21-
#[ORM\Column(type: 'datetime_immutable')]
22+
#[ORM\Column(type: Types::DATETIME_IMMUTABLE)]
2223
public \DateTimeImmutable $datetime2;
2324

24-
#[ORM\Column(type: 'datetimetz_immutable')]
25+
#[ORM\Column(type: Types::DATETIMETZ_IMMUTABLE)]
2526
public \DateTimeImmutable $datetimetz1;
2627

27-
#[ORM\Column(type: 'datetimetz_immutable')]
28+
#[ORM\Column(type: Types::DATETIMETZ_IMMUTABLE)]
2829
public \DateTimeImmutable $datetimetz2;
2930
}

fixtures/MartinGeorgiev/Doctrine/Entity/ContainsDecimals.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44

55
namespace Fixtures\MartinGeorgiev\Doctrine\Entity;
66

7+
use Doctrine\DBAL\Types\Types;
78
use Doctrine\ORM\Mapping as ORM;
89

910
#[ORM\Entity()]
1011
class ContainsDecimals extends Entity
1112
{
12-
#[ORM\Column(type: 'decimal')]
13+
#[ORM\Column(type: Types::DECIMAL)]
1314
public float $decimal1;
1415

15-
#[ORM\Column(type: 'decimal')]
16+
#[ORM\Column(type: Types::DECIMAL)]
1617
public float $decimal2;
1718

18-
#[ORM\Column(type: 'decimal')]
19+
#[ORM\Column(type: Types::DECIMAL)]
1920
public float $decimal3;
2021
}

fixtures/MartinGeorgiev/Doctrine/Entity/ContainsIntegers.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44

55
namespace Fixtures\MartinGeorgiev\Doctrine\Entity;
66

7+
use Doctrine\DBAL\Types\Types;
78
use Doctrine\ORM\Mapping as ORM;
89

910
#[ORM\Entity()]
1011
class ContainsIntegers extends Entity
1112
{
12-
#[ORM\Column(type: 'integer')]
13+
#[ORM\Column(type: Types::INTEGER)]
1314
public int $integer1;
1415

15-
#[ORM\Column(type: 'integer')]
16+
#[ORM\Column(type: Types::INTEGER)]
1617
public int $integer2;
1718

18-
#[ORM\Column(type: 'integer')]
19+
#[ORM\Column(type: Types::INTEGER)]
1920
public int $integer3;
2021
}

fixtures/MartinGeorgiev/Doctrine/Entity/ContainsJsons.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
namespace Fixtures\MartinGeorgiev\Doctrine\Entity;
66

7+
use Doctrine\DBAL\Types\Types;
78
use Doctrine\ORM\Mapping as ORM;
89

910
#[ORM\Entity()]
1011
class ContainsJsons extends Entity
1112
{
12-
#[ORM\Column(type: 'json')]
13+
#[ORM\Column(type: Types::JSON)]
1314
public array $object1;
1415

15-
#[ORM\Column(type: 'json')]
16+
#[ORM\Column(type: Types::JSON)]
1617
public array $object2;
1718
}

fixtures/MartinGeorgiev/Doctrine/Entity/ContainsTexts.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44

55
namespace Fixtures\MartinGeorgiev\Doctrine\Entity;
66

7+
use Doctrine\DBAL\Types\Types;
78
use Doctrine\ORM\Mapping as ORM;
89

910
#[ORM\Entity()]
1011
class ContainsTexts extends Entity
1112
{
12-
#[ORM\Column(type: 'text')]
13+
#[ORM\Column(type: Types::TEXT)]
1314
public string $text1;
1415

15-
#[ORM\Column(type: 'text')]
16+
#[ORM\Column(type: Types::TEXT)]
1617
public string $text2;
1718
}

0 commit comments

Comments
 (0)