Closed
Description
When using cbf to clean up following sample code, it turns it
<?php
function testParse()
{
if (true)
try {
} catch (\LogicException $e) {
} catch (\Exception $e) {
}
}
into
<?php
function testParse()
{
if (true) {
try {
} catch (\LogicException $e) {
}
} catch (\Exception $e) {
}
}
To reproduce
Steps to reproduce the behavior:
- Create a file called
test.php
with the code sample above... - Run
phpcbf test.php ...
- now has a syntax error
$ vendor/bin/phpcbf test.php
PHPCBF RESULT SUMMARY
----------------------------------------------------------------------
FILE FIXED REMAINING
----------------------------------------------------------------------
test.php 5 0
----------------------------------------------------------------------
A TOTAL OF 5 ERRORS WERE FIXED IN 1 FILE
----------------------------------------------------------------------
Time: 48ms; Memory: 10MB
Expected behavior
Either a fatal error and no code modification, or this code :
<?php
function testParse()
{
if (true) {
try {
} catch (\LogicException $e) {
} catch (\Exception $e) {
}
}
}
Versions (please complete the following information):
- OS: Ubuntu 20 (standard apt repo)
- PHP: 7.4
- PHPCS: 3.6.0
- Standard: PSR12
Here's a full version : https://github.com/GPierre-Antoine/phpcbf-bug