Skip to content

Commit

Permalink
Merge pull request #41 from sunrise-php/release/v3.4.0
Browse files Browse the repository at this point in the history
v3.4
  • Loading branch information
fenric authored Feb 12, 2025
2 parents 4ccf8a5 + 29eaeb2 commit 0a732ef
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
"psr/http-message": "^1.0"
},
"require-dev": {
"php-di/php-di": "^6.4",
"php-di/php-di": "^6.4 || ^7.0",
"php-http/psr7-integration-tests": "^1.4",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^9.6",
"sunrise/coding-standard": "^1.0",
"vimeo/psalm": "^5.26"
"vimeo/psalm": "^5.26 || ^6.0"
},
"autoload": {
"files": [
Expand All @@ -61,15 +61,15 @@
}
},
"scripts": {
"phpcs": "@php phpcs --colors",
"psalm": "@php psalm --no-cache",
"phpstan": "@php phpstan analyse src --level=9 --memory-limit=-1",
"phpunit": "@php phpunit --colors=always",
"test": [
"phpcs --colors",
"psalm --no-cache",
"phpstan analyse src --level=9 --memory-limit=-1",
"XDEBUG_MODE=coverage phpunit --coverage-text --colors=always"
],
"build": [
"phpdoc -d src/ -t phpdoc/",
"XDEBUG_MODE=coverage phpunit --coverage-html coverage/"
"@phpcs",
"@psalm",
"@phpstan",
"@phpunit"
]
},
"conflict": {
Expand Down
6 changes: 6 additions & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<issueHandlers>
<PossiblyUnusedMethod errorLevel="suppress" />
<PossiblyUnusedReturnValue errorLevel="suppress" />
<UnusedClass errorLevel="suppress" />
</issueHandlers>
</psalm>
1 change: 1 addition & 0 deletions src/Request/JsonRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private static function createBody($data, int $flags, int $depth): StreamInterfa
}

try {
/** @var non-empty-string $json */
$json = json_encode($data, $flags | JSON_THROW_ON_ERROR, $depth);
} catch (JsonException $e) {
throw new InvalidArgumentException(sprintf(
Expand Down
1 change: 1 addition & 0 deletions src/Response/JsonResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ private static function createBody($data, int $flags, int $depth): StreamInterfa
}

try {
/** @var non-empty-string $json */
$json = json_encode($data, $flags | JSON_THROW_ON_ERROR, $depth);
} catch (JsonException $e) {
throw new InvalidArgumentException(sprintf(
Expand Down
3 changes: 0 additions & 3 deletions src/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ public function isSeekable(): bool
return false;
}

/** @var array{seekable: bool} */
$metadata = stream_get_meta_data($this->resource);

return $metadata['seekable'];
Expand Down Expand Up @@ -179,7 +178,6 @@ public function isWritable(): bool
return false;
}

/** @var array{mode: string} */
$metadata = stream_get_meta_data($this->resource);

return strpbrk($metadata['mode'], '+acwx') !== false;
Expand Down Expand Up @@ -215,7 +213,6 @@ public function isReadable(): bool
return false;
}

/** @var array{mode: string} */
$metadata = stream_get_meta_data($this->resource);

return strpbrk($metadata['mode'], '+r') !== false;
Expand Down
1 change: 1 addition & 0 deletions src/UploadedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public function getStream(): StreamInterface
public function moveTo($targetPath): void
{
/** @psalm-suppress TypeDoesNotContainType */
// @phpstan-ignore function.alreadyNarrowedType
if (!is_string($targetPath)) {
throw new TypeError(sprintf(
'Argument #1 ($targetPath) must be of type string, %s given',
Expand Down

0 comments on commit 0a732ef

Please sign in to comment.