diff --git a/Makefile b/Makefile index 0dd639c3..ba7b8ffe 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ unit-tests: ./vendor/bin/phpunit -c config/phpunit.xml.dist mutation-tests: ## run mutation tests - ./vendor/bin/roave-infection-static-analysis-plugin run --configuration=config/infection.json.dist --psalm-config=config/psalm.xml + ./vendor/bin/roave-infection-static-analysis-plugin --configuration=config/infection.json.dist --psalm-config=config/psalm.xml code-coverage: unit-tests ## generate and upload test coverage metrics to https://coveralls.io/ ./vendor/bin/php-coveralls -x var/clover.xml -o var/coveralls-upload.json -v diff --git a/composer.lock b/composer.lock index bf418ed4..003dccfe 100644 --- a/composer.lock +++ b/composer.lock @@ -6504,16 +6504,16 @@ }, { "name": "vimeo/psalm", - "version": "5.15.0", + "version": "5.17.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "5c774aca4746caf3d239d9c8cadb9f882ca29352" + "reference": "c620f6e80d0abfca532b00bda366062aaedf6e5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/5c774aca4746caf3d239d9c8cadb9f882ca29352", - "reference": "5c774aca4746caf3d239d9c8cadb9f882ca29352", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/c620f6e80d0abfca532b00bda366062aaedf6e5d", + "reference": "c620f6e80d0abfca532b00bda366062aaedf6e5d", "shasum": "" }, "require": { @@ -6538,8 +6538,8 @@ "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", "sebastian/diff": "^4.0 || ^5.0", "spatie/array-to-xml": "^2.17.0 || ^3.0", - "symfony/console": "^4.1.6 || ^5.0 || ^6.0", - "symfony/filesystem": "^5.4 || ^6.0" + "symfony/console": "^4.1.6 || ^5.0 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0" }, "conflict": { "nikic/php-parser": "4.17.0" @@ -6561,7 +6561,7 @@ "psalm/plugin-phpunit": "^0.18", "slevomat/coding-standard": "^8.4", "squizlabs/php_codesniffer": "^3.6", - "symfony/process": "^4.4 || ^5.0 || ^6.0" + "symfony/process": "^4.4 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { "ext-curl": "In order to send data to shepherd", @@ -6574,7 +6574,7 @@ "psalm-refactor", "psalter" ], - "type": "library", + "type": "project", "extra": { "branch-alias": { "dev-master": "5.x-dev", @@ -6606,10 +6606,11 @@ "static analysis" ], "support": { + "docs": "https://psalm.dev/docs", "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.15.0" + "source": "https://github.com/vimeo/psalm" }, - "time": "2023-08-20T23:07:30+00:00" + "time": "2023-12-03T20:21:41+00:00" }, { "name": "webmozart/assert", diff --git a/src/Psl/Internal/box.php b/src/Psl/Internal/box.php index 87065e50..0f8098e6 100644 --- a/src/Psl/Internal/box.php +++ b/src/Psl/Internal/box.php @@ -29,9 +29,6 @@ function box(Closure $fun): array $last_message = $message; }); - /** - * @var string|null $last_message - */ if (null !== $last_message && Str\contains($last_message, '): ')) { $last_message = Str\after( Str\lowercase($last_message), diff --git a/src/Psl/Network/Internal/socket_connect.php b/src/Psl/Network/Internal/socket_connect.php index 9d4f4bb9..50420a27 100644 --- a/src/Psl/Network/Internal/socket_connect.php +++ b/src/Psl/Network/Internal/socket_connect.php @@ -9,6 +9,7 @@ use Revolt\EventLoop; use function fclose; +use function is_resource; use function stream_context_create; use function stream_socket_client; @@ -42,10 +43,12 @@ function socket_connect(string $uri, array $context = [], ?float $timeout = null $timeout_watcher = ''; if (null !== $timeout) { $timeout_watcher = EventLoop::delay($timeout, static function () use ($suspension, &$write_watcher, $socket) { - /** @var string $write_watcher */ EventLoop::cancel($write_watcher); - fclose($socket); + /** @psalm-suppress RedundantCondition - it can be resource|closed-resource */ + if (is_resource($socket)) { + fclose($socket); + } $suspension->throw(new Exception\TimeoutException('Connection to socket timed out.')); }); diff --git a/src/Psl/Shell/execute.php b/src/Psl/Shell/execute.php index 89df1d77..03519e9d 100644 --- a/src/Psl/Shell/execute.php +++ b/src/Psl/Shell/execute.php @@ -86,7 +86,6 @@ static function (array $m) use ( return $m[0]; } - /** @var array $variable_cache */ if (isset($variable_cache[$m[0]])) { /** @var string */ return $variable_cache[$m[0]]; @@ -101,15 +100,8 @@ static function (array $m) use ( return '"' . $value . '"'; } - /** - * @var string $var - * @var int $variable_count - */ $var = $identifier . ((string) ++$variable_count); - /** - * @var array $environment - */ $environment[$var] = '"' . Regex\replace( Str\Byte\replace_every( $value, @@ -137,7 +129,6 @@ static function (array $m) use ( 1 => ['pipe', 'w'], 2 => ['pipe', 'w'], ]; - /** @var array $environment */ $process = proc_open($commandline, $descriptor, $pipes, $working_directory, $environment, $options); // @codeCoverageIgnoreStart // not sure how to replicate this, but it can happen \_o.o_/