Reputation: 33654
Whenever I am trying to clear the cache on Symfony2 I am constantly getting the following error:
PHP Parse error: parse error in /Users/Adam/Sites/MyApp/src/MyApp/MainBundle/Services/TransactionManager.php on line 177
PHP Stack trace:
PHP 1. {main}() /Users/Adam/Sites/MyApp/app/console:0
PHP 2. Symfony\Component\Console\Application->run() /Users/Adam/Sites/MyApp/app/console:32
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /Users/Adam/Sites/MyApp/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:121
PHP 4. Symfony\Component\HttpKernel\Kernel->boot() /Users/Adam/Sites/MyApp/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:70
PHP 5. Symfony\Component\HttpKernel\Kernel->initializeContainer() /Users/Adam/Sites/MyApp/app/bootstrap.php.cache:2215
PHP 6. Symfony\Component\DependencyInjection\ContainerBuilder->compile() /Users/Adam/Sites/MyApp/app/bootstrap.php.cache:2435
PHP 7. Symfony\Component\DependencyInjection\Compiler\Compiler->compile() /Users/Adam/Sites/MyApp/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:629
PHP 8. JMS\AopBundle\DependencyInjection\Compiler\PointcutMatchingPass->process() /Users/Adam/Sites/MyApp/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:119
PHP 9. JMS\AopBundle\DependencyInjection\Compiler\PointcutMatchingPass->processDefinition() /Users/Adam/Sites/MyApp/vendor/jms/aop-bundle/JMS/AopBundle/DependencyInjection/Compiler/PointcutMatchingPass.php:59
PHP 10. class_exists() /Users/Adam/Sites/MyApp/vendor/jms/aop-bundle/JMS/AopBundle/DependencyInjection/Compiler/PointcutMatchingPass.php:96
PHP 11. Composer\Autoload\ClassLoader->loadClass() /Users/Adam/Sites/MyApp/vendor/jms/aop-bundle/JMS/AopBundle/DependencyInjection/Compiler/PointcutMatchingPass.php:0
Here's what line 177 looks like:
/**
* {@inheritDoc}
*/
public function findAwaitingPaymentTransactionsByUserId( $dateRange = [] )
{
// ...
}
Any idea why this is? This just happened after I upgrade my Lion OS X, before it works just fine with the code above.
Upvotes: 0
Views: 601
Reputation: 52493
The method's default argument $dateRange = []
uses the short array syntax that was introduced in PHP 5.4.
Your PHP
command line interface uses PHP 5.3
that can't understand this syntax.
Therefore the method declaration results in a PHP Parse error
.
Change the method to ...
// array() instead of []
public function findAwaitingPaymentTransactionsByUserId( $dateRange = array() )
{
// ...
}
... to resolve the issue.
Upvotes: 2