Skip to content

Commit 06d8cf7

Browse files
committed
Fix too-wide return types of functions and methods that cannot be overridden
Under the fixMissingReturnTypes feature toggle, return.unusedType and return.tooWideBool of functions, private methods and methods that cannot be overridden remove the members the function never returns, first from the native type, then from the @return tags, which stay subtypes of the native type. bool becomes true or false only where PHP allows it, and before PHP 7.4 the native type of an overriding method is not narrowed. Amp-Thread-ID: https://ampcode.com/threads/T-01a22c96-9e21-771f-9a29-4627539ba301
1 parent 1c4ca0d commit 06d8cf7

25 files changed

Lines changed: 1864 additions & 4 deletions

‎Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ lint:
2121
--exclude tests/PHPStan/Rules/Methods/data \
2222
--exclude tests/PHPStan/Rules/Functions/data \
2323
--exclude tests/PHPStan/Rules/data/fix-missing-return-type \
24+
--exclude tests/PHPStan/Rules/TooWideTypehints/data/fix-too-wide-return-type \
2425
--exclude tests/PHPStan/Rules/Names/data \
2526
--exclude tests/PHPStan/Rules/Operators/data/invalid-inc-dec.php \
2627
--exclude tests/PHPStan/Rules/Arrays/data/offset-access-without-dim-for-reading.php \

0 commit comments

Comments
 (0)