mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-22 02:36:52 +01:00
Force return bool while processing files
This commit is contained in:
parent
e07cae9f8c
commit
b65b3aa971
@ -44,10 +44,7 @@ final class FileProcessor
|
||||
return $this->processFileToString($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|bool
|
||||
*/
|
||||
public function processFile(SplFileInfo $fileInfo)
|
||||
public function processFile(SplFileInfo $fileInfo): bool
|
||||
{
|
||||
[$newStmts, $oldStmts, $oldTokens] = $this->nodeTraverserQueue->processFileInfo($fileInfo);
|
||||
|
||||
|
@ -185,7 +185,7 @@ final class ProcessCommand extends Command
|
||||
}
|
||||
} else {
|
||||
$newContent = $this->fileProcessor->processFile($fileInfo);
|
||||
if ($newContent !== false) {
|
||||
if ($newContent) {
|
||||
$this->changedFiles[] = $fileInfo->getPathname();
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,8 @@ final class FormatPerservingPrinter
|
||||
* @param Node[] $newStmts
|
||||
* @param Node[] $oldStmts
|
||||
* @param Node[] $oldTokens
|
||||
* @return int|bool
|
||||
*/
|
||||
public function printToFile(SplFileInfo $fileInfo, array $newStmts, array $oldStmts, array $oldTokens)
|
||||
public function printToFile(SplFileInfo $fileInfo, array $newStmts, array $oldStmts, array $oldTokens): bool
|
||||
{
|
||||
$oldContent = file_get_contents($fileInfo->getRealPath());
|
||||
$newContent = $this->printToString($newStmts, $oldStmts, $oldTokens);
|
||||
|
Loading…
x
Reference in New Issue
Block a user