Skip to content

Commit ae310e5

Browse files
author
Bernhard Schmitt
committed
WIP: Adjust to PHP8.2 and Neos 9
1 parent 508adb2 commit ae310e5

61 files changed

Lines changed: 341 additions & 598 deletions

File tree

Some content is hidden

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

Classes/Application/EnumProvider.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
namespace PackageFactory\AtomicFusion\PresentationObjects\Application;
1010

11-
use Neos\ContentRepository\Domain\Model\NodeInterface;
12-
use Neos\ContentRepository\Domain\Model\NodeType;
13-
use Neos\ContentRepository\NodeTypePostprocessor\NodeTypePostprocessorInterface;
11+
use Neos\ContentRepository\Core\NodeType\NodeType;
12+
use Neos\ContentRepository\Core\NodeType\NodeTypePostprocessorInterface;
13+
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
1414
use Neos\Flow\Annotations as Flow;
1515
use Neos\Flow\I18n\Translator;
1616
use Neos\Neos\Service\DataSource\AbstractDataSource;
@@ -20,23 +20,19 @@
2020

2121
final class EnumProvider extends AbstractDataSource implements ProtectedContextAwareInterface, NodeTypePostprocessorInterface
2222
{
23-
/**
24-
* @Flow\Inject(lazy=false)
25-
* @var Translator
26-
*/
27-
protected $translator;
23+
#[Flow\Inject]
24+
protected Translator $translator;
2825

2926
/**
3027
* @var string
3128
*/
3229
protected static $identifier = 'packagefactory-atomicfusion-presentationobjects-enumcases';
3330

3431
/**
35-
* @param NodeInterface|null $node
3632
* @param array<string|int,string> $arguments
3733
* @return array<string|int,array<string,string>>
3834
*/
39-
public function getData(NodeInterface $node = null, array $arguments = []): array
35+
public function getData(Node $node = null, array $arguments = []): array
4036
{
4137
if (!array_key_exists('enumName', $arguments) || !is_string($arguments['enumName'])) {
4238
throw new \InvalidArgumentException('Argument "enumName" must be provided.', 1625297174);
@@ -55,11 +51,10 @@ public function getData(NodeInterface $node = null, array $arguments = []): arra
5551
}
5652

5753
/**
58-
* @param NodeType $nodeType
5954
* @param array<mixed> $configuration
6055
* @param array<mixed> $options
6156
*/
62-
public function process(NodeType $nodeType, array &$configuration, array $options)
57+
public function process(NodeType $nodeType, array &$configuration, array $options): void
6358
{
6459
if (!array_key_exists('enumName', $options) || !is_string($options['enumName'])) {
6560
throw new \InvalidArgumentException('Option "enumName" must be provided.', 1625298032);

Classes/Command/ComponentCommandController.php

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,19 @@
2323
*/
2424
class ComponentCommandController extends CommandController
2525
{
26-
/**
27-
* @Flow\Inject
28-
* @var PackageResolver
29-
*/
30-
protected $packageResolver;
26+
#[Flow\Inject]
27+
protected PackageResolver $packageResolver;
3128

32-
/**
33-
* @Flow\InjectConfiguration(path="componentGeneration.colocate")
34-
* @var bool
35-
*/
36-
protected $colocate;
29+
#[Flow\InjectConfiguration(path: 'componentGeneration.colocate')]
30+
protected bool $colocate;
3731

3832
#[Flow\Inject]
3933
protected FactoryRendererInterface $factoryRenderer;
4034

4135
/**
4236
* Create a new PresentationObject component and factory
4337
*
44-
* This command will create an <b>interface</b>, a <b>value object</b> and a
38+
* This command will create a <b>value object</b> and a
4539
* <b>factory</b> under in the chosen component namespace. It'll also register
4640
* the factory for later use in Fusion.
4741
*
@@ -64,7 +58,6 @@ class ComponentCommandController extends CommandController
6458
* @param string $name The name of the new component
6559
* @param bool $listable If set, an additional list type will be generated
6660
* @param bool $yes If set, no confirmation is going to be required for overwriting files
67-
* @return void
6861
* @throws \Neos\Utility\Exception\FilesException
6962
*/
7063
public function kickStartCommand(string $name, bool $listable = false, bool $yes = false): void
@@ -87,22 +80,16 @@ public function kickStartCommand(string $name, bool $listable = false, bool $yes
8780
}
8881

8982
/**
90-
* Create a new pseudo-enum value object
91-
*
92-
* This command will create a <b>value object</b> for a pseudo-enum under in the
93-
* chosen component namespace and under the provided name. It'll also create a
94-
* co-located <b>exception</b> class that will be used when validation for the
95-
* pseudo-enum fails.
83+
* Create a new enum
9684
*
97-
* Additionally, a <b>datasource</b> for use in SelectBoxEditors will be created
98-
* in the Application namespace of your chosen package.
85+
* This command will create an enum under in the
86+
* chosen component namespace and under the provided name.
9987
*
10088
* @param string $componentName The name of the component the new pseudo-enum belongs to
10189
* @param string $name The name of the new pseudo-enum
10290
* @param string $type The type of the new pseudo-enum (must be one of: "string", "int")
10391
* @param array|string[] $values A comma-separated colon list of names:values for the new pseudo-enum, e.g. a,b,c , a:1,b:2,c:3 or a:1.2,b:2.4,c:3.6
10492
* @param bool $yes If set, no confirmation is going to be required for overwriting files
105-
* @return void
10693
*/
10794
public function kickStartEnumCommand(string $componentName, string $name, string $type, array $values = [], bool $yes = false): void
10895
{

Classes/Domain/Component/Component.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
use Neos\Flow\Annotations as Flow;
1212

1313
#[Flow\Proxy(false)]
14-
final class Component
14+
final readonly class Component
1515
{
1616
public function __construct(
17-
public readonly ComponentName $name,
18-
public readonly Props $props
17+
public ComponentName $name,
18+
public Props $props
1919
) {
2020
}
2121

Classes/Domain/Component/ComponentGenerator.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,16 @@
1818
* The component generator domain service
1919
*/
2020
#[Flow\Proxy(false)]
21-
final class ComponentGenerator
21+
final readonly class ComponentGenerator
2222
{
2323
public function __construct(
24-
private readonly FileWriterInterface $fileWriter,
25-
private readonly FactoryRendererInterface $factoryRenderer
24+
private FileWriterInterface $fileWriter,
25+
private FactoryRendererInterface $factoryRenderer
2626
) {
2727
}
2828

2929
/**
30-
* @param ComponentName $componentName
3130
* @param array|string[] $serializedProps
32-
* @param string $packagePath
33-
* @param bool $colocate
34-
* @param bool $listable
35-
* @return void
3631
* @throws \Neos\Utility\Exception\FilesException
3732
*/
3833
public function generateComponent(
@@ -58,11 +53,6 @@ public function generateComponent(
5853
$this->registerFactory($packagePath, $componentName);
5954
}
6055

61-
/**
62-
* @param string $packagePath
63-
* @param ComponentName $componentName
64-
* @return void
65-
*/
6656
private function registerFactory(string $packagePath, ComponentName $componentName): void
6757
{
6858
$configurationPath = $packagePath . 'Configuration/';

Classes/Domain/Component/ComponentName.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
use PackageFactory\AtomicFusion\PresentationObjects\Domain\PackageKey;
1515

1616
#[Flow\Proxy(false)]
17-
final class ComponentName
17+
final readonly class ComponentName
1818
{
1919
public function __construct(
20-
public readonly PackageKey $packageKey,
21-
public readonly FusionNamespace $fusionNamespace,
22-
public readonly string $name
20+
public PackageKey $packageKey,
21+
public FusionNamespace $fusionNamespace,
22+
public string $name
2323
) {
2424
}
2525

Classes/Domain/Component/PluralName.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111
use Neos\Flow\Annotations as Flow;
1212

13-
/**
14-
* @Flow\Proxy(false)
15-
*/
13+
#[Flow\Proxy(false)]
1614
final class PluralName
1715
{
1816
public static function forName(string $name): string

Classes/Domain/Component/PropType/BoolPropType.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@
1010

1111
use Neos\Flow\Annotations as Flow;
1212

13-
/**
14-
* @Flow\Proxy(false)
15-
*/
16-
final class BoolPropType implements PropTypeInterface
13+
#[Flow\Proxy(false)]
14+
final readonly class BoolPropType implements PropTypeInterface
1715
{
18-
private bool $nullable;
19-
2016
public function __construct(
21-
bool $nullable
17+
private bool $nullable
2218
) {
23-
$this->nullable = $nullable;
2419
}
2520

2621
public function isNullable(): bool

Classes/Domain/Component/PropType/ComponentArrayPropType.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,12 @@
1212
use PackageFactory\AtomicFusion\PresentationObjects\Domain\Component\ComponentName;
1313
use PackageFactory\AtomicFusion\PresentationObjects\Domain\Component\PluralName;
1414

15-
/**
16-
* @Flow\Proxy(false)
17-
*/
18-
final class ComponentArrayPropType implements PropTypeInterface
15+
#[Flow\Proxy(false)]
16+
final readonly class ComponentArrayPropType implements PropTypeInterface
1917
{
20-
private ComponentName $componentName;
21-
2218
public function __construct(
23-
ComponentName $componentName
19+
private ComponentName $componentName
2420
) {
25-
$this->componentName = $componentName;
2621
}
2722

2823
public function isNullable(): bool

Classes/Domain/Component/PropType/ComponentPropType.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,13 @@
1212
use PackageFactory\AtomicFusion\PresentationObjects\Domain\Component\ComponentName;
1313
use PackageFactory\AtomicFusion\PresentationObjects\Domain\Component\Props;
1414

15-
/**
16-
* @Flow\Proxy(false)
17-
*/
18-
final class ComponentPropType implements PropTypeInterface
15+
#[Flow\Proxy(false)]
16+
final readonly class ComponentPropType implements PropTypeInterface
1917
{
20-
private ComponentName $componentName;
21-
22-
private bool $nullable;
23-
2418
public function __construct(
25-
ComponentName $componentName,
26-
bool $nullable
19+
private ComponentName $componentName,
20+
private bool $nullable
2721
) {
28-
$this->componentName = $componentName;
29-
$this->nullable = $nullable;
3022
}
3123

3224
public function isNullable(): bool

Classes/Domain/Component/PropType/EnumPropType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
use Neos\Flow\Annotations as Flow;
1212

1313
#[Flow\Proxy(false)]
14-
final class EnumPropType implements PropTypeInterface
14+
final readonly class EnumPropType implements PropTypeInterface
1515
{
1616
public function __construct(
1717
/** @var class-string<\BackedEnum> */
18-
public readonly string $className,
18+
public string $className,
1919
private bool $nullable
2020
) {
2121
}

0 commit comments

Comments
 (0)