Skip to content

Commit 3c076c5

Browse files
author
roadiz-ci
committed
Merge branch hotfix/v2.6.17
1 parent 2cb7a46 commit 3c076c5

11 files changed

Lines changed: 23 additions & 24 deletions

.github/workflows/run-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
strategy:
2222
matrix:
23-
php-version: ['8.2', '8.3']
23+
php-version: ['8.3', '8.4']
2424
steps:
2525
- uses: shivammathur/setup-php@v2
2626
with:

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright © 2024 Ambroise Maupate
3+
Copyright © 2025 Ambroise Maupate
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
66

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "Roadiz sub-package which generates Typescript interfaces skeleton based on your schema",
44
"type": "library",
55
"require": {
6-
"roadiz/nodetype-contracts": "^2.0.0",
7-
"symfony/http-foundation": "6.4.*"
6+
"roadiz/nodetype-contracts": "^3.0.0",
7+
"symfony/http-foundation": "7.3.*"
88
},
99
"require-dev": {
1010
"phpstan/phpstan": "^1.5.3",
@@ -26,8 +26,8 @@
2626
},
2727
"extra": {
2828
"branch-alias": {
29-
"dev-master": "2.5.x-dev",
30-
"dev-develop": "2.6.x-dev"
29+
"dev-master": "2.6.x-dev",
30+
"dev-develop": "2.7.x-dev"
3131
}
3232
}
3333
}

src/Generators/AbstractFieldGenerator.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ protected function getIntroductionLines(): array
5959

6060
public function getIntroduction(): string
6161
{
62-
return implode(PHP_EOL, array_map(function (string $line) {
63-
return static::INDENTATION_MARK.'// '.$line;
64-
}, $this->getIntroductionLines()));
62+
return implode(PHP_EOL, array_map(fn (string $line) => static::INDENTATION_MARK.'// '.$line, $this->getIntroductionLines()));
6563
}
6664
}

src/Generators/ChildrenNodeFieldGenerator.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66

77
final class ChildrenNodeFieldGenerator extends AbstractFieldGenerator
88
{
9+
#[\Override]
910
public function getContents(): string
1011
{
1112
return implode(PHP_EOL, [
1213
$this->getIntroduction(),
1314
]);
1415
}
1516

17+
#[\Override]
1618
protected function getIntroductionLines(): array
1719
{
1820
$lines = [
@@ -25,6 +27,7 @@ protected function getIntroductionLines(): array
2527
return $lines;
2628
}
2729

30+
#[\Override]
2831
protected function getType(): string
2932
{
3033
return '';

src/Generators/DeclarationGenerator.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ public function getContents(): string
4545

4646
private function getAllTypesInterface(): string
4747
{
48-
$nodeTypeNames = array_map(function (NodeTypeInterface $nodeType) {
49-
return $nodeType->getSourceEntityClassName();
50-
}, $this->nodeTypes);
48+
$nodeTypeNames = array_map(fn (NodeTypeInterface $nodeType) => $nodeType->getSourceEntityClassName(), $this->nodeTypes);
5149

5250
$nodeTypeNames = implode(' | ', $nodeTypeNames);
5351

src/Generators/DocumentsFieldGenerator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66

77
final class DocumentsFieldGenerator extends AbstractFieldGenerator
88
{
9+
#[\Override]
910
protected function getNullableAssertion(): string
1011
{
1112
return ''; // always available even if empty
1213
}
1314

15+
#[\Override]
1416
protected function getType(): string
1517
{
1618
return 'Array<RoadizDocument>';

src/Generators/EnumFieldGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66

77
final class EnumFieldGenerator extends AbstractFieldGenerator
88
{
9+
#[\Override]
910
protected function getType(): string
1011
{
1112
switch (true) {
1213
case $this->field->isEnum():
1314
$defaultValues = $this->field->getDefaultValuesAsArray();
1415
if (!empty($defaultValues) && count($defaultValues) > 0) {
15-
$defaultValues = array_map(function (string $value) {
16-
return '\''.$value.'\'';
17-
}, $defaultValues);
16+
$defaultValues = array_map(fn (string $value) => '\''.$value.'\'', $defaultValues);
1817

1918
return implode(' | ', $defaultValues).' | null';
2019
}
@@ -27,6 +26,7 @@ protected function getType(): string
2726
}
2827
}
2928

29+
#[\Override]
3030
protected function getIntroductionLines(): array
3131
{
3232
$lines = parent::getIntroductionLines();

src/Generators/NodeReferencesFieldGenerator.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99
final class NodeReferencesFieldGenerator extends AbstractFieldGenerator
1010
{
11+
#[\Override]
1112
protected function getNullableAssertion(): string
1213
{
1314
return ''; // always available even if empty
1415
}
1516

17+
#[\Override]
1618
protected function getType(): string
1719
{
1820
return 'Array<'.$this->getUnionType().'>';
@@ -44,11 +46,10 @@ private function getUnionType(): string
4446
return 'RoadizNodesSources';
4547
}
4648

47-
return implode(' | ', array_map(function (NodeTypeInterface $nodeType) {
48-
return $nodeType->getSourceEntityClassName();
49-
}, $nodeTypes));
49+
return implode(' | ', array_map(fn (NodeTypeInterface $nodeType) => $nodeType->getSourceEntityClassName(), $nodeTypes));
5050
}
5151

52+
#[\Override]
5253
protected function getIntroductionLines(): array
5354
{
5455
$lines = parent::getIntroductionLines();

src/Generators/NodeTypeGenerator.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,11 @@ protected function getIntroduction(): string
7777
$lines[] = 'Publishable: '.$this->generatorFactory->getHumanBool($this->nodeType->isPublishable());
7878
$lines[] = 'Visible: '.$this->generatorFactory->getHumanBool($this->nodeType->isVisible());
7979

80-
return implode(PHP_EOL, array_map(function (string $line) {
81-
return '// '.$line;
82-
}, $lines));
80+
return implode(PHP_EOL, array_map(fn (string $line) => '// '.$line, $lines));
8381
}
8482

8583
protected function getFieldsContents(): string
8684
{
87-
return implode(PHP_EOL, array_map(function (AbstractFieldGenerator $abstractFieldGenerator) {
88-
return $abstractFieldGenerator->getContents();
89-
}, $this->fieldGenerators));
85+
return implode(PHP_EOL, array_map(fn (AbstractFieldGenerator $abstractFieldGenerator) => $abstractFieldGenerator->getContents(), $this->fieldGenerators));
9086
}
9187
}

0 commit comments

Comments
 (0)