1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
<?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$files = [
__DIR__.'/../src/Carbon/Traits/Date.php',
__DIR__.'/../src/Carbon/Traits/Units.php',
__DIR__.'/../src/Carbon/Lang/fr.php',
];
$comments = [
'// @property',
'// @call ',
'// Words with feminine grammatical gender: semaine',
];
foreach ($files as $file) {
$contents = str_replace("\r", '', file_get_contents($file));
$newContents = implode("\n", array_filter(explode("\n", $contents), static function ($line) use ($comments) {
$code = trim($line);
foreach ($comments as $comment) {
if (str_starts_with($code, $comment)) {
return false;
}
}
return true;
}));
if ($newContents !== $contents) {
file_put_contents($file, $newContents);
}
}
|