Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/tests/ export-ignore

* text=auto
*.neon eol=lf
*.php eol=lf
Comment thread
lachlan-00 marked this conversation as resolved.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.idea/
/.php-cs-fixer.cache
/.phpunit.result.cache
/composer.lock
/demo/*.jpg
Expand Down
99 changes: 99 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in('src/')
->in('tests/')
;

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'simplified_if_return' => true,
'no_superfluous_phpdoc_tags' => true,
'single_class_element_per_statement' => true,
'class_attributes_separation' => ['elements' => ['method' => 'one']],
'no_superfluous_phpdoc_tags' => true,
'single_class_element_per_statement' => true,
Comment thread
lachlan-00 marked this conversation as resolved.
Outdated
'array_syntax' => [
'syntax' => 'short'
],
'blank_line_after_namespace' => true,
'blank_line_before_statement' => [
'statements' => ['declare', 'return']
],
'blank_line_between_import_groups' => true,
'concat_space' => [
'spacing' => 'one'
],
'constant_case' => true,
'braces_position' => [
'functions_opening_brace' => 'next_line_unless_newline_at_signature_end',
'allow_single_line_empty_anonymous_classes' => true,
'allow_single_line_anonymous_functions' => true
],
'declare_equal_normalize' => [
'space' => 'none'
],
'elseif' => true,
'encoding' => true,
'full_opening_tag' => true,
'line_ending' => true,
'lowercase_cast' => true,
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
'keep_multiple_spaces_after_comma' => false,
],
'trailing_comma_in_multiline' => [
'elements' => ['parameters'],
],
'multiline_comment_opening_closing' => true,
'no_break_comment' => false,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_whitespace_in_blank_line' => true,
'return_type_declaration' => [
'space_before' => 'none',
],
'single_blank_line_at_eof' => true,
'strict_param' => false,
'modifier_keywords' => [
'elements' => ['const', 'method', 'property']
],
'no_unused_imports' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha'
],
'ordered_class_elements' => [
'order' => [
'use_trait',
'case',
'constant_public',
'constant_protected',
'constant_private',
'property_public_static',
'property_protected_static',
'property_private_static',
'property_public',
'property_protected',
'property_private',
'construct',
'method_public_static',
'method_protected_static',
'method_private_static',
'method_public',
'method_protected',
'method_private',
'magic',
],
'sort_algorithm' => 'alpha',
]
])
->setIndent(" ")
->setFinder($finder)
->setLineEnding("\n")
->setUsingCache(true)
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
;

1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
}
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.49",
"phpunit/phpunit": "^9.6",
"phpstan/phpstan": "2.1.17",
"squizlabs/php_codesniffer": "4.0.1",
Expand Down
Loading