Closed weierophinney closed 7 years ago
I really don't like the fact that a string
may now possibly change meaning with a version upgrade.
This should be mentioned as BC Break
because of that.
Still, feature is awesome and worth pursuing.
This should be mentioned as BC Break because of that.
I'll update the class to accept a flag for enabling the behavior instead, and have that disabled by default; that way we can introduce the feature without requiring a major version bump.
Removed BC break flag, as I've made the key processing opt-in at this time.
There are already three optional constructor arguments; I can add it, but I think the method call also makes sense.
On Feb 17, 2017 12:10 PM, "Marco Pivetta" notifications@github.com wrote:
@Ocramius requested changes on this pull request.
In doc/book/processor.md https://github.com/zendframework/zend-config/pull/37#discussion_r101813442 :
@@ -107,6 +131,14 @@ echo $config->foo;
This example returns the output:
Value is TOKEN,Value is bar
.+As of version 3.1.0, you can also tell the
Constant
processor to process keys: + +```php +$processor->enableKeyProcessing();A constructor argument would be preferrable
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zendframework/zend-config/pull/37#pullrequestreview-22556617, or mute the thread https://github.com/notifications/unsubscribe-auth/AABlV9KiOQSMjijzwMQSm_XP951GLE78ks5rdeKhgaJpZM4MEdNe .
This patch updates the
Constant
processor to allow processing class constants, including the::class
pseudo-constant; additionally, it ensures that both theToken
andConstant
processors can apply toConfig
keys as well as the values by calling theirenableKeyProcessing()
methods.To allow this to work, I've changed the visibility of
Token::doProcess()
fromprivate
toprotected
, to allow overriding the method within theConstant
class. I've also added the new test caseZendTest\Config\Processor\Constant
to cover the behavior.Essentially, this allows the following to work (assuming the provided classes and constants exist):
Via: