Skip to content

Instantly share code, notes, and snippets.

@michaelmano
Last active March 9, 2021 04:25
Show Gist options
  • Save michaelmano/754aa7754c2868874c4769a627dbe064 to your computer and use it in GitHub Desktop.
Save michaelmano/754aa7754c2868874c4769a627dbe064 to your computer and use it in GitHub Desktop.
<?php
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules(array(
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'native_function_invocation' => true,
'native_constant_invocation' => true,
'native_function_casing' => true,
'native_function_type_declaration_casing' => true,
'new_with_braces' => true,
'no_alternative_syntax' => true,
'no_closing_tag' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'combine_consecutive_unsets' => true,
'mb_str_functions' => true,
'modernize_types_casting' => true,
'full_opening_tag' => true,
'linebreak_after_opening_tag' => true,
'mb_str_functions' => true,
'no_php4_constructor' => true,
'no_superfluous_phpdoc_tags' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_order' => true,
'semicolon_after_instruction' => true,
'strict_comparison' => true,
'strict_param' => true,
'strict_param' => true,
'ordered_class_elements' => true,
'phpdoc_add_missing_param_annotation' => true,
'@PSR2' => true,
'psr4' => true,
'heredoc_to_nowdoc' => true,
'no_unused_imports' => true,
'method_argument_space' => false,
'general_phpdoc_annotation_remove' => array('expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'),
))
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
->filter(function (\SplFileInfo $file) {
$filename = $file->getRelativePathname();
if (
'wp-config.php' === $filename ||
preg_match('/^src\//i', $filename) ||
preg_match('/^wp-content\/themes/i', $filename) ||
preg_match('/^wp-content\/src\//i', $filename) ||
preg_match('/^wp-content\/mu-plugins\/vivo/i', $filename)
) {
return true;
}
return false;
})
)
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment