Skip to content

Commit

Permalink
Fix return value
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Vogel committed Sep 23, 2024
1 parent b9b5828 commit aa991a8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Commands/BatchFileProcessorBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ protected function configure() {
/**
* @param Input\InputInterface $input
* @param OutputInterface $output
* @return void
* @return int
*/
protected function execute( Input\InputInterface $input, OutputInterface $output ) {
protected function execute( Input\InputInterface $input, OutputInterface $output ): int {
$this->input = $input;
$this->output = $output;

Expand All @@ -81,9 +81,10 @@ protected function execute( Input\InputInterface $input, OutputInterface $output
$this->output->writeln( "Destination: {$this->dest}\n" );

$this->makeFileList();
$this->processFiles();
$returnValue = $this->processFiles();

$this->output->writeln( '<info>Done.</info>' );
return $returnValue;
}

protected function makeFileList() {
Expand Down Expand Up @@ -121,11 +122,17 @@ protected function makeFileList() {
$this->output->writeln( '<info>done.</info>' );
}

protected function processFiles() {
protected function processFiles(): int {
$overallReturn = 0;
foreach ( $this->files as $file ) {
$this->currentFile = $file;
$result = $this->processFile( $file );
if ( $result === false ) {
$this->output->writeln( "<error>Failed to process file {$file->getPathname()}</error>" );
$overallReturn = 1;
}
}
return $overallReturn;
}

/**
Expand Down

0 comments on commit aa991a8

Please sign in to comment.