Skip to content

Commit d7246a0

Browse files
committed
[BE] Consider implicit throw points when the only explicit one is Throw_
1 parent a63334e commit d7246a0

File tree

8 files changed

+2
-13
lines changed

8 files changed

+2
-13
lines changed

changelog-2.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ Bleeding edge (TODO move to other sections)
9292
* More precise types for bcmath function parameters ([#2217](https://github.com/phpstan/phpstan-src/pull/2217)), thanks @Warxcell!
9393
* Enforce `@no-named-arguments` (https://github.com/phpstan/phpstan-src/commit/74ba8c23696948f2647d880df72f375346f41010), #5968
9494
* Check too wide private property type (https://github.com/phpstan/phpstan-src/commit/7453f4f75fae3d635063589467842aae29d88b54)
95-
* Consider implicit throw points when the only explicit one is Throw_ (https://github.com/phpstan/phpstan-src/commit/22eef6d5ab9a4afafb2305258fea273be6cc06e4)
9695
* Check existing classes in `@param-out` (https://github.com/phpstan/phpstan-src/commit/30c4b9e80f51af8b5f166ba3aae93d8409c9c0ea), #10260
9796
* Check existing classes in `@param-closure-this` (https://github.com/phpstan/phpstan-src/commit/2fa539a39e06bcc3155b109fd8d246703ceb176d), #10933
9897
* Check invalid `@param-closure-this` (https://github.com/phpstan/phpstan-src/commit/95c0a5806c65c975201b9d3a464873f75a04c8b8), #10932
@@ -139,6 +138,7 @@ Improvements 🔧
139138
* New `RuleLevelHelper::accepts()` behaviour (https://github.com/phpstan/phpstan-src/commit/941fc815db49315b8783dc466cf593e0d8a85d23)
140139
* Infer explicit mixed when instantiating generic class with unknown template types (https://github.com/phpstan/phpstan-src/commit/089d4c6fb6eb709c44123548d33990113d174b86), #6398
141140
* Use explicit mixed for global array variables ([#1411](https://github.com/phpstan/phpstan-src/pull/1411)), thanks @herndlm!
141+
* Consider implicit throw points when the only explicit one is `Throw_` (https://github.com/phpstan/phpstan-src/commit/22eef6d5ab9a4afafb2305258fea273be6cc06e4)
142142

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

conf/bleedingEdge.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,5 @@ parameters:
4949
preciseMissingReturn: true
5050
validatePregQuote: true
5151
tooWidePropertyType: true
52-
explicitThrow: true
5352
absentTypeChecks: true
5453
requireFileExists: true

conf/config.neon

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ parameters:
8787
requireFileExists: false
8888
narrowPregMatches: true
8989
tooWidePropertyType: false
90-
explicitThrow: false
9190
absentTypeChecks: false
9291
fileExtensions:
9392
- php
@@ -534,7 +533,6 @@ services:
534533
universalObjectCratesClasses: %universalObjectCratesClasses%
535534
paramOutType: %featureToggles.paramOutType%
536535
preciseMissingReturn: %featureToggles.preciseMissingReturn%
537-
explicitThrow: %featureToggles.explicitThrow%
538536

539537
-
540538
class: PHPStan\Analyser\ConstantResolver

conf/parametersSchema.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ parametersSchema:
8080
validatePregQuote: bool()
8181
narrowPregMatches: bool()
8282
tooWidePropertyType: bool()
83-
explicitThrow: bool()
8483
absentTypeChecks: bool()
8584
requireFileExists: bool()
8685
])

src/Analyser/NodeScopeResolver.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ public function __construct(
262262
private readonly bool $detectDeadTypeInMultiCatch,
263263
private readonly bool $paramOutType,
264264
private readonly bool $preciseMissingReturn,
265-
private readonly bool $explicitThrow,
266265
)
267266
{
268267
$earlyTerminatingMethodNames = [];
@@ -1565,10 +1564,7 @@ private function processStmtNode(
15651564
}
15661565

15671566
// implicit only
1568-
if (
1569-
count($matchingThrowPoints) === 0
1570-
|| ($this->explicitThrow && $onlyExplicitIsThrow)
1571-
) {
1567+
if (count($matchingThrowPoints) === 0 || $onlyExplicitIsThrow) {
15721568
foreach ($throwPoints as $throwPointIndex => $throwPoint) {
15731569
if ($throwPoint->isExplicit()) {
15741570
continue;

src/Testing/RuleTestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ private function getAnalyser(DirectRuleRegistry $ruleRegistry): Analyser
108108
self::getContainer()->getParameter('featureToggles')['detectDeadTypeInMultiCatch'],
109109
self::getContainer()->getParameter('featureToggles')['paramOutType'],
110110
self::getContainer()->getParameter('featureToggles')['preciseMissingReturn'],
111-
self::getContainer()->getParameter('featureToggles')['explicitThrow'],
112111
);
113112
$fileAnalyser = new FileAnalyser(
114113
$this->createScopeFactory($reflectionProvider, $typeSpecifier),

src/Testing/TypeInferenceTestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public static function processFile(
8888
self::getContainer()->getParameter('featureToggles')['detectDeadTypeInMultiCatch'],
8989
self::getContainer()->getParameter('featureToggles')['paramOutType'],
9090
self::getContainer()->getParameter('featureToggles')['preciseMissingReturn'],
91-
self::getContainer()->getParameter('featureToggles')['explicitThrow'],
9291
);
9392
$resolver->setAnalysedFiles(array_map(static fn (string $file): string => $fileHelper->normalizePath($file), array_merge([$file], static::getAdditionalAnalysedFiles())));
9493

tests/PHPStan/Analyser/AnalyserTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,6 @@ private function createAnalyser(): Analyser
731731
self::getContainer()->getParameter('featureToggles')['detectDeadTypeInMultiCatch'],
732732
self::getContainer()->getParameter('featureToggles')['paramOutType'],
733733
self::getContainer()->getParameter('featureToggles')['preciseMissingReturn'],
734-
self::getContainer()->getParameter('featureToggles')['explicitThrow'],
735734
);
736735
$lexer = new Lexer();
737736
$fileAnalyser = new FileAnalyser(

0 commit comments

Comments
 (0)