Skip to content

Commit

Permalink
Upgrade psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Aug 18, 2023
1 parent 9244691 commit 39f849d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"phpunit/phpunit": "^9",
"amphp/php-cs-fixer-config": "^2",
"league/uri": "^6",
"psalm/phar": "^4.23"
"psalm/phar": "^5"
},
"suggest": {
"amphp/redis": "Allows storing session data in Redis"
Expand Down
4 changes: 3 additions & 1 deletion src/Base64UrlSessionIdGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

final class Base64UrlSessionIdGenerator implements SessionIdGenerator
{
/** @var non-empty-string */
private readonly string $regex;
/** @var positive-int */
private readonly int $bytes;

public function __construct(int $length = 48)
Expand All @@ -16,7 +18,7 @@ public function __construct(int $length = 48)
}

// divisible by four to not waste chars with "=" and simplify regexp.
$this->bytes = $length / 4 * 3;
$this->bytes = (int) ($length / 4 * 3);

Check failure on line 21 in src/Base64UrlSessionIdGenerator.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

PropertyTypeCoercion

src/Base64UrlSessionIdGenerator.php:21:24: PropertyTypeCoercion: $this->bytes expects 'int<1, max>', parent type 'int' provided (see https://psalm.dev/198)
$this->regex = '/^[A-Za-z0-9_\-]{' . $length . '}$/';

if ($this->bytes < 16) {
Expand Down

0 comments on commit 39f849d

Please sign in to comment.