Skip to content

Commit 5d4eefc

Browse files
committed
[BE] Precise missing return
1 parent bef91dd commit 5d4eefc

File tree

8 files changed

+2
-10
lines changed

8 files changed

+2
-10
lines changed

changelog-2.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ Bleeding edge (TODO move to other sections)
110110
* Check mixed in binary operator ([#3231](https://github.com/phpstan/phpstan-src/pull/3231)), #7538, #10440, thanks @schlndh!
111111
* Check vprintf/vsprintf arguments against placeholder count ([#3126](https://github.com/phpstan/phpstan-src/pull/3126)), thanks @staabm!
112112
* Check mixed in unary operator ([#3253](https://github.com/phpstan/phpstan-src/pull/3253)), thanks @schlndh!
113-
* Report "missing return" error closer to where the return is missing (https://github.com/phpstan/phpstan-src/commit/04f8636e6577cbcaefc944725eed74c0d7865ead)
114113
* Stricter ++/-- operator check ([#3255](https://github.com/phpstan/phpstan-src/pull/3255)), thanks @schlndh!
115114
* Check preg_quote delimiter sanity ([#3252](https://github.com/phpstan/phpstan-src/pull/3252)), #11338, thanks @staabm!
116115
* Improved the type of the `$mode` parameter for the `count()` ([#3190](https://github.com/phpstan/phpstan-src/pull/3190)), thanks @kuma3!
@@ -139,6 +138,7 @@ Improvements 🔧
139138
* Use explicit mixed for global array variables ([#1411](https://github.com/phpstan/phpstan-src/pull/1411)), thanks @herndlm!
140139
* Consider implicit throw points when the only explicit one is `Throw_` (https://github.com/phpstan/phpstan-src/commit/22eef6d5ab9a4afafb2305258fea273be6cc06e4)
141140
* Run missing type check on `@param-out` (https://github.com/phpstan/phpstan-src/commit/56b20024386d983927c64dfa895ff026bed2798c)
141+
* Report "missing return" error closer to where the return is missing (https://github.com/phpstan/phpstan-src/commit/04f8636e6577cbcaefc944725eed74c0d7865ead)
142142

143143
Bugfixes 🐛
144144
=====================

conf/bleedingEdge.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ parameters:
4545
checkParameterCastableToStringFunctions: true
4646
uselessReturnValue: true
4747
printfArrayParameters: true
48-
preciseMissingReturn: true
4948
validatePregQuote: true
5049
tooWidePropertyType: true
5150
absentTypeChecks: true

conf/config.neon

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ parameters:
8181
checkParameterCastableToStringFunctions: false
8282
uselessReturnValue: false
8383
printfArrayParameters: false
84-
preciseMissingReturn: false
8584
validatePregQuote: false
8685
requireFileExists: false
8786
narrowPregMatches: true
@@ -530,7 +529,6 @@ services:
530529
treatPhpDocTypesAsCertain: %treatPhpDocTypesAsCertain%
531530
detectDeadTypeInMultiCatch: %featureToggles.detectDeadTypeInMultiCatch%
532531
universalObjectCratesClasses: %universalObjectCratesClasses%
533-
preciseMissingReturn: %featureToggles.preciseMissingReturn%
534532

535533
-
536534
class: PHPStan\Analyser\ConstantResolver

conf/parametersSchema.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ parametersSchema:
7575
checkParameterCastableToStringFunctions: bool()
7676
uselessReturnValue: bool()
7777
printfArrayParameters: bool()
78-
preciseMissingReturn: bool()
7978
validatePregQuote: bool()
8079
narrowPregMatches: bool()
8180
tooWidePropertyType: bool()

src/Analyser/NodeScopeResolver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ public function __construct(
260260
private readonly bool $implicitThrows,
261261
private readonly bool $treatPhpDocTypesAsCertain,
262262
private readonly bool $detectDeadTypeInMultiCatch,
263-
private readonly bool $preciseMissingReturn,
264263
)
265264
{
266265
$earlyTerminatingMethodNames = [];
@@ -359,7 +358,7 @@ public function processStmtNodes(
359358
$parentNode = $parentNode;
360359

361360
$endStatements = $statementResult->getEndStatements();
362-
if ($this->preciseMissingReturn && count($endStatements) > 0) {
361+
if (count($endStatements) > 0) {
363362
foreach ($endStatements as $endStatement) {
364363
$endStatementResult = $endStatement->getResult();
365364
$nodeCallback(new ExecutionEndNode(

src/Testing/RuleTestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ private function getAnalyser(DirectRuleRegistry $ruleRegistry): Analyser
106106
self::getContainer()->getParameter('exceptions')['implicitThrows'],
107107
$this->shouldTreatPhpDocTypesAsCertain(),
108108
self::getContainer()->getParameter('featureToggles')['detectDeadTypeInMultiCatch'],
109-
self::getContainer()->getParameter('featureToggles')['preciseMissingReturn'],
110109
);
111110
$fileAnalyser = new FileAnalyser(
112111
$this->createScopeFactory($reflectionProvider, $typeSpecifier),

src/Testing/TypeInferenceTestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public static function processFile(
8686
self::getContainer()->getParameter('exceptions')['implicitThrows'],
8787
self::getContainer()->getParameter('treatPhpDocTypesAsCertain'),
8888
self::getContainer()->getParameter('featureToggles')['detectDeadTypeInMultiCatch'],
89-
self::getContainer()->getParameter('featureToggles')['preciseMissingReturn'],
9089
);
9190
$resolver->setAnalysedFiles(array_map(static fn (string $file): string => $fileHelper->normalizePath($file), array_merge([$file], static::getAdditionalAnalysedFiles())));
9291

tests/PHPStan/Analyser/AnalyserTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,6 @@ private function createAnalyser(): Analyser
729729
true,
730730
$this->shouldTreatPhpDocTypesAsCertain(),
731731
self::getContainer()->getParameter('featureToggles')['detectDeadTypeInMultiCatch'],
732-
self::getContainer()->getParameter('featureToggles')['preciseMissingReturn'],
733732
);
734733
$lexer = new Lexer();
735734
$fileAnalyser = new FileAnalyser(

0 commit comments

Comments
 (0)