Skip to content

Commit

Permalink
TASK: Remove obsolete special handling for DateTimeInterface
Browse files Browse the repository at this point in the history
With #4251 `NodeType::getDefaultValuesForProperties` doesnt return a `DateTime` anymore for dateTime default values
  • Loading branch information
mhsdesign committed Mar 1, 2024
1 parent 26ce195 commit 41bc886
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ public static function defaultFromNodeType(NodeType $nodeType, PropertyConverter
{
$values = [];
foreach ($nodeType->getDefaultValuesForProperties() as $propertyName => $defaultValue) {
if ($defaultValue instanceof \DateTimeInterface) {
$defaultValue = json_encode($defaultValue);
}

$propertyType = PropertyType::fromNodeTypeDeclaration(
$nodeType->getPropertyType($propertyName),
PropertyName::fromString($propertyName),
Expand Down
2 changes: 1 addition & 1 deletion Neos.ContentRepository.Core/Classes/NodeType/NodeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public function getPropertyType(string $propertyName): string
*
* The default value is configured for each property under the "default" key.
*
* @return array<string,mixed>
* @return array<string,int|float|string|bool|array<int|string,mixed>>
* @api
*/
public function getDefaultValuesForProperties(): array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ public function findAdjustmentsForNodeType(NodeTypeName $nodeTypeName): \Generat

// detect missing default values
foreach ($nodeType->getDefaultValuesForProperties() as $propertyKey => $defaultValue) {
if ($defaultValue instanceof \DateTimeInterface) {
$defaultValue = json_encode($defaultValue);
}
if ($defaultValue === null) {
// we don't need to set null as default value if it doesn't exist
continue;
}
if (!array_key_exists($propertyKey, $propertyKeysInNode)) {
yield StructureAdjustment::createForNode(
$node,
Expand Down

0 comments on commit 41bc886

Please sign in to comment.