php 8 expected expression operand but got T_NAME_FULLY_QUALIFIED
When using dmu_upgrade
and PHP 8, I get the error
Indexing...
done.
[warning] my_module does not implement hook_block_configure.
[error] Error at line 26:14 in file /var/www/html/web/modules/custom/my_module/my_module.module: excepted expression operand but got T_NAME_FULLY_QUALIFIED
[notice] #0 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(1227): Pharborist\Parser->exprOperand()
#1 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(525): Pharborist\Parser->expr()
#2 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(484): Pharborist\Parser->exprStatement()
#3 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(2291): Pharborist\Parser->statement()
#4 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(2239): Pharborist\Parser->innerStatement()
#5 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(2250): Pharborist\Parser->innerStatementList(Object(Pharborist\StatementBlockNode), '}')
#6 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(461): Pharborist\Parser->innerStatementBlock()
#7 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(575): Pharborist\Parser->statement()
#8 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(424): Pharborist\Parser->_if()
#9 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(2291): Pharborist\Parser->statement()
#10 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(2239): Pharborist\Parser->innerStatement()
#11 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(2250): Pharborist\Parser->innerStatementList(Object(Pharborist\StatementBlockNode), '}')
#12 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(2228): Pharborist\Parser->innerStatementBlock()
#13 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(2166): Pharborist\Parser->body(Object(Pharborist\Functions\FunctionDeclarationNode))
#14 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(356): Pharborist\Parser->functionDeclaration()
#15 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(321): Pharborist\Parser->topStatement()
#16 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(202): Pharborist\Parser->topStatementList(Object(Pharborist\RootNode))
#17 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(240): Pharborist\Parser->buildTree(Object(Pharborist\TokenIterator))
#18 /var/www/html/vendor/jcnventura/pharborist/src/Parser.php(219): Pharborist\Parser::parseSource('<?php\n\n/**\n * @...', '/var/www/html/w...')
#19 /var/www/html/web/modules/contrib/drupalmoduleupgrader/src/Target.php(211): Pharborist\Parser::parseFile('/var/www/html/w...')
#20 /var/www/html/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Indexer/Functions.php(111): Drupal\drupalmoduleupgrader\Target->open('/var/www/html/w...')
#21 /var/www/html/web/modules/contrib/drupalmoduleupgrader/src/ConverterBase.php(67): Drupal\drupalmoduleupgrader\Plugin\DMU\Indexer\Functions->get('my_module_block...')
#22 /var/www/html/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Converter/Blocks.php(40): Drupal\drupalmoduleupgrader\ConverterBase->executeHook(Object(Drupal\drupalmoduleupgrader\Target), 'hook_block_info')
#23 /var/www/html/web/modules/contrib/drupalmoduleupgrader/src/Commands/DrupalmoduleupgraderCommands.php(188): Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Blocks->convert(Object(Drupal\drupalmoduleupgrader\Target))
#24 [internal function]: Drupal\drupalmoduleupgrader\Commands\DrupalmoduleupgraderCommands->upgrade('my_module', Array)
#25 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#26 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#27 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#28 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(350): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#29 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /var/www/html/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /var/www/html/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /var/www/html/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 /var/www/html/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#36 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
#37 /var/www/html/vendor/bin/drush(117): include('/var/www/html/v...')
#38 {main}
The error is thrown because it converts some of the file to Drupal 9 syntax, then it runs again maybe, and fails on line 26 which has become $cache = \Drupal::cache('cache_block')->get($cid);
?
line 26:14 is the backslash.
Steps to reproduce
Try to upgrade the attached module when using PHP 8.0