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

Side effects rule #28

Open
pdewouters opened this issue Jul 3, 2023 · 0 comments
Open

Side effects rule #28

pdewouters opened this issue Jul 3, 2023 · 0 comments

Comments

@pdewouters
Copy link
Contributor

We should add a sniff for https://www.php-fig.org/psr/psr-1/#23-side-effects given https://dekode.atlassian.net/wiki/spaces/doc/pages/1604452353/File+structure+and+naming+conventions

Note that files should either declare code, or run code, but in general, should not do both. This increases re-usability since a class will then not automatically initiate when its file is loaded up. The primary plugin or theme file should instead instantiate any classes needed to be ran.

https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/PSR1/ruleset.xml#L24

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

No branches or pull requests

1 participant