Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpcbf FAILED TO FIX files #3702

Open
samoralespu opened this issue Oct 27, 2022 · 1 comment
Open

phpcbf FAILED TO FIX files #3702

samoralespu opened this issue Oct 27, 2022 · 1 comment

Comments

@samoralespu
Copy link

samoralespu commented Oct 27, 2022

Describe the bug
I run phpcbf command, it fixed a lot of files, but it left this message
"A TOTAL OF 43 ERRORS WERE FIXED IN 2 FILES"
PHPCBF FAILED TO FIX 2 FILES

Code sample
This is how I'm running the phpcbf

vendor/bin/phpcbf --standard=PSR12 app\views -n 

To reproduce
Steps to reproduce the behavior:

  1. Create a file called _app_link_list.php with the code sample above:
<div class='centered'>
   <table id='core_track_app_links' class="table table-hover">
      <thead class="table-dark">
         <tr>
            <th class='main_sortable sort_str'>App Name</th>
            <th>URL</th>
            <th>Actions</th> 
         </tr>
      </thead>
      <tbody>
         <?php
         foreach ($g_app as $app) {
            $line_class = "table_line_normal";
         ?>
            <tr class='<?php echo $line_class ?> row_line'>
               <td class='<?php echo $line_class ?>'> <?php echo $app->app_name ?></td>
               <td class='<?php echo $line_class ?>'> <?php echo $app->url ?></td>
               <td><?php
               link_edit_modal(["app_links", "update", "write"], "modal_app_links", "", 
                    ["action"=>"update", 
                     "id"      =>$app->id, 
                     "app_name"=>$app->app_name, 
                     "url"     =>$app->url
                     ]);
                link_remove_jquery(["app_links","delete","write"], "SaveAppNames(\"delete\",\"".$app->id."\")");
                     ?>
                </td>
            </tr>
         <?php
         }
         ?>
      </tbody>
   </table>
</div>

<script>
   jQuery(document).ready(function(){
      filter_list('core_track_app_links','filter_app_name',0,2,'row_line',0);
      filter_list('core_track_app_links','filter_url',1,2,'row_line',0);
   });
</script>
  1. Run `phpcbf
  2. See error message displayed
PHPCBF FAILED TO FIX 2 FILES

Pd: this is just one of two files.

Versions :

  • OS: Windows 10
  • PHP: 8.1
  • PHPCS: 3.7.1
  • Standard: PSR12

Edit:
It was because of this:
<td><?php
I splited the line and it worked propperly.
I think it's a bug.

The other file error was because I was calling a function like this:
generateSelectRequestMethods("id",$filter_endpoint_request,"filter_endpoint_request","onchange='filter_list(\"endpoints_table\",\"filter_endpoint_request\",0,5,\"row_line\",0)'",)

I guess that this final "," caused the program to fail, I think this is also a bug.

@jrfnl
Copy link
Contributor

jrfnl commented May 6, 2023

@samoralespu Your issue has gotten little attention as the report is pretty unclear. The bug report template asks for a small code sample to reproduce the issue with. The code sample as provided generates 27 different errors, so it is unclear what you are reporting.

It was because of this:
<td><?php
I splited the line and it worked propperly.
I think it's a bug.

I can see there is some sort of conflict, but with 27 errors in the original code sample, there is too much noise.
Please provide a small isolated code sample to make the issue reproducible.

The other file error was because I was calling a function like this:

I guess that this final "," caused the program to fail, I think this is also a bug.

This issue has been fixed via PR #3805 and the fix will be included in PHPCS 3.8.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants