Skip to content

Commit

Permalink
Merge branch hotfix/v2.3.28
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Sep 24, 2024
1 parent b434711 commit 2e573f5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 30 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright © 2023 Ambroise Maupate
Copyright © 2024 Ambroise Maupate

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:

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"require": {
"php": ">=8.1",
"roadiz/nodetype-contracts": "~1.1.2",
"symfony/translation": "5.4.*",
"symfony/http-foundation": "5.4.*"
"symfony/translation": "6.4.*",
"symfony/http-foundation": "6.4.*"
},
"license": "MIT",
"authors": [
Expand All @@ -28,8 +28,8 @@
},
"extra": {
"branch-alias": {
"dev-main": "2.2.x-dev",
"dev-develop": "2.3.x-dev"
"dev-main": "2.3.x-dev",
"dev-develop": "2.4.x-dev"
}
}
}
7 changes: 4 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
parameters:
level: max
level: 7
paths:
- src
reportUnmatchedIgnoredErrors: false
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
32 changes: 10 additions & 22 deletions src/Generators/MarkdownGeneratorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,10 @@

final class MarkdownGeneratorFactory
{
private ParameterBag $nodeTypesBag;
private TranslatorInterface $translator;

/**
* @param ParameterBag $nodeTypesBag
* @param TranslatorInterface $translator
*/
public function __construct(ParameterBag $nodeTypesBag, TranslatorInterface $translator)
{
$this->nodeTypesBag = $nodeTypesBag;
$this->translator = $translator;
public function __construct(
private readonly ParameterBag $nodeTypesBag,
private readonly TranslatorInterface $translator
) {
}

public function getHumanBool(bool $bool): string
Expand Down Expand Up @@ -50,16 +43,11 @@ public function createForNodeType(NodeTypeInterface $nodeType): NodeTypeGenerato
*/
public function createForNodeTypeField(NodeTypeFieldInterface $field): AbstractFieldGenerator
{
switch (true) {
case $field->isNodes():
return new NodeReferencesFieldGenerator($this, $field, $this->nodeTypesBag, $this->translator);
case $field->isChildrenNodes():
return new ChildrenNodeFieldGenerator($this, $field, $this->nodeTypesBag, $this->translator);
case $field->isMultiple():
case $field->isEnum():
return new DefaultValuedFieldGenerator($this, $field, $this->nodeTypesBag, $this->translator);
default:
return new CommonFieldGenerator($this, $field, $this->nodeTypesBag, $this->translator);
}
return match (true) {
$field->isNodes() => new NodeReferencesFieldGenerator($this, $field, $this->nodeTypesBag, $this->translator),
$field->isChildrenNodes() => new ChildrenNodeFieldGenerator($this, $field, $this->nodeTypesBag, $this->translator),
$field->isMultiple(), $field->isEnum() => new DefaultValuedFieldGenerator($this, $field, $this->nodeTypesBag, $this->translator),
default => new CommonFieldGenerator($this, $field, $this->nodeTypesBag, $this->translator),
};
}
}

0 comments on commit 2e573f5

Please sign in to comment.