for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Soluble\MediaTools\Common\Exception;
use Symfony\Component\Process\Exception as SPException;
use Symfony\Component\Process\Process;
class ProcessException extends RuntimeException implements ProcessExceptionInterface
{
/** @var Process */
protected $process;
/**
* ProcessException constructor.
*
* @param Process $process
* @param SPException\RuntimeException $previousException
* @param string|null $message if not set will use the previousException message
*/
public function __construct(Process $process, SPException\RuntimeException $previousException, string $message = null)
if ($previousException instanceof SPException\ProcessFailedException ||
$previousException instanceof SPException\ProcessTimedOutException ||
$previousException instanceof SPException\ProcessSignaledException
) {
$code = $previousException->getProcess()->getExitCode();
} else {
$code = 1;
}
$msg = $message ?? $previousException->getMessage();
parent::__construct(
$msg,
$code ?? 1,
$previousException
);
$this->process = $process;
This check looks for improperly formatted assignments.
Every assignment must have exactly one space before and one space after the equals operator.
To illustrate:
$a = "a"; $ab = "ab"; $abc = "abc";
will have no issues, while
will report issues in lines 1 and 2.
* Return symfony process object.
public function getProcess(): Process
return $this->process;
public function getErrorOutput(): string
return $this->process->getErrorOutput();
* @return SPException\RuntimeException|SPException\ProcessFailedException|SPException\ProcessSignaledException|SPException\ProcessTimedOutException
public function getSymfonyProcessRuntimeException(): SPException\RuntimeException
* @var SPException\RuntimeException
$previous = $this->getPrevious();
return $previous;
return $previous
Exception
Symfony\Component\Proces...eption\RuntimeException
This check looks for improperly formatted assignments.
Every assignment must have exactly one space before and one space after the equals operator.
To illustrate:
will have no issues, while
will report issues in lines 1 and 2.