[MakeEntity] Remove dead is_string() branch in generate()#1798
Open
Amoifr wants to merge 1 commit into
Open
Conversation
The values stored in $fileManagerOperations always are ClassSourceManipulator instances (created via createClassManipulator()), so the is_string() branch was never reached. It was a leftover from older versions that displayed a message. Drop the dead branch (and its phpstan-ignore) and dump the files directly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1509.
As suspected in the issue, the
is_string($manipulatorOrMessage)check inMakeEntity::generate()is alwaysfalse: every value stored in$fileManagerOperationscomes fromcreateClassManipulator()and therefore is aClassSourceManipulator. The string branch ($io->comment(...)) is dead code left over from older versions that returned a message — which is exactly why it carried a@phpstan-ignore-linepointing to this issue.This PR drops the dead branch (and the
@phpstan-ignore-line), and dumps the files directly:No behavior change — only the unreachable branch is removed.
MakeEntityTestproduces identical results before/after.