{"action":"closed","issue":{"url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1069","repository_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards","labels_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1069/labels{/name}","comments_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1069/comments","events_url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1069/events","html_url":"https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1069","id":245747273,"number":1069,"title":"Add PSR1.Files.SideEffects to WordPress-Extra?","user":{"login":"GaryJones","id":88371,"avatar_url":"https://avatars2.githubusercontent.com/u/88371?v=4","gravatar_id":"","url":"https://api.github.com/users/GaryJones","html_url":"https://github.com/GaryJones","followers_url":"https://api.github.com/users/GaryJones/followers","following_url":"https://api.github.com/users/GaryJones/following{/other_user}","gists_url":"https://api.github.com/users/GaryJones/gists{/gist_id}","starred_url":"https://api.github.com/users/GaryJones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GaryJones/subscriptions","organizations_url":"https://api.github.com/users/GaryJones/orgs","repos_url":"https://api.github.com/users/GaryJones/repos","events_url":"https://api.github.com/users/GaryJones/events{/privacy}","received_events_url":"https://api.github.com/users/GaryJones/received_events","type":"User","site_admin":false},"labels":[{"id":409617152,"url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/labels/Status:%20Awaiting%20Feedback","name":"Status: Awaiting Feedback","color":"fef2c0","default":false},{"id":197939849,"url":"https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/labels/Type:%20Enhancement","name":"Type: Enhancement","color":"84b6eb","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-07-26T14:46:52Z","updated_at":"2017-07-26T15:34:35Z","closed_at":"2017-07-26T15:34:35Z","body":"`[PSR1.Files.SideEffects](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/PSR1/Sniffs/Files/SideEffectsSniff.php) is the sniff that covers the following bit of [PSR-1](http://www.php-fig.org/psr/psr-1/#23-side-effects):\r\n\r\n> A file SHOULD declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it SHOULD execute logic with side effects, but SHOULD NOT do both.\r\n>\r\n> The phrase “side effects” means execution of logic not directly related to declaring classes, functions, constants, etc., merely from including the file.\r\n>\r\n> “Side effects” include but are not limited to: generating output, explicit use of require or include, connecting to external services, modifying ini settings, emitting errors or exceptions, modifying global or static variables, reading from or writing to a file, and so on.\r\n\r\nMost readers here will agree that keeping symbol definitions separate from files that actively do something is a good plan, particularly when it comes to autoloaded files.\r\n\r\nThe issue for not implementing this in `WordPres-Extra` is that there might be _many_ plugins and themes (let alone WP core) that do something like:\r\n\r\n```php\r\nadd_action( '...', 'my_function' );\r\n/**\r\n * DocBlock\r\n */\r\nfunction my_function() {\r\n    // ...\r\n}\r\n```\r\n\r\nRefactoring that to move the `add_action()` / `add_filter()` call is not trivial, and can make non-OO code harder to follow.\r\n\r\n@WordPress-Coding-Standards/wpcs-admins Thoughts?"}}
{"actor":{"display_login":"GaryJones"}}