Skip to content

Commit

Permalink
Merge pull request #134 from shopware/ntr/switched-to-cs-fixer
Browse files Browse the repository at this point in the history
NTR - Switched to cs fixer
  • Loading branch information
lernhart authored Nov 19, 2024
2 parents 89c5f80 + 67da11e commit 2b62998
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 230 deletions.
67 changes: 60 additions & 7 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,66 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude('var')
;
declare(strict_types=1);

return (new PhpCsFixer\Config())
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

return (new Config())
->setParallelConfig(ParallelConfigFactory::detect())
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'linebreak_after_opening_tag' => false,
'blank_line_after_opening_tag' => false,
'phpdoc_summary' => false,
'phpdoc_annotation_without_dot' => false,
'phpdoc_to_comment' => false,
'declare_strict_types' => true,
'strict_comparison' => true,
'strict_param' => true,
'no_useless_else' => true,
'void_return' => true,
'phpdoc_line_span' => true,
'php_unit_dedicate_assert_internal_type' => true,
'php_unit_mock' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'static'],
'no_useless_return' => true,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
],
'single_line_throw' => false,
'fopen_flags' => false,
'self_accessor' => false,
'phpdoc_align' => ['align' => 'left'],
'phpdoc_order' => ['order' => ['param', 'throws', 'return']],
'class_attributes_separation' => ['elements' => ['property' => 'one', 'method' => 'one']],
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'concat_space' => ['spacing' => 'one'],
'native_function_invocation' => [
'scope' => 'namespaced',
'strict' => false,
'exclude' => ['ini_get'],
],
'general_phpdoc_annotation_remove' => ['annotations' => ['copyright', 'category']],
'no_superfluous_phpdoc_tags' => ['allow_unused_params' => true, 'allow_mixed' => true],
'php_unit_dedicate_assert' => ['target' => 'newest'],
'single_quote' => ['strings_containing_single_quote_chars' => true],
])
->setFinder($finder)
;
->setUsingCache(true)
->setCacheFile('var/cache/cs_fixer.cache')
->setFinder(
(new Finder())->in([
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/public',
__DIR__ . '/config',
__DIR__ . '/bin',
])->exclude([
'node_modules',
'*/vendor/*',
])
);
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
"@auto-scripts"
],
"scripts": {
"ecs": "ecs check src tests",
"ecs-fix": "ecs check --fix src tests",
"ecs": "php-cs-fixer fix --dry-run --diff",
"ecs-fix": "php-cs-fixer fix",
"phpstan": "phpstan analyze --memory-limit=2G",
"phpunit": "phpunit",
"infection": "infection -j10 -s",
Expand All @@ -97,6 +97,7 @@
}
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.63",
"infection/infection": "^0.29.6",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.16",
"phpstan/extension-installer": "^1.3",
Expand All @@ -106,7 +107,6 @@
"symfony/debug-bundle": "^7.1",
"symfony/stopwatch": "^7.1",
"symfony/web-profiler-bundle": "^7.1",
"symplify/easy-coding-standard": "^12.0",
"symplify/phpstan-rules": "13.0.1",
"tomasvotruba/type-coverage": "^1.0.0"
}
Expand Down
63 changes: 1 addition & 62 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/bundles.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Expand Down
2 changes: 1 addition & 1 deletion config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
->load('Swag\\Braintree\\', '../src/*')
->exclude('../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}');

$container->import(__DIR__.'/services/braintree.xml', 'xml');
$container->import(__DIR__ . '/services/braintree.xml', 'xml');
};
146 changes: 0 additions & 146 deletions ecs.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Framework/Exception/BraintreeHttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class BraintreeHttpException extends HttpException
public function __construct(
string $message,
array $parameters = [],
?\Throwable $e = null
?\Throwable $e = null,
) {
$this->parameters = $parameters;
$message = $this->parse($message, $parameters);
Expand Down
2 changes: 1 addition & 1 deletion src/Framework/Serializer/EntityNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class EntityNormalizer implements NormalizerInterface
private const REGEX = '/.*(Swag.*)/';

public function __construct(
private readonly NormalizerInterface $normalizer
private readonly NormalizerInterface $normalizer,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Repository/ConfigRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* @method ConfigEntity|null find($id, $lockMode = null, $lockVersion = null)
* @method ConfigEntity|null findOneBy(array $criteria, array $orderBy = null)
* @method ConfigEntity[] findAll()
* @method ConfigEntity[] findAll()
*
* @extends AbstractRepository<ConfigEntity>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/CurrencyMappingRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* @method CurrencyMappingEntity|null find($id, $lockMode = null, $lockVersion = null)
* @method CurrencyMappingEntity|null findOneBy(array $criteria, array $orderBy = null)
* @method CurrencyMappingEntity[] findAll()
* @method CurrencyMappingEntity[] findAll()
*
* @extends AbstractRepository<CurrencyMappingEntity>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/ShopRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* @method ShopInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method ShopInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method ShopInterface[] findAll()
* @method ShopInterface[] findAll()
*
* @extends AbstractRepository<ShopInterface>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/TransactionReportRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* @method TransactionReportEntity|null find($id, $lockMode = null, $lockVersion = null)
* @method TransactionReportEntity|null findOneBy(array $criteria, array $orderBy = null)
* @method TransactionReportEntity[] findAll()
* @method TransactionReportEntity[] findAll()
*
* @extends ServiceEntityRepository<TransactionReportEntity>
*/
Expand Down
Loading

0 comments on commit 2b62998

Please sign in to comment.