Skip to content
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 composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"aws/aws-sdk-php": "^3.338.0",
"azure-oss/storage-blob-flysystem": "^1.2",
"brianium/paratest": "^7.14",
"carthage-software/mago": "1.16.0",
"carthage-software/mago": "1.30.0",
"guzzlehttp/psr7": "^2.6.1",
"league/flysystem-aws-s3-v3": "^3.25.1",
"league/flysystem-ftp": "^3.25.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/AccessControl/AccessDecision.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct(
/**
* Determines if access is granted or denied based on the provided decision.
*/
public static function from(null|self|bool $decision): self
public static function from(self|bool|null $decision): self
{
if ($decision instanceof self) {
return $decision;
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/AccessControl/Policy.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ final class Policy
*/
public function __construct(
public ?string $resource = null,
public null|UnitEnum|string|iterable $action = null,
public UnitEnum|string|iterable|null $action = null,
) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/
final readonly class CurrentAuthenticatableInitializer implements DynamicInitializer
{
public function canInitialize(ClassReflector $class, null|string|UnitEnum $tag): bool
public function canInitialize(ClassReflector $class, string|UnitEnum|null $tag): bool
{
return $class->implements(Authenticatable::class) || $class->is(Authenticatable::class);
}

public function initialize(ClassReflector $class, null|string|UnitEnum $tag, Container $container): object
public function initialize(ClassReflector $class, string|UnitEnum|null $tag, Container $container): object
{
$authenticatable = $container->get(Authenticator::class)->current();

Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/Exceptions/OAuthWasNotConfigured.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class OAuthWasNotConfigured extends Exception implements AuthenticationException
{
public static function configurationWasMissing(null|string|UnitEnum $tag): self
public static function configurationWasMissing(string|UnitEnum|null $tag): self
{
$tag = Str\parse($tag, default: null);

Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/OAuth/Config/AppleOAuthConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(
/**
* Identifier for this OAuth configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createProvider(): AbstractProvider
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/OAuth/Config/DiscordOAuthConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
/**
* Identifier for this OAuth configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createProvider(): AbstractProvider
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/OAuth/Config/FacebookOAuthConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
/**
* Identifier for this OAuth configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createProvider(): AbstractProvider
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/OAuth/Config/GenericOAuthConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct(
/**
* Identifier for this OAuth configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,

/**
* Separator for the scopes, defaults to `,` if omitted.
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/OAuth/Config/GitHubOAuthConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(
/**
* Identifier for this OAuth configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createProvider(): AbstractProvider
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/OAuth/Config/GoogleOAuthConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(
/**
* Identifier for this OAuth configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createProvider(): AbstractProvider
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/OAuth/Config/InstagramOAuthConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
/**
* Identifier for this OAuth configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createProvider(): AbstractProvider
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/OAuth/Config/LinkedInOAuthConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
/**
* Identifier for this OAuth configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createProvider(): AbstractProvider
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/OAuth/Config/MicrosoftOAuthConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
/**
* Identifier for this OAuth configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createProvider(): AbstractProvider
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/OAuth/Config/SlackOAuthConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
/**
* Identifier for this OAuth configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createProvider(): AbstractProvider
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/OAuth/Config/TwitchOAuthConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __construct(
/**
* Identifier for this OAuth configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createProvider(): AbstractProvider
Expand Down
4 changes: 2 additions & 2 deletions packages/auth/src/OAuth/OAuthClientInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

final class OAuthClientInitializer implements DynamicInitializer
{
public function canInitialize(ClassReflector $class, null|string|UnitEnum $tag): bool
public function canInitialize(ClassReflector $class, string|UnitEnum|null $tag): bool
{
return $class->getType()->matches(OAuthClient::class);
}

#[Singleton]
public function initialize(ClassReflector $class, null|string|UnitEnum $tag, Container $container): OAuthClient
public function initialize(ClassReflector $class, string|UnitEnum|null $tag, Container $container): OAuthClient
{
if (! $container->has(OAuthConfig::class, $tag)) {
throw OAuthWasNotConfigured::configurationWasMissing($tag);
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/OAuth/Testing/OAuthTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct(
/**
* Forces the usage of a testing OAuth client for the given provider.
*/
public function fake(OAuthUser $user, null|string|UnitEnum $tag = null): TestingOAuthClient
public function fake(OAuthUser $user, string|UnitEnum|null $tag = null): TestingOAuthClient
{
$config = $this->container->get(OAuthConfig::class, $tag);
$uri = $this->container->get(UriGenerator::class);
Expand Down
8 changes: 4 additions & 4 deletions packages/cache/src/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ interface Cache
* @param null|Duration|DateTimeInterface $duration The duration for the lock, or an expiration date from which the duration will be calculated. If not specified, the lock will not expire.
* @param null|Stringable|string $owner The owner of the lock, which will be used to identify the process releasing it. If not specified, a random string will be used.
*/
public function lock(Stringable|string $key, null|Duration|DateTimeInterface $duration = null, null|Stringable|string $owner = null): Lock;
public function lock(Stringable|string $key, Duration|DateTimeInterface|null $duration = null, Stringable|string|null $owner = null): Lock;

/**
* Sets the specified key to the specified value in the cache. Optionally, specify an expiration.
*/
public function put(Stringable|string $key, mixed $value, null|Duration|DateTimeInterface $expiration = null): CacheItemInterface;
public function put(Stringable|string $key, mixed $value, Duration|DateTimeInterface|null $expiration = null): CacheItemInterface;

/**
* Sets the specified keys to the specified values in the cache. Optionally, specify an expiration.
Expand All @@ -40,7 +40,7 @@ public function put(Stringable|string $key, mixed $value, null|Duration|DateTime
* @param iterable<TKey,TValue> $values
* @return array<string,CacheItemInterface>
*/
public function putMany(iterable $values, null|Duration|DateTimeInterface $expiration = null): array;
public function putMany(iterable $values, Duration|DateTimeInterface|null $expiration = null): array;

/**
* Gets the value associated with the specified key from the cache. If the key does not exist, null is returned.
Expand Down Expand Up @@ -77,7 +77,7 @@ public function decrement(Stringable|string $key, int $by = 1): int;
*
* @param null|Duration $stale Allow the value to be stale for the specified amount of time in addition to the time-to-live specified by `$expiration`. When a value is stale, it will still be returned as-is, but it will be refreshed in the background.
*/
public function resolve(Stringable|string $key, Closure $callback, null|Duration|DateTimeInterface $expiration = null, ?Duration $stale = null): mixed;
public function resolve(Stringable|string $key, Closure $callback, Duration|DateTimeInterface|null $expiration = null, ?Duration $stale = null): mixed;

/**
* Removes the specified key from the cache.
Expand Down
6 changes: 3 additions & 3 deletions packages/cache/src/CacheInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

final readonly class CacheInitializer implements DynamicInitializer
{
public function canInitialize(ClassReflector $class, null|string|UnitEnum $tag): bool
public function canInitialize(ClassReflector $class, string|UnitEnum|null $tag): bool
{
return $class->getType()->matches(Cache::class);
}

#[Singleton]
public function initialize(ClassReflector $class, null|string|UnitEnum $tag, Container $container): Cache
public function initialize(ClassReflector $class, string|UnitEnum|null $tag, Container $container): Cache
{
$config = $container->get(CacheConfig::class, $tag);

Expand All @@ -35,7 +35,7 @@ public function initialize(ClassReflector $class, null|string|UnitEnum $tag, Con
);
}

private function shouldCacheBeEnabled(null|string|UnitEnum $tag): bool
private function shouldCacheBeEnabled(string|UnitEnum|null $tag): bool
{
$globalCacheEnabled = (bool) env('CACHE_ENABLED', default: true);

Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/Config/CustomCacheConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(
/*
* Identifies the {@see \Tempest\Cache\Cache} instance in the container, in case you need more than one configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createAdapter(Container $container): AdapterInterface
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/Config/FilesystemCacheConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
/*
* Identifies the {@see \Tempest\Cache\Cache} instance in the container, in case you need more than one configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createAdapter(Container $container): FilesystemAdapter
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/Config/InMemoryCacheConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct(
/*
* Identifies the {@see \Tempest\Cache\Cache} instance in the container, in case you need more than one configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createAdapter(Container $container): ArrayAdapter
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/Config/PhpCacheConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
/*
* Identifies the {@see \Tempest\Cache\Cache} instance in the container, in case you need more than one configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createAdapter(Container $container): PhpFilesAdapter
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/Config/RedisCacheConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct(
/*
* Identifies the {@see \Tempest\Cache\Cache} instance in the container, in case you need more than one configuration.
*/
public null|string|UnitEnum $tag = null,
public string|UnitEnum|null $tag = null,
) {}

public function createAdapter(Container $container): RedisAdapter
Expand Down
10 changes: 5 additions & 5 deletions packages/cache/src/GenericCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public function __construct(
private(set) CacheItemPoolInterface $adapter,
public bool $enabled = true,
private ?DeferredTasks $deferredTasks = null,
public null|UnitEnum|string $tag = null,
public UnitEnum|string|null $tag = null,
) {}

public function lock(Stringable|string $key, null|Duration|DateTimeInterface $duration = null, null|Stringable|string $owner = null): Lock
public function lock(Stringable|string $key, Duration|DateTimeInterface|null $duration = null, Stringable|string|null $owner = null): Lock
{
if ($duration instanceof DateTimeInterface) {
$duration = $duration->since(DateTime::now());
Expand All @@ -46,7 +46,7 @@ public function has(Stringable|string $key): bool
return $this->adapter->getItem((string) $key)->isHit();
}

public function put(Stringable|string $key, mixed $value, null|Duration|DateTimeInterface $expiration = null): CacheItemInterface
public function put(Stringable|string $key, mixed $value, Duration|DateTimeInterface|null $expiration = null): CacheItemInterface
{
$item = $this->adapter
->getItem((string) $key)
Expand All @@ -67,7 +67,7 @@ public function put(Stringable|string $key, mixed $value, null|Duration|DateTime
return $item;
}

public function putMany(iterable $values, null|Duration|DateTimeInterface $expiration = null): array
public function putMany(iterable $values, Duration|DateTimeInterface|null $expiration = null): array
{
$items = [];

Expand Down Expand Up @@ -144,7 +144,7 @@ public function getMany(iterable $key): array
);
}

public function resolve(Stringable|string $key, Closure $callback, null|Duration|DateTimeInterface $expiration = null, ?Duration $stale = null): mixed
public function resolve(Stringable|string $key, Closure $callback, Duration|DateTimeInterface|null $expiration = null, ?Duration $stale = null): mixed
{
if (! $this->enabled) {
return $callback();
Expand Down
4 changes: 2 additions & 2 deletions packages/cache/src/GenericLock.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(
private(set) ?Duration $duration = null,
) {}

public function locked(null|Stringable|string $by = null): bool
public function locked(Stringable|string|null $by = null): bool
{
if ($by === null) {
return $this->cache->has($this->key);
Expand Down Expand Up @@ -45,7 +45,7 @@ public function acquire(): bool
return $this->cache->get($this->key) === $this->owner;
}

public function execute(Closure $callback, null|DateTimeInterface|Duration $wait = null): mixed
public function execute(Closure $callback, DateTimeInterface|Duration|null $wait = null): mixed
{
$wait ??= Datetime::now();
$waitUntil = $wait instanceof Duration
Expand Down
4 changes: 2 additions & 2 deletions packages/cache/src/Lock.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function acquire(): bool;
/**
* Checks if the lock is currently held.
*/
public function locked(null|Stringable|string $by = null): bool;
public function locked(Stringable|string|null $by = null): bool;

/**
* Executes the given callback while holding the lock.
Expand All @@ -44,7 +44,7 @@ public function locked(null|Stringable|string $by = null): bool;
*
* @return TReturn The result of the callback.
*/
public function execute(Closure $callback, null|DateTimeInterface|Duration $wait = null): mixed;
public function execute(Closure $callback, DateTimeInterface|Duration|null $wait = null): mixed;

/**
* Releases the lock.
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/Testing/CacheTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(
/**
* Forces the usage of a testing cache.
*/
public function fake(null|string|UnitEnum $tag = null): TestingCache
public function fake(string|UnitEnum|null $tag = null): TestingCache
{
$cache = new TestingCache(
tag: Str\to_kebab_case(Str\parse($tag, default: 'default')),
Expand Down
Loading
Loading