diff --git a/.phive/phars.xml b/.phive/phars.xml index 8bad0db..7a060a0 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -4,4 +4,5 @@ + diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..29895a6 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,12 @@ +in(__DIR__ . '/src') + ->in(__DIR__ . '/test'); + +return (new \PhpCsFixer\Config()) + ->setCacheFile('var/cache/php-cs-fixer') + ->setFinder($finder) + ->setRules(['@PER-CS' => true]); diff --git a/composer.json b/composer.json index 301b02e..5854271 100644 --- a/composer.json +++ b/composer.json @@ -64,15 +64,15 @@ } }, "scripts": { - "post-install-cmd": "phive --no-progress install --force-accept-unsigned --trust-gpg-keys C00543248C87FB13,4AA394086372C20A,CF1A108D0E7AE720,51C67305FFC2E5C0", + "post-install-cmd": "phive --no-progress install --force-accept-unsigned --trust-gpg-keys C00543248C87FB13,4AA394086372C20A,CF1A108D0E7AE720,51C67305FFC2E5C0,E82B2FB314E9906E", "analyse": [ "@analyse:phplint", "@analyse:phpstan", - "@analyse:phpcs", + "@analyse:phpcsfixer", "@analyse:compatibilitycheck" ], "analyse:compatibilitycheck": "./vendor/bin/phpcs --standard=./phpcs.compatibilitycheck.xml", - "analyse:phpcs": "./vendor/bin/phpcs", + "analyse:phpcsfixer": "./tools/php-cs-fixer check --diff --show-progress=dots", "analyse:phplint": "./tools/phplint", "analyse:phpstan": "./tools/phpstan analyse", "cs-fix": [ @@ -80,10 +80,8 @@ ], "cs-fix:phpcbf": "./vendor/bin/phpcbf", "report": [ - "@report:phpcs", "@report:phpstan" ], - "report:phpcs": "./vendor/bin/phpcs || exit 0", "report:phpstan": "./tools/phpstan analyse --no-progress --no-ansi --no-interaction --error-format=checkstyle > ./var/log/phpstan-report.xml || exit 0", "test": [ "@test:phpunit" diff --git a/phpcs.xml.dist b/phpcs.xml.dist deleted file mode 100644 index 1ae9151..0000000 --- a/phpcs.xml.dist +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - src/ - test/ - - - - - - - - - - diff --git a/src/AtooloCityCallBundle.php b/src/AtooloCityCallBundle.php index 4a5e802..8a7080a 100644 --- a/src/AtooloCityCallBundle.php +++ b/src/AtooloCityCallBundle.php @@ -25,8 +25,8 @@ public function build(ContainerBuilder $container): void new LoaderResolver( [ new YamlFileLoader($container, new FileLocator($configDir)), - ] - ) + ], + ), ); $loader->load('services.yaml'); diff --git a/src/Service/Indexer/Enricher/SiteKitSchema2x/NewsDocumentEnricher.php b/src/Service/Indexer/Enricher/SiteKitSchema2x/NewsDocumentEnricher.php index 04784c0..a01dc67 100644 --- a/src/Service/Indexer/Enricher/SiteKitSchema2x/NewsDocumentEnricher.php +++ b/src/Service/Indexer/Enricher/SiteKitSchema2x/NewsDocumentEnricher.php @@ -15,9 +15,7 @@ */ class NewsDocumentEnricher implements DocumentEnricher { - public function cleanup(): void - { - } + public function cleanup(): void {} /** * @throws DocumentEnrichingException @@ -25,7 +23,7 @@ public function cleanup(): void public function enrichDocument( Resource $resource, IndexDocument $doc, - string $processId + string $processId, ): IndexSchema2xDocument { if ($resource->objectType !== 'citycall-news') { @@ -42,11 +40,11 @@ public function enrichDocument( */ private function enrichDocumentForNews( Resource $resource, - IndexDocument $doc + IndexDocument $doc, ): IndexDocument { $isAdHocActive = $resource->data->getBool( - 'metadata.isAdHocActive' + 'metadata.isAdHocActive', ); if ($isAdHocActive) { $doc->setMetaBool('citycall_isadhoc', true); diff --git a/test/Service/Indexer/Enricher/SiteKitSchema2x/NewsDocumentEnricherTest.php b/test/Service/Indexer/Enricher/SiteKitSchema2x/NewsDocumentEnricherTest.php index 81163b5..48ec668 100644 --- a/test/Service/Indexer/Enricher/SiteKitSchema2x/NewsDocumentEnricherTest.php +++ b/test/Service/Indexer/Enricher/SiteKitSchema2x/NewsDocumentEnricherTest.php @@ -20,8 +20,8 @@ public function testIsAdHocActive(): void $doc = $this->enrichDocument([ 'objectType' => 'citycall-news', 'metadata' => [ - 'isAdHocActive' => true - ] + 'isAdHocActive' => true, + ], ]); /** @var array{sp_meta_string_leikanumber: bool} $fields */ @@ -29,7 +29,7 @@ public function testIsAdHocActive(): void $this->assertTrue( $fields['sp_meta_bool_citycall_isadhoc'], - 'unexpected isadhoc' + 'unexpected isadhoc', ); } @@ -38,8 +38,8 @@ public function testWithNonNewsObjectType(): void $doc = $this->enrichDocument([ 'objectType' => 'otherType', 'metadata' => [ - 'isAdHocActive' => true - ] + 'isAdHocActive' => true, + ], ]); /** @var array{sp_meta_string_leikanumber: bool} $fields */ @@ -47,7 +47,7 @@ public function testWithNonNewsObjectType(): void $this->assertEmpty( $fields, - 'document should be empty' + 'document should be empty', ); } @@ -59,7 +59,7 @@ public function testCleanup(): void } private function enrichDocument( - array $data + array $data, ): IndexSchema2xDocument { $enricher = new NewsDocumentEnricher(); $doc = new IndexSchema2xDocument(); diff --git a/test/TestResourceFactory.php b/test/TestResourceFactory.php index 823e31b..ea128bf 100644 --- a/test/TestResourceFactory.php +++ b/test/TestResourceFactory.php @@ -18,7 +18,7 @@ public static function create(array $data): Resource $data['name'] ?? '', $data['objectType'] ?? '', ResourceLanguage::of($data['locale'] ?? ''), - new DataBag($data) + new DataBag($data), ); } }