{"action":"created","issue":{"url":"https://api.github.com/repos/nunomaduro/larastan/issues/165","repository_url":"https://api.github.com/repos/nunomaduro/larastan","labels_url":"https://api.github.com/repos/nunomaduro/larastan/issues/165/labels{/name}","comments_url":"https://api.github.com/repos/nunomaduro/larastan/issues/165/comments","events_url":"https://api.github.com/repos/nunomaduro/larastan/issues/165/events","html_url":"https://github.com/nunomaduro/larastan/issues/165","id":371658489,"node_id":"MDU6SXNzdWUzNzE2NTg0ODk=","number":165,"title":"Variable $.. might not be defined","user":{"login":"victorlap","id":1645632,"node_id":"MDQ6VXNlcjE2NDU2MzI=","avatar_url":"https://avatars0.githubusercontent.com/u/1645632?v=4","gravatar_id":"","url":"https://api.github.com/users/victorlap","html_url":"https://github.com/victorlap","followers_url":"https://api.github.com/users/victorlap/followers","following_url":"https://api.github.com/users/victorlap/following{/other_user}","gists_url":"https://api.github.com/users/victorlap/gists{/gist_id}","starred_url":"https://api.github.com/users/victorlap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/victorlap/subscriptions","organizations_url":"https://api.github.com/users/victorlap/orgs","repos_url":"https://api.github.com/users/victorlap/repos","events_url":"https://api.github.com/users/victorlap/events{/privacy}","received_events_url":"https://api.github.com/users/victorlap/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-10-18T18:38:15Z","updated_at":"2018-10-18T19:03:03Z","closed_at":"2018-10-18T18:52:26Z","author_association":"NONE","body":"- Larastan Version: 0.3.4\r\n- `--level` used: default\r\n\r\n### Description:\r\nWhen Iterating through an array, which is certain to have values, larastan does not recognize that the variable created in the foreach is still there after the foreach.\r\n\r\n### Laravel code where the issue was found:\r\n```\r\n        // Convert bytes to kilobytes.\r\n        $units = [ 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ];\r\n        foreach ($units as $unit) {\r\n            if (round($size, 2) >= KILOBYTE) {\r\n                $size = $size / KILOBYTE;\r\n            } else {\r\n                break;\r\n            }\r\n        }\r\n\r\n        return sprintf('%s %s', $size, $unit);\r\n```\r\n\r\n### Larastan message\r\n`Variable $unit might not be defined.`"},"comment":{"url":"https://api.github.com/repos/nunomaduro/larastan/issues/comments/431125096","html_url":"https://github.com/nunomaduro/larastan/issues/165#issuecomment-431125096","issue_url":"https://api.github.com/repos/nunomaduro/larastan/issues/165","id":431125096,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMTEyNTA5Ng==","user":{"login":"victorlap","id":1645632,"node_id":"MDQ6VXNlcjE2NDU2MzI=","avatar_url":"https://avatars0.githubusercontent.com/u/1645632?v=4","gravatar_id":"","url":"https://api.github.com/users/victorlap","html_url":"https://github.com/victorlap","followers_url":"https://api.github.com/users/victorlap/followers","following_url":"https://api.github.com/users/victorlap/following{/other_user}","gists_url":"https://api.github.com/users/victorlap/gists{/gist_id}","starred_url":"https://api.github.com/users/victorlap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/victorlap/subscriptions","organizations_url":"https://api.github.com/users/victorlap/orgs","repos_url":"https://api.github.com/users/victorlap/repos","events_url":"https://api.github.com/users/victorlap/events{/privacy}","received_events_url":"https://api.github.com/users/victorlap/received_events","type":"User","site_admin":false},"created_at":"2018-10-18T19:03:02Z","updated_at":"2018-10-18T19:03:02Z","author_association":"NONE","body":"Okay thanks! "}}
{"actor":{"display_login":"victorlap"}}