Skip to content

Commit 713915d

Browse files
authored
Polishing composer rules (#5170)
* [Composer] Add check for existing compsore.json * update composer package * coding style * various static fixes
1 parent 96e4412 commit 713915d

File tree

56 files changed

+401
-246
lines changed

Some content is hidden

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

56 files changed

+401
-246
lines changed

composer.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@
4141
"symfony/dependency-injection": "^5.1",
4242
"symfony/finder": "^4.4.8|^5.1",
4343
"symfony/http-kernel": "^4.4.8|^5.1",
44-
"symplify/autowire-array-parameter": "^9.0.26",
45-
"symplify/console-color-diff": "^9.0.26",
46-
"symplify/package-builder": "^9.0.26",
47-
"symplify/rule-doc-generator": "^9.0.26",
48-
"symplify/set-config-resolver": "^9.0.26",
49-
"symplify/simple-php-doc-parser": "^9.0.26",
50-
"symplify/skipper": "^9.0.26",
51-
"symplify/smart-file-system": "^9.0.26",
52-
"symplify/symfony-php-config": "^9.0.26",
44+
"symplify/autowire-array-parameter": "^9.0.34",
45+
"symplify/console-color-diff": "^9.0.34",
46+
"symplify/package-builder": "^9.0.34",
47+
"symplify/rule-doc-generator": "^9.0.34",
48+
"symplify/set-config-resolver": "^9.0.34",
49+
"symplify/simple-php-doc-parser": "^9.0.34",
50+
"symplify/skipper": "^9.0.34",
51+
"symplify/smart-file-system": "^9.0.34",
52+
"symplify/symfony-php-config": "^9.0.34",
5353
"webmozart/assert": "^1.9"
5454
},
5555
"require-dev": {
@@ -62,12 +62,12 @@
6262
"phpstan/phpstan-nette": "^0.12.12",
6363
"phpunit/phpunit": "^9.5",
6464
"sebastian/diff": "^4.0.4",
65-
"symplify/changelog-linker": "^9.0.26",
66-
"symplify/coding-standard": "^9.0.26",
67-
"symplify/easy-coding-standard": "^9.0.26",
68-
"symplify/easy-testing": "^9.0.26",
69-
"symplify/phpstan-extensions": "^9.0.26",
70-
"symplify/phpstan-rules": "^9.0.26",
65+
"symplify/changelog-linker": "^9.0.34",
66+
"symplify/coding-standard": "^9.0.34",
67+
"symplify/easy-coding-standard": "^9.0.34",
68+
"symplify/easy-testing": "^9.0.34",
69+
"symplify/phpstan-extensions": "^9.0.34",
70+
"symplify/phpstan-rules": "^9.0.34",
7171
"tracy/tracy": "^2.7"
7272
},
7373
"replace": {

config/set/nette-30.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@
103103
$services->set(ComposerModifier::class)
104104
->call('configure', [
105105
ValueObjectInliner::inline([
106-
new ChangePackageVersion('nette/nette', '^3.0'), // meta package
106+
// meta package
107+
new ChangePackageVersion('nette/nette', '^3.0'),
107108
// https://github.com/nette/nette/blob/v2.4.0/composer.json vs https://github.com/nette/nette/blob/v3.0.0/composer.json
108-
new ChangePackageVersion('nette/application', '^3.0.6'), // older versions have security issues
109+
// older versions have security issues
110+
new ChangePackageVersion('nette/application', '^3.0.6'),
109111
new ChangePackageVersion('nette/bootstrap', '^3.0'),
110112
new ChangePackageVersion('nette/caching', '^3.0'),
111113
new ChangePackageVersion('nette/component-model', '^3.0'),
@@ -133,6 +135,6 @@
133135
new ChangePackageVersion('contributte/forms-multiplier', '3.1.x-dev'),
134136
// other packages
135137
new ChangePackageVersion('radekdostal/nette-datetimepicker', '^3.0'),
136-
])
138+
]),
137139
]);
138140
};

packages/better-php-doc-parser/tests/PhpDocInfo/PhpDocInfo/PhpDocInfoTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,8 @@ public function testReplaceTagByAnother(): void
7878

7979
$this->docBlockManipulator->replaceTagByAnother($phpDocInfo->getPhpDocNode(), 'test', 'flow');
8080

81-
$this->assertStringEqualsFile(
82-
__DIR__ . '/Source/expected-replaced-tag.txt',
83-
$this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo)
84-
);
81+
$printedPhpDocInfo = $this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo);
82+
$this->assertStringEqualsFile(__DIR__ . '/Source/expected-replaced-tag.txt', $printedPhpDocInfo);
8583
}
8684

8785
private function createPhpDocInfoFromFile(string $path): PhpDocInfo

packages/better-php-doc-parser/tests/PhpDocInfo/PhpDocInfoPrinter/DoctrineTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ public function testClass(string $docFilePath, Node $node): void
2525
$fileInfo = new SmartFileInfo($docFilePath);
2626
$relativeFilePathFromCwd = $fileInfo->getRelativeFilePathFromCwd();
2727

