Skip to content

Commit 574130c

Browse files
authored
Merge pull request #1794 from deguif/php-cs-fixer-3.0.0
Update php-cs-fixer to 3.0.0
2 parents 7f3d131 + 771de95 commit 574130c

File tree

102 files changed

+810
-349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+810
-349
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
/tests export-ignore
33
/.gitattributes export-ignore
44
/.gitignore export-ignore
5-
/.php_cs.dist export-ignore
5+
/.php-cs-fixer.dist.php export-ignore
66
/.scrutinizer.yml export-ignore
77
/phpunit.xml.dist export-ignore

.github/workflows/continuous-integration.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ jobs:
1414
php-version: '7.4'
1515
coverage: 'none'
1616
extensions: 'json, mbstring, tokenizer'
17-
tools: 'composer-normalize, php-cs-fixer:2.18.3'
17+
tools: 'composer-normalize, php-cs-fixer:3.0.0'
1818

1919
- name: 'Display tools versions'
2020
run: |
2121
composer-normalize --version
2222
php-cs-fixer --version
2323
2424
- name: 'Check PHP code'
25-
run: 'php-cs-fixer fix --diff --dry-run --allow-risky=yes --using-cache=false'
25+
run: 'php-cs-fixer fix --diff --dry-run --allow-risky=yes --using-cache=no'
2626

2727
- name: 'Check composer.json'
2828
run: 'composer-normalize --diff --dry-run --no-update-lock'

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ phpunit.xml
22
vendor
33
composer.lock
44
composer.phar
5-
.php_cs
6-
.php_cs.cache
5+
.php-cs-fixer.php
6+
.php-cs-fixer.cache

.php_cs.dist renamed to .php-cs-fixer.dist.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@
99
file that was distributed with this source code.
1010
EOF;
1111

12-
return PhpCsFixer\Config::create()
12+
return (new PhpCsFixer\Config())
1313
->setRules([
14+
'@PHP71Migration' => true,
15+
'@PSR2' => true,
16+
'@PhpCsFixer' => true,
1417
'@Symfony' => true,
15-
'array_syntax' => ['syntax' => 'short'],
16-
'combine_consecutive_issets' => true,
17-
'combine_consecutive_unsets' => true,
1818
'header_comment' => ['header' => $header],
1919
'is_null' => true,
20-
'linebreak_after_opening_tag' => true,
21-
'list_syntax' => ['syntax' => 'short'],
20+
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
21+
'method_chaining_indentation' => false,
2222
'native_constant_invocation' => true,
23-
'native_function_invocation' => true,
23+
'native_function_invocation' => [
24+
'include' => ['@all'],
25+
],
2426
'no_alias_functions' => true,
25-
'no_useless_else' => true,
2627
'nullable_type_declaration_for_default_null_value' => true,
27-
'ordered_class_elements' => true,
2828
'ordered_imports' => true,
29+
'php_unit_test_class_requires_covers' => false,
2930
'phpdoc_no_empty_return' => false,
30-
'ternary_to_null_coalescing' => true,
31-
'visibility_required' => ['property', 'method', 'const'],
31+
'visibility_required' => ['elements' => ['property', 'method', 'const']],
3232
])
3333
->setUsingCache(true)
3434
->setFinder(

src/Command/PopulateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
154154
/**
155155
* Recreates an index, populates it, and refreshes it.
156156
*/
157-
private function populateIndex(OutputInterface $output, string $index, bool $reset, $options): void
157+
private function populateIndex(OutputInterface $output, string $index, bool $reset, array $options): void
158158
{
159159
$this->dispatcher->dispatch($event = new PreIndexPopulateEvent($index, $reset, $options));
160160

src/DependencyInjection/Configuration.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ private function getPropertiesNode()
120120
$node
121121
->useAttributeAsKey('name')
122122
->prototype('variable')
123-
->treatNullLike([]);
123+
->treatNullLike([])
124+
;
124125

125126
return $node;
126127
}
@@ -281,7 +282,8 @@ private function getPersistenceNode()
281282
->scalarNode('service')->end()
282283
->end()
283284
->end()
284-
->end();
285+
->end()
286+
;
285287

286288
return $node;
287289
}
@@ -304,7 +306,8 @@ private function getSerializerNode()
304306
->booleanNode('serialize_null')
305307
->defaultFalse()
306308
->end()
307-
->end();
309+
->end()
310+
;
308311

309312
return $node;
310313
}
@@ -470,7 +473,7 @@ private function addIndexesSection(ArrayNodeDefinition $rootNode)
470473
/**
471474
* @return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition
472475
*/
473-
private function createTreeBuilderNode($name)
476+
private function createTreeBuilderNode(string $name)
474477
{
475478
return (new TreeBuilder($name))->getRootNode();
476479
}

src/DependencyInjection/FOSElasticaExtension.php

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,19 @@ public function load(array $configs, ContainerBuilder $container)
9393

9494
$this->loadClients($config['clients'], $container);
9595
$container->setAlias('fos_elastica.client', \sprintf('fos_elastica.client.%s', $config['default_client']))
96-
->setPublic(false);
96+
->setPublic(false)
97+
;
9798
$container->setAlias(ElasticaClient::class, 'fos_elastica.client')
98-
->setPublic(false);
99+
->setPublic(false)
100+
;
99101
$container->setAlias(Client::class, 'fos_elastica.client')
100-
->setPublic(false);
102+
->setPublic(false)
103+
;
101104

