Skip to content

Commit 1529b88

Browse files
authored
Merge branch 'master' into 2.0
2 parents c5da4fd + f33c54a commit 1529b88

227 files changed

Lines changed: 8679 additions & 2681 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.

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ indent_size = 2
1414
[{package.json,.babelrc,.eslintrc,.stylelintrc}]
1515
indent_size = 2
1616

17-
[*.{css,js,ts}]
17+
[*.{css,js,ts,neon}]
1818
indent_style = tab
1919

2020
[Makefile]
@@ -24,4 +24,4 @@ indent_style = tab
2424
indent_style = tab
2525

2626
[*.md]
27-
trim_trailing_whitespace = false
27+
trim_trailing_whitespace = false

.github/workflows/qa.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: CI
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
coding-standard:
@@ -51,16 +51,11 @@ jobs:
5151
run: |
5252
composer install
5353
54-
- name: Run phpstan on Tests/
54+
- name: Run phpstan
5555
run: |
5656
bin/phpstan analyse \
57-
--autoload-file Build/BuildEssentials/PhpUnit/UnitTestBootstrap.php \
5857
--level 8 \
59-
Tests/Unit
60-
61-
- name: Run phpstan on Classes/
62-
run: |
63-
bin/phpstan analyse --level 8 Classes
58+
Tests/Unit Classes
6459
6560
unit-tests:
6661
runs-on: ubuntu-20.04

Classes/Command/ComponentCommandController.php

100755100644
Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,28 @@
88
use Neos\Flow\Annotations as Flow;
99
use Neos\Flow\Cli\CommandController;
1010
use PackageFactory\AtomicFusion\PresentationObjects\Domain\Component\ComponentGenerator;
11-
use PackageFactory\AtomicFusion\PresentationObjects\Domain\Value\ValueGenerator;
11+
use PackageFactory\AtomicFusion\PresentationObjects\Domain\Component\ComponentName;
12+
use PackageFactory\AtomicFusion\PresentationObjects\Domain\Enum\EnumGenerator;
13+
use PackageFactory\AtomicFusion\PresentationObjects\Domain\PackageKey;
14+
use PackageFactory\AtomicFusion\PresentationObjects\Domain\PackageResolver;
15+
use PackageFactory\AtomicFusion\PresentationObjects\Infrastructure\DefensiveConfirmationFileWriter;
1216

