Skip to content

Commit fe9fbff

Browse files
author
roadiz-ci
committed
chore: Bumped
1 parent d9f32fa commit fe9fbff

11 files changed

Lines changed: 42 additions & 83 deletions

.github/workflows/run-test.yml

Lines changed: 1 addition & 3 deletions
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.1', '8.2', '8.3']
23+
php-version: ['8.2', '8.3']
2424
steps:
2525
- uses: shivammathur/setup-php@v2
2626
with:
@@ -36,7 +36,5 @@ jobs:
3636
${{ runner.os }}-php-${{ matrix.php-version }}-
3737
- name: Install Dependencies
3838
run: composer install --no-scripts --no-ansi --no-interaction --no-progress
39-
- name: Run PHP Code Sniffer
40-
run: vendor/bin/phpcs -p ./src
4139
- name: Run PHPStan
4240
run: vendor/bin/phpstan analyse --no-progress -c phpstan.neon

Makefile

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

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"require-dev": {
1010
"phpstan/phpstan": "^1.5.3",
11-
"squizlabs/php_codesniffer": "^3.5"
11+
"phpstan/phpdoc-parser": "<2"
1212
},
1313
"license": "MIT",
1414
"authors": [
@@ -26,8 +26,8 @@
2626
},
2727
"extra": {
2828
"branch-alias": {
29-
"dev-master": "2.3.x-dev",
30-
"dev-develop": "2.4.x-dev"
29+
"dev-master": "2.4.x-dev",
30+
"dev-develop": "2.5.x-dev"
3131
}
3232
}
3333
}

phpcs.xml.dist

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

src/DeclarationGeneratorFactory.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@
1515
use RZ\Roadiz\Typescript\Declaration\Generators\ScalarFieldGenerator;
1616
use Symfony\Component\HttpFoundation\ParameterBag;
1717

18-
final class DeclarationGeneratorFactory
18+
final readonly class DeclarationGeneratorFactory
1919
{
20-
public function __construct(private readonly ParameterBag $nodeTypesBag)
20+
public function __construct(private ParameterBag $nodeTypesBag)
2121
{
2222
}
2323

24-
/**
25-
* @return ParameterBag
26-
*/
2724
public function getNodeTypesBag(): ParameterBag
2825
{
2926
return $this->nodeTypesBag;
@@ -34,11 +31,6 @@ public function getHumanBool(bool $bool): string
3431
return $bool ? 'true' : 'false';
3532
}
3633

37-
/**
38-
* @param NodeTypeInterface $nodeType
39-
*
40-
* @return NodeTypeGenerator
41-
*/
4234
public function createForNodeType(NodeTypeInterface $nodeType): NodeTypeGenerator
4335
{
4436
return new NodeTypeGenerator(
@@ -47,11 +39,6 @@ public function createForNodeType(NodeTypeInterface $nodeType): NodeTypeGenerato
4739
);
4840
}
4941

50-
/**
51-
* @param NodeTypeFieldInterface $field
52-
*
53-
* @return AbstractFieldGenerator
54-
*/
5542
public function createForNodeTypeField(NodeTypeFieldInterface $field): AbstractFieldGenerator
5643
{
5744
return match (true) {

src/Generators/AbstractFieldGenerator.php

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,10 @@ abstract class AbstractFieldGenerator
1212
// Four spaces
1313
public const INDENTATION_MARK = ' ';
1414

15-
protected NodeTypeFieldInterface $field;
16-
protected ParameterBag $nodeTypesBag;
17-
18-
/**
19-
* @param NodeTypeFieldInterface $field
20-
* @param ParameterBag $nodeTypesBag
21-
*/
2215
public function __construct(
23-
NodeTypeFieldInterface $field,
24-
ParameterBag $nodeTypesBag
16+
protected readonly NodeTypeFieldInterface $field,
17+
protected readonly ParameterBag $nodeTypesBag,
2518
) {
26-
$this->field = $field;
27-
$this->nodeTypesBag = $nodeTypesBag;
2819
}
2920

3021
protected function getNullableAssertion(): string
@@ -36,18 +27,18 @@ abstract protected function getType(): string;
3627

3728
private function getDeclaration(): string
3829
{
39-
return static::INDENTATION_MARK .
40-
$this->field->getVarName() .
41-
$this->getNullableAssertion() . ': ' .
30+
return static::INDENTATION_MARK.
31+
$this->field->getVarName().
32+
$this->getNullableAssertion().': '.
4233
$this->getType();
4334
}
4435

4536
public function getContents(): string
4637
{
4738
return implode(PHP_EOL, [
48-
$this->getIntroduction(),
49-
$this->getDeclaration()
50-
]);
39+
$this->getIntroduction(),
40+
$this->getDeclaration(),
41+
]);
5142
}
5243

5344
protected function getIntroductionLines(): array
@@ -60,19 +51,16 @@ protected function getIntroductionLines(): array
6051
}
6152

