Add EOL to a bunch of files (#4530)
* prettier complain if not end with newline
* a bunch of newlines.
the newlines were created with the following script:
<?php
declare(strict_types=1);
$dir = realpath(__DIR__ . '/..');
chdir($dir);
foreach ((new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS))) as $file) {
if ($file->isDir()) {
continue;
}
if ($file->isLink()) {
continue;
}
$size = $file->getSize();
if ($size === 0) {
continue;
}
$path = $file->getPathname();
$blacklist = array(
'/.git/',
'/node_modules/',
'/vendor/',
'rex:/\\.svg$/i'
);
foreach ($blacklist as $pattern) {
$isBlacklisted = str_starts_with($pattern, 'rex:') ? preg_match(substr($pattern, strlen('rex:')), $path) : str_contains($path, $pattern);
if ($isBlacklisted) {
continue 2;
}
}
$content = file_get_contents($path);
// is binary?
if(strlen($content) !== strcspn($content, "\x00\x01\x02\x03\x04\x05\x06\x07\x08")) {
//var_dump("skipping binary file: {$path}");
continue;
}
$lastByte = substr($content, -1);
if ($lastByte === "\n") {
continue;
}
var_dump($path, $lastByte);
$content .= "\n";
file_put_contents($path, $content, LOCK_EX);
}
?>
* prettier fix