zumba / swivel

Strategy driven, segmented feature toggles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP Warning when sending a non callable with array as behaviors

jrbasso opened this issue · comments

It is minor, but when you send a behavior which is an array and the one of the first 2 parameters is a non-string[able] value (ie, array) it gives a PHP Warning.

Here is the portion of the code that the warning happens:

if (!isset($strategy[0], $strategy[1]) || !method_exists($strategy[0], $strategy[1])) {

Code to test:

$this->forFeature('Abc')
    // ...
    ->defaultBehavior(['item1', ['item2.1', 'item2.2'], 'item3'])
    ->execute();

At the end it will raise an exception because it is not callable, but exceptions can be expected, but the warning should be avoided.

It's no longer applicable since the latest version is always receiving a callable instead of values.