102105
$this->loadIndexes($config['indexes'], $container);
103106
$container->setAlias('fos_elastica.index', \sprintf('fos_elastica.index.%s', $config['default_index']))
104-
->setPublic(false);
107+
->setPublic(false)
108+
;
105109
$container->setParameter('fos_elastica.default_index', $config['default_index']);
106110

107111
if ($usedIndexNames = \array_intersect_key($config['indexes'], $config['index_templates'])) {
@@ -112,7 +116,8 @@ public function load(array $configs, ContainerBuilder $container)
112116
$container->getDefinition('fos_elastica.config_source.container')->replaceArgument(0, $this->indexConfigs);
113117
$container
114118
->getDefinition('fos_elastica.config_source.template_container')
115-
->replaceArgument(0, $this->indexTemplateConfigs);
119+
->replaceArgument(0, $this->indexTemplateConfigs)
120+
;
116121

117122
$this->loadIndexManager($container);
118123
$this->loadIndexTemplateManager($container);
@@ -536,10 +541,7 @@ private function loadIndexListener(array $indexConfig, ContainerBuilder $contain
536541
$listenerId = \sprintf('fos_elastica.listener.%s', $indexName);
537542
$listenerDef = new ChildDefinition($abstractListenerId);
538543
$listenerDef->replaceArgument(0, new Reference($objectPersisterId));
539-
$listenerDef->replaceArgument(3, $indexConfig['listener']['logger'] ?
540-
new Reference($indexConfig['listener']['logger']) :
541-
null
542-
);
544+
$listenerDef->replaceArgument(3, $indexConfig['listener']['logger'] ? new Reference($indexConfig['listener']['logger']) : null);
543545
$listenerConfig = [
544546
'identifier' => $indexConfig['identifier'],
545547
'indexName' => $indexName,
@@ -640,18 +642,20 @@ private function loadTypeFinder(array $typeConfig, ContainerBuilder $container,
640642
}
641643

642644
$container->getDefinition('fos_elastica.repository_manager')
643-
->addMethodCall('addIndex', $arguments);
645+
->addMethodCall('addIndex', $arguments)
646+
;
644647

645648
$managerId = \sprintf('fos_elastica.manager.%s', $typeConfig['driver']);
646649
$container->getDefinition($managerId)
647-
->addMethodCall('addEntity', [$typeConfig['model'], $indexName]);
650+
->addMethodCall('addEntity', [$typeConfig['model'], $indexName])
651+
;
648652

649653
return $finderId;
650654
}
651655

652656
/**
653657
* Loads the index manager.
654-
**/
658+
*/
655659
private function loadIndexManager(ContainerBuilder $container): void
656660
{
657661
$indexRefs = \array_map(function ($index) {
@@ -695,7 +699,8 @@ private function loadDriver(ContainerBuilder $container, string $driver): void
695699
private function loadSerializer(array $config, ContainerBuilder $container): void
696700
{
697701
$container->setAlias('fos_elastica.serializer', $config['serializer'])
698-
->setPublic(false);
702+
->setPublic(false)
703+
;
699704

700705
$serializer = $container->getDefinition('fos_elastica.serializer_callback_prototype');
701706
$serializer->setClass($config['callback_class']);
@@ -723,9 +728,11 @@ private function createDefaultManagerAlias(string $defaultManager, ContainerBuil
723728
}
724729

725730
$container->setAlias('fos_elastica.manager', \sprintf('fos_elastica.manager.%s', $defaultManagerService))
726-
->setPublic(false);
731+
->setPublic(false)
732+
;
727733
$container->setAlias(RepositoryManagerInterface::class, 'fos_elastica.manager')
728-
->setPublic(false);
734+
->setPublic(false)
735+
;
729736
}
730737

731738
/**

src/Doctrine/AbstractElasticaToModelTransformer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ abstract class AbstractElasticaToModelTransformer extends BaseTransformer
2828
*
2929
* @var ManagerRegistry
3030
*/
31-
protected $registry = null;
31+
protected $registry;
3232

3333
/**
3434
* Class of the model to map to the elastica documents.
3535
*
3636
* @var string
3737
*/
38-
protected $objectClass = null;
38+
protected $objectClass;
3939

4040
/**
4141
* Optional parameters.
@@ -77,7 +77,7 @@ public function getObjectClass(): string
7777
* @throws \RuntimeException
7878
*
7979
* @return array
80-
**/
80+
*/
8181
public function transform(array $elasticaObjects)
8282
{
8383
$ids = $highlights = [];

src/Doctrine/MongoDB/ElasticaToModelTransformer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ protected function findByIdentifiers(array $identifierValues, $hydrate)
3838
->hydrate($hydrate)
3939
->getQuery()
4040
->execute()
41-
->toArray();
41+
->toArray()
42+
;
4243
}
4344
}

src/Doctrine/ORM/ElasticaToModelTransformer.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ protected function findByIdentifiers(array $identifierValues, $hydrate)
4040

4141
$qb = $this->getEntityQueryBuilder();
4242
$qb->andWhere($qb->expr()->in(static::ENTITY_ALIAS.'.'.$this->options['identifier'], ':values'))
43-
->setParameter('values', $identifierValues);
43+
->setParameter('values', $identifierValues)
44+
;
4445

4546
$query = $qb->getQuery();
4647

@@ -60,7 +61,8 @@ protected function getEntityQueryBuilder()
6061
{
6162
$repository = $this->registry
6263
->getManagerForClass($this->objectClass)
63-
->getRepository($this->objectClass);
64+
->getRepository($this->objectClass)
65+
;
6466

6567
return $repository->{$this->options['query_builder_method']}(static::ENTITY_ALIAS);
6668
}

0 commit comments

Comments
 (0)