Skip to content

Commit

Permalink
Ignore {} after ->
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien committed Jun 4, 2014
1 parent 968d435 commit 48e3729
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sbp/sbp.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ static public function isBlock(&$line, &$grouped, $iRead = 0)
$content = substr($content, 1);
$find = self::findLastBlock($content);
$pos = $find ?: 0;
return $find !== false && substr_count($content, '{', $pos) === 0;
return $find !== false && !preg_match('#(?<!->)\s*\{#U', substr($content, $pos));
}
return $find !== false && substr_count($line, '{', $pos) === 0;
return $find !== false && !preg_match('#(?<!->)\s*\{#U', substr($line, $pos));
}

static public function contentTab($match)
Expand Down Expand Up @@ -1057,19 +1057,19 @@ function ($value)
'#(?<![a-zA-Z0-9_\x7f-\xff\$])function(\s[^{]*);#'
=> 'function$1 {}',

'#(?<![a-zA-Z0-9_\x7f-\xff\$])('.self::IF_BLOKCS.')(?:[\t ]+(\S.*))?\s*\{#U'
'#(?<![a-zA-Z0-9_\x7f-\xff\$])('.self::IF_BLOKCS.')(?:[\t ]+(\S.*))?(?<!->)\s*\{#U'
=> '$1 ($2) {',

'#(?<![a-zA-Z0-9_\x7f-\xff\$])(function[\t ]+'.self::VALIDNAME.')(?:[\t ]+(array[\t ].+|_*[A-Z\$\&\\\\].+))?\s*\{#U'
'#(?<![a-zA-Z0-9_\x7f-\xff\$])(function[\t ]+'.self::VALIDNAME.')(?:[\t ]+(array[\t ].+|_*[A-Z\$\&\\\\].+))?(?<!->)\s*\{#U'
=> '$1 ($2) {',

'#(?<![a-zA-Z0-9_\x7f-\xff\$])function[\t ]+(array[\t ].+|_*[A-Z\$\&\\\\].+)?\s*\{#U'
'#(?<![a-zA-Z0-9_\x7f-\xff\$])function[\t ]+(array[\t ].+|_*[A-Z\$\&\\\\].+)?(?<!->)\s*\{#U'
=> 'function ($1) {',

'#(?<![a-zA-Z0-9_\x7f-\xff\$])function\s+use(?![a-zA-Z0-9_\x7f-\xff])#U'
=> 'function () use',

'#(?<![a-zA-Z0-9_\x7f-\xff\$])(function.*[^a-zA-Z0-9_\x7f-\xff\$])use[\t ]*((array[\t ].+|_*[A-Z\$\&\\\\].+)\{)#U'
'#(?<![a-zA-Z0-9_\x7f-\xff\$])(function.*[^a-zA-Z0-9_\x7f-\xff\$])use[\t ]*((array[\t ].+|_*[A-Z\$\&\\\\].+)(?<!->)[\t ]*\{)#U'
=> '$1 ) use ( $2',

'#\((\([^\(\)]+\))\)#'
Expand Down

0 comments on commit 48e3729

Please sign in to comment.