Skip to content

Commit

Permalink
Fixed undefined index in ArrayDeclarationSniff
Browse files Browse the repository at this point in the history
  • Loading branch information
lolautruche committed Jan 26, 2015
1 parent b592de6 commit b51965b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion php/ezcs/Sniffs/Arrays/ArrayDeclarationSniff.php
Expand Up @@ -173,7 +173,10 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$stackPtrCount = count($tokens[$stackPtr]['nested_parenthesis']);
}

if (count($tokens[$nextToken]['nested_parenthesis']) > ($stackPtrCount + 1)) {
if (
isset($tokens[$nextToken]['nested_parenthesis'])
&& (count($tokens[$nextToken]['nested_parenthesis']) > ($stackPtrCount + 1))
) {
// This comma is inside more parenthesis than the ARRAY keyword,
// then there it is actually a comma used to seperate arguments
// in a function call.
Expand Down

0 comments on commit b51965b

Please sign in to comment.