{"action":"created","issue":{"url":"https://api.github.com/repos/scrutinizer-ci/php-analyzer/issues/543","labels_url":"https://api.github.com/repos/scrutinizer-ci/php-analyzer/issues/543/labels{/name}","comments_url":"https://api.github.com/repos/scrutinizer-ci/php-analyzer/issues/543/comments","events_url":"https://api.github.com/repos/scrutinizer-ci/php-analyzer/issues/543/events","html_url":"https://github.com/scrutinizer-ci/php-analyzer/issues/543","id":54847076,"number":543,"title":"Type hints check of array type does not accept empty array as valid value.","user":{"login":"discordier","id":940331,"avatar_url":"https://avatars.githubusercontent.com/u/940331?v=3","gravatar_id":"","url":"https://api.github.com/users/discordier","html_url":"https://github.com/discordier","followers_url":"https://api.github.com/users/discordier/followers","following_url":"https://api.github.com/users/discordier/following{/other_user}","gists_url":"https://api.github.com/users/discordier/gists{/gist_id}","starred_url":"https://api.github.com/users/discordier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discordier/subscriptions","organizations_url":"https://api.github.com/users/discordier/orgs","repos_url":"https://api.github.com/users/discordier/repos","events_url":"https://api.github.com/users/discordier/events{/privacy}","received_events_url":"https://api.github.com/users/discordier/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-20T06:02:52Z","updated_at":"2015-01-20T06:47:41Z","closed_at":null,"body":"When an interface hints to be of array type, an empty array is not considered valid.\r\n```php\r\ninterface FooInterface\r\n{\r\n  /**\r\n   * This is foobar.\r\n   *\r\n   * @return string[]|null\r\n   */\r\n  public function bar();\r\n}\r\n\r\nclass Foo implements FooInterface\r\n{\r\n  /**\r\n   * {@inheritdoc}\r\n   */\r\n  public function bar()\r\n  {\r\n    return array();\r\n  }\r\n}\r\n```\r\n\r\nThis yields:\r\n```\r\nThe return type of return array(); (array) is incompatible with the return type declared by the \r\ninterface FooInterface::searchFor of type string[]|null.\r\n```\r\n\r\nIMO the empty array should be accepted as valid return value as even an empty array is what it is... an array. :)\r\n\r\nsee https://scrutinizer-ci.com/g/MetaModels/core/inspections/9c54d742-b686-4068-8153-3047087ffae2/issues/files/src/MetaModels/Attribute/Base.php?status=new&orderField=path&order=asc&issueId=60f88d44-76c3-4b5f-8026-4d7575032ad5"},"comment":{"url":"https://api.github.com/repos/scrutinizer-ci/php-analyzer/issues/comments/70611540","html_url":"https://github.com/scrutinizer-ci/php-analyzer/issues/543#issuecomment-70611540","issue_url":"https://api.github.com/repos/scrutinizer-ci/php-analyzer/issues/543","id":70611540,"user":{"login":"tristanlins","id":343404,"avatar_url":"https://avatars.githubusercontent.com/u/343404?v=3","gravatar_id":"","url":"https://api.github.com/users/tristanlins","html_url":"https://github.com/tristanlins","followers_url":"https://api.github.com/users/tristanlins/followers","following_url":"https://api.github.com/users/tristanlins/following{/other_user}","gists_url":"https://api.github.com/users/tristanlins/gists{/gist_id}","starred_url":"https://api.github.com/users/tristanlins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tristanlins/subscriptions","organizations_url":"https://api.github.com/users/tristanlins/orgs","repos_url":"https://api.github.com/users/tristanlins/repos","events_url":"https://api.github.com/users/tristanlins/events{/privacy}","received_events_url":"https://api.github.com/users/tristanlins/received_events","type":"User","site_admin":false},"created_at":"2015-01-20T06:47:41Z","updated_at":"2015-01-20T06:47:41Z","body":"+1"}}