disallowParamsAnywhere isn't supported
First off, I love the flexibility that this library has. It's been quite beneficial for getting rid of specific uses of code in our systems.
There may be another way to do this, but from reading the documentation, I can't seem to figure out a way; I want to disallow all calls to Object->method but only if the parameter is 'my-test-string'. method however can take a string, an array of values, or a destructured array of values. So I want disallowParamsAnywhere, specifically for the destructured array case.
disallowParams is a partial workaround, and will allow us to catch the obvious cases, but having support for catching them anywhere would be awesome!
Hi, I'm happy to hear this little thing helps! :-)
Do you mean that you'd like to detect and disallow a call that looks like these:
$object->method('my-test-string');
$object->method([123, 'foo', 'my-test-string']);
$object->method([4 => 56, 'foo' => new SomeClass, 'my-test-string']);
... but these would be fine:
$object->method('something');
$object->method([123, 'foo', 'bat']);
$object->method([4 => 56, 'foo' => new SomeClass, 'waldo']);
You're spot on! I'm sure the array piece makes it more difficult, of course :D