UltimateModuleCreator / Umc_Base

MIT License
78 stars 40 forks source link

Can't Compile for Production with this installed #16

Closed astorm closed 7 years ago

astorm commented 8 years ago

If I install this module into my system and attempt to compile my classes for production (with the setup:di:compile command) I end up with a

No tokens were provided

error. Full stack trace below

$ php bin/magento -vvv setup:di:compile
Compilation was started.
Repositories code generation... 1/7 [====>-----------------------]  14% 3 secs 58.8 MiB

  [Zend\Code\Exception\RuntimeException]  
  No tokens were provided                 

Exception trace:
 () at /Users/alanstorm/Sites/magento-2-with-keys/magento2/vendor/zendframework/zend-code/src/Scanner/TokenArrayScanner.php:298
 Zend\Code\Scanner\TokenArrayScanner->scan() at /Users/alanstorm/Sites/magento-2-with-keys/magento2/vendor/zendframework/zend-code/src/Scanner/TokenArrayScanner.php:134
 Zend\Code\Scanner\TokenArrayScanner->getClassNames() at /Users/alanstorm/Sites/magento-2-with-keys/magento2/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php:67
 Magento\Setup\Module\Di\Code\Reader\ClassesScanner->getList() at /Users/alanstorm/Sites/magento-2-with-keys/magento2/setup/src/Magento/Setup/Module/Di/App/Task/Operation/RepositoryGenerator.php:66
 Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator->doOperation() at /Users/alanstorm/Sites/magento-2-with-keys/magento2/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php:56
 Magento\Setup\Module\Di\App\Task\Manager->process() at /Users/alanstorm/Sites/magento-2-with-keys/magento2/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php:211
 Magento\Setup\Console\Command\DiCompileCommand->execute() at /Users/alanstorm/Sites/magento-2-with-keys/magento2/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
 Symfony\Component\Console\Command\Command->run() at /Users/alanstorm/Sites/magento-2-with-keys/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:874
 Symfony\Component\Console\Application->doRunCommand() at /Users/alanstorm/Sites/magento-2-with-keys/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at /Users/alanstorm/Sites/magento-2-with-keys/magento2/vendor/magento/framework/Console/Cli.php:49
 Magento\Framework\Console\Cli->doRun() at /Users/alanstorm/Sites/magento-2-with-keys/magento2/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /Users/alanstorm/Sites/magento-2-with-keys/magento2/bin/magento:25

While this probably isn't a module you'd want to leave installed on a production system, I've found you often still to pre-generate your classes when working on a local development Magento 2 system. It would be nice if this could be fixed.

der-workfloh commented 8 years ago

Seems you have an empty file which is parsed by the \Magento\Setup\Module\Di\Code\Reader\ClassesScanner, which uses the PHP token_get_all method. The exception is thrown, if the method does not return any value, which is the case on an empty file.

astorm commented 8 years ago

@websharp Thanks for reminding me about this ticket. I was able to track down the reason for this -- UMC users folders with a .php extension

https://github.com/UltimateModuleCreator/Umc_Base/tree/master/etc/source/Ui/Component/Listing/Column/EntityActions.php

The setup:di:compile command scans every directory in app/code for PHP files. This means it processes the directory as a file, finds no tokens, and halts.

maderlock commented 7 years ago

This should no longer be an issue with Magento 2.1

UltimateModuleCreator commented 7 years ago

@maderlock Thanks for the heads up, but can you explain why?

UltimateModuleCreator commented 7 years ago

This should be fixed in version 2.0.0-beta1