Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecations php 8.4 #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CommandProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct($mode = self::MODE_DETECT)
* @param array<string, scalar>|NULL $env
* @return string
*/
public function process($app, array $args, array $env = NULL)
public function process($app, array $args, ?array $env = NULL)
{
$cmd = [];

Expand Down
14 changes: 7 additions & 7 deletions src/GitRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @param string $repository
* @throws GitException
*/
public function __construct($repository, IRunner $runner = NULL)
public function __construct($repository, ?IRunner $runner = NULL)
{
if (basename($repository) === '.git') {
$repository = dirname($repository);
Expand Down Expand Up @@ -167,8 +167,8 @@
{
try {
$branch = $this->extractFromCommand(['branch', '-a', '--no-color'], function($value) {
if (isset($value[0]) && $value[0] === '*') {

Check failure on line 170 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.3

Cannot access offset 0 on mixed.

Check failure on line 170 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.2

Cannot access offset 0 on mixed.

Check failure on line 170 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.1

Cannot access offset 0 on mixed.
return trim(substr($value, 1));

Check failure on line 171 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.3

Parameter #1 $string of function substr expects string, mixed given.

Check failure on line 171 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.2

Parameter #1 $string of function substr expects string, mixed given.

Check failure on line 171 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.1

Parameter #1 $string of function substr expects string, mixed given.
}

return FALSE;
Expand All @@ -194,7 +194,7 @@
public function getBranches()
{
return $this->extractFromCommand(['branch', '-a', '--no-color'], function($value) {
return trim(substr($value, 1));

Check failure on line 197 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.3

Parameter #1 $string of function substr expects string, mixed given.

Check failure on line 197 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.2

Parameter #1 $string of function substr expects string, mixed given.

Check failure on line 197 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.1

Parameter #1 $string of function substr expects string, mixed given.
});
}

Expand All @@ -207,7 +207,7 @@
public function getRemoteBranches()
{
return $this->extractFromCommand(['branch', '-r', '--no-color'], function($value) {
return trim(substr($value, 1));

Check failure on line 210 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.3

Parameter #1 $string of function substr expects string, mixed given.

Check failure on line 210 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.2

Parameter #1 $string of function substr expects string, mixed given.

Check failure on line 210 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.1

Parameter #1 $string of function substr expects string, mixed given.
});
}

Expand All @@ -220,7 +220,7 @@
public function getLocalBranches()
{
return $this->extractFromCommand(['branch', '--no-color'], function($value) {
return trim(substr($value, 1));

Check failure on line 223 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.3

Parameter #1 $string of function substr expects string, mixed given.

Check failure on line 223 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.2

Parameter #1 $string of function substr expects string, mixed given.

Check failure on line 223 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.1

Parameter #1 $string of function substr expects string, mixed given.
});
}

Expand Down Expand Up @@ -466,7 +466,7 @@
* @return static
* @throws GitException
*/
public function pull($remote = NULL, array $options = NULL)
public function pull($remote = NULL, ?array $options = NULL)
{
$this->run('pull', $options, '--end-of-options', $remote);
return $this;
Expand All @@ -480,7 +480,7 @@
* @return static
* @throws GitException
*/
public function push($remote = NULL, array $options = NULL)
public function push($remote = NULL, ?array $options = NULL)
{
$this->run('push', $options, '--end-of-options', $remote);
return $this;
Expand All @@ -494,7 +494,7 @@
* @return static
* @throws GitException
*/
public function fetch($remote = NULL, array $options = NULL)
public function fetch($remote = NULL, ?array $options = NULL)
{
$this->run('fetch', $options, '--end-of-options', $remote);
return $this;
Expand All @@ -509,7 +509,7 @@
* @return static
* @throws GitException
*/
public function addRemote($name, $url, array $options = NULL)
public function addRemote($name, $url, ?array $options = NULL)
{
$this->run('remote', 'add', $options, '--end-of-options', $name, $url);
return $this;
Expand Down Expand Up @@ -551,7 +551,7 @@
* @return static
* @throws GitException
*/
public function setRemoteUrl($name, $url, array $options = NULL)
public function setRemoteUrl($name, $url, ?array $options = NULL)
{
$this->run('remote', 'set-url', $options, '--end-of-options', $name, $url);
return $this;
Expand Down Expand Up @@ -593,7 +593,7 @@
* @return string[]|NULL
* @throws GitException
*/
protected function extractFromCommand(array $args, callable $filter = NULL)
protected function extractFromCommand(array $args, ?callable $filter = NULL)
{
$result = $this->run(...$args);
$output = $result->getOutput();
Expand All @@ -608,7 +608,7 @@
continue;
}

$newArray[] = (string) $value;

Check failure on line 611 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.3

Cannot cast mixed to string.

Check failure on line 611 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.2

Cannot cast mixed to string.

Check failure on line 611 in src/GitRepository.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.1

Cannot cast mixed to string.
}

$output = $newArray;
Expand Down
2 changes: 1 addition & 1 deletion src/Runners/CliRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/**
* @return RunnerResult
*/
public function run($cwd, array $args, array $env = NULL)
public function run($cwd, array $args, ?array $env = NULL)
{
if (!is_dir($cwd)) {
throw new GitException("Directory '$cwd' not found");
Expand All @@ -53,8 +53,8 @@
}

// Reset output and error
stream_set_blocking($pipes[1], FALSE);

Check failure on line 56 in src/Runners/CliRunner.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.3

Cannot access offset 1 on mixed.

Check failure on line 56 in src/Runners/CliRunner.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.3

Parameter #1 $stream of function stream_set_blocking expects resource, mixed given.

Check failure on line 56 in src/Runners/CliRunner.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.2

Cannot access offset 1 on mixed.

Check failure on line 56 in src/Runners/CliRunner.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.2

Parameter #1 $stream of function stream_set_blocking expects resource, mixed given.

Check failure on line 56 in src/Runners/CliRunner.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.1

Cannot access offset 1 on mixed.

Check failure on line 56 in src/Runners/CliRunner.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.1

Parameter #1 $stream of function stream_set_blocking expects resource, mixed given.
stream_set_blocking($pipes[2], FALSE);

Check failure on line 57 in src/Runners/CliRunner.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.3

Cannot access offset 2 on mixed.

Check failure on line 57 in src/Runners/CliRunner.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.3

Parameter #1 $stream of function stream_set_blocking expects resource, mixed given.

Check failure on line 57 in src/Runners/CliRunner.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.2

Cannot access offset 2 on mixed.

Check failure on line 57 in src/Runners/CliRunner.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.2

Parameter #1 $stream of function stream_set_blocking expects resource, mixed given.

Check failure on line 57 in src/Runners/CliRunner.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.1

Cannot access offset 2 on mixed.

Check failure on line 57 in src/Runners/CliRunner.php

View workflow job for this annotation

GitHub Actions / static-analysis / PHPStan - PHP 8.1

Parameter #1 $stream of function stream_set_blocking expects resource, mixed given.
$stdout = '';
$stderr = '';

Expand Down
2 changes: 1 addition & 1 deletion src/Runners/MemoryRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function setResult(array $args, array $env, $output, $errorOutput = [], $
/**
* @return RunnerResult
*/
public function run($cwd, array $args, array $env = NULL)
public function run($cwd, array $args, ?array $env = NULL)
{
$cmd = $this->commandProcessor->process('git', $args, $env);

Expand Down
2 changes: 1 addition & 1 deletion src/Runners/OldGitRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(IRunner $runner = NULL)
}


public function run($cwd, array $args, array $env = NULL)
public function run($cwd, array $args, ?array $env = NULL)
{
if (($key = array_search('--end-of-options', $args)) !== FALSE) {
unset($args[$key]);
Expand Down
Loading