Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Improve PHP doc comments #4147

Merged
merged 5 commits into from Mar 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/Rector/AbstractTcaRector.php
Expand Up @@ -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_) {
simonschaufi marked this conversation as resolved.
Show resolved Hide resolved
simonschaufi marked this conversation as resolved.
Show resolved Hide resolved
* return;
linawolf marked this conversation as resolved.
Show resolved Hide resolved
* }
* $this->removeArrayItemFromArrayByKey($appearanceArray, 'showRemovedLocalizationRecords');
* ```
*
* Attention: Strict comparizion is used for the key. key with int 42 will
linawolf marked this conversation as resolved.
Show resolved Hide resolved
* not remove string "42"!
*
* @param string|int $key
*/
protected function removeArrayItemFromArrayByKey(Array_ $array, $key): void
Expand Down