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

Bump ramsey/composer-install from 2 to 3 #3

Merged
merged 4 commits into from
Jul 26, 2024
Merged
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 .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: ramsey/composer-install@v2
- uses: ramsey/composer-install@v3
with:
composer-options: "${{ matrix.composer-options }}"

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## [Unreleased]

* The [PSR-6 definition on what makes a valid cache key](https://www.php-fig.org/psr/psr-6/#definitions), it is said that
keys must support keys consisting of the characters `A-Z`, `a-z`, `0-9`, `_`, and `.` in any order in UTF-8
encoding and a length of up to 64 characters. Implementing libraries MAY support additional characters and encodings
or longer lengths, but must support at least that minimum.
* Dashes (`-`) are now allowed in cache keys.
* The arbitrary maximum key length of 64 characters has been removed.


## [1.1.0] - 2024-03-02

* The Cache can now be instantiated without providing a [PSR-20](https://www.php-fig.org/psr/psr-20/) clock implementation.
Expand Down
2 changes: 1 addition & 1 deletion src/CacheKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ private function __construct(private readonly string $value) {}

public static function fromString(string $value): self
{
if (preg_match('/^[a-zA-Z0-9_.]{1,64}$/u', $value) !== 1) {
if (preg_match('/^[a-zA-Z0-9_.-]+$/u', $value) !== 1) {
throw InvalidArgument::invalidKey();
}

Expand Down
2 changes: 1 addition & 1 deletion tests/CacheKeyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static function validValues(): array
return [
'single char' => ['x'],
'64 chars' => [str_repeat('x', 64)],
'all allowed chars' => ['aZ0_.-'],
];
}

Expand All @@ -43,7 +44,6 @@ public static function invalidValues(): array
return [
'empty string' => [''],
'invalid character' => ['\\'],
'too long' => [str_repeat('x', 65)],
];
}
}