Skip to content

Commit

Permalink
[BUGFIX] Keep max property for other input types
Browse files Browse the repository at this point in the history
Resolves #3925
  • Loading branch information
simonschaufi committed Nov 23, 2023
1 parent 3e9263b commit 988df0f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ private function refactorColumn(DOMDocument $domDocument, ?DOMElement $configEle
return;
}

if (! StringUtility::inList($evalListValue, self::INT) && ! StringUtility::inList($evalListValue, self::DOUBLE2)) {
if (! StringUtility::inList($evalListValue, self::INT)
&& ! StringUtility::inList($evalListValue, self::DOUBLE2)
) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ protected function refactorColumn(Expr $columnName, Expr $columnTca): void
return;
}

if (! StringUtility::inList($evalListValue, self::INT) && ! StringUtility::inList($evalListValue, self::DOUBLE2)) {
if (! StringUtility::inList($evalListValue, self::INT)
&& ! StringUtility::inList($evalListValue, self::DOUBLE2)
) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Rector/v12/v0/tca/MigrateToEmailTypeRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ protected function refactorColumn(Expr $columnName, Expr $columnTca): void
return;
}

$this->removeArrayItemFromArrayByKey($configArray, 'max');

if (! $this->hasKey($configArray, 'eval')) {
return;
}
Expand All @@ -103,6 +101,8 @@ protected function refactorColumn(Expr $columnName, Expr $columnTca): void
return;
}

$this->removeArrayItemFromArrayByKey($configArray, 'max');

$evalList = ArrayUtility::trimExplode(',', $evalListValue, true);

// Remove "email" and "trim" from $evalList
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Ssch\TYPO3Rector\Tests\Rector\v12\v0\tca\MigrateToEmailTypeRector\Fixture;

return [
'ctrl' => [],
'columns' => [
'email_field' => [
'label' => 'Text',
'config' => [
'type' => 'input',
'eval' => 'trim',
'max' => 255,
],
],
],
];

?>
-----
<?php

namespace Ssch\TYPO3Rector\Tests\Rector\v12\v0\tca\MigrateToEmailTypeRector\Fixture;

return [
'ctrl' => [],
'columns' => [
'email_field' => [
'label' => 'Text',
'config' => [
'type' => 'input',
'eval' => 'trim',
'max' => 255,
],
],
],
];

?>

0 comments on commit 988df0f

Please sign in to comment.