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

generate:cest: Adding declare(strict_types=1); and return type void to generated files #6736

Open
wants to merge 5 commits into
base: 5.1
Choose a base branch
from

Conversation

ThomasLandauer
Copy link
Member

No description provided.

@TavoNiievez
Copy link
Member

In the past I was against adding : void at the end of methods because it doesn't add anything relevant to the tests and because it can make the suite tests harder to read.
Strict types were also suggested by me, but it was also not decided to add them.
I even suggested that Cest should be 'final' classes, but again, the simpler the default generated code the better I guess was the reasoning.

@ThomasLandauer
Copy link
Member Author

Well, you can certainly see it as noise. But that's the way that PHP has been taking over the last view years.

  • void: psalm is reporting:

    MissingReturnType: Method App\Tests\Acceptance\FirstCest::_before does not have a return type, expecting void

  • declare(strict_types=1); is good practice today
  • And now I even added final - overlooked that yesterday :-)
  • Thinking some more about it, I now even added $scenario (see https://codeception.com/docs/AdvancedUsage) - probably rarely used, but very hard to find in the docs...

My main argument is: That's the way good PHP code should look nowadays, so we should gently guide people to this direction. And the generated files are just a suggestion - anybody can easily delete the stuff they don't want.

@Naktibalda Naktibalda changed the title Update Cest.php: Adding declare(strict_types=1); and return type void to generated files generate:cest: Adding declare(strict_types=1); and return type void to generated files Feb 19, 2024
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.

None yet

2 participants