{"action":"created","issue":{"url":"https://api.github.com/repos/phpDocumentor/phpDocumentor2/issues/1689","labels_url":"https://api.github.com/repos/phpDocumentor/phpDocumentor2/issues/1689/labels{/name}","comments_url":"https://api.github.com/repos/phpDocumentor/phpDocumentor2/issues/1689/comments","events_url":"https://api.github.com/repos/phpDocumentor/phpDocumentor2/issues/1689/events","html_url":"https://github.com/phpDocumentor/phpDocumentor2/issues/1689","id":120184767,"number":1689,"title":"Introduce procedural @implements tag..","user":{"login":"donquixote","id":150032,"avatar_url":"https://avatars.githubusercontent.com/u/150032?v=3","gravatar_id":"","url":"https://api.github.com/users/donquixote","html_url":"https://github.com/donquixote","followers_url":"https://api.github.com/users/donquixote/followers","following_url":"https://api.github.com/users/donquixote/following{/other_user}","gists_url":"https://api.github.com/users/donquixote/gists{/gist_id}","starred_url":"https://api.github.com/users/donquixote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donquixote/subscriptions","organizations_url":"https://api.github.com/users/donquixote/orgs","repos_url":"https://api.github.com/users/donquixote/repos","events_url":"https://api.github.com/users/donquixote/events{/privacy}","received_events_url":"https://api.github.com/users/donquixote/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":22,"created_at":"2015-12-03T14:36:03Z","updated_at":"2015-12-28T21:03:25Z","closed_at":null,"body":"This suggestion is based on an observation in Drupal 7.\r\nIt is becoming less of a problem with more and more code being OOP (e.g. moving to Drupal 8), but it might still apply to some people or more, for some time or longer.\r\n\r\nProblem: The framework (or CMS) forces a specific parameter signature for functions with a specific role.\r\nIn Drupal 7 these are hooks, theme functions, form builder functions, etc.\r\n\r\nThe IDE does not know this, and complains about unused parameters.\r\n\r\nFor a class method overriding an interface method, it does not care if parameters are unused, because it understands that the parameters are required. But for procedural, this does not work.\r\n\r\nThe official way to document this in Drupal 7 is \"Implements hook_foo()\". But this is too much of a Drupalism to suggest support by the IDE or phpDocumentor. Also, it only applies to hooks, not to theme functions or form callbacks.\r\n\r\nSo I am going to suggest an `@implements` doc tag for functions, methods and closures - equivalent to the native \"implements\" statement, but on function level.\r\n\r\nThe `@implements` tag would indicate that the function has the same (or weaker) signature as the one it implements, in the same way that a class method must have the same (or weaker) signature as the interface method it implements.\r\n\r\nAn IDE that understands this could\r\n- Complain about signature mismatch.\r\n- Stop complaining about unused parameters in the implementing function.\r\n\r\nThis is how it would look like:\r\n\r\n```php\r\nfunction hook_eat(Food $food) {}\r\n\r\n/**\r\n * @implements hook_eat()\r\n */\r\nfunction my_eat(Food $food) {\r\n  // No need to actually use the $food parameter.\r\n}\r\n\r\n/**\r\n * @implements hook_eat()\r\n */\r\n$f = function(Food $foo) {\r\n}\r\n\r\nclass C {\r\n  /**\r\n   * @implements hook_eat()\r\n   */\r\n  static function eatQuietly(Food $foo) {}\r\n}\r\n```\r\n\r\nOld discussion on drupal.org: https://www.drupal.org/node/983268 (I am not promising anything about whether the Drupal community will pick this up)\r\n\r\nDoxygen has something like it, but I don't quite understand how it is meant to be used..\r\nhttp://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmdimplements\r\n\r\n------------\r\n\r\nEDIT: I just realize there is a github user with this name :)\r\nCode formatting of `@implements` helps."},"comment":{"url":"https://api.github.com/repos/phpDocumentor/phpDocumentor2/issues/comments/167656076","html_url":"https://github.com/phpDocumentor/phpDocumentor2/issues/1689#issuecomment-167656076","issue_url":"https://api.github.com/repos/phpDocumentor/phpDocumentor2/issues/1689","id":167656076,"user":{"login":"donquixote","id":150032,"avatar_url":"https://avatars.githubusercontent.com/u/150032?v=3","gravatar_id":"","url":"https://api.github.com/users/donquixote","html_url":"https://github.com/donquixote","followers_url":"https://api.github.com/users/donquixote/followers","following_url":"https://api.github.com/users/donquixote/following{/other_user}","gists_url":"https://api.github.com/users/donquixote/gists{/gist_id}","starred_url":"https://api.github.com/users/donquixote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donquixote/subscriptions","organizations_url":"https://api.github.com/users/donquixote/orgs","repos_url":"https://api.github.com/users/donquixote/repos","events_url":"https://api.github.com/users/donquixote/events{/privacy}","received_events_url":"https://api.github.com/users/donquixote/received_events","type":"User","site_admin":false},"created_at":"2015-12-28T21:03:25Z","updated_at":"2015-12-28T21:03:25Z","body":"@henrywright \r\n\r\n> May I suggest you use something like @type literal to distinguish between named and anonymous functions?\r\n\r\nI don't quite get it.."}}