Issues (24)

src/Exception/ProcessFailedException.php (1 issue)

Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpSpellcheck\Exception;
6
7
use Symfony\Component\Process\Process;
8
9
class ProcessFailedException extends \RuntimeException implements ExceptionInterface
10
{
11 2
    /**
12
     * @var Process
13
     */
14
    private $process;
15
16
    public function __construct(
17 2
        Process $process,
18
        \Throwable $previous = null,
19 2
        string $failureReason = '',
20 2
        int $code = 0
21 2
    ) {
22 2
        $this->process = $process;
23 2
24 2
        $message = \Safe\sprintf(
0 ignored issues
show
Deprecated Code introduced by
The function Safe\sprintf() has been deprecated: The Safe version of this function is no longer needed in PHP 8.0+ ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

24
        $message = /** @scrutinizer ignore-deprecated */ \Safe\sprintf(

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
25 2
            'Process with command "%s" has failed%s with exit code %d(%s)%s',
26
            $process->getCommandLine(),
27
            $process->isStarted() ? ' running' : '',
28 2
            $process->getExitCode(),
29 2
            $process->getExitCodeText(),
30 2
            $failureReason !== '' ? ' because "' . $failureReason . '"' : ''
31 2
        );
32
33 2
        parent::__construct(
34
            $message,
35
            $code,
36
            $previous
37
        );
38
    }
39
40
    public function getProcess(): Process
41
    {
42
        return $this->process;
43
    }
44
}
45