6253
if (!empty($this->field->getGroupName())) {
63-
$lines[] = 'Group: ' . $this->field->getGroupName();
54+
$lines[] = 'Group: '.$this->field->getGroupName();
6455
}
6556

6657
return $lines;
6758
}
6859

69-
/**
70-
* @return string
71-
*/
7260
public function getIntroduction(): string
7361
{
7462
return implode(PHP_EOL, array_map(function (string $line) {
75-
return static::INDENTATION_MARK . '// ' . $line;
63+
return static::INDENTATION_MARK.'// '.$line;
7664
}, $this->getIntroductionLines()));
7765
}
7866
}

src/Generators/ChildrenNodeFieldGenerator.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ public function getContents(): string
1212
$this->getIntroduction(),
1313
]);
1414
}
15+
1516
protected function getIntroductionLines(): array
1617
{
1718
$lines = [
18-
'This node-type uses "blocks" which are available through parent RoadizNodesSources.blocks'
19+
'This node-type uses "blocks" which are available through parent RoadizNodesSources.blocks',
1920
];
2021
if (!empty($this->field->getDefaultValues())) {
21-
$lines[] = 'Possible block node-types: ' . $this->field->getDefaultValues();
22+
$lines[] = 'Possible block node-types: '.$this->field->getDefaultValues();
2223
}
24+
2325
return $lines;
2426
}
2527

src/Generators/DeclarationGenerator.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ final class DeclarationGenerator
1515
private array $nodeTypes;
1616

1717
/**
18-
* @param DeclarationGeneratorFactory $generatorFactory
1918
* @param NodeTypeInterface[] $nodeTypes
2019
*/
2120
public function __construct(
2221
private readonly DeclarationGeneratorFactory $generatorFactory,
23-
array $nodeTypes = []
22+
array $nodeTypes = [],
2423
) {
2524
if (empty($nodeTypes)) {
2625
$this->nodeTypes = array_unique($this->generatorFactory->getNodeTypesBag()->all());
@@ -41,7 +40,7 @@ public function getContents(): string
4140

4241
$blocks[] = $this->getAllTypesInterface();
4342

44-
return implode(PHP_EOL . PHP_EOL, $blocks);
43+
return implode(PHP_EOL.PHP_EOL, $blocks);
4544
}
4645

4746
private function getAllTypesInterface(): string

src/Generators/EnumFieldGenerator.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ protected function getType(): string
1919
);
2020
if (count($defaultValues) > 0) {
2121
$defaultValues = array_map(function (string $value) {
22-
return '\'' . $value . '\'';
22+
return '\''.$value.'\'';
2323
}, $defaultValues);
24-
return implode(' | ', $defaultValues) . ' | null';
24+
25+
return implode(' | ', $defaultValues).' | null';
2526
}
2627
}
28+
2729
return 'string';
2830
case $this->field->isMultiple():
2931
return 'Array<string>';
@@ -36,8 +38,9 @@ protected function getIntroductionLines(): array
3638
{
3739
$lines = parent::getIntroductionLines();
3840
if (!empty($this->field->getDefaultValues())) {
39-
$lines[] = 'Possible values: ' . $this->field->getDefaultValues();
41+
$lines[] = 'Possible values: '.$this->field->getDefaultValues();
4042
}
43+
4144
return $lines;
4245
}
4346
}

src/Generators/NodeReferencesFieldGenerator.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protected function getNullableAssertion(): string
1515

1616
protected function getType(): string
1717
{
18-
return 'Array<' . $this->getUnionType() . '>';
18+
return 'Array<'.$this->getUnionType().'>';
1919
}
2020

2121
/**
@@ -27,8 +27,10 @@ private function getLinkedNodeTypes(): array
2727
return [];
2828
}
2929
$nodeTypeNames = explode(',', $this->field->getDefaultValues());
30+
3031
return array_values(array_filter(array_map(function (string $name) {
3132
$nodeType = $this->nodeTypesBag->get(trim($name));
33+
3234
return $nodeType instanceof NodeTypeInterface ? $nodeType : null;
3335
}, $nodeTypeNames)));
3436
}
@@ -50,8 +52,9 @@ protected function getIntroductionLines(): array
5052
{
5153
$lines = parent::getIntroductionLines();
5254
if (!empty($this->field->getDefaultValues())) {
53-
$lines[] = 'Possible values: ' . $this->field->getDefaultValues();
55+
$lines[] = 'Possible values: '.$this->field->getDefaultValues();
5456
}
57+
5558
return $lines;
5659
}
5760
}

0 commit comments

Comments
 (0)