Categories


Archives


Recent Posts


Categories


Parse error: syntax error, unexpected ‘)’, expecting ‘&’ or variable (T_VARIABLE) in

astorm

Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

The error

Parse error: syntax error, unexpected ’)’, expecting ’&’ or variable (T_VARIABLE) in

is by far te most common thing I’m seeing during Magento 2 development. Its root cause?

public function __construct(
    MagentoFrameworkAppRequestInterface $requestInterface,
)

I’m injecting a dependency by copy/pasting the type hint and parameter from somewhere else and leaving the trailing ,

public function __construct(
    MagentoFrameworkAppRequestInterface $requestInterface
)

Copyright © Alana Storm 1975 – 2023 All Rights Reserved

Originally Posted: 3rd December 2015

email hidden; JavaScript is required