From 469d512d32eb9fba77f62f7791466bbdb7988be3 Mon Sep 17 00:00:00 2001 From: Thijs De Paepe Date: Wed, 18 Oct 2023 15:55:03 +0200 Subject: [PATCH] ModifierAction cleanup --- src/Component/Action/ModifierAction.php | 4 ++-- tests/Component/Action/ModifierActionTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Component/Action/ModifierAction.php b/src/Component/Action/ModifierAction.php index 0ab8e86f..2a07c79a 100644 --- a/src/Component/Action/ModifierAction.php +++ b/src/Component/Action/ModifierAction.php @@ -26,7 +26,7 @@ class ModifierAction implements OptionsInterface /** @var array */ private $options = [ 'modifier' => null, - 'format' => null, + 'formatter' => null, 'keys' => null, ]; @@ -55,7 +55,7 @@ public function apply($item) } $item[$key] = $modifier->modify($listItem); } - if (null !== $listItem && $this->options['format'] && $formatter = $this->getFormatter($this->options['format'])) { + if (null !== $listItem && $this->options['formatter'] && $formatter = $this->getFormatter($this->options['formatter'])) { if (is_array($listItem)) { $item[$key] = array_map(function ($itemValue) use ($formatter) { return is_string($itemValue) ? $formatter->format($itemValue) : $formatter->reverseFormat($itemValue); diff --git a/tests/Component/Action/ModifierActionTest.php b/tests/Component/Action/ModifierActionTest.php index 5c6d67b2..612b47b0 100644 --- a/tests/Component/Action/ModifierActionTest.php +++ b/tests/Component/Action/ModifierActionTest.php @@ -162,7 +162,7 @@ public function test_it_should_format_a_boolean_action(): void $action->setOptions( [ - 'format' => 'boolean', + 'formatter' => 'boolean', 'keys' => 'active', 'true' => 'TRUE', 'false' => 'FALSE',