Skip to content

Commit ee172cc

Browse files
Bump csfixer to version 3.75.0 and tweak configuration (#479)
* bump csfixer to latest version and tweak config * adds test for long version
1 parent 58d222a commit ee172cc

File tree

64 files changed

+336
-306
lines changed

Some content is hidden

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

64 files changed

+336
-306
lines changed

.php-cs-fixer.dist.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
->setFinder($finder)
1010
->setRiskyAllowed(true)
1111
->setRules([
12+
'@PER-CS' => true,
1213
'@Symfony' => true,
1314
'@Symfony:risky' => true,
1415
'@PHP71Migration:risky' => true,
@@ -39,5 +40,8 @@
3940
'list_syntax' => ['syntax' => 'short'],
4041
'phpdoc_to_comment' => false,
4142
'php_unit_method_casing' => ['case' => 'snake_case'],
42-
'function_to_constant' => false
43+
'function_to_constant' => false,
44+
'php_unit_data_provider_static' => true ,
45+
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
46+
'phpdoc_array_type' => true
4347
]);

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
"ondram/ci-detector": "^4.1"
3535
},
3636
"require-dev": {
37-
"roave/security-advisories": "dev-master",
38-
"symfony/var-dumper": "^3.0|^4.0|^5.0|^6.0|^7.0",
39-
"phpunit/phpunit": "^7.5|^9.0|^10.0",
37+
"friendsofphp/php-cs-fixer": "^3.75",
4038
"mikey179/vfsstream": "^1.6",
4139
"phpspec/prophecy": "^1.10",
42-
"friendsofphp/php-cs-fixer": "3.4.0",
43-
"phpspec/prophecy-phpunit": "^2.3"
40+
"phpspec/prophecy-phpunit": "^2.3",
41+
"phpunit/phpunit": "^7.5|^9.0|^10.0",
42+
"roave/security-advisories": "dev-master",
43+
"symfony/var-dumper": "^3.0|^4.0|^5.0|^6.0|^7.0"
4444
},
4545
"autoload": {
4646
"psr-4": {

src/Analyzer/FileParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class FileParser implements Parser
1919

2020
private FileVisitor $fileVisitor;
2121

22-
/** @var ParsingError[] */
22+
/** @var array<ParsingError> */
2323
private array $parsingErrors;
2424

2525
public function __construct(
@@ -38,7 +38,7 @@ public function __construct(
3838
}
3939

4040
/**
41-
* @return ClassDescription[]
41+
* @return array<ClassDescription>
4242
*/
4343
public function getClassDescriptions(): array
4444
{

src/Analyzer/FileVisitor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class FileVisitor extends NodeVisitorAbstract
1313
{
1414
private ClassDescriptionBuilder $classDescriptionBuilder;
1515

16-
/** @var ClassDescription[] */
16+
/** @var array<ClassDescription> */
1717
private array $classDescriptions = [];
1818

1919
public function __construct(ClassDescriptionBuilder $classDescriptionBuilder)

src/Analyzer/NameResolver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ protected function resolveAttrGroups(Node $node): void
329329

330330
/**
331331
* @param Stmt\Use_::TYPE_* $type
332-
* @param ?Name $prefix
333332
*
334333
* @psalm-suppress PossiblyNullArgument
335334
*/

src/CLI/Command/Check.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
142142

143143
$rulesFilename = $this->getConfigFilename($input);
144144
if (!$onlyErrors) {
145-
$output->writeln(sprintf("Config file: %s\n", $rulesFilename));
145+
$output->writeln(\sprintf("Config file: %s\n", $rulesFilename));
146146
}
147147

148148
$config = new Config();
@@ -267,9 +267,9 @@ private function printViolations(Violations $violations, OutputInterface $output
267267
$output->writeln('<error>ERRORS!</error>');
268268
}
269269

270-
$output->writeln(sprintf('%s', $violations->toString($format)));
270+
$output->writeln(\sprintf('%s', $violations->toString($format)));
271271
if (!$onlyErrors) {
272-
$output->writeln(sprintf('<error>%s VIOLATIONS DETECTED!</error>', \count($violations)));
272+
$output->writeln(\sprintf('<error>%s VIOLATIONS DETECTED!</error>', \count($violations)));
273273
}
274274
}
275275

@@ -278,7 +278,7 @@ private function printParsedErrors(ParsingErrors $parsingErrors, OutputInterface
278278
if (!$onlyErrors) {
279279
$output->writeln('<error>ERROR ON PARSING THESE FILES:</error>');
280280
}
281-
$output->writeln(sprintf('%s', $parsingErrors->toString()));
281+
$output->writeln(\sprintf('%s', $parsingErrors->toString()));
282282
}
283283

284284
private function printNoViolationsDetectedMessage(OutputInterface $output, bool $onlyErrors = false, string $format = Printer::FORMAT_TEXT): void

src/CLI/PhpArkitectApplication.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010

1111
class PhpArkitectApplication extends \Symfony\Component\Console\Application
1212
{
13-
/** @var string */
14-
private static $logo = <<< 'EOD'
15-
____ _ _ ____ _ _ _ _ _
16-
| _ \| | | | _ \ / \ _ __| | _(_) |_ ___ ___| |_
17-
| |_) | |_| | |_) / _ \ | '__| |/ / | __/ _ \/ __| __|
18-
| __/| _ | __/ ___ \| | | <| | || __/ (__| |_
19-
|_| |_| |_|_| /_/ \_\_| |_|\_\_|\__\___|\___|\__|
20-
EOD;
13+
private static string $logo = <<< 'EOD'
14+
____ _ _ ____ _ _ _ _ _
15+
| _ \| | | | _ \ / \ _ __| | _(_) |_ ___ ___| |_
16+
| |_) | |_| | |_) / _ \ | '__| |/ / | __/ _ \/ __| __|
17+
| __/| _ | __/ ___ \| | | <| | || __/ (__| |_
18+
|_| |_| |_|_| /_/ \_\_| |_|\_\_|\__\___|\___|\__|
19+
EOD;
2120

2221
public function __construct()
2322
{
@@ -29,6 +28,6 @@ public function __construct()
2928

3029
public function getLongVersion(): string
3130
{
32-
return sprintf("%s\n\n<info>%s</info> version <comment>%s</comment>", self::$logo, $this->getName(), $this->getVersion());
31+
return \sprintf("%s\n\n<info>%s</info> version <comment>%s</comment>", self::$logo, $this->getName(), $this->getVersion());
3332
}
3433
}

src/CLI/Printer/GitlabPrinter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ public function print(array $violationsCollection): string
1212
$allErrors = [];
1313

1414
/**
15-
* @var string $key
16-
* @var Violation[] $violationsByFqcn
15+
* @var string $key
16+
* @var array<Violation> $violationsByFqcn
1717
*/
1818
foreach ($violationsCollection as $class => $violationsByFqcn) {
1919
foreach ($violationsByFqcn as $violation) {

src/CLI/Printer/JsonPrinter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public function print(array $violationsCollection): string
1313
$details = [];
1414

1515
/**
16-
* @var string $key
17-
* @var Violation[] $violationsByFqcn
16+
* @var string $key
17+
* @var array<Violation> $violationsByFqcn
1818
*/
1919
foreach ($violationsCollection as $class => $violationsByFqcn) {
2020
$violationForThisFqcn = \count($violationsByFqcn);

src/CLI/Printer/TextPrinter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ public function print(array $violationsCollection): string
1212
$errors = '';
1313

1414
/**
15-
* @var string $key
16-
* @var Violation[] $violationsByFqcn
15+
* @var string $key
16+
* @var array<Violation> $violationsByFqcn
1717
*/
1818
foreach ($violationsCollection as $key => $violationsByFqcn) {
1919
$violationForThisFqcn = \count($violationsByFqcn);

0 commit comments

Comments
 (0)