Skip to content

Commit 1883a8f

Browse files
committed
Update baseline
1 parent d71ca6d commit 1883a8f

File tree

4 files changed

+41
-72
lines changed

4 files changed

+41
-72
lines changed

.php_cs.dist

Lines changed: 0 additions & 25 deletions
This file was deleted.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"require-dev": {
1717
"ergebnis/composer-normalize": "^2.0",
18-
"friendsofphp/php-cs-fixer": "^2.17",
18+
"friendsofphp/php-cs-fixer": "^3.0",
1919
"phpstan/phpstan": "~0.12.0",
2020
"phpunit/phpunit": "^9.0",
2121
"symfony/filesystem": "^4.2 || ^5.0",
@@ -41,7 +41,7 @@
4141
"prefer-stable": true,
4242
"scripts": {
4343
"integrate": [
44-
"vendor/bin/php-cs-fixer fix --dry-run",
44+
"vendor/bin/php-cs-fixer fix --dry-run --allow-risky=yes",
4545
"vendor/bin/phpstan analyse lib -c phpstan.neon",
4646
"vendor/bin/phpunit"
4747
]

lib/Adapter/Simple/ClassScanner.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
namespace Phpactor\ClassFileConverter\Adapter\Simple;
44

5-
use RuntimeException;
6-
use function token_name;
7-
85
/**
96
* Return the class name from a file.
107
*
@@ -20,6 +17,10 @@ public function getClassNameFromFile(string $file): ?string
2017

2118
$fp = fopen($file, 'r');
2219

20+
if (false === $fp) {
21+
return null;
22+
}
23+
2324
$class = $namespace = $buffer = '';
2425
$i = 0;
2526

@@ -71,6 +72,9 @@ public function getClassNameFromFile(string $file): ?string
7172
return ltrim($namespace . '\\' . $class, '\\');
7273
}
7374

75+
/**
76+
* @param string|array<mixed> $token
77+
*/
7478
private function isClassLike($token): bool
7579
{
7680
if (!is_array($token)) {

phpstan-baseline.neon

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ parameters:
66
path: lib/Adapter/Composer/ComposerClassToFile.php
77

88
-
9-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Composer\\\\ComposerClassToFile\\:\\:getStrategies\\(\\) return type has no value type specified in iterable type array\\.$#"
9+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Composer\\\\ComposerClassToFile\\:\\:getFileCandidates\\(\\) has no return typehint specified\\.$#"
1010
count: 1
1111
path: lib/Adapter/Composer/ComposerClassToFile.php
1212

1313
-
14-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Composer\\\\ComposerClassToFile\\:\\:resolveFile\\(\\) has parameter \\$candidates with no typehint specified\\.$#"
14+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Composer\\\\ComposerClassToFile\\:\\:getFileCandidates\\(\\) has parameter \\$prefixes with no value type specified in iterable type array\\.$#"
1515
count: 1
1616
path: lib/Adapter/Composer/ComposerClassToFile.php
1717

1818
-
19-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Composer\\\\ComposerClassToFile\\:\\:resolveFile\\(\\) has parameter \\$prefixes with no value type specified in iterable type array\\.$#"
19+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Composer\\\\ComposerClassToFile\\:\\:getStrategies\\(\\) return type has no value type specified in iterable type array\\.$#"
2020
count: 1
2121
path: lib/Adapter/Composer/ComposerClassToFile.php
2222

2323
-
24-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Composer\\\\ComposerClassToFile\\:\\:getFileCandidates\\(\\) has no return typehint specified\\.$#"
24+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Composer\\\\ComposerClassToFile\\:\\:resolveFile\\(\\) has parameter \\$candidates with no typehint specified\\.$#"
2525
count: 1
2626
path: lib/Adapter/Composer/ComposerClassToFile.php
2727

2828
-
29-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Composer\\\\ComposerClassToFile\\:\\:getFileCandidates\\(\\) has parameter \\$prefixes with no value type specified in iterable type array\\.$#"
29+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Composer\\\\ComposerClassToFile\\:\\:resolveFile\\(\\) has parameter \\$prefixes with no value type specified in iterable type array\\.$#"
3030
count: 1
3131
path: lib/Adapter/Composer/ComposerClassToFile.php
3232

@@ -50,16 +50,6 @@ parameters:
5050
count: 1
5151
path: lib/Adapter/Composer/ComposerFileToClass.php
5252

53-
-
54-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Simple\\\\ClassScanner\\:\\:getClassNameFromFile\\(\\) has no return typehint specified\\.$#"
55-
count: 1
56-
path: lib/Adapter/Simple/ClassScanner.php
57-
58-
-
59-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Simple\\\\ClassScanner\\:\\:getClassNameFromFile\\(\\) has parameter \\$file with no typehint specified\\.$#"
60-
count: 1
61-
path: lib/Adapter/Simple/ClassScanner.php
62-
6353
-
6454
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Adapter\\\\Simple\\\\SimpleClassToFile\\:\\:classToFileCandidates\\(\\) return type has no value type specified in iterable type Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates\\.$#"
6555
count: 1
@@ -76,52 +66,52 @@ parameters:
7666
path: lib/ClassToFileConverter.php
7767

7868
-
79-
message: "#^Property Phpactor\\\\ClassFileConverter\\\\Domain\\\\ChainClassToFile\\:\\:\\$converters type has no value type specified in iterable type array\\.$#"
69+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ChainClassToFile\\:\\:__construct\\(\\) has parameter \\$converters with no value type specified in iterable type array\\.$#"
8070
count: 1
8171
path: lib/Domain/ChainClassToFile.php
8272

8373
-
84-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ChainClassToFile\\:\\:__construct\\(\\) has parameter \\$converters with no value type specified in iterable type array\\.$#"
74+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ChainClassToFile\\:\\:classToFileCandidates\\(\\) return type has no value type specified in iterable type Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates\\.$#"
8575
count: 1
8676
path: lib/Domain/ChainClassToFile.php
8777

8878
-
89-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ChainClassToFile\\:\\:classToFileCandidates\\(\\) return type has no value type specified in iterable type Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates\\.$#"
79+
message: "#^Property Phpactor\\\\ClassFileConverter\\\\Domain\\\\ChainClassToFile\\:\\:\\$converters type has no value type specified in iterable type array\\.$#"
9080
count: 1
9181
path: lib/Domain/ChainClassToFile.php
9282

9383
-
94-
message: "#^Property Phpactor\\\\ClassFileConverter\\\\Domain\\\\ChainFileToClass\\:\\:\\$converters type has no value type specified in iterable type array\\.$#"
84+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ChainFileToClass\\:\\:__construct\\(\\) has parameter \\$converters with no value type specified in iterable type array\\.$#"
9585
count: 1
9686
path: lib/Domain/ChainFileToClass.php
9787

9888
-
99-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ChainFileToClass\\:\\:__construct\\(\\) has parameter \\$converters with no value type specified in iterable type array\\.$#"
89+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ChainFileToClass\\:\\:fileToClassCandidates\\(\\) return type has no value type specified in iterable type Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassNameCandidates\\.$#"
10090
count: 1
10191
path: lib/Domain/ChainFileToClass.php
10292

10393
-
104-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ChainFileToClass\\:\\:fileToClassCandidates\\(\\) return type has no value type specified in iterable type Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassNameCandidates\\.$#"
94+
message: "#^Property Phpactor\\\\ClassFileConverter\\\\Domain\\\\ChainFileToClass\\:\\:\\$converters type has no value type specified in iterable type array\\.$#"
10595
count: 1
10696
path: lib/Domain/ChainFileToClass.php
10797

10898
-
109-
message: "#^Property Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassName\\:\\:\\$fullyQualifiedName has no typehint specified\\.$#"
99+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassName\\:\\:beginsWith\\(\\) has no return typehint specified\\.$#"
110100
count: 1
111101
path: lib/Domain/ClassName.php
112102

113103
-
114-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassName\\:\\:fromString\\(\\) has no return typehint specified\\.$#"
104+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassName\\:\\:beginsWith\\(\\) has parameter \\$prefix with no typehint specified\\.$#"
115105
count: 1
116106
path: lib/Domain/ClassName.php
117107

118108
-
119-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassName\\:\\:fromString\\(\\) has parameter \\$string with no typehint specified\\.$#"
109+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassName\\:\\:fromString\\(\\) has no return typehint specified\\.$#"
120110
count: 1
121111
path: lib/Domain/ClassName.php
122112

123113
-
124-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassName\\:\\:namespace\\(\\) has no return typehint specified\\.$#"
114+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassName\\:\\:fromString\\(\\) has parameter \\$string with no typehint specified\\.$#"
125115
count: 1
126116
path: lib/Domain/ClassName.php
127117

@@ -131,12 +121,12 @@ parameters:
131121
path: lib/Domain/ClassName.php
132122

133123
-
134-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassName\\:\\:beginsWith\\(\\) has no return typehint specified\\.$#"
124+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassName\\:\\:namespace\\(\\) has no return typehint specified\\.$#"
135125
count: 1
136126
path: lib/Domain/ClassName.php
137127

138128
-
139-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassName\\:\\:beginsWith\\(\\) has parameter \\$prefix with no typehint specified\\.$#"
129+
message: "#^Property Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassName\\:\\:\\$fullyQualifiedName has no typehint specified\\.$#"
140130
count: 1
141131
path: lib/Domain/ClassName.php
142132

@@ -145,11 +135,6 @@ parameters:
145135
count: 1
146136
path: lib/Domain/ClassNameCandidates.php
147137

148-
-
149-
message: "#^Property Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassNameCandidates\\:\\:\\$classNames has no typehint specified\\.$#"
150-
count: 1
151-
path: lib/Domain/ClassNameCandidates.php
152-
153138
-
154139
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassNameCandidates\\:\\:__construct\\(\\) has parameter \\$classNames with no value type specified in iterable type array\\.$#"
155140
count: 1
@@ -171,37 +156,37 @@ parameters:
171156
path: lib/Domain/ClassNameCandidates.php
172157

173158
-
174-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassToFile\\:\\:classToFileCandidates\\(\\) return type has no value type specified in iterable type Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates\\.$#"
159+
message: "#^Property Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassNameCandidates\\:\\:\\$classNames has no typehint specified\\.$#"
175160
count: 1
176-
path: lib/Domain/ClassToFile.php
161+
path: lib/Domain/ClassNameCandidates.php
177162

178163
-
179-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassToFileFileToClass\\:\\:fileToClassCandidates\\(\\) return type has no value type specified in iterable type Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassNameCandidates\\.$#"
164+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassToFile\\:\\:classToFileCandidates\\(\\) return type has no value type specified in iterable type Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates\\.$#"
180165
count: 1
181-
path: lib/Domain/ClassToFileFileToClass.php
166+
path: lib/Domain/ClassToFile.php
182167

183168
-
184169
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassToFileFileToClass\\:\\:classToFileCandidates\\(\\) return type has no value type specified in iterable type Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates\\.$#"
185170
count: 1
186171
path: lib/Domain/ClassToFileFileToClass.php
187172

188173
-
189-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePath\\:\\:fromString\\(\\) has parameter \\$path with no typehint specified\\.$#"
174+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassToFileFileToClass\\:\\:fileToClassCandidates\\(\\) return type has no value type specified in iterable type Phpactor\\\\ClassFileConverter\\\\Domain\\\\ClassNameCandidates\\.$#"
190175
count: 1
191-
path: lib/Domain/FilePath.php
176+
path: lib/Domain/ClassToFileFileToClass.php
192177

193178
-
194179
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePath\\:\\:fromParts\\(\\) has parameter \\$parts with no value type specified in iterable type array\\.$#"
195180
count: 1
196181
path: lib/Domain/FilePath.php
197182

198183
-
199-
message: "#^Class Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#"
184+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePath\\:\\:fromString\\(\\) has parameter \\$path with no typehint specified\\.$#"
200185
count: 1
201-
path: lib/Domain/FilePathCandidates.php
186+
path: lib/Domain/FilePath.php
202187

203188
-
204-
message: "#^Property Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates\\:\\:\\$filePaths has no typehint specified\\.$#"
189+
message: "#^Class Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates implements generic interface IteratorAggregate but does not specify its types\\: TKey, TValue$#"
205190
count: 1
206191
path: lib/Domain/FilePathCandidates.php
207192

@@ -225,13 +210,18 @@ parameters:
225210
count: 1
226211
path: lib/Domain/FilePathCandidates.php
227212

213+
-
214+
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates\\:\\:getIterator\\(\\) return type has no value type specified in iterable type Traversable\\<mixed, mixed\\>\\.$#"
215+
count: 1
216+
path: lib/Domain/FilePathCandidates.php
217+
228218
-
229219
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates\\:\\:toArray\\(\\) return type has no value type specified in iterable type array\\.$#"
230220
count: 1
231221
path: lib/Domain/FilePathCandidates.php
232222

233223
-
234-
message: "#^Method Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates\\:\\:getIterator\\(\\) return type has no value type specified in iterable type Traversable\\<mixed, mixed\\>\\.$#"
224+
message: "#^Property Phpactor\\\\ClassFileConverter\\\\Domain\\\\FilePathCandidates\\:\\:\\$filePaths has no typehint specified\\.$#"
235225
count: 1
236226
path: lib/Domain/FilePathCandidates.php
237227

0 commit comments

Comments
 (0)