Closed
Description
test.phtml: (it's a Zend view script / template)
<?php
switch ($this->error):
case Shop_Customer :: ERROR_INVALID_GENDER: ?>
Ungültiges Geschlecht!
<?php break;
case Shop_Customer :: ERROR_EMAIL_IN_USE: ?>
Die eingetragene E-Mail-Adresse ist bereits registriert.
<?php break;
endswitch;
?>
phpcs.xml:
<?xml version="1.0"?>
<ruleset>
<description>Test coding standard</description>
<file>test.phtml</file>
<arg name="extensions" value="php,phtml" />
<arg name="tab-width" value="4"/>
<arg name="encoding" value="utf-8"/>
<arg name="report" value="full"/>
<arg value="np"/>
<rule ref="Generic.ControlStructures.InlineControlStructure" />
</ruleset>
Output:
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
2 | ERROR | [x] Inline control structures are not allowed
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
The BIG problem is that after running phpcbf
the code is broken:
test.phtml: (after repair attempt)
<?php
switch ($this->error) { :
case Shop_Customer :: ERROR_INVALID_GENDER: ?>
Ungültiges Geschlecht!
<?php break };
case Shop_Customer :: ERROR_EMAIL_IN_USE: ?>
Die eingetragene E-Mail-Adresse ist bereits registriert.
<?php break;
endswitch;
?>
Now there are wrong brackets:
Parse error: syntax error, unexpected ':', expecting case (T_CASE) or default (T_DEFAULT) or '}' in test.phtml on line 2
Errors parsing test.phtml
Hope you can reproduce this.