Force return bool while processing files

This commit is contained in:
Gabriel Caruso 2017-12-28 16:24:01 -02:00
parent e07cae9f8c
commit b65b3aa971
3 changed files with 3 additions and 7 deletions

View File

@ -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);

View File

@ -185,7 +185,7 @@ final class ProcessCommand extends Command
}
} else {
$newContent = $this->fileProcessor->processFile($fileInfo);
if ($newContent !== false) {
if ($newContent) {
$this->changedFiles[] = $fileInfo->getPathname();
}
}

View File

@ -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);