Skip to content

Commit 41ebf3e

Browse files
committed
Merge branch 'main' into feat/redis
2 parents fc397a8 + dde685a commit 41ebf3e

File tree

340 files changed

+9651
-2764
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

340 files changed

+9651
-2764
lines changed

.env.example

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,12 @@ ENVIRONMENT=local
44
# The base URI that's used for all generated URIs
55
BASE_URI=http://localhost
66

7-
# The CACHE key is used as a global override to turn all caches on or off
8-
# Should be true in production, but null or false in local development
9-
CACHE=null
7+
# Setting to `false` force-disable internal caches.
8+
INTERNAL_CACHES=true
109

11-
# Enable or disable discovery cache
10+
# Enable or disable discovery cache. Can be `true`, `partial` or `false`.
1211
DISCOVERY_CACHE=false
1312

14-
# Enable or disable config cache
15-
CONFIG_CACHE=false
16-
17-
# Enable or disable icon cache
18-
ICON_CACHE=true
19-
20-
# Enable or disable view cache
21-
VIEW_CACHE=false
22-
23-
# Enable or disable project cache (allround cache)
24-
PROJECT_CACHE=false
25-
2613
# Overwrite default log paths (null = default)
2714
DEBUG_LOG_PATH=null
28-
SERVER_LOG_PATH=null
15+
SERVER_LOG_PATH=null

.github/workflows/integration-tests.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
workflow_dispatch:
66
schedule:
77
- cron: '0 0 * * *'
8+
env:
9+
POSTGRES_USER: runner
10+
POSTGRES_PASSWORD: ''
11+
POSTGRES_DB: postgres
812

913
jobs:
1014
vitest:
@@ -28,7 +32,7 @@ jobs:
2832
uses: shivammathur/setup-php@v2
2933
with:
3034
php-version: ${{ matrix.php }}
31-
extensions: dom, curl, libxml, mbstring, pcntl, fileinfo, pdo, sqlite, pdo_sqlite, pdo_mysql, intl, ftp, zip
35+
extensions: dom, curl, libxml, mbstring, pcntl, fileinfo, pdo, sqlite, pdo_sqlite, pdo_mysql, pdo_pgsql intl, ftp, zip
3236
coverage: pcov
3337

3438
- name: Setup Bun
@@ -60,6 +64,9 @@ jobs:
6064
stability:
6165
- prefer-stable
6266
- prefer-lowest
67+
exclude:
68+
- os: windows-latest
69+
database: postgres
6370

6471
name: "Run tests: PHP ${{ matrix.php }} - ${{ matrix.database }} - ${{ matrix.stability }} - ${{ matrix.os }}"
6572

@@ -98,7 +105,10 @@ jobs:
98105
uses: ankane/setup-postgres@v1
99106

100107
- name: Set database config - ${{ matrix.database }}
101-
run: php -r "file_exists('tests/Fixtures/Config/database.config.php') || copy('tests/Fixtures/Config/database.${{ matrix.database }}.php', 'tests/Fixtures/Config/database.config.php');"
108+
run: php -r "copy('tests/Fixtures/Config/database.${{ matrix.database }}.php', 'tests/Fixtures/Config/database.config.php');"
109+
110+
- name: Tempest about
111+
run: php ./tempest about
102112

