{"action":"created","issue":{"url":"https://api.github.com/repos/phpstan/phpstan/issues/323","repository_url":"https://api.github.com/repos/phpstan/phpstan","labels_url":"https://api.github.com/repos/phpstan/phpstan/issues/323/labels{/name}","comments_url":"https://api.github.com/repos/phpstan/phpstan/issues/323/comments","events_url":"https://api.github.com/repos/phpstan/phpstan/issues/323/events","html_url":"https://github.com/phpstan/phpstan/issues/323","id":234737478,"node_id":"MDU6SXNzdWUyMzQ3Mzc0Nzg=","number":323,"title":"False positives when using \"method_exists\" condition on interfaces","user":{"login":"Wirone","id":600668,"node_id":"MDQ6VXNlcjYwMDY2OA==","avatar_url":"https://avatars2.githubusercontent.com/u/600668?v=4","gravatar_id":"","url":"https://api.github.com/users/Wirone","html_url":"https://github.com/Wirone","followers_url":"https://api.github.com/users/Wirone/followers","following_url":"https://api.github.com/users/Wirone/following{/other_user}","gists_url":"https://api.github.com/users/Wirone/gists{/gist_id}","starred_url":"https://api.github.com/users/Wirone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wirone/subscriptions","organizations_url":"https://api.github.com/users/Wirone/orgs","repos_url":"https://api.github.com/users/Wirone/repos","events_url":"https://api.github.com/users/Wirone/events{/privacy}","received_events_url":"https://api.github.com/users/Wirone/received_events","type":"User","site_admin":false},"labels":[{"id":680520084,"node_id":"MDU6TGFiZWw2ODA1MjAwODQ=","url":"https://api.github.com/repos/phpstan/phpstan/labels/feature-request","name":"feature-request","color":"1d76db","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":25,"created_at":"2017-06-09T06:55:02Z","updated_at":"2018-06-25T16:02:27Z","closed_at":null,"author_association":"NONE","body":"When variable is typed as interface and we use concrete implementation in code, sometimes there are valid calls to methods that doesn't exist in interface. For example when using `Symfony\\Component\\HttpFoundation\\Session\\SessionInterface` and want to use `getFlashBag` method, this will trigger error in PHPStan (level 2):\r\n\r\n```\r\n/** @var \\Symfony\\Component\\HttpFoundation\\Session\\SessionInterface $session */\r\n$session = $request->getSession();\r\nif ($session && method_exists($session, 'getFlashBag')) {\r\n    $session->getFlashBag()->add('success', 'False positive detected!');\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/phpstan/phpstan/issues/comments/400005174","html_url":"https://github.com/phpstan/phpstan/issues/323#issuecomment-400005174","issue_url":"https://api.github.com/repos/phpstan/phpstan/issues/323","id":400005174,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDAwNTE3NA==","user":{"login":"xificurk","id":117465,"node_id":"MDQ6VXNlcjExNzQ2NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/117465?v=4","gravatar_id":"","url":"https://api.github.com/users/xificurk","html_url":"https://github.com/xificurk","followers_url":"https://api.github.com/users/xificurk/followers","following_url":"https://api.github.com/users/xificurk/following{/other_user}","gists_url":"https://api.github.com/users/xificurk/gists{/gist_id}","starred_url":"https://api.github.com/users/xificurk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xificurk/subscriptions","organizations_url":"https://api.github.com/users/xificurk/orgs","repos_url":"https://api.github.com/users/xificurk/repos","events_url":"https://api.github.com/users/xificurk/events{/privacy}","received_events_url":"https://api.github.com/users/xificurk/received_events","type":"User","site_admin":false},"created_at":"2018-06-25T16:02:27Z","updated_at":"2018-06-25T16:02:27Z","author_association":"NONE","body":"@ondrejmirtes This workaround:\r\n```php\r\nif (method_exists($object, '__toString')) {\r\n    echo (string) $object; // instead of $object->__toString();\r\n}\r\n```\r\nno longer works in 0.10. Any suggestions how to solve this?"}}
{"actor":{"display_login":"xificurk"}}