Skip to content

Commit

Permalink
BugFix: Fixed block::offsetSet where passing null as $offset raised a…
Browse files Browse the repository at this point in the history
…n exception
  • Loading branch information
tivie committed Dec 9, 2014
1 parent c3d62d6 commit 4856cd6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Token/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,16 @@ public function offsetGet($offset)
* @link http://php.net/manual/en/arrayaccess.offsetset.php
* @param mixed $offset The offset to assign the argument to.
* @param mixed $argument The argument to set.
* @return void
* @throws InvalidArgumentException
*/
public function offsetSet($offset, $argument)
{
if (!is_scalar($offset)) {
throw new \InvalidArgumentException("Offset must be a scalar");
if (!is_null($offset) && !is_scalar($offset)) {
throw new InvalidArgumentException('scalar', 0);
}

if (!$argument instanceof TokenInterface) {
throw new \InvalidArgumentException("Argument must be of type TokenInterface");
throw new InvalidArgumentException('TokenInterface', 1);
}

if (!in_array($argument, $this->children)) {
Expand Down

0 comments on commit 4856cd6

Please sign in to comment.