103113
- name: List discovered locations
104114
run: php ./tempest discovery:status

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
},
4242
"require-dev": {
4343
"aidan-casey/mock-client": "dev-master",
44-
"carthage-software/mago": "0.22.2",
44+
"carthage-software/mago": "0.24.1",
4545
"guzzlehttp/psr7": "^2.6.1",
4646
"illuminate/view": "~11.7.0",
4747
"league/flysystem-aws-s3-v3": "^3.0",
@@ -152,6 +152,7 @@
152152
"packages/support/src/Math/constants.php",
153153
"packages/support/src/Math/functions.php",
154154
"packages/support/src/Namespace/functions.php",
155+
"packages/support/src/Number/functions.php",
155156
"packages/support/src/Path/functions.php",
156157
"packages/support/src/Random/functions.php",
157158
"packages/support/src/Regex/functions.php",

mago.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ name = "strictness/require-return-type"
6464
ignore_arrow_function = true
6565
ignore_closure = true
6666

67+
# https://github.com/carthage-software/mago/issues/206
68+
[[linter.rules]]
69+
name = "best-practices/literal-named-argument"
70+
level = "off"
71+
6772
# https://github.com/carthage-software/mago/issues/146
6873
[[linter.rules]]
6974
name = "strictness/require-strict-types"

packages/auth/src/CurrentUserInitializer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@
88
use Tempest\Container\DynamicInitializer;
99
use Tempest\Container\Tag;
1010
use Tempest\Reflection\ClassReflector;
11+
use UnitEnum;
1112

1213
final readonly class CurrentUserInitializer implements DynamicInitializer
1314
{
14-
public function canInitialize(ClassReflector $class, ?string $tag): bool
15+
public function canInitialize(ClassReflector $class, null|string|UnitEnum $tag): bool
1516
{
1617
return $class->implements(CanAuthenticate::class);
1718
}
1819

19-
public function initialize(ClassReflector $class, ?string $tag, Container $container): object
20+
public function initialize(ClassReflector $class, null|string|UnitEnum $tag, Container $container): object
2021
{
2122
$user = $container->get(Authenticator::class)->currentUser();
2223

packages/auth/src/Install/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function grantPermission(string|UnitEnum|Permission $permission): self
4040
{
4141
$permission = $this->resolvePermission($permission);
4242

43-
new UserPermission(
43+
UserPermission::new(
4444
user: $this,
4545
permission: $permission,
4646
)->save();

packages/auth/src/Install/UserPermission.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ final class UserPermission
1010
{
1111
use IsDatabaseModel;
1212

13-
public function __construct(
14-
public User $user,
15-
public Permission $permission,
16-
) {}
13+
public User $user;
14+
15+
public Permission $permission;
1716
}

packages/cache/src/Cache.php

Lines changed: 77 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,90 @@
66

77
use Closure;
88
use Psr\Cache\CacheItemInterface;
9+
use Stringable;
910
use Tempest\DateTime\DateTimeInterface;
11+
use Tempest\DateTime\Duration;
1012

1113
interface Cache
1214
{
13-
public function put(string $key, mixed $value, ?DateTimeInterface $expiresAt = null): CacheItemInterface;
15+
/**
16+
* Whether the cache is enabled.
17+
*/
18+
public bool $enabled {
19+
get;
20+
set;
21+
}
1422

15-
public function get(string $key): mixed;
23+
/**
24+
* Returns a lock for the specified key. The lock is not acquired until `acquire()` is called.
25+
*
26+
* @param Stringable|string $key The identifier of the lock.
27+
* @param null|Duration|DateTimeInterface $expiration The expiration time for the lock. If not specified, the lock will not expire.
28+
* @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.
29+
*/
30+
public function lock(Stringable|string $key, null|Duration|DateTimeInterface $expiration = null, null|Stringable|string $owner = null): Lock;
1631

17-
/** @param Closure(): mixed $cache */
18-
public function resolve(string $key, Closure $cache, ?DateTimeInterface $expiresAt = null): mixed;
32+
/**
33+
* Sets the specified key to the specified value in the cache. Optionally, specify an expiration.
34+
*/
35+
public function put(Stringable|string $key, mixed $value, null|Duration|DateTimeInterface $expiration = null): CacheItemInterface;
1936

20-
public function remove(string $key): void;
37+
/**
38+
* Sets the specified keys to the specified values in the cache. Optionally, specify an expiration.
39+
*
40+
* @template TKey of array-key
41+
* @template TValue
42+
*
43+
* @param iterable<TKey,TValue> $array
44+
* @return array<TKey,CacheItemInterface>
45+
*/
46+
public function putMany(iterable $values, null|Duration|DateTimeInterface $expiration = null): array;
2147

22-
public function clear(): void;
48+
/**
49+
* Gets the value associated with the specified key from the cache. If the key does not exist, null is returned.
50+
*/
51+
public function get(Stringable|string $key): mixed;
52+
53+
/**
54+
* Gets the values associated with the specified keys from the cache. If a key does not exist, null is returned for that key.
55+
*
56+
* @template TKey of array-key
57+
* @template TValue
58+
*
59+
* @param iterable<TKey,TValue> $array
60+
* @return array<TValue,mixed>
61+
*/
62+
public function getMany(iterable $key): array;
63+
64+
/**
65+
* Determines whether the cache contains the specified key.
66+
*/
67+
public function has(Stringable|string $key): bool;
68+
69+
/**
70+
* Increments the value associated with the specified key by the specified amount. If the key does not exist, it is created with the specified amount.
71+
*/
72+
public function increment(Stringable|string $key, int $by = 1): int;
2373

24-
public function isEnabled(): bool;
74+
/**
75+
* Decrements the value associated with the specified key by the specified amount. If the key does not exist, it is created with the negative amount.
76+
*/
77+
public function decrement(Stringable|string $key, int $by = 1): int;
78+
79+
/**
80+
* If the specified key already exists in the cache, the value is returned and the `$callback` is not executed. Otherwise, the result of the callback is stored, then returned.
81+
*
82+
* @var 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.
83+
*/
84+
public function resolve(Stringable|string $key, Closure $callback, null|Duration|DateTimeInterface $expiration = null, ?Duration $stale = null): mixed;
85+
86+
/**
87+
* Removes the specified key from the cache.
88+
*/
89+
public function remove(Stringable|string $key): void;
90+
91+
/**
92+
* Clears the entire cache.
93+
*/
94+
public function clear(): void;
2595
}

packages/cache/src/CacheClearCommand.php

Lines changed: 0 additions & 52 deletions
This file was deleted.

packages/cache/src/CacheConfig.php

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)