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

Allow configuration of additional replacements #97

Merged
merged 2 commits into from Jul 14, 2022

Conversation

weierophinney
Copy link
Member

Q A
Documentation yes
Bugfix yes
BC Break no
New Feature yes
RFC no
QA no

Description

This patch adds the ability to configure additional replacement mappings via configuration:

return [
    'laminas-zendframework-bridge' => [
        'replacements' => [
            // Never rewrite!
            'customZendFormBinder' => 'customZendFormBinder',
            'CustomZendFormBinder' => 'CustomZendFormBinder',
        ],
    ],
];

The laminas-zendframework-bridge configuration itself will never be rewritten.
Any replacements found in configuration passed to the processor, however, will be used to seed a Replacements instance, thus allowing additional rules.
In the example above, we're indicating that if those specific strings are found, they should NOT be rewritten.

Fixes #94

Per a suggestion in laminas#94, this patch modifies the `ConfigPostProcessor` such that it now examines the merged configuration passed to it for its own configuration, specifically for replacement rules.
These may be provided via the following configuration:

```php
return [
    'laminas-zendframework-bridge' => [
        'replacements' => [
            'to-replace' => 'replacement',
            // ...
        ],
    ],
];
```

This configuration itself will NEVER be rewritten.
However, the rules will now be used as additional replacements when running the processor.

Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
@weierophinney weierophinney added this to the 1.6.0 milestone Jul 14, 2022
@Ocramius Ocramius self-assigned this Jul 14, 2022
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Ocramius Ocramius merged commit d74d2da into laminas:1.6.x Jul 14, 2022
@Ocramius
Copy link
Member

Thanks @weierophinney

@weierophinney weierophinney deleted the feature/configure-replacements branch July 14, 2022 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants