getFixers() публичный Метод

Get fixers.
public getFixers ( ) : PhpCsFixer\Fixer\FixerInterface[]
Результат PhpCsFixer\Fixer\FixerInterface[]
Пример #1
0
 /**
  * @dataProvider provideAllRulesFromSets
  */
 public function testIfAllRulesInSetsExists($rule)
 {
     $factory = new FixerFactory();
     $factory->registerBuiltInFixers();
     $fixers = array();
     foreach ($factory->getFixers() as $fixer) {
         $fixers[$fixer->getName()] = $fixer;
     }
     $this->assertArrayHasKey($rule, $fixers);
 }
Пример #2
0
 public function getFixersPriorityCases()
 {
     $factory = new FixerFactory();
     $factory->registerBuiltInFixers();
     $fixers = array();
     foreach ($factory->getFixers() as $fixer) {
         $fixers[$fixer->getName()] = $fixer;
     }
     $cases = array(array($fixers['binary_operator_spaces'], $fixers['align_double_arrow']), array($fixers['binary_operator_spaces'], $fixers['align_equals']), array($fixers['class_definition'], $fixers['no_trailing_whitespace']), array($fixers['concat_without_spaces'], $fixers['concat_with_spaces']), array($fixers['double_arrow_no_multiline_whitespace'], $fixers['align_double_arrow']), array($fixers['double_arrow_no_multiline_whitespace'], $fixers['trailing_comma_in_multiline_array']), array($fixers['elseif'], $fixers['braces']), array($fixers['method_separation'], $fixers['braces']), array($fixers['method_separation'], $fixers['no_tab_indentation']), array($fixers['no_blank_lines_between_uses'], $fixers['ordered_imports']), array($fixers['no_duplicate_semicolons'], $fixers['braces']), array($fixers['no_duplicate_semicolons'], $fixers['no_multiline_whitespace_before_semicolons']), array($fixers['no_duplicate_semicolons'], $fixers['no_singleline_whitespace_before_semicolons']), array($fixers['no_duplicate_semicolons'], $fixers['switch_case_semicolon_to_colon']), array($fixers['no_leading_import_slash'], $fixers['ordered_imports']), array($fixers['no_short_bool_cast'], $fixers['spaces_cast']), array($fixers['no_short_echo_tag'], $fixers['echo_to_print']), array($fixers['no_tab_indentation'], $fixers['phpdoc_indent']), array($fixers['no_unneeded_control_parentheses'], $fixers['no_trailing_whitespace']), array($fixers['no_unused_imports'], $fixers['blank_line_after_namespace']), array($fixers['no_unused_imports'], $fixers['no_extra_consecutive_blank_lines']), array($fixers['no_unused_imports'], $fixers['no_leading_import_slash']), array($fixers['php_unit_strict'], $fixers['php_unit_construct']), array($fixers['phpdoc_no_access'], $fixers['phpdoc_order']), array($fixers['phpdoc_no_access'], $fixers['phpdoc_separation']), array($fixers['phpdoc_no_access'], $fixers['phpdoc_trim']), array($fixers['phpdoc_no_empty_return'], $fixers['phpdoc_order']), array($fixers['phpdoc_no_empty_return'], $fixers['phpdoc_separation']), array($fixers['phpdoc_no_empty_return'], $fixers['phpdoc_trim']), array($fixers['phpdoc_no_package'], $fixers['phpdoc_order']), array($fixers['phpdoc_no_package'], $fixers['phpdoc_separation']), array($fixers['phpdoc_no_package'], $fixers['phpdoc_trim']), array($fixers['phpdoc_order'], $fixers['phpdoc_separation']), array($fixers['phpdoc_order'], $fixers['phpdoc_trim']), array($fixers['phpdoc_separation'], $fixers['phpdoc_trim']), array($fixers['phpdoc_summary'], $fixers['phpdoc_trim']), array($fixers['phpdoc_var_without_name'], $fixers['phpdoc_trim']), array($fixers['single_import_per_statement'], $fixers['no_leading_import_slash']), array($fixers['single_import_per_statement'], $fixers['no_unused_imports']), array($fixers['unary_operator_spaces'], $fixers['not_operator_with_space']), array($fixers['unary_operator_spaces'], $fixers['not_operator_with_successor_space']), array($fixers['unix_line_endings'], $fixers['single_blank_line_at_eof']), array($fixers['simplified_null_return'], $fixers['no_useless_return']), array($fixers['no_duplicate_semicolons'], $fixers['no_useless_return']), array($fixers['no_useless_return'], $fixers['no_whitespace_in_blank_lines']), array($fixers['no_useless_return'], $fixers['no_extra_consecutive_blank_lines']), array($fixers['no_useless_return'], $fixers['blank_line_before_return']));
     // prepare bulk tests for phpdoc fixers to test that:
     // * `phpdoc_to_comment` is first
     // * `phpdoc_indent` is second
     // * `phpdoc_types` is third
     // * `phpdoc_scalar` is fourth
     // * `phpdoc_align` is last
     $cases[] = array($fixers['phpdoc_to_comment'], $fixers['phpdoc_indent']);
     $cases[] = array($fixers['phpdoc_indent'], $fixers['phpdoc_types']);
     $cases[] = array($fixers['phpdoc_types'], $fixers['phpdoc_scalar']);
     $docFixerNames = array_filter(array_keys($fixers), function ($name) {
         return false !== strpos($name, 'phpdoc');
     });
     foreach ($docFixerNames as $docFixerName) {
         if (!in_array($docFixerName, array('phpdoc_to_comment', 'phpdoc_indent', 'phpdoc_types', 'phpdoc_scalar'), true)) {
             $cases[] = array($fixers['phpdoc_to_comment'], $fixers[$docFixerName]);
             $cases[] = array($fixers['phpdoc_indent'], $fixers[$docFixerName]);
             $cases[] = array($fixers['phpdoc_types'], $fixers[$docFixerName]);
             $cases[] = array($fixers['phpdoc_scalar'], $fixers[$docFixerName]);
         }
         if ('phpdoc_align' !== $docFixerName) {
             $cases[] = array($fixers[$docFixerName], $fixers['phpdoc_align']);
         }
     }
     return $cases;
 }