chore: add missing values to the Config DTO

* Add `dockerfile.stages.*.extra_directories` as an optional list of
  strings.
* Allow `php.phpstan` and `php.phpcs` to be `false` or a Collection so
  their configuration files can not be generated.
* Add `php.phpunit` and allow it to be set to `false` so its
  configuration files can not be generated.
* Add `database.extra_databases`
* Add `php.phpstan.baseline` as an optional boolean.
* Add `node.version` as a string.
This commit is contained in:
Oliver Davies 2023-11-22 23:50:20 +00:00
parent 5627480a1a
commit 16ad71f4f4
2 changed files with 66 additions and 36 deletions

View file

@ -1,11 +1,18 @@
# Changelog
## Unreleased
## 2023-11-22
### Added
* Add CHANGELOG.md.
* Add missing validation rules to the `Configuration` DTO object.
* Add `dockerfile.stages.*.extra_directories` as an optional list of strings (used in the Drupal Commerce Kickstart example).
* Allow `php.phpstan` and `php.phpcs` to be `false` or a Collection so their configuration files can not be generated (used in the Drupal Commerce Kickstart example).
* Add `php.phpunit` and allow it to be set to `false` so its configuration files can not be generated (used in the Drupal Commerce Kickstart example).
* No further PHPUnit configuration is supported.
* Add `database.extra_databases`
* Add `php.phpstan.baseline` as an optional boolean.
* Add `node.version` as a string.
* Add a test to ensure the project type is a valid type.
* Add a test to ensure the web server is a valid type.
* Add a `test` task to `run` script.

View file

@ -13,6 +13,12 @@ final class Config
#[Assert\Collection(
allowExtraFields: false,
fields: [
'extra_databases' => new Assert\Optional([
new Assert\Type('array'),
new Assert\All([
new Assert\Type('string'),
]),
]),
'type' => new Assert\Required([
new Assert\Choice(choices: ['mariadb', 'mysql']),
new Assert\Type('string'),
@ -55,6 +61,12 @@ final class Config
new Assert\Type('string'),
]),
]),
'extra_directories' => new Assert\Optional([
new Assert\Type('array'),
new Assert\All([
new Assert\Type('string'),
]),
]),
'extends' => new Assert\Optional([
new Assert\Type('string'),
]),
@ -161,13 +173,8 @@ final class Config
#[Assert\Collection(
allowExtraFields: false,
fields: [
'type' => new Assert\Required([
new Assert\Type('array'),
new Assert\Collection([
'type' => new Assert\Required([
new Assert\Type('string'),
]),
]),
'version' => new Assert\Required([
new Assert\Type('string'),
]),
],
)]
@ -182,37 +189,53 @@ final class Config
new Assert\Type('string'),
]),
'phpcs' => new Assert\Optional([
new Assert\Collection([
'paths' => new Assert\Required([
new Assert\Type('array'),
new Assert\Count(['min' => 1]),
new Assert\All([
new Assert\Type('string'),
new Assert\AtLeastOneOf(
constraints: [
new Assert\IsFalse(),
new Assert\Collection([
'paths' => new Assert\Required([
new Assert\Type('array'),
new Assert\Count(['min' => 1]),
new Assert\All([
new Assert\Type('string'),
]),
]),
'standards' => new Assert\Required([
new Assert\Type('array'),
new Assert\Count(['min' => 1]),
new Assert\All([
new Assert\Type('string'),
]),
]),
]),
]),
'standards' => new Assert\Required([
new Assert\Type('array'),
new Assert\Count(['min' => 1]),
new Assert\All([
new Assert\Type('string'),
]),
]),
]),
]
),
]),
'phpstan' => new Assert\Optional([
new Assert\Collection([
'level' => new Assert\Required([
new Assert\Type(['string', 'integer']),
]),
'paths' => new Assert\Required([
new Assert\Type('array'),
new Assert\Count(['min' => 1]),
new Assert\All([
new Assert\Type('string'),
'phpstan' => new Assert\Optional(
new Assert\AtLeastOneOf(
constraints: [
new Assert\IsFalse(),
new Assert\Collection([
'baseline' => new Assert\Optional([
new Assert\Type('boolean'),
]),
'level' => new Assert\Required([
new Assert\Type(['string', 'integer']),
]),
'paths' => new Assert\Required([
new Assert\Type('array'),
new Assert\Count(['min' => 1]),
new Assert\All([
new Assert\Type('string'),
]),
]),
]),
]),
]),
]),
]
),
),
'phpunit' => new Assert\Optional(
new Assert\IsFalse(),
),
],
)]
public array $php;