{"action":"created","issue":{"url":"https://api.github.com/repos/bobthecow/psysh/issues/206","labels_url":"https://api.github.com/repos/bobthecow/psysh/issues/206/labels{/name}","comments_url":"https://api.github.com/repos/bobthecow/psysh/issues/206/comments","events_url":"https://api.github.com/repos/bobthecow/psysh/issues/206/events","html_url":"https://github.com/bobthecow/psysh/pull/206","id":89036582,"number":206,"title":"Don't try and match where we've not been able to find the variable","user":{"login":"davedevelopment","id":61351,"avatar_url":"https://avatars.githubusercontent.com/u/61351?v=3","gravatar_id":"","url":"https://api.github.com/users/davedevelopment","html_url":"https://github.com/davedevelopment","followers_url":"https://api.github.com/users/davedevelopment/followers","following_url":"https://api.github.com/users/davedevelopment/following{/other_user}","gists_url":"https://api.github.com/users/davedevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/davedevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davedevelopment/subscriptions","organizations_url":"https://api.github.com/users/davedevelopment/orgs","repos_url":"https://api.github.com/users/davedevelopment/repos","events_url":"https://api.github.com/users/davedevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/davedevelopment/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-17T14:42:33Z","updated_at":"2015-06-19T19:01:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bobthecow/psysh/pulls/206","html_url":"https://github.com/bobthecow/psysh/pull/206","diff_url":"https://github.com/bobthecow/psysh/pull/206.diff","patch_url":"https://github.com/bobthecow/psysh/pull/206.patch"},"body":"At present, this includes\r\n\r\n```\r\n$app['something']->\r\n$app->getSomething()->\r\n```\r\n\r\netc.\r\n\r\nIt would be great to be able to parse back far enough, but I think that's quite a task"},"comment":{"url":"https://api.github.com/repos/bobthecow/psysh/issues/comments/113607174","html_url":"https://github.com/bobthecow/psysh/pull/206#issuecomment-113607174","issue_url":"https://api.github.com/repos/bobthecow/psysh/issues/206","id":113607174,"user":{"login":"davedevelopment","id":61351,"avatar_url":"https://avatars.githubusercontent.com/u/61351?v=3","gravatar_id":"","url":"https://api.github.com/users/davedevelopment","html_url":"https://github.com/davedevelopment","followers_url":"https://api.github.com/users/davedevelopment/followers","following_url":"https://api.github.com/users/davedevelopment/following{/other_user}","gists_url":"https://api.github.com/users/davedevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/davedevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davedevelopment/subscriptions","organizations_url":"https://api.github.com/users/davedevelopment/orgs","repos_url":"https://api.github.com/users/davedevelopment/repos","events_url":"https://api.github.com/users/davedevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/davedevelopment/received_events","type":"User","site_admin":false},"created_at":"2015-06-19T19:01:28Z","updated_at":"2015-06-19T19:01:28Z","body":"Sure thing! That `hasMatched` method essentially checks to make sure either the last or second to last token was a `T_OBJECT_OPERATOR`, which is fine. However, once we're up in to the `getMatches` method, the code assumes that whatever comes before the `T_OBJECT_OPERATOR` is both a `T_VARIABLE` and it will be available in the current variable context. \r\n\r\nSo when I type\r\n\r\n``` php\r\n$app['some.pimple.service']-><tab><tab>\r\n```\r\n\r\nThis matcher would attempt to call `getVariable` with an empty string, because the token before the `T_OBJECT` is a `]`. `getVariable` throws if it can't find whatever variable it is that you ask for.\r\n\r\nWe could add code to `hasMatched` as well to prevent things getting that far, at least for the cases where it's not a `T_OBJECT`, but I think it's safest to keep this catch in here. I'd rather not have any matches shown than see an exception."}}