Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore return type hints in src/Command #975

Closed
wants to merge 1 commit into from
Closed

Ignore return type hints in src/Command #975

wants to merge 1 commit into from

Conversation

cleptric
Copy link
Member

@cleptric cleptric commented Oct 4, 2023

PHPCS will complain about missing return-type hints when you bake your first command.

Method \App\Command\AppCommand::execute() does not have native return type hint for its return value but it should be possible to add it based on @return
    |       |     annotation "int|null|void".

PHPCBF then adds : int|null|null 🤔

@@ -4,6 +4,7 @@

<rule ref="CakePHP"/>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
<exclude-pattern>*/src/Command/*</exclude-pattern>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot do this

Copy link
Member Author

@cleptric cleptric Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keen to explain why? It seems to work fine in my apps.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess as all methods would now be ignored. So maybe we just target execute().

@cleptric
Copy link
Member Author

cleptric commented Oct 4, 2023

Moved to cakephp/bake#950

@cleptric cleptric closed this Oct 4, 2023
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.

2 participants