Skip to content

Commit 528f6d4

Browse files
feat: PHP 8.4 Support (#216)
Closes: #190
2 parents f026fc7 + f680d1d commit 528f6d4

File tree

87 files changed

+250
-195
lines changed

Some content is hidden

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

87 files changed

+250
-195
lines changed

Dockerfile

+7-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN apt install -y \
1818
RUN <<EOF
1919
set -eux
2020

21-
PHP_VERSION=8.3
21+
PHP_VERSION=8.4
2222
PHP_CONFIG="/etc/php/${PHP_VERSION}"
2323

2424
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
@@ -35,10 +35,11 @@ DEBIAN_FRONTEND=noninteractive TZ=UTC apt install -y \
3535
"php${PHP_VERSION}-pdo-sqlite" \
3636
""
3737

38-
sed -i 's/^error_reporting = .\+$/error_reporting = E_ALL/' "${PHP_CONFIG}/cli/php.ini"
39-
sed -i 's/^display_errors = .\+$/display_errors = On/' "${PHP_CONFIG}/cli/php.ini"
40-
sed -i 's/^;opcache\.enable=.\+$/opcache.enable=1/' "${PHP_CONFIG}/cli/php.ini"
41-
sed -i 's/^;opcache\.enable_cli=.\+$/opcache.enable_cli=1/' "${PHP_CONFIG}/cli/php.ini"
38+
sed -i 's/^error_reporting = .\+$/error_reporting = E_ALL \& ~E_DEPRECATED/' "${PHP_CONFIG}/cli/php.ini"
39+
sed -i 's/^display_errors = .\+$/display_errors = On/' "${PHP_CONFIG}/cli/php.ini"
40+
sed -i 's/^;opcache\.enable=.\+$/opcache.enable=1/' "${PHP_CONFIG}/cli/php.ini"
41+
sed -i 's/^;opcache\.enable_cli=.\+$/opcache.enable_cli=1/' "${PHP_CONFIG}/cli/php.ini"
42+
sed -i 's/^opcache\.jit=.\+$/opcache.jit=disable/' "${PHP_CONFIG}/mods-available/opcache.ini"
4243
tee -a "${PHP_CONFIG}/mods-available/xdebug.ini" > /dev/null <<"EOT"
4344
xdebug.output_dir = /project/.xdebug
4445
xdebug.profiler_output_name = callgrind.out.%t.%r
@@ -83,4 +84,4 @@ EOF
8384
# ==============================================================================
8485
FROM scratch
8586
COPY --from=build / /
86-
CMD "/bin/bash"
87+
CMD ["/bin/bash"]

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ The set provides best practices to make development more fun and classes/service
1010

1111
| Requirement | Constraint | Supported by |
1212
|--------------|---------------------|------------------|
13-
| PHP | `^8.3` | `HEAD ⋯ 5.0.0` |
13+
| PHP | `^8.4` | `HEAD` |
14+
| | `^8.3` | `HEAD ⋯ 5.0.0` |
1415
| | `^8.2` | `7.1.0 ⋯ 2.0.0` |
1516
| | `^8.1` | `6.4.2 ⋯ 2.0.0` |
1617
| | `^8.0` | `4.6.0 ⋯ 2.0.0` |

composer-dependency-analyser.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// General
1111
$config = (new Configuration())
1212
->enableAnalysisOfUnusedDevDependencies()
13+
->ignoreErrorsOnPackage('symfony/polyfill-php84', [ErrorType::UNUSED_DEPENDENCY])
1314
->ignoreErrorsOnPackage('bamarni/composer-bin-plugin', [ErrorType::UNUSED_DEPENDENCY])
1415
->ignoreErrorsOnPackage('laravel/scout', [ErrorType::DEV_DEPENDENCY_IN_PROD])
1516
->ignoreUnknownClasses([
@@ -67,14 +68,14 @@
6768
$parse = static function (string $line): string {
6869
// Simplified parser
6970
// https://git-scm.com/docs/gitattributes
70-
$line = trim($line);
71+
$line = mb_trim($line);
7172

7273
if (str_starts_with($line, '#')) {
7374
$line = '';
7475
}
7576

7677
if (str_ends_with($line, ' export-ignore')) {
77-
$line = trim(explode(' ', $line, 2)[0] ?? '');
78+
$line = mb_trim(explode(' ', $line, 2)[0] ?? '');
7879
} else {
7980
$line = '';
8081
}
@@ -92,7 +93,7 @@
9293

9394
// Convert
9495
if ($line) {
95-
$line = ltrim($line, '/');
96+
$line = mb_ltrim($line, '/');
9697
$line = Glob::toRegex($line);
9798
}
9899

composer.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
3333
},
3434
"require": {
35-
"php": "^8.3",
35+
"php": "^8.3|^8.4",
3636
"ext-bcmath": "*",
3737
"ext-dom": "*",
3838
"ext-filter": "*",
@@ -44,7 +44,6 @@
4444
"composer/semver": "^3.2",
4545
"doctrine/sql-formatter": "^1.1",
4646
"guzzlehttp/psr7": "^2.4.5",
47-
"http-interop/http-factory-guzzle": "^1.0.0",
4847
"illuminate/collections": "^11.0.8",
4948
"illuminate/conditionable": "^11.0.8",
5049
"illuminate/console": "^11.0.8",
@@ -67,6 +66,7 @@
6766
"nette/neon": "^3.4.1",
6867
"nikic/php-parser": "^5.4.0",
6968
"nuwave/lighthouse": "^6.36.0",
69+
"nyholm/psr7": "^1.8",
7070
"opis/json-schema": "^2.3.0",
7171
"phpdocumentor/type-resolver": "^1.7",
7272
"phpstan/phpdoc-parser": "^2.0.0",
@@ -82,6 +82,7 @@
8282
"symfony/http-foundation": "^7.0.0",
8383
"symfony/http-kernel": "^7.0.0",
8484
"symfony/mime": "^7.0.0",
85+
"symfony/polyfill-php84": "^1.31",
8586
"symfony/property-access": "^7.0.0",
8687
"symfony/property-info": "^7.1.10",
8788
"symfony/psr-http-message-bridge": "^7.0.0",

metadata.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"^11.0.8"
99
],
1010
"php": [
11+
"^8.4",
1112
"^8.3"
1213
]
1314
},

packages/core/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ This package contains useful utilities and classes.
1010

1111
| Requirement | Constraint | Supported by |
1212
|--------------|---------------------|------------------|
13-
| PHP | `^8.3` | `HEAD ⋯ 5.0.0` |
13+
| PHP | `^8.4` | `HEAD` |
14+
| | `^8.3` | `HEAD ⋯ 5.0.0` |
1415
| | `^8.2` | `7.1.0 ⋯ 2.0.0` |
1516
| | `^8.1` | `6.4.2 ⋯ 2.0.0` |
1617
| | `^8.0` | `4.6.0 ⋯ 2.0.0` |

packages/core/composer.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
1919
},
2020
"require": {
21-
"php": "^8.3",
21+
"php": "^8.3|^8.4",
22+
"ext-mbstring": "*",
2223
"illuminate/console": "^11.0.8",
2324
"illuminate/container": "^11.0.8",
2425
"illuminate/contracts": "^11.0.8",
2526
"illuminate/support": "^11.0.8",
2627
"symfony/deprecation-contracts": "^3.0.0",
27-
"symfony/filesystem": "^7.0.0"
28+
"symfony/filesystem": "^7.0.0",
29+
"symfony/polyfill-php84": "^1.31"
2830
},
2931
"require-dev": {
3032
"phpunit/phpunit": "^10.5.0|^11.0.0",

packages/core/metadata.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"^11.0.8"
99
],
1010
"php": [
11+
"^8.4",
1112
"^8.3"
1213
]
1314
},