28-
$this->assertSame(
29-
$docComment,
30-
$this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo),
31-
$relativeFilePathFromCwd
32-
);
28+
$printedPhpDocInfo = $this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo);
29+
$this->assertSame($docComment, $printedPhpDocInfo, $relativeFilePathFromCwd);
3330
}
3431

3532
public function provideDataClass(): Iterator

packages/better-php-doc-parser/tests/PhpDocInfo/PhpDocInfoPrinter/MultilineTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ public function test(string $docFilePath, Node $node): void
3636
$fileInfo = new SmartFileInfo($docFilePath);
3737
$relativeFilePathFromCwd = $fileInfo->getRelativeFilePathFromCwd();
3838

39-
$this->assertSame(
40-
$docComment,
41-
$this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo),
42-
$relativeFilePathFromCwd
43-
);
39+
$printedPhpDocInfo = $this->phpDocInfoPrinter->printFormatPreserving($phpDocInfo);
40+
$this->assertSame($docComment, $printedPhpDocInfo, $relativeFilePathFromCwd);
4441
}
4542

4643
public function provideData(): Iterator

packages/better-php-doc-parser/tests/PhpDocParser/TypeNodeAnalyzerTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ protected function setUp(): void
3838
*/
3939
public function testContainsArrayType(TypeNode $typeNode, bool $expectedContains): void
4040
{
41-
$this->assertSame($expectedContains, $this->typeNodeAnalyzer->containsArrayType($typeNode));
41+
$containsArrayType = $this->typeNodeAnalyzer->containsArrayType($typeNode);
42+
$this->assertSame($expectedContains, $containsArrayType);
4243
}
4344

4445
public function provideDataForArrayType(): Iterator
@@ -55,7 +56,8 @@ public function provideDataForArrayType(): Iterator
5556
*/
5657
public function testIsIntersectionAndNotNullable(TypeNode $typeNode, bool $expectedIs): void
5758
{
58-
$this->assertSame($expectedIs, $this->typeNodeAnalyzer->isIntersectionAndNotNullable($typeNode));
59+
$isIntersection = $this->typeNodeAnalyzer->isIntersectionAndNotNullable($typeNode);
60+
$this->assertSame($expectedIs, $isIntersection);
5961
}
6062

6163
public function provideDataForIntersectionAndNotNullable(): Iterator

packages/node-type-resolver/tests/PerNodeTypeResolver/ClassAndInterfaceTypeResolver/ClassTypeResolverTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public function test(string $file, int $nodePosition, Type $expectedType): void
2929
{
3030
$variableNodes = $this->getNodesForFileOfType($file, Class_::class);
3131

32-
$this->assertEquals($expectedType, $this->nodeTypeResolver->resolve($variableNodes[$nodePosition]));
32+
$resolvedType = $this->nodeTypeResolver->resolve($variableNodes[$nodePosition]);
33+
$this->assertEquals($expectedType, $resolvedType);
3334
}
3435

3536
public function dataProvider(): Iterator

packages/node-type-resolver/tests/PerNodeTypeResolver/ClassAndInterfaceTypeResolver/InterfaceTypeResolverTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public function test(string $file, int $nodePosition, Type $expectedType): void
2424
{
2525
$variableNodes = $this->getNodesForFileOfType($file, Interface_::class);
2626

27-
$this->assertEquals($expectedType, $this->nodeTypeResolver->resolve($variableNodes[$nodePosition]));
27+
$resolvedType = $this->nodeTypeResolver->resolve($variableNodes[$nodePosition]);
28+
$this->assertEquals($expectedType, $resolvedType);
2829
}
2930

3031
public function dataProvider(): Iterator

packages/node-type-resolver/tests/PerNodeTypeResolver/NameTypeResolver/NameTypeResolverTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public function test(string $file, int $nodePosition, Type $expectedType): void
2323
{
2424
$nameNodes = $this->getNodesForFileOfType($file, Name::class);
2525

26-
$this->assertEquals($expectedType, $this->nodeTypeResolver->resolve($nameNodes[$nodePosition]));
26+
$resolvedType = $this->nodeTypeResolver->resolve($nameNodes[$nodePosition]);
27+
$this->assertEquals($expectedType, $resolvedType);
2728
}
2829

2930
public function provideData(): Iterator

packages/node-type-resolver/tests/PerNodeTypeResolver/TraitTypeResolver/TraitTypeResolverTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public function test(string $file, int $nodePosition, Type $expectedType): void
2424
{
2525
$variableNodes = $this->getNodesForFileOfType($file, Trait_::class);
2626

27-
$this->assertEquals($expectedType, $this->nodeTypeResolver->resolve($variableNodes[$nodePosition]));
27+
$resolvedType = $this->nodeTypeResolver->resolve($variableNodes[$nodePosition]);
28+
$this->assertEquals($expectedType, $resolvedType);
2829
}
2930

3031
public function provideData(): Iterator

0 commit comments

Comments
 (0)