Skip to content

Commit

Permalink
Merge pull request #323 from ergebnis/feature/faker
Browse files Browse the repository at this point in the history
Enhancement: Add rule set for fakerphp/faker
  • Loading branch information
ergebnis-bot committed Dec 27, 2020
2 parents 6f40fd9 + 59c618f commit acaa4a8
Show file tree
Hide file tree
Showing 4 changed files with 417 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

For a full diff see [`2.10.0...main`][2.10.0...main].

### Added

* Added `Ergebnis\PhpCsFixer\Config\RuleSet\Faker`, a rule set for `fakerphp/faker` ([#323]), by [@localheinz]

## [`2.10.0`][2.10.0]

For a full diff see [`2.9.0...2.10.0`][2.9.0...2.10.0].
Expand Down Expand Up @@ -321,6 +325,7 @@ For a full diff see [`d899e77...1.0.0`][d899e77...1.0.0].
[#319]: https://github.com/ergebnis/php-cs-fixer-config/pull/319
[#320]: https://github.com/ergebnis/php-cs-fixer-config/pull/320
[#321]: https://github.com/ergebnis/php-cs-fixer-config/pull/321
[#323]: https://github.com/ergebnis/php-cs-fixer-config/pull/323

[@dependabot]: https://github.com/apps/dependabot
[@linuxjuggler]: https://github.com/linuxjuggler
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ $ composer require --dev ergebnis/php-cs-fixer-config

Pick one of the rule sets:

* [`Ergebnis\PhpCsFixer\RuleSet\Faker`](src/RuleSet/Faker.php)
* [`Ergebnis\PhpCsFixer\RuleSet\Laravel6`](src/RuleSet/Laravel6.php)
* [`Ergebnis\PhpCsFixer\RuleSet\Php71`](src/RuleSet/Php74.php)
* [`Ergebnis\PhpCsFixer\RuleSet\Php73`](src/RuleSet/Php73.php)
Expand Down
204 changes: 204 additions & 0 deletions src/RuleSet/Faker.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
<?php

declare(strict_types=1);

/**
* Copyright (c) 2019-2020 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/ergebnis/php-cs-fixer-config
*/

namespace Ergebnis\PhpCsFixer\Config\RuleSet;

/**
* @see https://github.com/FakerPHP/Faker/blob/main/.php_cs.dist
*/
final class Faker extends AbstractRuleSet
{
protected $name = 'faker (PHP 7.2)';

protected $rules = [
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => [
'statements' => [
'break',
'continue',
'default',
'die',
'do',
'exit',
'for',
'foreach',
'if',
'include',
'include_once',
'require',
'require_once',
'return',
'switch',
'throw',
'try',
'while',
'yield',
],
],
'braces' => [
'allow_single_line_anonymous_class_with_empty_body' => true,
],
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => [
'method' => 'one',
],
],
'combine_nested_dirname' => true,
'compact_nullable_typehint' => true,
'concat_space' => [
'spacing' => 'one',
],
'declare_equal_normalize' => true,
'function_typehint_space' => true,
'general_phpdoc_annotation_remove' => [
'annotations' => [
'author',
],
],
'global_namespace_import' => [
'import_classes' => false,
'import_constants' => false,
'import_functions' => false,
],
'header_comment' => false,
'implode_call' => true,
'increment_style' => true,
'is_null' => true,
'lambda_not_used_import' => true,
'list_syntax' => [
'syntax' => 'short',
],
'lowercase_cast' => true,
'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'modernize_types_casting' => true,
'multiline_comment_opening_closing' => true,
'new_with_braces' => true,
'no_alias_functions' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_spaces_around_offset' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unneeded_final_method' => true,
'no_unreachable_default_argument_value' => true,
'no_unset_cast' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'non_printable_character' => true,
'normalize_index_brace' => true,
'operator_linebreak' => [
'only_booleans' => true,
'position' => 'beginning',
],
'ordered_imports' => true,
'php_unit_construct' => true,
'php_unit_dedicate_assert' => true,
'php_unit_dedicate_assert_internal_type' => true,
'php_unit_expectation' => true,
'php_unit_fqcn_annotation' => true,
'php_unit_method_casing' => true,
'php_unit_mock' => true,
'php_unit_mock_short_will_return' => true,
'php_unit_namespaced' => true,
'php_unit_no_expectation_annotation' => true,
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_test_case_static_method_calls' => [
'call_type' => 'self',
],
'phpdoc_align' => true,
'phpdoc_indent' => true,
'phpdoc_inline_tag_normalizer' => true,
'phpdoc_line_span' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => [
'replacements' => [
'link' => 'see',
'type' => 'var',
],
],
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_order' => true,
'phpdoc_order_by_value' => [
'annotations' => [
'covers',
'dataProvider',
'group',
'requires',
'throws',
'uses',
],
],
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => [
'null_adjustment' => 'always_last',
'sort_algorithm' => 'alpha',
],
'phpdoc_var_without_name' => true,
'pow_to_exponentiation' => true,
'psr_autoloading' => true,
'random_api_migration' => true,
'return_assignment' => true,
'return_type_declaration' => true,
'semicolon_after_instruction' => true,
'short_scalar_cast' => true,
'single_blank_line_before_namespace' => true,
'single_line_comment_style' => true,
'single_quote' => true,
'single_trait_insert_per_statement' => true,
'standardize_not_equals' => true,
'static_lambda' => true,
'strict_param' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [
'elements' => [
'const',
'method',
'property',
],
],
'whitespace_after_comma_in_array' => true,
];

protected $targetPhpVersion = 70200;
}
Loading

0 comments on commit acaa4a8

Please sign in to comment.