Skip to content

Commit 5d62f5e

Browse files
authored
Merge branch '3.x' into fix/cache-lock
2 parents 0ec037f + 3c0d1f3 commit 5d62f5e

File tree

214 files changed

+3192
-1747
lines changed

Some content is hidden

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

214 files changed

+3192
-1747
lines changed

.github/workflows/coding-conventions.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
pull_request:
55
workflow_dispatch:
66

7-
# CSFixer and Rector are temporarily disabled until they have proper PHP 8.4 support
87
jobs:
98
check-style:
109
name: Run style check
@@ -15,12 +14,12 @@ jobs:
1514
- name: Setup PHP
1615
uses: shivammathur/setup-php@v2
1716
with:
18-
php-version: 8.4
17+
php-version: 8.5
1918
coverage: none
2019

2120
- name: Install dependencies
2221
run: |
23-
composer update --prefer-dist --no-interaction
22+
composer update --prefer-dist --no-interaction --ignore-platform-reqs
2423
composer mago:install-binary
2524
2625
- name: Run Mago
@@ -46,7 +45,7 @@ jobs:
4645
- name: Setup PHP
4746
uses: shivammathur/setup-php@v2
4847
with:
49-
php-version: 8.4
48+
php-version: 8.5
5049
coverage: none
5150

5251
- name: Install composer dependencies
@@ -65,7 +64,7 @@ jobs:
6564
# - name: Setup PHP
6665
# uses: shivammathur/setup-php@v2
6766
# with:
68-
# php-version: 8.4
67+
# php-version: 8.5
6968
# coverage: none
7069
#
7170
# - name: Install composer dependencies

.github/workflows/integration-tests-windows.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
php:
19-
- 8.4
19+
- 8.5
2020
os:
2121
- windows-latest
2222
env:
@@ -55,7 +55,7 @@ jobs:
5555
os:
5656
- windows-latest
5757
php:
58-
- 8.4
58+
- 8.5
5959
database:
6060
- sqlite
6161
- mysql
@@ -84,7 +84,7 @@ jobs:
8484
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
8585
8686
- name: Install dependencies
87-
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
87+
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --ignore-platform-reqs
8888

8989
- name: "Setup Redis"
9090
if: ${{ matrix.os != 'windows-latest' }}

.github/workflows/integration-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
php:
23-
- 8.4
23+
- 8.5
2424
os:
2525
- ubuntu-latest
2626
# - windows-latest
@@ -59,7 +59,7 @@ jobs:
5959
- ubuntu-latest
6060
# - windows-latest
6161
php:
62-
- 8.4
62+
- 8.5
6363
database:
6464
- sqlite
6565
- mysql
@@ -90,7 +90,7 @@ jobs:
9090
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
9191
9292
- name: Install dependencies
93-
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
93+
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --ignore-platform-reqs
9494

9595
- name: "Setup Redis"
9696
if: ${{ matrix.os != 'windows-latest' }}

.github/workflows/isolated-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up PHP
1818
uses: shivammathur/setup-php@v2
1919
with:
20-
php-version: 8.4
20+
php-version: 8.5
2121
coverage: none
2222

2323
- uses: actions/checkout@v4
@@ -43,7 +43,7 @@ jobs:
4343
- ubuntu-latest
4444
package: ${{ fromJson(needs.get_packages.outputs.matrix) }}
4545
php:
46-
- 8.4
46+
- 8.5
4747
stability:
4848
- prefer-stable
4949
- prefer-lowest
@@ -77,7 +77,7 @@ jobs:
7777
run: |
7878
./bin/build-changed-packages
7979
cd "packages/${{ matrix.package.basename }}"
80-
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
80+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction --ignore-platform-reqs
8181
8282
- name: Execute tests
8383
run: phpunit -c "packages/${{ matrix.package.basename }}/phpunit.xml"

.github/workflows/subsplit-packages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set Up PHP
1818
uses: shivammathur/setup-php@v2
1919
with:
20-
php-version: 8.4
20+
php-version: 8.5
2121
coverage: none
2222

2323
- uses: actions/checkout@v4

.github/workflows/validate-packages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup PHP
1919
uses: shivammathur/setup-php@v2
2020
with:
21-
php-version: 8.4
21+
php-version: 8.5
2222
extensions: dom, curl, libxml, mbstring, pcntl, fileinfo, intl
2323
coverage: none
2424

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"monolog/monolog": "^3.7.0",
2525
"nette/php-generator": "^4.1.6",
2626
"nikic/php-parser": "^5.3",
27-
"php": "^8.4",
27+
"php": "^8.5",
2828
"psr-discovery/http-client-implementations": "^1.4",
2929
"psr-discovery/http-factory-implementations": "^1.2",
3030
"psr/cache": "^3.0",

