Check values passed to PreprocessorChain::offsetSet().

This commit is contained in:
Daniele Alessandri
2011-04-05 12:37:11 +02:00
parent b5d748156e
commit 1ee7926673
@@ -47,6 +47,12 @@ class PreprocessorChain implements ICommandPreprocessorChain, \ArrayAccess {
}
public function offsetSet($index, $preprocessor) {
if (!$preprocessor instanceof ICommandPreprocessor) {
throw new \InvalidArgumentException(
'A preprocessor chain can hold only instances of classes implementing '.
'the Predis\Commands\Preprocessors\ICommandPreprocessor interface'
);
}
$this->_preprocessors[$index] = $preprocessor;
}