[TypeDeclaration] Skip return interface on NarrowObjectReturnTypeRector#7621
[TypeDeclaration] Skip return interface on NarrowObjectReturnTypeRector#7621samsonasik wants to merge 1 commit intomainfrom
Conversation
|
New PHPStan release https://github.com/phpstan/phpstan/releases/tag/2.1.32 seems cause unit test error: https://github.com/rectorphp/rector-src/actions/runs/19303467511/job/55204152912?pr=7621#step:5:102 I am creating separate PR to fix it: |
|
This makes the whole rule far less useful. |
|
This rule defeats the purpose of typing interfaces in your application (violates DIP). I've skipped this rule for this reason---I think it should be made optional and not part of the default type declaration set |
|
Okay, I can focus on bumping phpstan 2.1.32 for now :) |
|
I wasn't aware that this rule would be automatically enabled somewhere. Why is that? |
|
@ruudk it enabled at part of list level: by PR: |
|
Ah that's also a bit of a YOLO mode isn't it? Whenever a new one is added? |
|
yes, that's to test in the wild :) the another one? removing type from union/nullable means dead code, so that's on dead code set rector-src/src/Config/Level/DeadCodeLevel.php Line 151 in 1a19a34 |
Per @calebdw feedback on #7575 (comment)
This PR skip return interface, except for common use that usually use dummy/implementation on tests, defined in constant
ALLOWED_INTERFACES_CHANGElist./cc @Orest-Divintari