Skip to content

[MakeEntity] Remove dead is_string() branch in generate()#1798

Open
Amoifr wants to merge 1 commit into
symfony:1.xfrom
Amoifr:fix-1509-makeentity-dead-is-string-branch
Open

[MakeEntity] Remove dead is_string() branch in generate()#1798
Amoifr wants to merge 1 commit into
symfony:1.xfrom
Amoifr:fix-1509-makeentity-dead-is-string-branch

Conversation

@Amoifr

@Amoifr Amoifr commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1509.

As suspected in the issue, the is_string($manipulatorOrMessage) check in MakeEntity::generate() is always false: every value stored in $fileManagerOperations comes from createClassManipulator() and therefore is a ClassSourceManipulator. 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-line pointing to this issue.

This PR drops the dead branch (and the @phpstan-ignore-line), and dumps the files directly:

foreach ($fileManagerOperations as $path => $manipulator) {
    $this->fileManager->dumpFile($path, $manipulator->getSourceCode());
}

No behavior change — only the unreachable branch is removed. MakeEntityTest produces identical results before/after.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[make:entity] generate() call to is_string() appears to always evaluate to false

1 participant