Skip to content

Commit ca5d00b

Browse files
authored
fix: Use default file cache key if behat/gherkin version is unknown (#370)
As per PHPStan, it is possible that the version of the `behat/gherkin` package, (which we use as cache key), cannot be retrieved. This would cause a php deprecation due to attempting to hash a null value. This PR makes it default to `'unknown'` in that case. This change was extracted from #364.
1 parent 19c27aa commit ca5d00b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Cache/FileCache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class FileCache implements CacheInterface
3131
*/
3232
private static function getGherkinVersionHash(): string
3333
{
34-
$version = InstalledVersions::getVersion('behat/gherkin');
34+
$version = InstalledVersions::getVersion('behat/gherkin') ?? 'unknown';
3535

3636
// Composer version strings can contain arbitrary content so hash for filesystem safety
3737
return md5($version);

0 commit comments

Comments
 (0)