{"action":"created","issue":{"url":"https://api.github.com/repos/phpstan/phpstan/issues/1276","repository_url":"https://api.github.com/repos/phpstan/phpstan","labels_url":"https://api.github.com/repos/phpstan/phpstan/issues/1276/labels{/name}","comments_url":"https://api.github.com/repos/phpstan/phpstan/issues/1276/comments","events_url":"https://api.github.com/repos/phpstan/phpstan/issues/1276/events","html_url":"https://github.com/phpstan/phpstan/issues/1276","id":343640997,"node_id":"MDU6SXNzdWUzNDM2NDA5OTc=","number":1276,"title":"Possible bug with interface parameter types","user":{"login":"tarlepp","id":595561,"node_id":"MDQ6VXNlcjU5NTU2MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/595561?v=4","gravatar_id":"","url":"https://api.github.com/users/tarlepp","html_url":"https://github.com/tarlepp","followers_url":"https://api.github.com/users/tarlepp/followers","following_url":"https://api.github.com/users/tarlepp/following{/other_user}","gists_url":"https://api.github.com/users/tarlepp/gists{/gist_id}","starred_url":"https://api.github.com/users/tarlepp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tarlepp/subscriptions","organizations_url":"https://api.github.com/users/tarlepp/orgs","repos_url":"https://api.github.com/users/tarlepp/repos","events_url":"https://api.github.com/users/tarlepp/events{/privacy}","received_events_url":"https://api.github.com/users/tarlepp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-23T13:48:12Z","updated_at":"2018-07-23T14:00:20Z","closed_at":null,"author_association":"NONE","body":"<!-- Before reporting an issue please check that you are using the latest PHPStan version! -->\r\n\r\n### Summary of a problem or a feature request\r\n\r\nGetting this weird error.\r\n\r\n### Code snippet that reproduces the problem\r\nMethod in my trait (src/Repository/Traits/RepositoryMethodsTrait.php)\r\n```\r\n/**\r\n * Wrapper for default Doctrine repository findBy method.\r\n *\r\n * @param mixed[]       $criteria\r\n * @param string[]|null $orderBy\r\n * @param int|null      $limit\r\n * @param int|null      $offset\r\n *\r\n * @return EntityInterface[]|array<int, mixed>\r\n */\r\npublic function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array\r\n{\r\n    return array_values(\r\n        $this\r\n            ->getEntityManager()\r\n            ->getRepository($this->getEntityName())\r\n            ->findBy($criteria, $orderBy, $limit, $offset)\r\n    );\r\n}\r\n```\r\n\r\nCode of Doctrine\\Common\\Persistence\\ObjectRepository::findBy() from its interface\r\n```\r\n/**\r\n * Finds objects by a set of criteria.\r\n *\r\n * Optionally sorting and limiting details can be passed. An implementation may throw\r\n * an UnexpectedValueException if certain values of the sorting or limiting details are\r\n * not supported.\r\n *\r\n * @param mixed[]       $criteria\r\n * @param string[]|null $orderBy\r\n * @param int|null      $limit\r\n * @param int|null      $offset\r\n *\r\n * @return object[] The objects.\r\n *\r\n * @throws \\UnexpectedValueException\r\n */\r\npublic function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null);\r\n```\r\n\r\nAnd when I'm running phpstan I get following:\r\n```\r\nwunder@code2018-VirtualBox:~/projects/symfony-flex-backend$ make phpstan \r\nRunning PHPStan - PHP Static Analysis Tool\r\nPHPStan - PHP Static Analysis Tool 0.9.2.0\r\n 230/230 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%\r\n\r\n ------ -------------------------------------------------------------------------------------------------------------------------------------- \r\n  Line   src/Repository/Traits/RepositoryMethodsTrait.php (in context of class App\\Repository\\BaseRepository)                                  \r\n ------ -------------------------------------------------------------------------------------------------------------------------------------- \r\n  84     Parameter #2 $orderBy of method Doctrine\\Common\\Persistence\\ObjectRepository::findBy() expects array<string>|null, array|null given.  \r\n ------ -------------------------------------------------------------------------------------------------------------------------------------- \r\n\r\n                                                                                                                        \r\n [ERROR] Found 1 error                                                                                                  \r\n                                                                                                                        \r\n\r\nMakefile:150: recipe for target 'phpstan' failed\r\nmake: *** [phpstan] Error 1\r\nwunder@code2018-VirtualBox:~/projects/symfony-flex-backend$ \r\n```\r\n\r\nAnd if I change my trait method `?array $orderBy = null` to `$orderBy = null` - no errors from phpstan\r\n\r\n### Expected output\r\n\r\nNo errors\r\n"},"comment":{"url":"https://api.github.com/repos/phpstan/phpstan/issues/comments/407067891","html_url":"https://github.com/phpstan/phpstan/issues/1276#issuecomment-407067891","issue_url":"https://api.github.com/repos/phpstan/phpstan/issues/1276","id":407067891,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzA2Nzg5MQ==","user":{"login":"iluuu1994","id":1752683,"node_id":"MDQ6VXNlcjE3NTI2ODM=","avatar_url":"https://avatars3.githubusercontent.com/u/1752683?v=4","gravatar_id":"","url":"https://api.github.com/users/iluuu1994","html_url":"https://github.com/iluuu1994","followers_url":"https://api.github.com/users/iluuu1994/followers","following_url":"https://api.github.com/users/iluuu1994/following{/other_user}","gists_url":"https://api.github.com/users/iluuu1994/gists{/gist_id}","starred_url":"https://api.github.com/users/iluuu1994/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iluuu1994/subscriptions","organizations_url":"https://api.github.com/users/iluuu1994/orgs","repos_url":"https://api.github.com/users/iluuu1994/repos","events_url":"https://api.github.com/users/iluuu1994/events{/privacy}","received_events_url":"https://api.github.com/users/iluuu1994/received_events","type":"User","site_admin":false},"created_at":"2018-07-23T14:00:20Z","updated_at":"2018-07-23T14:00:20Z","author_association":"MEMBER","body":"Btw, I'm not saying this is not a valid issue. I'm just saying I cannot reproduce it. Is there something my example is missing?"}}
{"actor":{"display_login":"iluuu1994"}}