magento / marketplace-eqp

Magento 1.x Coding Standard
http://docs.magento.com/marketplace/user_guide/Resources/pdf/Extension_Quality_Program_Overview.pdf
MIT License
224 stars 68 forks source link

PHP syntax error: syntax error, unexpected '.', expecting ']' #92

Closed tzsolti closed 6 years ago

tzsolti commented 6 years ago

Whenever I have a class, which contains a code like below:

 public $errorMessageTemplates = [
        General::ERROR_A => "Some very long text "
            . "which continues... "
            . "and still continues.",
        General::ERROR_B => "text message",
        General::ERROR_C => "another message",
        General::ERROR_D => General::SOMETHING . " is required",
        General::ERROR_E => "last message",
    ]; 

I get the following error message:

PHP syntax error: syntax error, unexpected '.', expecting ']' Source : MEQP2.PHP.Syntax.PHPSyntax

This happens only on Marketplace, locally there are no errors. After trying to submit a couple of times with some changes, it has turned out that for some reason the concatenation is not recognized and that's why I get this error. However this code doesn't throw any syntax error in PHP and it has passed the previous EQP. Can anyone fix this issue?

lenaorobei commented 6 years ago

@tzsolti to be able to help you with this issue, please answer following questions:

  1. What Magento compatibility did you select when submit your extension?
  2. What PHP version do you have installed locally?

It looks like you claimed 2.0 compatibility and that automatically means we check your code against PHP 5.5.

tzsolti commented 6 years ago

Thanks for pointing me to the right direction. I'm using locally many PHP versions: 5.6.x, 7.0.x, 7.1.x, but not 5.5.x. I didn't know that if an extension supports Magento 2.0, then all the supported major PHP versions should be supported. It seems that if we exclude the code change, then all it remains is to just drop support for Magento 2.0.x. Thanks again for the help