Skip to content

Commit

Permalink
feat: switch to php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
sitepark-veltrup committed Jul 2, 2024
1 parent 35e7622 commit 525dd60
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 41 deletions.
1 change: 1 addition & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<phar name="composer-normalize" version="^2.32.0" location="./tools/composer-normalize" copy="false" installed="2.32.0"/>
<phar name="phpunit" version="^10.4.0" location="./tools/phpunit.phar" copy="true" installed="10.4.1"/>
<phar name="overtrue/phplint" version="^9.0.4" location="./tools/phplint" copy="false" installed="9.0.4"/>
<phar name="php-cs-fixer" version="^3.58.1" installed="3.58.1" copy="false" location="./tools/php-cs-fixer"/>
</phive>
12 changes: 12 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

$finder = (new \PhpCsFixer\Finder())
->in(__DIR__ . '/src')
->in(__DIR__ . '/test');

return (new \PhpCsFixer\Config())
->setCacheFile('var/cache/php-cs-fixer')
->setFinder($finder)
->setRules(['@PER-CS' => true]);
25 changes: 0 additions & 25 deletions phpcs.xml.dist

This file was deleted.

4 changes: 2 additions & 2 deletions src/AtooloCityCallBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public function build(ContainerBuilder $container): void
new LoaderResolver(
[
new YamlFileLoader($container, new FileLocator($configDir)),
]
)
],
),
);

$loader->load('services.yaml');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@
*/
class NewsDocumentEnricher implements DocumentEnricher
{
public function cleanup(): void
{
}
public function cleanup(): void {}

/**
* @throws DocumentEnrichingException
*/
public function enrichDocument(
Resource $resource,
IndexDocument $doc,
string $processId
string $processId,
): IndexSchema2xDocument {

if ($resource->objectType !== 'citycall-news') {
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ public function testIsAdHocActive(): void
$doc = $this->enrichDocument([
'objectType' => 'citycall-news',
'metadata' => [
'isAdHocActive' => true
]
'isAdHocActive' => true,
],
]);

/** @var array{sp_meta_string_leikanumber: bool} $fields */
$fields = $doc->getFields();

$this->assertTrue(
$fields['sp_meta_bool_citycall_isadhoc'],
'unexpected isadhoc'
'unexpected isadhoc',
);
}

Expand All @@ -38,16 +38,16 @@ public function testWithNonNewsObjectType(): void
$doc = $this->enrichDocument([
'objectType' => 'otherType',
'metadata' => [
'isAdHocActive' => true
]
'isAdHocActive' => true,
],
]);

/** @var array{sp_meta_string_leikanumber: bool} $fields */
$fields = $doc->getFields();

$this->assertEmpty(
$fields,
'document should be empty'
'document should be empty',
);
}

Expand All @@ -59,7 +59,7 @@ public function testCleanup(): void
}

private function enrichDocument(
array $data
array $data,
): IndexSchema2xDocument {
$enricher = new NewsDocumentEnricher();
$doc = new IndexSchema2xDocument();
Expand Down
2 changes: 1 addition & 1 deletion test/TestResourceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
}
}

0 comments on commit 525dd60

Please sign in to comment.