Too many Blank Lines are getting removed!
Closed this issue · 5 comments
wmathes commented
The current package turns
<?php
require_once __DIR__ . '/../../vendor/autoload.php';
require_once __DIR__ . '/../../df.inc.php';
df_init();
set_time_limit(0);
df_component_load('html');
df_component_load('database');
df_component_load('tex');
require_once __DIR__ . '/../../models/includes.php';
crazy_init();
$piece_id = $_REQUEST['piece_id'];
//YYY-MM-DD
$start_date = $_REQUEST['start_date'];
$end_date = $_REQUEST['end_date'];
if($piece_id&&$start_date&&$end_date)
{
$data = crazy_piece_inout_list($piece_id, $start_date, $end_date);
echo \CrazyFactory\Erp\Documents\Pdfs\InOutListPdf::getFileName(['piece_code' => 'bla', 'start_date' => $start_date, 'end_date' => $end_date, 'lines' => $data]);
}
into
<?php
require_once __DIR__ . '/../../vendor/autoload.php';
require_once __DIR__ . '/../../df.inc.php';
df_init();
set_time_limit(0);
df_component_load('html');
df_component_load('database');
df_component_load('tex');
require_once __DIR__ . '/../../models/includes.php';
crazy_init();
$piece_id = $_REQUEST['piece_id'];
//YYY-MM-DD
$start_date = $_REQUEST['start_date'];
$end_date = $_REQUEST['end_date'];
if ($piece_id&&$start_date&&$end_date) {
$data = crazy_piece_inout_list($piece_id, $start_date, $end_date);
echo \CrazyFactory\Erp\Documents\Pdfs\InOutListPdf::getFileName(['piece_code' => 'bla', 'start_date' => $start_date, 'end_date' => $end_date, 'lines' => $data]);
}
turbo8p commented
turbo8p commented
A quick solution for this is to convert all files line feed in the project to "\n" and then run the sniff.
turbo8p commented
I'm not sure how often this will occur for this mixed line feed in one file. If we have only "\r\n" or "\n" the sniff is working correctly.
turbo8p commented
To solve your issue
Convert all EOL with sniff before running the whole sniff suite, you can follow this steps:
- dopr bash
vendor/bin/phpcbf --standard=PSR2 --sniffs=Generic.Files.LineEndings ./src
vendor/bin/phpcbf --standard=PSR2 --sniffs=Generic.Files.LineEndings ./tests
- exit
- dopr lint:fix
Note: Convert EOL for the whole project may throw out of memory error.
wmathes commented
We should have that Sniff then in our ruleset at the beginning or not? :)