1317
/**
14-
* The command controller for kickstarting PresentationObject components
18+
* The command controller for kick-starting PresentationObject components
1519
*/
1620
class ComponentCommandController extends CommandController
1721
{
1822
/**
1923
* @Flow\Inject
20-
* @var ComponentGenerator
24+
* @var PackageResolver
2125
*/
22-
protected $componentGenerator;
26+
protected $packageResolver;
2327

2428
/**
25-
* @Flow\Inject
26-
* @var ValueGenerator
29+
* @Flow\InjectConfiguration(path="componentGeneration.colocate")
30+
* @var bool
2731
*/
28-
protected $valueGenerator;
32+
protected $colocate;
2933

3034
/**
3135
* Create a new PresentationObject component and factory
@@ -41,20 +45,35 @@ class ComponentCommandController extends CommandController
4145
* The following values are allowed for types:
4246
*
4347
* * string, int, float, bool
48+
* * slot
4449
* * Value class names created with <u>component:kickstartvalue</u> in the same
4550
* component namespace
4651
* * Component class names created with <u>component:kickstart</u> in the same
4752
* package
4853
* * ImageSource
4954
* * Uri
55+
* * array<...> with any of the above as an argument
5056
*
5157
* @param string $name The name of the new component
52-
* @param null|string $packageKey Package key of an optional target package, if not set the configured default package or the first available site package will be used
58+
* @param bool $listable If set, an additional list type will be generated
59+
* @param bool $yes If set, no confirmation is going to be required for overwriting files
5360
* @return void
61+
* @throws \Neos\Utility\Exception\FilesException
5462
*/
55-
public function kickStartCommand(string $name, ?string $packageKey = null): void
63+
public function kickStartCommand(string $name, bool $listable = false, bool $yes = false): void
5664
{
57-
$this->componentGenerator->generateComponent($name, $this->request->getExceedingArguments(), $packageKey);
65+
$componentGenerator = new ComponentGenerator(
66+
new DefensiveConfirmationFileWriter($this->output, $yes)
67+
);
68+
$package = $this->packageResolver->resolvePackage();
69+
70+
$componentGenerator->generateComponent(
71+
ComponentName::fromInput($name, PackageKey::fromPackage($package)),
72+
$this->request->getExceedingArguments(),
73+
$package->getPackagePath(),
74+
$this->colocate,
75+
$listable
76+
);
5877
}
5978

6079
/**
@@ -71,12 +90,25 @@ public function kickStartCommand(string $name, ?string $packageKey = null): void
7190
* @param string $componentName The name of the component the new pseudo-enum belongs to
7291
* @param string $name The name of the new pseudo-enum
7392
* @param string $type The type of the new pseudo-enum (must be one of: "string", "int")
74-
* @param array|string[] $values A comma-separated list of values for the new pseudo-enum
75-
* @param null|string $packageKey Package key of an optional target package, if not set the configured default package or the first available site package will be used
93+
* @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
94+
* @param bool $yes If set, no confirmation is going to be required for overwriting files
7695
* @return void
7796
*/
78-
public function kickStartValueCommand(string $componentName, string $name, string $type, array $values = [], ?string $packageKey = null): void
97+
public function kickStartEnumCommand(string $componentName, string $name, string $type, array $values = [], bool $yes = false): void
7998
{
80-
$this->valueGenerator->generateValue($componentName, $name, $type, $values, $packageKey);
99+
$enumGenerator = new EnumGenerator(
100+
new \DateTimeImmutable(),
101+
new DefensiveConfirmationFileWriter($this->output, $yes)
102+
);
103+
$package = $this->packageResolver->resolvePackage();
104+
105+
$enumGenerator->generateEnum(
106+
ComponentName::fromInput($componentName, PackageKey::fromPackage($package)),
107+
$name,
108+
$type,
109+
$values,
110+
$package->getPackagePath(),
111+
$this->colocate
112+
);
81113
}
82114
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php declare(strict_types=1);
2+
namespace PackageFactory\AtomicFusion\PresentationObjects\Domain;
3+
4+
/*
5+
* This file is part of the PackageFactory.AtomicFusion.PresentationObjects package
6+
*/
7+
8+
/**
9+
* The abstract class for immutable array objects
10+
* @template K of int|string
11+
* @template V
12+
* @extends \ArrayObject<K,V>
13+
*/
14+
abstract class AbstractImmutableArrayObject extends \ArrayObject
15+
{
16+
/**
17+
* @param K $key
18+
* @param V $value
19+
* @return void
20+
*/
21+
public function offsetSet($key, $value): void
22+
{
23+
throw new \BadMethodCallException(get_class() . ' are immutable.', 1616240304);
24+
}
25+
26+
/**
27+
* @param K $key
28+
* @return void
29+
*/
30+
public function offsetUnset($key): void
31+
{
32+
throw new \BadMethodCallException(get_class() . ' are immutable.', 1616240304);
33+
}
34+
35+
/**
36+
* @param V $value
37+
* @return void
38+
*/
39+
public function append($value): void
40+
{
41+
throw new \BadMethodCallException(get_class() . ' are immutable.', 1616240304);
42+
}
43+
44+
/**
45+
* @param array<K,V> $array
46+
* @return array<K,V>
47+
*/
48+
public function exchangeArray($array): array
49+
{
50+
throw new \BadMethodCallException(get_class() . ' are immutable.', 1616240304);
51+
}
52+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php declare(strict_types=1);
2+
namespace PackageFactory\AtomicFusion\PresentationObjects\Domain\Component;
3+
4+
/*
5+
* This file is part of the PackageFactory.AtomicFusion.PresentationObjects package
6+
*/
7+
8+
use PackageFactory\AtomicFusion\PresentationObjects\Domain\AbstractImmutableArrayObject;
9+
use PackageFactory\AtomicFusion\PresentationObjects\Fusion\ComponentPresentationObjectInterface;
10+
11+
/**
12+
* The abstract class for component array objects
13+
* @extends AbstractImmutableArrayObject<int,ComponentPresentationObjectInterface>
14+
*/
15+
abstract class AbstractComponentArray extends AbstractImmutableArrayObject
16+
{
17+
}

0 commit comments

Comments
 (0)