Skip to content

Commit

Permalink
Merge pull request #345 from samsonasik/update-to-use-php81-syntax
Browse files Browse the repository at this point in the history
Update to use PHP 8.1 syntax
  • Loading branch information
gsteel authored Nov 26, 2024
2 parents 2dec673 + 0347417 commit 2396d3f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Pattern/ObjectCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

final class ObjectCache extends AbstractStorageCapablePattern implements Stringable
{
private CallbackCache $callbackCache;
private readonly CallbackCache $callbackCache;

/**
* @param StorageInterface<AdapterOptions> $storage
Expand Down Expand Up @@ -154,7 +154,7 @@ public function call(string $method, array $args = []): mixed
if (! method_exists($object, $method)) {
throw new Exception\RuntimeException(sprintf(
'%s only accepts methods which are implemented by %s',
$this::class,
self::class,
$object::class,
));
}
Expand Down
4 changes: 2 additions & 2 deletions src/Psr/CacheItemPool/CacheItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ final class CacheItem implements CacheItemInterface
*/
private ?int $expiration = null;

private ClockInterface $clock;
private readonly ClockInterface $clock;

public function __construct(
private string $key,
private readonly string $key,
private mixed $value,
/**
* True if the cache item lookup resulted in a cache hit or if they item is deferred or successfully saved
Expand Down
4 changes: 2 additions & 2 deletions src/Service/StorageAdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ final class StorageAdapterFactory implements StorageAdapterFactoryInterface
public const DEFAULT_PLUGIN_PRIORITY = 1;

public function __construct(
private PluginManagerInterface $adapters,
private StoragePluginFactoryInterface $pluginFactory
private readonly PluginManagerInterface $adapters,
private readonly StoragePluginFactoryInterface $pluginFactory
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Service/StoragePluginFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

final class StoragePluginFactory implements StoragePluginFactoryInterface
{
public function __construct(private PluginManagerInterface $plugins)
public function __construct(private readonly PluginManagerInterface $plugins)
{
}

Expand Down
2 changes: 1 addition & 1 deletion test/Psr/SimpleCache/SimpleCacheDecoratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private static function createCapabilities(
bool $ttlSupported = true,
int $maxKeyLength = -1
): Capabilities {
$supportedDataTypes = $supportedDataTypes ?? self::SIMPLE_CACHE_REQUIRED_TYPES;
$supportedDataTypes ??= self::SIMPLE_CACHE_REQUIRED_TYPES;
return new Capabilities(
maxKeyLength: $maxKeyLength,
ttlSupported: $ttlSupported,
Expand Down

0 comments on commit 2396d3f

Please sign in to comment.