{"action":"created","issue":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/1106","repository_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer","labels_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/1106/labels{/name}","comments_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/1106/comments","events_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/1106/events","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/pull/1106","id":170027713,"number":1106,"title":"Add UnusedUseStatementSniff copied from Drupal Coder","user":{"login":"ExplodingCabbage","id":2358339,"avatar_url":"https://avatars.githubusercontent.com/u/2358339?v=3","gravatar_id":"","url":"https://api.github.com/users/ExplodingCabbage","html_url":"https://github.com/ExplodingCabbage","followers_url":"https://api.github.com/users/ExplodingCabbage/followers","following_url":"https://api.github.com/users/ExplodingCabbage/following{/other_user}","gists_url":"https://api.github.com/users/ExplodingCabbage/gists{/gist_id}","starred_url":"https://api.github.com/users/ExplodingCabbage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ExplodingCabbage/subscriptions","organizations_url":"https://api.github.com/users/ExplodingCabbage/orgs","repos_url":"https://api.github.com/users/ExplodingCabbage/repos","events_url":"https://api.github.com/users/ExplodingCabbage/events{/privacy}","received_events_url":"https://api.github.com/users/ExplodingCabbage/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-08-08T21:16:48Z","updated_at":"2017-01-19T20:26:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/pulls/1106","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/pull/1106","diff_url":"https://github.com/squizlabs/PHP_CodeSniffer/pull/1106.diff","patch_url":"https://github.com/squizlabs/PHP_CodeSniffer/pull/1106.patch"},"body":"Resolves https://github.com/squizlabs/PHP_CodeSniffer/issues/801\n- [x] Code conforms to standard\n- [x] Has tests\n- [x] Unit tests pass.\n- [x] Manually tested against a codebase of mine that was rife with unused `use` statements\n- [ ] PHPCS team approves?\n- [x] Get approval from @klausi and @alexpott on copyright and licensing before merging\n\nNicked from https://github.com/klausi/coder with the gracious permission of its authors.\n\nChanges from the original at https://github.com/klausi/coder were:\n- Modified UnusedUseStatementUnitTest.inc.fixed to remove the Thing/NotUsed\n  use, instead of modifying the type hint involving it, since this is the\n  automatic fix the Sniff would generate and PHPCS's tests require that\n  'fixed' files match the output of running the fixer.\n- Added file headers in the style of PHPCS's other files\n- Modified code formatting to match PHPCS's linting rules\n\nNote that I am not the author of this sniff; @klausi and @alexpott are.\n\nWhen it comes to crafting the file's PHPDoc header and other copyright issues, although I've mostly just imitated the style of existing sniffs, I had to make a few decisions. I'll list them here so that all parties can confirm they're okay with my choices before this gets merged:\n- I didn't bother doing any Git magic to preserve the sniff's original commit history from Drupal coder, because doing so didn't seem important\n- I listed Klaus Purer and Alex Pott as authors, with the email addresses that they used for committing on Drupal Coder.\n- Since this is Klaus's work but every single other sniff has Squiz listed as a copyright holder, I listed **both** _Klaus Purer_ and _Squiz Pty Ltd (ABN 77 084 670 600)_ both as copyright holders, in the same style as e.g. Notifysend.php which lists Christian Weiske and Squiz as copyright holders. I'm no expert either in intellectual property law or PHPDoc, but I think this declares that both parties hold full copyright - i.e. that both parties are free to reproduce the work or to license it to others under any licensing terms that they please. @klausi and @alexpott, are you okay with that line being there?\n\nAlso, @klausi and @alexpott - you both agreed to relicensing under MIT in https://github.com/squizlabs/PHP_CodeSniffer/issues/801, which Klausi thought PHPCS was licensed under. However, while writing this I saw that all the files actually declare that they are BSD-licensed, not MIT-licensed. @klausi and @alexpott, could you both confirm that you're happy to relicense under BSD?\n\nAssuming everybody's comfortable with the legal stuff, I think this should be good to go.\n"},"comment":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/comments/273888685","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/pull/1106#issuecomment-273888685","issue_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/1106","id":273888685,"user":{"login":"gmponos","id":5675248,"avatar_url":"https://avatars.githubusercontent.com/u/5675248?v=3","gravatar_id":"","url":"https://api.github.com/users/gmponos","html_url":"https://github.com/gmponos","followers_url":"https://api.github.com/users/gmponos/followers","following_url":"https://api.github.com/users/gmponos/following{/other_user}","gists_url":"https://api.github.com/users/gmponos/gists{/gist_id}","starred_url":"https://api.github.com/users/gmponos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmponos/subscriptions","organizations_url":"https://api.github.com/users/gmponos/orgs","repos_url":"https://api.github.com/users/gmponos/repos","events_url":"https://api.github.com/users/gmponos/events{/privacy}","received_events_url":"https://api.github.com/users/gmponos/received_events","type":"User","site_admin":false},"created_at":"2017-01-19T20:26:08Z","updated_at":"2017-01-19T20:26:08Z","body":"I tried to see if there was any related comment but I could not find anything. \r\nForgive me if I am mentioning something that it is already said.\r\n\r\nI copy pasted the code of this sniff and used it into a project of mine.\r\n\r\nI had a `use` statement because of some comments. This sniff still detects them as unused. For instance:\r\n\r\n```php\r\n<?php\r\n\r\nuse MyNamspace\\MyException;\r\n\r\nclass MyClass\r\n{\r\n    /**\r\n     * @throws MyException\r\n     */\r\n     public function myFunction(){}\r\n}\r\n```\r\n\r\nIt's not easy to go through all the comments and use the full path of the namespace and it's not practical. It increases maintenance. Can this be fixed?"}}
{"actor":{"display_login":"gmponos"}}