{"action":"created","issue":{"url":"https://api.github.com/repos/scrutinizer-ci/scrutinizer/issues/289","labels_url":"https://api.github.com/repos/scrutinizer-ci/scrutinizer/issues/289/labels{/name}","comments_url":"https://api.github.com/repos/scrutinizer-ci/scrutinizer/issues/289/comments","events_url":"https://api.github.com/repos/scrutinizer-ci/scrutinizer/issues/289/events","html_url":"https://github.com/scrutinizer-ci/scrutinizer/issues/289","id":52357669,"number":289,"title":"Unnecessary var assign?","user":{"login":"edsonmedina","id":5449,"avatar_url":"https://avatars.githubusercontent.com/u/5449?v=3","gravatar_id":"","url":"https://api.github.com/users/edsonmedina","html_url":"https://github.com/edsonmedina","followers_url":"https://api.github.com/users/edsonmedina/followers","following_url":"https://api.github.com/users/edsonmedina/following{/other_user}","gists_url":"https://api.github.com/users/edsonmedina/gists{/gist_id}","starred_url":"https://api.github.com/users/edsonmedina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edsonmedina/subscriptions","organizations_url":"https://api.github.com/users/edsonmedina/orgs","repos_url":"https://api.github.com/users/edsonmedina/repos","events_url":"https://api.github.com/users/edsonmedina/events{/privacy}","received_events_url":"https://api.github.com/users/edsonmedina/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-12-18T12:18:29Z","updated_at":"2015-02-10T10:00:59Z","closed_at":null,"body":"I'm getting this issue reported when assigning a variable to null (to free the memory, as opposed to unset() which merely destroys the reference).\r\n\r\n\r\nsee [Issue](https://scrutinizer-ci.com/g/edsonmedina/php_testability/issues/master/files/src/HTMLReport.php?orderField=path&order=asc&issueId=a1ae17f4-0b45-4930-a1a8-967fd462b04d) (Id: dead_assignment.unnecessary_var_assign)"},"comment":{"url":"https://api.github.com/repos/scrutinizer-ci/scrutinizer/issues/comments/73673485","html_url":"https://github.com/scrutinizer-ci/scrutinizer/issues/289#issuecomment-73673485","issue_url":"https://api.github.com/repos/scrutinizer-ci/scrutinizer/issues/289","id":73673485,"user":{"login":"stof","id":439401,"avatar_url":"https://avatars.githubusercontent.com/u/439401?v=3","gravatar_id":"","url":"https://api.github.com/users/stof","html_url":"https://github.com/stof","followers_url":"https://api.github.com/users/stof/followers","following_url":"https://api.github.com/users/stof/following{/other_user}","gists_url":"https://api.github.com/users/stof/gists{/gist_id}","starred_url":"https://api.github.com/users/stof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stof/subscriptions","organizations_url":"https://api.github.com/users/stof/orgs","repos_url":"https://api.github.com/users/stof/repos","events_url":"https://api.github.com/users/stof/events{/privacy}","received_events_url":"https://api.github.com/users/stof/received_events","type":"User","site_admin":false},"created_at":"2015-02-10T10:00:59Z","updated_at":"2015-02-10T10:00:59Z","body":"@edsonmedina you are wrong. ``unset`` deletes the variable, which decrements the refcount of the zval, exactly the same than when assigning null to the variable (where the previous zval is not reference anymore). Waiting for the next GC cycle is needed only in case there is a circular ref in your object graph, and there won't be any difference when assigning ``null``.\r\n\r\nThe only difference when assigning ``null`` is that you consume memory for an unnecessary variable referencing a ``null`` zval. "}}