{"action":"created","issue":{"url":"https://api.github.com/repos/phpstan/phpstan/issues/351","repository_url":"https://api.github.com/repos/phpstan/phpstan","labels_url":"https://api.github.com/repos/phpstan/phpstan/issues/351/labels{/name}","comments_url":"https://api.github.com/repos/phpstan/phpstan/issues/351/comments","events_url":"https://api.github.com/repos/phpstan/phpstan/issues/351/events","html_url":"https://github.com/phpstan/phpstan/issues/351","id":239384054,"number":351,"title":"\"Using $this outside a class\" in views templates","user":{"login":"Wirone","id":600668,"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,"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":{"url":"https://api.github.com/repos/phpstan/phpstan/milestones/4","html_url":"https://github.com/phpstan/phpstan/milestone/4","labels_url":"https://api.github.com/repos/phpstan/phpstan/milestones/4/labels","id":2735485,"number":4,"title":"Custom node visitors","description":"","creator":{"login":"ondrejmirtes","id":104888,"avatar_url":"https://avatars0.githubusercontent.com/u/104888?v=4","gravatar_id":"","url":"https://api.github.com/users/ondrejmirtes","html_url":"https://github.com/ondrejmirtes","followers_url":"https://api.github.com/users/ondrejmirtes/followers","following_url":"https://api.github.com/users/ondrejmirtes/following{/other_user}","gists_url":"https://api.github.com/users/ondrejmirtes/gists{/gist_id}","starred_url":"https://api.github.com/users/ondrejmirtes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ondrejmirtes/subscriptions","organizations_url":"https://api.github.com/users/ondrejmirtes/orgs","repos_url":"https://api.github.com/users/ondrejmirtes/repos","events_url":"https://api.github.com/users/ondrejmirtes/events{/privacy}","received_events_url":"https://api.github.com/users/ondrejmirtes/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":1,"state":"open","created_at":"2017-08-31T10:03:09Z","updated_at":"2018-01-06T13:41:36Z","due_on":null,"closed_at":null},"comments":12,"created_at":"2017-06-29T07:02:47Z","updated_at":"2018-04-15T18:03:14Z","closed_at":null,"author_association":"NONE","body":"In Yii2 templates, like this:\r\n\r\n```\r\n<?php\r\n\r\n/* @var $this yii\\web\\View */\r\n/* @var $form yii\\bootstrap\\ActiveForm */\r\n/* @var $model App\\Model\\Foo */\r\n\r\necho $this->title;\r\n```\r\n\r\nPHPStan displays error about \"Using $this outside a class\".\r\n\r\nIs there a way to fix this without fully ignoring this error message? Like disabling rule for specified directory?"},"comment":{"url":"https://api.github.com/repos/phpstan/phpstan/issues/comments/381425572","html_url":"https://github.com/phpstan/phpstan/issues/351#issuecomment-381425572","issue_url":"https://api.github.com/repos/phpstan/phpstan/issues/351","id":381425572,"user":{"login":"Wirone","id":600668,"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},"created_at":"2018-04-15T18:03:14Z","updated_at":"2018-04-15T18:03:14Z","author_association":"NONE","body":"1. I don't understand why I should generate any additional files just for analysis tool. Tools should make developers do less, not more 😉\r\n\r\n2. Not EVERY file. But PHP's native functionality is to mix HTML markup with PHP code and in this kind of files such typehinting should be supported, IMHO. It's not only framework's templating, imagine project with many `include`s / `require`s and with, ekhm, globals 😉 In included file you would like to typehint some known variables and analyze it statically. It's basic language functionality, nothing framework-oriented. PHPStan should not expect every project has SOLID and other good practices where each file is single class/interface/trait... It should support developers in the full scope of their language and it's one part where it simply doesn't."}}
{"actor":{"display_login":"Wirone"}}