Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closure detected instead of method && Fatal Error #33

Closed
susannemoog opened this issue Jul 26, 2014 · 3 comments
Closed

Closure detected instead of method && Fatal Error #33

susannemoog opened this issue Jul 26, 2014 · 3 comments
Labels

Comments

@susannemoog
Copy link

Hi,

trying to run phpMetrics on https://github.com/TYPO3/TYPO3.CMS I get:

[Exception]
Closure detected instead of method

Trying to run metrics without oop (--without-oop) the analysis runs but then I get a fatal error:

Grouping results by package/directory. This will take few minutes...           
PHP Fatal error:  Call to a member function getConcreteClasses() on a non-object in /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Metrics/Mood/Abstractness/Abstractness.php on line 32
PHP Stack trace:
PHP   1. {main}() /home/susanne/.composer/vendor/halleck45/phpmetrics/bin/metrics.php:0
PHP   2. Symfony\Component\Console\Application->run() /home/susanne/.composer/vendor/halleck45/phpmetrics/bin/metrics.php:22
PHP   3. Symfony\Component\Console\Application->doRun() /home/susanne/.composer/vendor/symfony/console/Symfony/Component/Console/Application.php:121
PHP   4. Symfony\Component\Console\Application->doRunCommand() /home/susanne/.composer/vendor/symfony/console/Symfony/Component/Console/Application.php:191
PHP   5. Symfony\Component\Console\Command\Command->run() /home/susanne/.composer/vendor/symfony/console/Symfony/Component/Console/Application.php:885
PHP   6. Hal\Application\Command\RunMetricsCommand->execute() /home/susanne/.composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241
PHP   7. Hal\Application\Command\Job\Queue->execute() /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Application/Command/RunMetricsCommand.php:114
PHP   8. Hal\Application\Command\Job\DoAggregatedAnalyze->execute() /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Application/Command/Job/Queue.php:51
PHP   9. Hal\Metrics\Mood\Abstractness\Abstractness->calculate() /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Application/Command/Job/DoAggregatedAnalyze.php:81

Anything I'm doing wrong?

Thanks,

susanne

@Halleck45
Copy link
Collaborator

Hi. Can you copy-paste here the details of exception ?

@susannemoog
Copy link
Author

Hi,

yes. This happens while analyzing https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/Utility/GeneralUtility.php

  
  [Exception]  
  Closure detected instead of method  

Exception trace:
 () at /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Component/OOP/Extractor/MethodExtractor.php:50
 Hal\Component\OOP\Extractor\MethodExtractor->extract() at /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Component/OOP/Extractor/Extractor.php:123
 Hal\Component\OOP\Extractor\Extractor->extract() at /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Application/Command/Job/Analyze/FileAnalyzer.php:137
 Hal\Application\Command\Job\Analyze\FileAnalyzer->execute() at /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Application/Command/Job/DoAnalyze.php:120
 Hal\Application\Command\Job\DoAnalyze->execute() at /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Application/Command/Job/Queue.php:51
 Hal\Application\Command\Job\Queue->execute() at /home/susanne/.composer/vendor/halleck45/phpmetrics/src/Hal/Application/Command/RunMetricsCommand.php:114
 Hal\Application\Command\RunMetricsCommand->execute() at /home/susanne/.composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241
 Symfony\Component\Console\Command\Command->run() at /home/susanne/.composer/vendor/symfony/console/Symfony/Component/Console/Application.php:885
 Symfony\Component\Console\Application->doRunCommand() at /home/susanne/.composer/vendor/symfony/console/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at /home/susanne/.composer/vendor/symfony/console/Symfony/Component/Console/Application.php:121
 Symfony\Component\Console\Application->run() at /home/susanne/.composer/vendor/halleck45/phpmetrics/bin/metrics.php:22

@Halleck45
Copy link
Collaborator

This bug occurs when file is too big to fit in memory. Tokenizer splits file into multiple subfiles, and bugs can occurs.

I think that fixing this bug is not possible : only a human can cut code safely.

In your case, you can split GeneralUtility.php (5000 lines of code !) in multiple files manually :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants