{"action":"created","issue":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/934","repository_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer","labels_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/934/labels{/name}","comments_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/934/comments","events_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/934/events","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/issues/934","id":143354235,"number":934,"title":"Ability to pass filename on CLI when checking STDIN","user":{"login":"choma","id":4775453,"avatar_url":"https://avatars.githubusercontent.com/u/4775453?v=3","gravatar_id":"","url":"https://api.github.com/users/choma","html_url":"https://github.com/choma","followers_url":"https://api.github.com/users/choma/followers","following_url":"https://api.github.com/users/choma/following{/other_user}","gists_url":"https://api.github.com/users/choma/gists{/gist_id}","starred_url":"https://api.github.com/users/choma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choma/subscriptions","organizations_url":"https://api.github.com/users/choma/orgs","repos_url":"https://api.github.com/users/choma/repos","events_url":"https://api.github.com/users/choma/events{/privacy}","received_events_url":"https://api.github.com/users/choma/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/labels/Enhancement","name":"Enhancement","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-03-24T20:43:36Z","updated_at":"2016-03-28T16:24:47Z","closed_at":null,"body":"I'm not sure if this is a duplicate of #873, so sorry if I make noise.\r\n\r\nI'm using emacs [flycheck](https://github.com/flycheck/flycheck) plugin to sniff code with [Cakephp codesniffer](https://github.com/cakephp/cakephp-codesniffer).\r\nThe reports with this plugin were different from what I had in the shell. I noted that the plugin uses `<` in the command. Then I checked in the CLI, and using file path like this:\r\n```sh\r\nphpcs --standard=path/to/cakephp-codesniffer/CakePHP path/to/SomeClass.php\r\n```\r\nis different from using STDIN like this:\r\n```sh\r\nphpcs --standard=/path/to/cakephp-codesniffer/CakePHP < /path/to/SomeClass.php\r\n# or this:\r\ncat /path/to/SomeClass.php | phpcs --standard=/path/to/cakephp-codesniffer/CakePHP\r\n```\r\nAs an example take this file:\r\n```php\r\n<?php\r\nnamespace App\\Controller\\Admin;\r\n\r\n/**\r\n * Users Controller\r\n *\r\n * @property \\App\\Model\\Table\\UsersTable $Users\r\n */\r\nclass UsersController extends AppController\r\n{\r\n\r\n    /**\r\n     * @return void Redirects.\r\n     */\r\n    public function login()\r\n    {\r\n        return $this->something();\r\n    }\r\n\r\n    /**\r\n     * @return boolean.\r\n     */\r\n    protected function _setCookie()\r\n    {\r\n        return true;\r\n    }\r\n\r\n    /**\r\n     * @return void.\r\n     */\r\n    public function forgotPassword()\r\n    {\r\n        return $this->anything();\r\n    }\r\n}\r\n```\r\nIf use file path, it will report (using `-s` option):\r\n```\r\nFILE: ...ww/fecen_v2/webroot/src/Controller/Admin/UsersControllerTest.php\r\n----------------------------------------------------------------------\r\nFOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE\r\n----------------------------------------------------------------------\r\n 13 | WARNING | Function return type is void, but function contains\r\n    |         | return statement\r\n    |         | (CakePHP.Commenting.FunctionComment.InvalidReturnVoid)\r\n----------------------------------------------------------------------\r\n\r\nTime: 66ms; Memory: 5.5Mb\r\n```\r\nIf I use STDIN, it will report:\r\n```\r\nFILE: STDIN\r\n----------------------------------------------------------------------\r\nFOUND 2 ERRORS AND 1 WARNING AFFECTING 2 LINES\r\n----------------------------------------------------------------------\r\n 13 | WARNING | Function return type is void, but function contains\r\n    |         | return statement\r\n    |         | (CakePHP.Commenting.FunctionComment.InvalidReturnVoid)\r\n 23 | ERROR   | Protected method name \"UsersController::_setCookie\" must\r\n    |         | not be prefixed with an underscore\r\n    |         | (Squiz.NamingConventions.ValidFunctionName.PublicUnderscore)\r\n 23 | ERROR   | Protected method name \"UsersController::_setCookie\" must\r\n    |         | not be prefixed with an underscore\r\n    |         | (PEAR.NamingConventions.ValidFunctionName.PublicUnderscore)\r\n----------------------------------------------------------------------\r\n\r\nTime: 47ms; Memory: 5.75Mb\r\n```\r\nIs it the intended behaviour?\r\nIs there a way to use *only* Cakephp rules when using STDIN?\r\n\r\nMy system info:\r\n```sh\r\nphpcs --version\r\n# PHP_CodeSniffer version 2.5.1 (stable) by Squiz (http://www.squiz.net)\r\n\r\nphp -v\r\n# PHP 5.6.19-1 (cli) \r\n# Copyright (c) 1997-2016 The PHP Group\r\n# Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies\r\n#    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies\r\n```\r\n\r\nThanks in advanced!"},"comment":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/comments/202470914","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/issues/934#issuecomment-202470914","issue_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/934","id":202470914,"user":{"login":"lunaryorn","id":224922,"avatar_url":"https://avatars.githubusercontent.com/u/224922?v=3","gravatar_id":"","url":"https://api.github.com/users/lunaryorn","html_url":"https://github.com/lunaryorn","followers_url":"https://api.github.com/users/lunaryorn/followers","following_url":"https://api.github.com/users/lunaryorn/following{/other_user}","gists_url":"https://api.github.com/users/lunaryorn/gists{/gist_id}","starred_url":"https://api.github.com/users/lunaryorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lunaryorn/subscriptions","organizations_url":"https://api.github.com/users/lunaryorn/orgs","repos_url":"https://api.github.com/users/lunaryorn/repos","events_url":"https://api.github.com/users/lunaryorn/events{/privacy}","received_events_url":"https://api.github.com/users/lunaryorn/received_events","type":"User","site_admin":false},"created_at":"2016-03-28T16:24:47Z","updated_at":"2016-03-28T16:24:47Z","body":"> I can certainly do that. \r\n\r\nThat'd really be awesome :heart_eyes: Thank you very much!"}}