From 9e4dc30cd9a53ba04ee72afaa05c0d4671939cc4 Mon Sep 17 00:00:00 2001 From: "lina.wolf" Date: Thu, 7 Mar 2024 13:22:50 +0100 Subject: [PATCH 1/5] [DOCS] Improve PHP doc comments * AbstractTcaRector::removeArrayItemFromArrayByKey --- src/Rector/AbstractTcaRector.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Rector/AbstractTcaRector.php b/src/Rector/AbstractTcaRector.php index 161703d9c..0e6d88f28 100644 --- a/src/Rector/AbstractTcaRector.php +++ b/src/Rector/AbstractTcaRector.php @@ -337,6 +337,26 @@ protected function hasKeyValuePair(Array_ $configValueArray, string $configKey, } /** + * Removes an array key directly from the first level of an array. + * + * ``` + * $this->removeArrayItemFromArrayByKey($configArray, 'myKeyToBeRemoved'); + * ``` + * + * If the key to be removed is in a sub array of the current one + * use `extractSubArrayByKey` to extract the sub array first: + * + * ``` + * $appearanceArray = $this->extractSubArrayByKey($configArray, 'appearance'); + * if (! $appearanceArray instanceof Array_) { + * return; + * } + * $this->removeArrayItemFromArrayByKey($appearanceArray, 'showRemovedLocalizationRecords'); + * ``` + * + * Attention: Strict comparizion is used for the key. key with int 42 will + * not remove string "42"! + * * @param string|int $key */ protected function removeArrayItemFromArrayByKey(Array_ $array, $key): void From a6d2eec16621b55f064ef6a6f6334b17af1a2a88 Mon Sep 17 00:00:00 2001 From: Lina Wolf <48202465+linawolf@users.noreply.github.com> Date: Thu, 7 Mar 2024 14:23:31 +0100 Subject: [PATCH 2/5] Update src/Rector/AbstractTcaRector.php Co-authored-by: Sebastian Schreiber --- src/Rector/AbstractTcaRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Rector/AbstractTcaRector.php b/src/Rector/AbstractTcaRector.php index 0e6d88f28..b8b8fbcf7 100644 --- a/src/Rector/AbstractTcaRector.php +++ b/src/Rector/AbstractTcaRector.php @@ -354,7 +354,7 @@ protected function hasKeyValuePair(Array_ $configValueArray, string $configKey, * $this->removeArrayItemFromArrayByKey($appearanceArray, 'showRemovedLocalizationRecords'); * ``` * - * Attention: Strict comparizion is used for the key. key with int 42 will + * Attention: Strict comparison is used for the key. key with int 42 will * not remove string "42"! * * @param string|int $key From 428f9afef659f083db7dfe7b64ab85ac65a5a786 Mon Sep 17 00:00:00 2001 From: Lina Wolf <48202465+linawolf@users.noreply.github.com> Date: Thu, 7 Mar 2024 14:24:20 +0100 Subject: [PATCH 3/5] Update src/Rector/AbstractTcaRector.php --- src/Rector/AbstractTcaRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Rector/AbstractTcaRector.php b/src/Rector/AbstractTcaRector.php index b8b8fbcf7..84a1e0a43 100644 --- a/src/Rector/AbstractTcaRector.php +++ b/src/Rector/AbstractTcaRector.php @@ -349,7 +349,7 @@ protected function hasKeyValuePair(Array_ $configValueArray, string $configKey, * ``` * $appearanceArray = $this->extractSubArrayByKey($configArray, 'appearance'); * if (! $appearanceArray instanceof Array_) { - * return; + * return; * } * $this->removeArrayItemFromArrayByKey($appearanceArray, 'showRemovedLocalizationRecords'); * ``` From 9c061459894b2bd4c0bd897fbda06dc7e0b9d643 Mon Sep 17 00:00:00 2001 From: Simon Schaufelberger Date: Fri, 8 Mar 2024 11:08:08 +0100 Subject: [PATCH 4/5] Update src/Rector/AbstractTcaRector.php --- src/Rector/AbstractTcaRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Rector/AbstractTcaRector.php b/src/Rector/AbstractTcaRector.php index 84a1e0a43..dc8f0594f 100644 --- a/src/Rector/AbstractTcaRector.php +++ b/src/Rector/AbstractTcaRector.php @@ -348,7 +348,7 @@ protected function hasKeyValuePair(Array_ $configValueArray, string $configKey, * * ``` * $appearanceArray = $this->extractSubArrayByKey($configArray, 'appearance'); - * if (! $appearanceArray instanceof Array_) { + * if (! $appearanceArray instanceof Array_) { * return; * } * $this->removeArrayItemFromArrayByKey($appearanceArray, 'showRemovedLocalizationRecords'); From 65bb6b73be2f0d359f111a196ece486f32f9c6a9 Mon Sep 17 00:00:00 2001 From: Simon Schaufelberger Date: Fri, 8 Mar 2024 11:08:38 +0100 Subject: [PATCH 5/5] Update src/Rector/AbstractTcaRector.php --- src/Rector/AbstractTcaRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Rector/AbstractTcaRector.php b/src/Rector/AbstractTcaRector.php index dc8f0594f..fe1ff5c9f 100644 --- a/src/Rector/AbstractTcaRector.php +++ b/src/Rector/AbstractTcaRector.php @@ -349,7 +349,7 @@ protected function hasKeyValuePair(Array_ $configValueArray, string $configKey, * ``` * $appearanceArray = $this->extractSubArrayByKey($configArray, 'appearance'); * if (! $appearanceArray instanceof Array_) { - * return; + * return; * } * $this->removeArrayItemFromArrayByKey($appearanceArray, 'showRemovedLocalizationRecords'); * ```