Skip to content

Commit

Permalink
chore: Bumped
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Oct 11, 2024
1 parent 078de26 commit 766afc1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 19 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 © 2024 Ambroise Maupate
Copyright © 2023 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": "6.4.*",
"symfony/http-foundation": "6.4.*"
"symfony/translation": "5.4.*",
"symfony/http-foundation": "5.4.*"
},
"license": "MIT",
"authors": [
Expand All @@ -28,8 +28,8 @@
},
"extra": {
"branch-alias": {
"dev-main": "2.3.x-dev",
"dev-develop": "2.4.x-dev"
"dev-main": "2.2.x-dev",
"dev-develop": "2.3.x-dev"
}
}
}
7 changes: 3 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
parameters:
level: 7
level: max
paths:
- src
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false
32 changes: 22 additions & 10 deletions src/Generators/MarkdownGeneratorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,17 @@

final class MarkdownGeneratorFactory
{
public function __construct(
private readonly ParameterBag $nodeTypesBag,
private readonly TranslatorInterface $translator
) {
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 getHumanBool(bool $bool): string
Expand Down Expand Up @@ -43,11 +50,16 @@ public function createForNodeType(NodeTypeInterface $nodeType): NodeTypeGenerato
*/
public function createForNodeTypeField(NodeTypeFieldInterface $field): AbstractFieldGenerator
{
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),
};
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);
}
}
}

0 comments on commit 766afc1

Please sign in to comment.