Skip to content

Commit 1a89049

Browse files
authored
chore: PHP 8.4 and upgrade pest (#33)
1 parent fa398c5 commit 1a89049

51 files changed

Lines changed: 2509 additions & 2033 deletions

Some content is hidden

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

‎.github/actions/setup-php-composer/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ inputs:
55
php-version:
66
description: 'PHP version to use'
77
required: false
8-
default: '8.3'
8+
default: '8.4'
99
coverage:
1010
description: 'Coverage driver to use (none, xdebug, pcov)'
1111
required: false

‎.github/workflows/run-tests.yml‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@ jobs:
1414
test:
1515
runs-on: ${{ matrix.os }}
1616
strategy:
17-
fail-fast: true
17+
fail-fast: false
1818
matrix:
1919
os: [ubuntu-latest, windows-latest]
20-
php: [8.3, 8.4, 8.5]
20+
php: [8.4, 8.5]
2121
stability: [prefer-lowest, prefer-stable]
22+
include:
23+
- os: ubuntu-latest
24+
php: 8.5
25+
stability: prefer-stable
26+
mutation: true
2227

2328
name: PHP${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
2429

@@ -30,18 +35,18 @@ jobs:
3035
uses: ./.github/actions/setup-php-composer
3136
with:
3237
php-version: ${{ matrix.php }}
33-
coverage: pcov
38+
coverage: ${{ matrix.mutation && 'pcov' || 'none' }}
3439
stability: ${{ matrix.stability }}
3540

3641
- name: Setup problem matchers
3742
run: |
3843
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
3944
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
4045
41-
- name: Execute tests with mutation
42-
if: ${{ matrix.os == 'ubuntu-latest' }}
43-
run: vendor/bin/pest --colors=always --mutate --parallel --min=80
44-
4546
- name: Execute tests
46-
if: ${{ matrix.os != 'ubuntu-latest' }}
47+
if: ${{ ! matrix.mutation }}
4748
run: vendor/bin/pest --colors=always
49+
50+
- name: Execute tests with mutation
51+
if: ${{ matrix.mutation }}
52+
run: vendor/bin/pest --colors=always --mutate --parallel --min=80

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
- ✅ **Validation** - Validate data against schemas with detailed error messages
1414
- 🤝 **Conditional Schemas** - Support for if/then/else, allOf, anyOf, and not conditions
1515
- 🔄 **Reflection** - Generate schemas from PHP classes, enums, and closures — including docblock array generics and constructor property promotion
16-
- 💪 **Type Safety** - Built with PHP 8.3+ features and strict typing
16+
- 💪 **Type Safety** - Built with PHP 8.4+ features and strict typing
1717
- 🔍 **Version-Aware Features** - Automatic validation of version-specific features with helpful error messages
1818

1919
## JSON Schema Version Support
@@ -29,7 +29,7 @@ This package supports multiple JSON Schema specification versions with automatic
2929

3030
## Requirements
3131

32-
- PHP 8.3+
32+
- PHP 8.4+
3333

3434
## Installation
3535

‎composer.json‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,20 @@
1919
}
2020
],
2121
"require": {
22-
"php": "^8.3",
22+
"php": "^8.4",
2323
"ext-json": "*",
24-
"opis/json-schema": "^2.4",
24+
"opis/json-schema": "^2.5",
2525
"phpstan/phpdoc-parser": "^2.3"
2626
},
2727
"require-dev": {
28-
"pestphp/pest": "^4.1.4",
29-
"pestphp/pest-plugin-type-coverage": "^4.0.3",
28+
"pestphp/pest": "^5.0",
29+
"pestphp/pest-plugin-phpstan": "^5.0",
30+
"pestphp/pest-plugin-rector": "^5.0",
31+
"pestphp/pest-plugin-type-coverage": "^5.0",
3032
"phpstan/phpstan": "^2.1.32",
3133
"phpstan/phpstan-strict-rules": "^2.0",
3234
"rector/rector": "^2.2",
33-
"symplify/easy-coding-standard": "^13.0"
35+
"symplify/easy-coding-standard": "~13.1.0"
3436
},
3537
"autoload": {
3638
"psr-4": {
@@ -43,7 +45,7 @@
4345
}
4446
},
4547
"scripts": {
46-
"test": "pest",
48+
"test": "pest --parallel",
4749
"ecs": "ecs check --fix",
4850
"ecs:check": "ecs check",
4951
"rector": "rector process",

‎docs/json-schema/installation.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ icon: 'terminal'
66

77
## Requirements
88

9-
- PHP 8.3+
9+
- PHP 8.4+
1010
- Composer for dependency management
1111

1212
## Installation Steps

‎docs/json-schema/introduction.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ icon: 'book-open'
3636
href="/json-schema/installation"
3737
icon="shield"
3838
>
39-
Built with PHP 8.3+ features and strict typing for reliable, maintainable code.
39+
Built with PHP 8.4+ features and strict typing for reliable, maintainable code.
4040
</Card>
4141
<Card
4242
title="Conditional Schemas"
@@ -70,7 +70,7 @@ icon: 'book-open'
7070

7171
## About This Package
7272

73-
This PHP package provides a fluent, type-safe way to build and validate JSON Schemas. Built with PHP 8.3+ features and strict typing, it supports multiple JSON Schema specification versions with automatic feature validation.
73+
This PHP package provides a fluent, type-safe way to build and validate JSON Schemas. Built with PHP 8.4+ features and strict typing, it supports multiple JSON Schema specification versions with automatic feature validation.
7474

7575
## Quick Example
7676

@@ -109,7 +109,7 @@ if ($schema->isValid($data)) {
109109
```
110110

111111
<Note>
112-
This package requires PHP 8.3 or higher and uses modern PHP features for optimal performance and developer experience.
112+
This package requires PHP 8.4 or higher and uses modern PHP features for optimal performance and developer experience.
113113
</Note>
114114

115115
## Supported Schema Types

‎docs/json-schema/schema-types/object.mdx‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,25 @@ $productSchema = Schema::object('product')
103103
```
104104
</Accordion>
105105

106+
## Named Properties
107+
108+
When the property key should not come from the schema title, use `property()` to set the name explicitly. You can also mark properties as required in bulk with `requireProperties()`:
109+
110+
```php
111+
$userSchema = Schema::object('user')
112+
->property('name', Schema::string()->minLength(1), required: true)
113+
->property('email', Schema::string()->format(SchemaFormat::Email), required: true)
114+
->property('bio', Schema::string()->maxLength(500));
115+
116+
// Or mark required properties separately
117+
$configSchema = Schema::object('config')
118+
->property('host', Schema::string())
119+
->property('port', Schema::integer())
120+
->requireProperties('host', 'port');
121+
```
122+
123+
`property()` is especially useful when converting from raw JSON Schema, where property keys are independent of any `title` metadata.
124+
106125
## Property Titles
107126

108127
Property names are defined by the schema constructor argument, while `title()` is metadata and only included when it differs from the property name:

‎ecs.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
cleanCode: true,
3434
)
3535
->withPhpCsFixerSets(
36-
php83Migration: true,
36+
php84Migration: true,
3737
)
3838
->withRules([
3939
NotOperatorWithSuccessorSpaceFixer::class,

‎phpstan.dist.neon‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
includes:
22
- vendor/phpstan/phpstan-strict-rules/rules.neon
3+
- vendor/pestphp/pest-plugin-phpstan/extension.neon
34

45
parameters:
56
level: 10
67
paths:
78
- src
9+
- tests
810
tmpDir: .phpstan-cache
911
checkBenevolentUnionTypes: true

‎rector.php‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
declare(strict_types=1);
44

55
use Rector\Config\RectorConfig;
6+
use Pest\Rector\Set\PestSetList;
67

78
return RectorConfig::configure()
89
->withPaths([
@@ -14,7 +15,12 @@
1415
importDocBlockNames: false,
1516
removeUnusedImports: true,
1617
)
17-
->withPhpSets()
18+
->withPhpSets(
19+
php84: true,
20+
)
21+
->withSets([
22+
PestSetList::CODING_STYLE,
23+
])
1824
->withPreparedSets(
1925
deadCode: true,
2026
codeQuality: true,

0 commit comments

Comments
 (0)