packages/core/src/Provider/Helper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use ReflectionClass;
66

77
use function dirname;
8-
use function ltrim;
8+
use function mb_ltrim;
99

1010
trait Helper {
1111
/**
@@ -18,7 +18,7 @@ abstract protected function getName(): string;
1818
*/
1919
protected function getPath(string $path): string {
2020
$class = new ReflectionClass(self::class);
21-
$path = dirname((string) $class->getFileName()).'/'.ltrim($path, '/');
21+
$path = dirname((string) $class->getFileName()).'/'.mb_ltrim($path, '/');
2222

2323
return $path;
2424
}

packages/dev/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Various internal tools and helpers to develop the package itself.
1010

1111
| Requirement | Constraint | Supported by |
1212
|--------------|---------------------|------------------|
13-
| PHP | `^8.3` | `HEAD ⋯ 6.2.0` |
13+
| PHP | `^8.4` | `HEAD` |
14+
| | `^8.3` | `HEAD ⋯ 6.2.0` |
1415
| | `^8.2` | `7.1.0 ⋯ 6.2.0` |
1516
| | `^8.1` | `6.4.2 ⋯ 6.2.0` |
1617
| PHPStan | `^2.1.1` | `HEAD` |

packages/dev/composer.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
1919
},
2020
"require": {
21-
"php": "^8.3",
21+
"php": "^8.3|^8.4",
22+
"ext-mbstring": "*",
2223
"illuminate/container": "^11.0.8",
2324
"illuminate/contracts": "^11.0.8",
2425
"illuminate/support": "^11.0.8",
@@ -27,6 +28,7 @@
2728
"nikic/php-parser": "^5.4.0",
2829
"nette/neon": "^3.4.1",
2930
"phpstan/phpstan": "^2.1.1",
31+
"symfony/polyfill-php84": "^1.31",
3032
"symfony/var-dumper": "^7.0.0"
3133
},
3234
"require-dev": {

packages/dev/metadata.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"requirements": {
99
"HEAD": {
1010
"php": [
11+
"^8.4",
1112
"^8.3"
1213
],
1314
"phpstan/phpstan": [

packages/dev/src/App/Dumper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
1010
use Symfony\Component\VarDumper\Dumper\CliDumper;
1111

12-
use function trim;
12+
use function mb_trim;
1313

1414
class Dumper {
1515
private readonly VarCloner $cloner;
@@ -49,7 +49,7 @@ public function dump(mixed $value, ?string $expression): void {
4949
}
5050

5151
public function raw(Stringable|string $value, ?string $expression, string $type): void {
52-
$dump = trim((string) $value);
52+
$dump = mb_trim((string) $value);
5353
$dump = ($expression !== null ? "The `{$expression}` is:\n\n" : '')."```{$type}\n{$dump}\n```\n";
5454
$this->dumps[] = $dump;
5555
}

packages/documentator/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ This package provides various utilities for documentation generation such as Mar
1010

1111
| Requirement | Constraint | Supported by |
1212
|--------------|---------------------|------------------|
13-
| PHP | `^8.3` | `HEAD ⋯ 5.0.0` |
13+
| PHP | `^8.4` | `HEAD` |
14+
| | `^8.3` | `HEAD ⋯ 5.0.0` |
1415
| | `^8.2` | `7.1.0 ⋯ 5.0.0-beta.1` |
1516
| | `^8.1` | `6.4.2 ⋯ 5.0.0-beta.1` |
1617
| Laravel | `^11.0.8` | `HEAD` |

packages/documentator/composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
1919
},
2020
"require": {
21-
"php": "^8.3",
21+
"php": "^8.3|^8.4",
2222
"ext-filter": "*",
2323
"ext-intl": "*",
2424
"ext-mbstring": "*",
@@ -35,6 +35,7 @@
3535
"symfony/deprecation-contracts": "^3.0.0",
3636
"symfony/filesystem": "^7.0.0",
3737
"symfony/finder": "^7.0.0",
38+
"symfony/polyfill-php84": "^1.31",
3839
"symfony/serializer": "^7.0.0",
3940
"lastdragon-ru/lara-asp-core": "self.version",
4041
"lastdragon-ru/lara-asp-formatter": "self.version",

packages/documentator/metadata.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"^11.0.8"
99
],
1010
"php": [
11+
"^8.4",
1112
"^8.3"
1213
]
1314
},

packages/documentator/src/Commands/Preprocess.php

+14-14
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
use function is_scalar;
4747
use function ksort;
4848
use function max;
49+
use function mb_rtrim;
50+
use function mb_trim;
4951
use function min;
50-
use function rtrim;
5152
use function str_repeat;
5253
use function strtr;
5354
use function strval;
54-
use function trim;
5555
use function var_export;
5656

5757
/**
@@ -137,7 +137,7 @@ protected function tasks(): array {
137137
public function getProcessedHelp(): string {
138138
try {
139139
return strtr(parent::getProcessedHelp(), [
140-
'%tasks%' => trim($this->getProcessedHelpTasks(3)),
140+
'%tasks%' => mb_trim($this->getProcessedHelpTasks(3)),
141141
]);
142142
} finally {
143143
$this->phpDocumentFactory = null;
@@ -151,11 +151,11 @@ protected function getProcessedHelpTasks(int $level): string {
151151
$processor = $this->processor();
152152

153153
foreach ($processor->tasks() as $index => $task) {
154-
$description = trim($this->getProcessedHelpTaskDescription($task, $level + 1));
154+
$description = mb_trim($this->getProcessedHelpTaskDescription($task, $level + 1));
155155
$description = $description !== '' ? $description : $default;
156156
$extensions = '`'.implode('`, `', $task::getExtensions()).'`';
157157
$deprecated = $this->getDeprecatedMark(new ReflectionClass($task));
158-
$title = trim((string) $this->getProcessedHelpTaskTitle($task));
158+
$title = mb_trim((string) $this->getProcessedHelpTaskTitle($task));
159159
$title = $title !== '' ? $title : "Task №{$index}";
160160
$help .= <<<MARKDOWN
161161
{$heading} {$title} ({$extensions}){$deprecated}
@@ -196,15 +196,15 @@ protected function getProcessedHelpTaskPreprocessInstructions(PreprocessTask $ta
196196
$class = new ReflectionClass($instruction);
197197
$name = $instruction::getName();
198198
$desc = $this->getDocBlock($class, null, $level + 1);
199-
$target = trim(
199+
$target = mb_trim(
200200
(string) $this->getProcessedHelpTaskPreprocessInstructionTarget($instruction, 'target', 2),
201201
);
202202
$target = $target !== '' ? $target : '_No description provided_.';
203203
$params = $this->getProcessedHelpTaskPreprocessParameters($instruction, 'target', 2);
204204
$deprecated = $this->getDeprecatedMark($class);
205205

206206
if ($params !== null) {
207-
$help[$name] = rtrim(
207+
$help[$name] = mb_rtrim(
208208
<<<HELP
209209
{$heading} `[{$name}]: <target> <parameters>`{$deprecated}
210210
@@ -216,7 +216,7 @@ protected function getProcessedHelpTaskPreprocessInstructions(PreprocessTask $ta
216216
HELP,
217217
);
218218
} else {
219-
$help[$name] = rtrim(
219+
$help[$name] = mb_rtrim(
220220
<<<HELP
221221
{$heading} `[{$name}]: <target>`{$deprecated}
222222
@@ -313,10 +313,10 @@ protected function getProcessedHelpTaskPreprocessParameters(
313313
}
314314

315315
// Add
316-
$definition = $this->getDeprecatedMark($property).$definition;
317-
$description = trim($this->getDocBlock($property, $padding));
318-
$description = $description !== '' ? $description : '_No description provided_.';
319-
$parameters[trim($definition)] = $description;
316+
$definition = $this->getDeprecatedMark($property).$definition;
317+
$description = mb_trim($this->getDocBlock($property, $padding));
318+
$description = $description !== '' ? $description : '_No description provided_.';
319+
$parameters[mb_trim($definition)] = $description;
320320
}
321321

322322
// Empty?
@@ -335,7 +335,7 @@ protected function getProcessedHelpTaskPreprocessParameters(
335335
}
336336

337337
$list = Text::setPadding($list, $padding);
338-
$list = rtrim($list);
338+
$list = mb_rtrim($list);
339339

340340
// Return
341341
return $list;
@@ -379,7 +379,7 @@ private function getDocBlock(
379379
}
380380

381381
// Return
382-
return trim($help);
382+
return mb_trim($help);
383383
}
384384

385385
/**

packages/documentator/src/Commands/Requirements.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
use function getcwd;
3636
use function mb_strlen;
3737
use function mb_substr;
38+
use function mb_trim;
3839
use function preg_match;
3940
use function preg_quote;
4041
use function range;
4142
use function reset;
4243
use function str_starts_with;
4344
use function strtr;
44-
use function trim;
4545
use function uksort;
4646
use function usort;
4747

@@ -188,7 +188,7 @@ public function __invoke(
188188
'packages' => $packages,
189189
'requirements' => $requirements,
190190
]);
191-
$output = trim($output);
191+
$output = mb_trim($output);
192192

193193
$this->output->writeln($output);
194194
}
@@ -272,7 +272,7 @@ protected function getPackageRequirements(array $require, array $merge, Composer
272272

273273
// Add
274274
$required = explode('|', Cast::toString($constraint));
275-
$required = array_map(trim(...), $required);
275+
$required = array_map(mb_trim(...), $required);
276276
$required = array_filter($required, static fn ($string) => $string !== '');
277277
$required = array_values($required);
278278
$requirement = Cast::toString($requirement);

0 commit comments

Comments
 (0)