Skip to content

Commit 7e47baa

Browse files
committed
Remove optional parameters added since June 2026
Parameters that became optional in the last 135 days are now required, and every caller passes the former default explicitly. The native mirrors in turbo-ext follow: regenerated arginfo, required ZPP arguments, and native calls into PHP that pass the full argument lists. Kept optional: parameters after an older optional parameter, the TemplateTypeTrait::isValidVariance() $strict required by the interface, CachedParser's $cachedSourceBytesMax (constructed by Larastan), OpenSslCipherMethodsProvider's $supportedCipherMethods (DI autowiring), and the trailing ExpressionResult constructor parameters that the generated ExpressionResultFactory does not pass. Amp-Thread-ID: https://ampcode.com/threads/T-01a18404-a5f9-74cf-bb1b-815927dc7033
1 parent b6bee99 commit 7e47baa

298 files changed

Lines changed: 4405 additions & 5209 deletions

File tree

Some content is hidden

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

‎bin/phpstan‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use Symfony\Component\Console\Helper\ProgressBar;
3333
require_once __DIR__ . '/../src/Process/Restart/IniComposer.php';
3434
require_once __DIR__ . '/../src/Process/Restart/RestartExecutor.php';
3535
require_once __DIR__ . '/../src/Process/Restart/RestartManager.php';
36-
RestartManager::run($_SERVER['argv']);
36+
RestartManager::run($_SERVER['argv'], null, null, 'phpstan');
3737
TurboExtensionEnabler::trustOwnTypesIfSuitable($_SERVER['argv']);
3838

3939
$analysisStartTime = microtime(true);

‎build/PHPStan/Build/InlineCallCollector.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ final class InlineCallCollector implements Collector
8383
/**
8484
* @param list<string>|null $directories the closed world to scan for overrides; null = directories()
8585
*/
86-
public function __construct(private Parser $parser, private ReflectionProvider $reflectionProvider, private ?array $directories = null)
86+
public function __construct(private Parser $parser, private ReflectionProvider $reflectionProvider, private ?array $directories)
8787
{
8888
}
8989

‎build/baseline-optional-parameters.neon‎

Lines changed: 220 additions & 1852 deletions
Large diffs are not rendered by default.

‎build/inline.neon‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ services:
1717
class: PHPStan\Build\InlineCallCollector
1818
arguments:
1919
parser: @defaultAnalysisParser
20+
directories: null
2021
tags:
2122
- phpstan.collector
2223
-

‎build/regex-parser/RegexGrammar.pp3‎

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
%token T_LITERAL \\.|.|\n
132132

133133
Expression -> {
134-
return new RegexNode('#expression', children: \is_array($children) ? $children : [$children]);
134+
return new RegexNode('#expression', '', '', \is_array($children) ? $children : [$children]);
135135
}
136136
: Alternation()?
137137
;
@@ -145,14 +145,14 @@ Alternation -> {
145145
foreach ($children as $child) {
146146
if ($child instanceof TokenInterface) {
147147
$isAlternation = true;
148-
$child = new RegexNode('token', 'alternation', $child->value);
148+
$child = new RegexNode('token', 'alternation', $child->value, []);
149149
}
150150
$nodes[] = $child;
151151
}
152152
if (!$isAlternation) {
153153
return $children[0] ?? [];
154154
}
155-
return new RegexNode('#alternation', children: $nodes);
155+
return new RegexNode('#alternation', '', '', $nodes);
156156
}
157157
: Concatenation()? (<T_ALTERNATION> Concatenation()?)*
158158
;
@@ -164,14 +164,14 @@ Concatenation -> {
164164
if (\count($children) === 1) {
165165
return $children[0];
166166
}
167-
return new RegexNode('#concatenation', children: $children);
167+
return new RegexNode('#concatenation', '', '', $children);
168168
}
169169
: (InternalOptions() | Assertion() | Quantification() | Condition())+
170170
;
171171

