示例#1
0
     $fmt->enablePass('NormalizeLnAndLtrimLines');
     $fmt->enablePass('MergeParenCloseWithCurlyOpen');
     $fmt->enablePass('MergeCurlyCloseAndDoWhile');
     $fmt->enablePass('MergeDoubleArrowAndArray');
     $fmt->enablePass('ResizeSpaces');
     $fmt->enablePass('ReindentColonBlocks');
     $fmt->enablePass('AlignEquals');
     $fmt->enablePass('AlignDoubleArrow');
     $fmt->enablePass('ReindentAndAlignObjOps');
     $fmt->enablePass('Reindent');
     $fmt->enablePass('EliminateDuplicatedEmptyLines');
     $fmt->enablePass('PSR2AlignObjOp');
     $fmt->enablePass('LeftAlignComment');
     $fmt->enablePass('RTrim');
     $fmt->enablePass('ReindentSwitchBlocks');
     PsrDecorator::decorate($fmt);
 }
 $got = $fmt->formatCode($content);
 $expected = '';
 if (file_exists($caseOut)) {
     $expected = file_get_contents($caseOut);
 }
 if ($got != $expected) {
     $brokenTests[$caseOut] = $got;
     if (isset($opt['stop'])) {
         $bailOut = true;
         break;
     }
     echo '!';
 } else {
     echo '.';
示例#2
0
    $argv = extractFromArgv($argv, 'enable_auto_align');
}
if (isset($opts['psr'])) {
    PsrDecorator::decorate($fmt);
    $argv = extractFromArgv($argv, 'psr');
}
if (isset($opts['psr1'])) {
    PsrDecorator::PSR1($fmt);
    $argv = extractFromArgv($argv, 'psr1');
}
if (isset($opts['psr1-naming'])) {
    PsrDecorator::PSR1Naming($fmt);
    $argv = extractFromArgv($argv, 'psr1-naming');
}
if (isset($opts['psr2'])) {
    PsrDecorator::PSR2($fmt);
    $argv = extractFromArgv($argv, 'psr2');
}
if (isset($opts['indent_with_space'])) {
    $fmt->enablePass('PSR2IndentWithSpace', $opts['indent_with_space']);
    $argv = extractFromArgv($argv, 'indent_with_space');
}
if ((isset($opts['psr1']) || isset($opts['psr2']) || isset($opts['psr'])) && isset($opts['enable_auto_align'])) {
    $fmt->enablePass('PSR2AlignObjOp');
}
if (isset($opts['visibility_order'])) {
    $fmt->enablePass('PSR2ModifierVisibilityStaticOrder');
    $argv = extractFromArgv($argv, 'visibility_order');
}
if (isset($opts['passes'])) {
    $optPasses = array_map(function ($v) {