Skip to content

Commit cbc28e3

Browse files
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
1 parent 1759251 commit cbc28e3

5 files changed

Lines changed: 16 additions & 16 deletions

File tree

‎ExecutableFinder.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function addSuffix(string $suffix)
4646
*
4747
* @return string|null
4848
*/
49-
publicfunctionfind(string$name, string$default = null, array$extraDirs = [])
49+
publicfunctionfind(string$name, ?string$default = null, array$extraDirs = [])
5050
{
5151
if (\ini_get('open_basedir')) {
5252
$searchPath = array_merge(explode(\PATH_SEPARATOR, \ini_get('open_basedir')), $extraDirs);

‎InputStream.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class InputStream implements \IteratorAggregate
3030
/**
3131
* Sets a callback that is called when the write buffer becomes empty.
3232
*/
33-
publicfunctiononEmpty(callable$onEmpty = null)
33+
publicfunctiononEmpty(?callable$onEmpty = null)
3434
{
3535
$this->onEmpty = $onEmpty;
3636
}

‎PhpProcess.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class PhpProcess extends Process
3232
* @param int $timeout The timeout in seconds
3333
* @param array|null $php Path to the PHP binary to use with any additional arguments
3434
*/
35-
publicfunction__construct(string$script, string$cwd = null, array$env = null, int$timeout = 60, array$php = null)
35+
publicfunction__construct(string$script, ?string$cwd = null, ?array$env = null, int$timeout = 60, ?array$php = null)
3636
{
3737
if (null === $php) {
3838
$executableFinder = newPhpExecutableFinder();
@@ -53,15 +53,15 @@ public function __construct(string $script, string $cwd = null, array $env = nul
5353
/**
5454
* {@inheritdoc}
5555
*/
56-
publicstaticfunctionfromShellCommandline(string$command, string$cwd = null, array$env = null, $input = null, ?float$timeout = 60)
56+
publicstaticfunctionfromShellCommandline(string$command, ?string$cwd = null, ?array$env = null, $input = null, ?float$timeout = 60)
5757
{
5858
thrownewLogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
5959
}
6060

6161
/**
6262
* {@inheritdoc}
6363
*/
64-
publicfunctionstart(callable$callback = null, array$env = [])
64+
publicfunctionstart(?callable$callback = null, array$env = [])
6565
{
6666
if (null === $this->getCommandLine()) {
6767
thrownewRuntimeException('Unable to find the PHP executable.');

‎Process.php‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class Process implements \IteratorAggregate
140140
*
141141
* @throws LogicException When proc_open is not installed
142142
*/
143-
publicfunction__construct(array$command, string$cwd = null, array$env = null, $input = null, ?float$timeout = 60)
143+
publicfunction__construct(array$command, ?string$cwd = null, ?array$env = null, $input = null, ?float$timeout = 60)
144144
{
145145
if (!\function_exists('proc_open')) {
146146
thrownewLogicException('The Process class relies on proc_open, which is not available on your PHP installation.');
@@ -189,7 +189,7 @@ public function __construct(array $command, string $cwd = null, array $env = nul
189189
*
190190
* @throws LogicException When proc_open is not installed
191191
*/
192-
publicstaticfunctionfromShellCommandline(string$command, string$cwd = null, array$env = null, $input = null, ?float$timeout = 60)
192+
publicstaticfunctionfromShellCommandline(string$command, ?string$cwd = null, ?array$env = null, $input = null, ?float$timeout = 60)
193193
{
194194
$process = newstatic([], $cwd, $env, $input, $timeout);
195195
$process->commandline = $command;
@@ -247,7 +247,7 @@ public function __clone()
247247
*
248248
* @final
249249
*/
250-
publicfunctionrun(callable$callback = null, array$env = []): int
250+
publicfunctionrun(?callable$callback = null, array$env = []): int
251251
{
252252
$this->start($callback, $env);
253253

@@ -266,7 +266,7 @@ public function run(callable $callback = null, array $env = []): int
266266
*
267267
* @final
268268
*/
269-
publicfunctionmustRun(callable$callback = null, array$env = []): self
269+
publicfunctionmustRun(?callable$callback = null, array$env = []): self
270270
{
271271
if (0 !== $this->run($callback, $env)) {
272272
thrownewProcessFailedException($this);
@@ -294,7 +294,7 @@ public function mustRun(callable $callback = null, array $env = []): self
294294
* @throws RuntimeException When process is already running
295295
* @throws LogicException In case a callback is provided and output has been disabled
296296
*/
297-
publicfunctionstart(callable$callback = null, array$env = [])
297+
publicfunctionstart(?callable$callback = null, array$env = [])
298298
{
299299
if ($this->isRunning()) {
300300
thrownewRuntimeException('Process is already running.');
@@ -385,7 +385,7 @@ public function start(callable $callback = null, array $env = [])
385385
*
386386
* @final
387387
*/
388-
publicfunctionrestart(callable$callback = null, array$env = []): self
388+
publicfunctionrestart(?callable$callback = null, array$env = []): self
389389
{
390390
if ($this->isRunning()) {
391391
thrownewRuntimeException('Process is already running.');
@@ -412,7 +412,7 @@ public function restart(callable $callback = null, array $env = []): self
412412
* @throws ProcessSignaledException When process stopped after receiving signal
413413
* @throws LogicException When process is not yet started
414414
*/
415-
publicfunctionwait(callable$callback = null)
415+
publicfunctionwait(?callable$callback = null)
416416
{
417417
$this->requireProcessIsStarted(__FUNCTION__);
418418

@@ -914,7 +914,7 @@ public function getStatus()
914914
*
915915
* @return int|null The exit-code of the process or null if it's not running
916916
*/
917-
publicfunctionstop(float$timeout = 10, int$signal = null)
917+
publicfunctionstop(float$timeout = 10, ?int$signal = null)
918918
{
919919
$timeoutMicro = microtime(true) + $timeout;
920920
if ($this->isRunning()) {
@@ -1310,7 +1310,7 @@ private function getDescriptors(): array
13101310
*
13111311
* @return \Closure
13121312
*/
1313-
protectedfunctionbuildCallback(callable$callback = null)
1313+
protectedfunctionbuildCallback(?callable$callback = null)
13141314
{
13151315
if ($this->outputDisabled) {
13161316
returnfunction ($type, $data) use ($callback): bool {

‎Tests/ProcessTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ public function testNotTerminableInputPipe()
15581558
* @param string|array $commandline
15591559
* @param mixed $input
15601560
*/
1561-
privatefunctiongetProcess($commandline, string$cwd = null, array$env = null, $input = null, ?int$timeout = 60): Process
1561+
privatefunctiongetProcess($commandline, ?string$cwd = null, ?array$env = null, $input = null, ?int$timeout = 60): Process
15621562
{
15631563
if (\is_string($commandline)) {
15641564
$process = Process::fromShellCommandline($commandline, $cwd, $env, $input, $timeout);
@@ -1573,7 +1573,7 @@ private function getProcess($commandline, string $cwd = null, array $env = null,
15731573
returnself::$process = $process;
15741574
}
15751575

1576-
privatefunctiongetProcessForCode(string$code, string$cwd = null, array$env = null, $input = null, ?int$timeout = 60): Process
1576+
privatefunctiongetProcessForCode(string$code, ?string$cwd = null, ?array$env = null, $input = null, ?int$timeout = 60): Process
15771577
{
15781578
return$this->getProcess([self::$phpBin, '-r', $code], $cwd, $env, $input, $timeout);
15791579
}

0 commit comments

Comments
 (0)