{"action":"created","issue":{"url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/139","labels_url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/139/comments","events_url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/139/events","html_url":"https://github.com/Halleck45/PhpMetrics/issues/139","id":94003675,"number":139,"title":"Exception: Closure detected instead of method","user":{"login":"andreimavenhut","id":10139867,"avatar_url":"https://avatars.githubusercontent.com/u/10139867?v=3","gravatar_id":"","url":"https://api.github.com/users/andreimavenhut","html_url":"https://github.com/andreimavenhut","followers_url":"https://api.github.com/users/andreimavenhut/followers","following_url":"https://api.github.com/users/andreimavenhut/following{/other_user}","gists_url":"https://api.github.com/users/andreimavenhut/gists{/gist_id}","starred_url":"https://api.github.com/users/andreimavenhut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreimavenhut/subscriptions","organizations_url":"https://api.github.com/users/andreimavenhut/orgs","repos_url":"https://api.github.com/users/andreimavenhut/repos","events_url":"https://api.github.com/users/andreimavenhut/events{/privacy}","received_events_url":"https://api.github.com/users/andreimavenhut/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-09T09:45:41Z","updated_at":"2015-08-24T15:17:15Z","closed_at":null,"body":"[Exception]\r\n  a 'Exception' exception occured analyzing file ./lib/Google/Service/Directory.php\r\n  Message: Closure detected instead of method\r\n  Details:\r\n  ------------\r\n  Stack:\r\n  #0 phar:///usr/local/bin/phpmetrics/src/Hal/Component/OOP/Extractor/Extractor.php(128): Hal\\Component\\OOP\\Extractor\\MethodExtractor->extract(15160, Object(Hal\\Component\\Token\\TokenCollection))\r\n  #1 phar:///usr/local/bin/phpmetrics/src/Hal/Application/Command/Job/Analyze/FileAnalyzer.php(138): Hal\\Component\\OOP\\Extractor\\Extractor->extract('./lib/Google/Se...')\r\n  #2 phar:///usr/local/bin/phpmetrics/src/Hal/Application/Command/Job/DoAnalyze.php(121): Hal\\Application\\Command\\Job\\Analyze\\FileAnalyzer->execute('./lib/Google/Se...')\r\n  #3 phar:///usr/local/bin/phpmetrics/src/Hal/Application/Command/Job/Queue.php(51): Hal\\Application\\Command\\Job\\DoAnalyze->execute(Object(Hal\\Component\\Result\\ResultCollection), Object(Hal\\Component\\Result\\ResultCollection))\r\n  #4 phar:///usr/local/bin/phpmetrics/src/Hal/Application/Command/RunMetricsCommand.php(119): Hal\\Application\\Command\\Job\\Queue->execute(Object(Hal\\Component\\Result\\ResultCollection), Object(Hal\\Component\\Result\\ResultCollection))\r\n  #5 phar:///usr/local/bin/phpmetrics/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Hal\\Application\\Command\\RunMetricsCommand->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutpu\r\n  t))\r\n  #6 phar:///usr/local/bin/phpmetrics/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n  #7 phar:///usr/local/bin/phpmetrics/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\\Component\\Console\\Application->doRunCommand(Object(Hal\\Application\\Command\\RunMetricsCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Obje\r\n  ct(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n  #8 phar:///usr/local/bin/phpmetrics/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n  #9 /usr/local/bin/phpmetrics(17): Symfony\\Component\\Console\\Application->run()\r\n  #10 {main}\r\n  ------------"},"comment":{"url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/comments/134244826","html_url":"https://github.com/Halleck45/PhpMetrics/issues/139#issuecomment-134244826","issue_url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/139","id":134244826,"user":{"login":"rexem","id":8599264,"avatar_url":"https://avatars.githubusercontent.com/u/8599264?v=3","gravatar_id":"","url":"https://api.github.com/users/rexem","html_url":"https://github.com/rexem","followers_url":"https://api.github.com/users/rexem/followers","following_url":"https://api.github.com/users/rexem/following{/other_user}","gists_url":"https://api.github.com/users/rexem/gists{/gist_id}","starred_url":"https://api.github.com/users/rexem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rexem/subscriptions","organizations_url":"https://api.github.com/users/rexem/orgs","repos_url":"https://api.github.com/users/rexem/repos","events_url":"https://api.github.com/users/rexem/events{/privacy}","received_events_url":"https://api.github.com/users/rexem/received_events","type":"User","site_admin":false},"created_at":"2015-08-24T15:17:14Z","updated_at":"2015-08-24T15:17:14Z","body":"It seems that PhpMetrics cannot handle files bigger than 102 KB in a consistent way.\r\n\r\n@andreimavenhut in your case, the only \"quick and dirty fix\" would be to set https://github.com/Halleck45/PhpMetrics/blob/master/src/Hal/Component/Token/Tokenizer.php#L30 to something bigger.\r\n\r\n\r\nIn order to avoid Memory allocation issues (see #13), the tokenizer is spiting large files in chunks. However, for example, if the split happens at the same time when T_STRING is defined the program will crash:\r\n```\r\n[...code...]\r\n$x = \"the 102400 bytes split happens here --> | <-- next chunk\";\r\n[...code...]\r\n```\r\n\r\nIt doesn't look there's an easy solution for this. Without the 042f52f commit, the user could at least set memory limits manually if needed (still ugly), however right now it's not an option.\r\n\r\nNot sure which solution @Halleck45 wants to go with, but it seems we're limited to:\r\n- increase the 100 KB limit (not a \"real\" solution though)\r\n- revert back to using raw token_get_all() for the full file (and/or allow user changing the memory/file limits)\r\n- ignore large files completely\r\n- use custom tokenizer (https://github.com/nikic/PHP-Parser ?)\r\n\r\nI hope that helps."}}