172172
InternalOptions -> {
173-
return new RegexNode('#internal_options', children: [
174-
new RegexNode('token', 'internal_option', $children->value),
173+
return new RegexNode('#internal_options', '', '', [
174+
new RegexNode('token', 'internal_option', $children->value, []),
175175
]);
176176
}
177177
: <T_INTERNAL_OPTION>
@@ -181,16 +181,16 @@ Condition -> {
181181
$reference = \array_shift($children);
182182
switch ($reference->id) {
183183
case self::T_NAMED_REFERENCE:
184-
\array_unshift($children, new RegexNode('token', 'capturing_name', $reference->captures[0]));
185-
return new RegexNode('#namedcondition', children: $children);
184+
\array_unshift($children, new RegexNode('token', 'capturing_name', $reference->captures[0], []));
185+
return new RegexNode('#namedcondition', '', '', $children);
186186
case self::T_ABSOLUTE_REFERENCE:
187-
\array_unshift($children, new RegexNode('token', 'index', $reference->captures[0]));
188-
return new RegexNode('#absolutecondition', children: $children);
187+
\array_unshift($children, new RegexNode('token', 'index', $reference->captures[0], []));
188+
return new RegexNode('#absolutecondition', '', '', $children);
189189
case self::T_RELATIVE_REFERENCE:
190-
\array_unshift($children, new RegexNode('token', 'index', $reference->captures[0]));
191-
return new RegexNode('#relativecondition', children: $children);
190+
\array_unshift($children, new RegexNode('token', 'index', $reference->captures[0], []));
191+
return new RegexNode('#relativecondition', '', '', $children);
192192
default:
193-
return new RegexNode('#assertioncondition', children: $children);
193+
return new RegexNode('#assertioncondition', '', '', $children);
194194
}
195195
}
196196
: (
@@ -211,7 +211,7 @@ Assertion -> {
211211
self::T_LOOKBEHIND => '#lookbehind',
212212
self::T_NEGATIVE_LOOKBEHIND => '#negativelookbehind',
213213
];
214-
return new RegexNode($ids[$assertion->id], children: $children);
214+
return new RegexNode($ids[$assertion->id], '', '', $children);
215215
}
216216
: (<T_LOOKAHEAD> | <T_NEGATIVE_LOOKAHEAD> | <T_LOOKBEHIND> | <T_NEGATIVE_LOOKBEHIND>)
217217
Alternation()?
@@ -225,9 +225,9 @@ Quantification -> {
225225
if (\count($children) === 1) {
226226
return $children[0];
227227
}
228-
return new RegexNode('#quantification', children: [
228+
return new RegexNode('#quantification', '', '', [
229229
$children[0],
230-
new RegexNode('token', \strtolower(\substr($children[1]->name, 2)), $children[1]->value),
230+
new RegexNode('token', \strtolower(\substr($children[1]->name, 2)), $children[1]->value, []),
231231
]);
232232
}
233233
: (CharacterClass() | Capturing() | Literal()) Quantifier()?
@@ -251,7 +251,7 @@ CharacterClass -> {
251251

252252
$nodes = [];
253253
if ($children->id === self::T_NEGATIVE_CLASS_FC || $children->id === self::T_CLASS_FC) {
254-
$nodes[] = new RegexNode('token', '_class', ']');
254+
$nodes[] = new RegexNode('token', '_class', ']', []);
255255
}
256256

257257
$literalNames = [
@@ -265,37 +265,37 @@ CharacterClass -> {
265265
$i = 0;
266266
// <range>? ( <posix_class> | <class_> | range() <range>? | literal() )* <range>?
267267
if ($i < $count && $tokens[$i]->name === 'T_RANGE') {
268-
$nodes[] = new RegexNode('token', 'range', $tokens[$i]->value);
268+
$nodes[] = new RegexNode('token', 'range', $tokens[$i]->value, []);
269269
$i++;
270270
}
271271
while ($i < $count) {
272272
$token = $tokens[$i];
273273
if ($token->name === 'T_POSIX_CLASS') {
274-
$nodes[] = new RegexNode('token', 'posix_class', $token->value);
274+
$nodes[] = new RegexNode('token', 'posix_class', $token->value, []);
275275
$i++;
276276
continue;
277277
}
278278
if ($token->name === 'T_CLASS_NESTED') {
279-
$nodes[] = new RegexNode('token', 'class_', $token->value);
279+
$nodes[] = new RegexNode('token', 'class_', $token->value, []);
280280
$i++;
281281
continue;
282282
}
283283
if (!isset($literalNames[$token->name])) {
284284
break;
285285
}
286-
$literal = new RegexNode('token', $literalNames[$token->name], $token->value);
286+
$literal = new RegexNode('token', $literalNames[$token->name], $token->value, []);
287287
if (
288288
$i + 2 < $count
289289
&& $tokens[$i + 1]->name === 'T_RANGE'
290290
&& isset($literalNames[$tokens[$i + 2]->name])
291291
) {
292-
$nodes[] = new RegexNode('#range', children: [
292+
$nodes[] = new RegexNode('#range', '', '', [
293293
$literal,
294-
new RegexNode('token', $literalNames[$tokens[$i + 2]->name], $tokens[$i + 2]->value),
294+
new RegexNode('token', $literalNames[$tokens[$i + 2]->name], $tokens[$i + 2]->value, []),
295295
]);
296296
$i += 3;
297297
if ($i < $count && $tokens[$i]->name === 'T_RANGE') {
298-
$nodes[] = new RegexNode('token', 'range', $tokens[$i]->value);
298+
$nodes[] = new RegexNode('token', 'range', $tokens[$i]->value, []);
299299
$i++;
300300
}
301301
continue;
@@ -304,15 +304,15 @@ CharacterClass -> {
304304
$i++;
305305
}
306306
if ($i < $count && $tokens[$i]->name === 'T_RANGE') {
307-
$nodes[] = new RegexNode('token', 'range', $tokens[$i]->value);
307+
$nodes[] = new RegexNode('token', 'range', $tokens[$i]->value, []);
308308
$i++;
309309
}
310310
if ($i !== $count) {
311311
throw new RegexSyntaxException('Unexpected token in character class');
312312
}
313313

314314
$negative = $children->id === self::T_NEGATIVE_CLASS_FC || $children->id === self::T_NEGATIVE_CLASS;
315-
return new RegexNode($negative ? '#negativeclass' : '#class', children: $nodes);
315+
return new RegexNode($negative ? '#negativeclass' : '#class', '', '', $nodes);
316316
}
317317
: <T_NEGATIVE_CLASS_FC> | <T_CLASS_FC> | <T_NEGATIVE_CLASS> | <T_CLASS>
318318
;
@@ -324,27 +324,27 @@ Capturing -> {
324324
$opening = \array_shift($children);
325325
switch ($opening->id) {
326326
case self::T_MARKER:
327-
return new RegexNode('#mark', children: [
328-
new RegexNode('token', 'name', $opening->captures[0]),
327+
return new RegexNode('#mark', '', '', [
328+
new RegexNode('token', 'name', $opening->captures[0], []),
329329
]);
330330
case self::T_COMMENT:
331-
return new RegexNode('#comment', children: $opening->captures[0] === '' ? [] : [
332-
new RegexNode('token', 'comment', $opening->captures[0]),
331+
return new RegexNode('#comment', '', '', $opening->captures[0] === '' ? [] : [
332+
new RegexNode('token', 'comment', $opening->captures[0], []),
333333
]);
334334
case self::T_NAMED_CAPTURING:
335-
\array_unshift($children, new RegexNode('token', 'capturing_name', $opening->captures[0]));
336-
return new RegexNode('#namedcapturing', children: $children);
335+
\array_unshift($children, new RegexNode('token', 'capturing_name', $opening->captures[0], []));
336+
return new RegexNode('#namedcapturing', '', '', $children);
337337
case self::T_NON_CAPTURING:
338-
return new RegexNode('#noncapturing', children: $children);
338+
return new RegexNode('#noncapturing', '', '', $children);
339339
case self::T_NON_CAPTURING_INTERNAL_OPTION:
340-
\array_unshift($children, new RegexNode('token', 'non_capturing_internal_option', $opening->value));
341-
return new RegexNode('#noncapturing', children: $children);
340+
\array_unshift($children, new RegexNode('token', 'non_capturing_internal_option', $opening->value, []));
341+
return new RegexNode('#noncapturing', '', '', $children);
342342
case self::T_NON_CAPTURING_RESET:
343-
return new RegexNode('#noncapturingreset', children: $children);
343+
return new RegexNode('#noncapturingreset', '', '', $children);
344344
case self::T_ATOMIC_GROUP:
345-
return new RegexNode('#atomicgroup', children: $children);
345+
return new RegexNode('#atomicgroup', '', '', $children);
346346
default:
347-
return new RegexNode('#capturing', children: $children);
347+
return new RegexNode('#capturing', '', '', $children);
348348
}
349349
}
350350
: <T_MARKER>
@@ -367,7 +367,7 @@ Literal -> {
367367
self::T_SUBROUTINE_G => 'subroutine',
368368
];
369369

370-
return new RegexNode('token', $names[$children->id] ?? \strtolower(\substr($children->name, 2)), $children->value);
370+
return new RegexNode('token', $names[$children->id] ?? \strtolower(\substr($children->name, 2)), $children->value, []);
371371
}
372372
: <T_CHARACTER>
373373
| <T_DYNAMIC_CHARACTER>

‎src/Analyser/Analyser.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public function analyse(
152152
// analysis ran in this process - its peak is read where the number is printed
153153
peakMemoryUsageBytes: 0,
154154
processedFiles: $allProcessedFiles,
155+
workerCount: 0,
155156
);
156157
}
157158

‎src/Analyser/AnalyserResult.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(
5050
private bool $reachedInternalErrorsCountLimit,
5151
private int $peakMemoryUsageBytes,
5252
private array $processedFiles,
53-
private int $workerCount = 0,
53+
private int $workerCount,
5454
)
5555
{
5656
}

‎src/Analyser/AnalyserResultFinalizer.php‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,23 @@ public function finalize(
6161
AnalyserResult $analyserResult,
6262
bool $onlyFiles,
6363
bool $debug,
64-
?Closure $preRuleCallback = null,
65-
?Closure $postRuleCallback = null,
66-
array $previousCollectedDataRuleResults = [],
64+
?Closure $preRuleCallback,
65+
?Closure $postRuleCallback,
66+
array $previousCollectedDataRuleResults,
6767
): FinalizerResult
6868
{
6969
if (count($analyserResult->getCollectedData()) === 0) {
70-
return $this->addUnmatchedIgnoredErrors($this->mergeFilteredPhpErrors($analyserResult), [], []);
70+
return $this->addUnmatchedIgnoredErrors($this->mergeFilteredPhpErrors($analyserResult), [], [], [], 0);
7171
}
7272

7373
$hasInternalErrors = count($analyserResult->getInternalErrors()) > 0 || $analyserResult->hasReachedInternalErrorsCountLimit();
7474
if ($hasInternalErrors) {
75-
return $this->addUnmatchedIgnoredErrors($this->mergeFilteredPhpErrors($analyserResult), [], []);
75+
return $this->addUnmatchedIgnoredErrors($this->mergeFilteredPhpErrors($analyserResult), [], [], [], 0);
7676
}
7777

7878
$nodeType = CollectedDataNode::class;
7979
$collectedData = $analyserResult->getCollectedData();
80-
$node = new CollectedDataNode($collectedData, $onlyFiles);
80+
$node = new CollectedDataNode($collectedData, $onlyFiles, null);
8181

8282
// Hashed once per collector type and run, in the same order however the files were merged.
8383
$collectorHashes = [];
@@ -349,8 +349,8 @@ private function addUnmatchedIgnoredErrors(
349349
AnalyserResult $analyserResult,
350350
array $collectorErrors,
351351
array $locallyIgnoredCollectorErrors,
352-
array $collectedDataRuleResults = [],
353-
int $reusedRulesCount = 0,
352+
array $collectedDataRuleResults,
353+
int $reusedRulesCount,
354354
): FinalizerResult
355355
{
356356
if (!$this->reportUnmatchedIgnoredErrors) {

‎src/Analyser/ArgsResult.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(
3131
private ExpressionResult $expressionResult,
3232
private ?ParametersAcceptor $resolvedParametersAcceptor,
3333
private array $argResults,
34-
private array $byRefArguments = [],
34+
private array $byRefArguments,
3535
)
3636
{
3737
}

0 commit comments

Comments
 (0)