docs/1-essentials/01-routing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ Once you have created a request class, you may simply inject it into a controlle
368368
```php app/AirportController.php
369369
use Tempest\Router\Post;
370370
use Tempest\Http\Responses\Redirect;
371-
use function Tempest\map;
371+
use function Tempest\Mapper\map;
372372
use function Tempest\Router\uri;
373373

374374
final readonly class AirportController

docs/1-essentials/02-views.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ keywords: "Experimental"
88

99
Views in Tempest are parsed by Tempest View, our own templating engine. Tempest View uses a syntax that can be thought of as a superset of HTML. If you prefer using a templating engine with more widespread support, [you may also use Blade, Twig, or any other](#using-other-engines) — as long as you provide a way to initialize it.
1010

11-
If you'd like to Tempest View as a standalone component in your project, you can read the documentation on how to do so [here](../5-extra-topics/02-standalone-components.md#tempest-view).
11+
If you'd like to Tempest View as a standalone component in your project, you can read the documentation on how to do so [here](../5-extra-topics/02-standalone-components.md#tempest-view).
1212

1313
### Syntax overview
1414

@@ -447,7 +447,7 @@ $title = 'foo';
447447
<!-- $title will need to be passed in explicitly,
448448
otherwise `x-post` wouldn't know about it: -->
449449

450-
<x-post :title="$title"></x-post>
450+
<x-post :title="$title"></x-post>
451451
```
452452

453453
```php
@@ -463,7 +463,6 @@ final class HomeController
463463
```
464464

465465
```html x-base.view.php
466-
467466
<h1>{{ $siteTitle }}</h1>
468467
```
469468

@@ -680,7 +679,7 @@ use Tempest\View\Renderers\TempestViewRenderer;
680679
use Tempest\View\ViewCache;
681680

682681
$renderer = TempestViewRenderer::make(
683-
cache: ViewCache::enabled(),
682+
cache: ViewCache::create(),
684683
);
685684
```
686685

@@ -690,8 +689,7 @@ It's recommended to turn view caching on in production environments. To clear th
690689
use Tempest\View\Renderers\TempestViewRenderer;
691690
use Tempest\View\ViewCache;
692691

693-
$viewCache = ViewCache::enabled();
694-
692+
$viewCache = ViewCache::create();
695693
$viewCache->clear();
696694

697695
$renderer = TempestViewRenderer::make(

docs/1-essentials/03-database.md

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ final class Book
147147
Because model objects aren't tied to the database specifically, Tempest's [mapper](../2-features/01-mapper.md) can map data from many different sources to them. For instance, you can persist your models as JSON instead of a database, if you want to:
148148

149149
```php
150-
use function Tempest\map;
150+
use function Tempest\Mapper\map;
151151

152152
$books = map($json)->collection()->to(Book::class); // from JSON source to Book collection
153153
$json = map($books)->toJson(); // from Book collection to JSON
@@ -308,34 +308,41 @@ final class User
308308

309309
The encryption key is taken from the `SIGNING_KEY` environment variable.
310310

311-
### DTO properties
311+
### Data transfer object properties
312312

313-
Sometimes, you might want to store data objects as-is in a table, without there needing to be a relation to another table. To do so, it's enough to add a serializer and caster to the data object's class, and Tempest will know that these objects aren't meant to be treated as database models. Next, you can store the object's data as a json field on the table (see [migrations](#migrations) for more info).
313+
You can store arbitrary objects directly in a `json` column when they don’t need to be part of the relational schema.
314+
315+
To do this, annotate the class with `⁠#[Tempest\Mapper\SerializeAs]` and provide a unique identifier for the object’s serialized form. The identifier must map to a single, distinct class.
314316

315317
```php
316-
use Tempest\Database\IsDatabaseModel;
317-
use Tempest\Mapper\CastWith;
318-
use Tempest\Mapper\SerializeWith;
319-
use Tempest\Mapper\Casters\DtoCaster;
320-
use Tempest\Mapper\Serializers\DtoSerializer;
318+
use Tempest\Mapper\SerializeAs;
321319

322-
final class DebugItem
320+
final class User implements Authenticatable
323321
{
324-
use IsDatabaseModel;
325-
326-
/* … */
327-
328-
public Backtrace $backtrace,
322+
public PrimaryKey $id;
323+
324+
public function __construct(
325+
public string $email,
326+
#[Hashed, SensitiveParameter]
327+
public ?string $password,
328+
public Settings $settings,
329+
) {}
329330
}
330331

331-
#[CastWith(DtoCaster::class)]
332-
#[SerializeWith(DtoSerializer::class)]
333-
final class Backtrace
332+
#[SerializeAs('user_settings')]
333+
final class Settings
334334
{
335-
// This object won't be considered a relation,
336-
// but rather serialized and stored in a JSON column.
335+
public function __construct(
336+
public readonly Theme $theme,
337+
public readonly bool $hide_sidebar_by_default,
338+
) {}
339+
}
337340

338-
public array $frames = [];
341+
enum Theme: string
342+
{
343+
case DARK = 'dark';
344+
case LIGHT = 'light';
345+
case AUTO = 'auto';
339346
}
340347
```
341348

0 commit comments

Comments
 (0)