Skip to content

Commit e8a1c38

Browse files
author
Xavier Marchegay
committed
add easyadmin phpcsfixer rules
1 parent 64851ee commit e8a1c38

File tree

5 files changed

+36
-10
lines changed

5 files changed

+36
-10
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/composer.lock
22
/vendor
3-
.php-cs-fixer.cache
3+
.php-cs-fixer.cache
4+
.idea

.php-cs-fixer.dist.php

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
11
<?php
22

3-
$finder = (new PhpCsFixer\Finder())
3+
$finder = PhpCsFixer\Finder::create()
44
->in(__DIR__)
5-
->exclude('var')
5+
->ignoreDotFiles(true)
6+
->ignoreVCS(true)
7+
->exclude(['build', 'vendor'])
8+
->files()
9+
->name('*.php')
610
;
711

8-
return (new PhpCsFixer\Config())
12+
$config = new PhpCsFixer\Config();
13+
14+
return $config
15+
->setUsingCache(true)
16+
->setRiskyAllowed(true)
17+
->setFinder($finder)
918
->setRules([
1019
'@Symfony' => true,
20+
'@Symfony:risky' => true,
21+
'@PHPUnit48Migration:risky' => true,
22+
'array_syntax' => ['syntax' => 'short'],
23+
'fopen_flags' => false,
24+
'ordered_imports' => true,
25+
'protected_to_private' => false,
26+
// Part of @Symfony:risky in PHP-CS-Fixer 2.13.0. To be removed from the config file once upgrading
27+
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
28+
// Part of future @Symfony ruleset in PHP-CS-Fixer To be removed from the config file once upgrading
29+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
30+
'single_line_throw' => false,
31+
// this must be disabled because the output of some tests include NBSP characters
32+
'non_printable_character' => false,
33+
'blank_line_between_import_groups' => false,
34+
'no_trailing_comma_in_singleline' => false,
35+
'nullable_type_declaration_for_default_null_value' => true,
36+
'phpdoc_to_comment' => false,
1137
])
12-
->setFinder($finder)
1338
;

src/Task/Database/DatabaseUpdaterTask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected function initializeStatement(ProcessState $state): int
5656
} else {
5757
$params = $options['params'];
5858
}
59-
if (!is_array($params)) {
59+
if (!\is_array($params)) {
6060
throw new \UnexpectedValueException('Expecting an array of params');
6161
}
6262

src/Task/EntityManager/AbstractDoctrineQueryTask.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ protected function getQueryBuilder(
6060
EntityRepository $repository,
6161
array $criteria,
6262
array $orderBy,
63-
int $limit = null,
64-
int $offset = null
63+
?int $limit = null,
64+
?int $offset = null
6565
): QueryBuilder {
6666
$qb = $repository->createQueryBuilder('e');
6767
foreach ($criteria as $field => $value) {

src/Task/EntityManager/PurgeDoctrineCacheTask.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function purgeEntityManagerCache(EntityManagerInterface $entityManager
6666
}
6767
}
6868

69-
protected function purgeCache(Cache $cache = null): void
69+
protected function purgeCache(?Cache $cache = null): void
7070
{
7171
if ($cache instanceof FlushableCache) {
7272
$cache->flushAll();
@@ -94,7 +94,7 @@ function (Options $options, $value): ?EntityManagerInterface {
9494
if (null === $value) {
9595
return null;
9696
}
97-
if (is_string($value)) {
97+
if (\is_string($value)) {
9898
$value = $this->doctrine->getManager($value);
9999
}
100100
if (!$value instanceof EntityManagerInterface) {

0 commit comments

Comments
 (0)