magento-coding-standard: PHP Syntax errors in xml files

Preconditions

  1. magento/magento-coding-standard v9
  2. A magento module that has an xml file that starts with <?xml version="1.0" ?>

Steps to reproduce

  1. run bin/phpcs ./ --standard=Magento2 --severity=10

Expected result

  1. Nothing module passes the test

Actual result

FILE: /opt/atlassian/pipelines/agent/build/etc/module.xml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | ERROR | PHP syntax error: syntax error, unexpected 'version'
   |       | (T_STRING)
----------------------------------------------------------------------
FILE: /opt/atlassian/pipelines/agent/build/etc/di.xml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 1 | ERROR | PHP syntax error: syntax error, unexpected 'version'
   |       | (T_STRING)
----------------------------------------------------------------------

This bug got introduced in v9 because our pipelines were running v8 yesterday and didn’t have this issue at the time.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@Hexmage I could recreate the issue and I know what is happening, in this magento-coding-standard we added also to check xml, but we need to exclude them from the php rules, I will be working on a solution that is going to be available next release