Skip to content

Commit

Permalink
chore: Add php-cs-fixer, php-commitizen, and php-parallel-lint dev li…
Browse files Browse the repository at this point in the history
…braries
  • Loading branch information
pointybeard committed Nov 14, 2021
1 parent c163a79 commit 932db8f
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .php-commitizen.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

return [
'type' => [
'lengthMin' => 3,
'lengthMax' => 8,
'acceptExtra' => false,
'values' => [
'feat',
'fix',
'docs',
'chore',
'test',
'refactor',
'revert',
'ci',
]
],
'scope' => [
'lengthMin' => 0,
'lengthMax' => 10,
'acceptExtra' => true,
'values' => [],
],
'description' => [
'lengthMin' => 1,
'lengthMax' => 47,
],
'subject' => [
'lengthMin' => 1,
'lengthMax' => 69,
],
'body' => [
'wrap' => 72,
],
'footer' => [
'wrap' => 72,
],
];
49 changes: 49 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

declare(strict_types=1);

return (new PhpCsFixer\Config())
->setUsingCache(true)
->setRiskyAllowed(true)
->setFinder(
(new PhpCsFixer\Finder())
->files()
->name('*.php')
->in(__DIR__.'/src')
->exclude(__DIR__.'/vendor')
)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'is_null' => true,
'blank_line_before_statement' => ['statements' => ['continue', 'declare', 'return', 'throw', 'try']],
'cast_spaces' => ['space' => 'single'],
'include' => true,
'class_attributes_separation' => ['elements' => ['const' => 'one', 'method' => 'one', 'property' => 'one']],
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'object_operator_without_whitespace' => true,
'phpdoc_align' => true,
'phpdoc_indent' => true,
'phpdoc_no_access' => true,
'phpdoc_no_package' => true,
'phpdoc_order' => true,
'phpdoc_scalar' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'psr_autoloading' => true,
'array_syntax' => ['syntax' => 'short'],
'declare_strict_types' => true,
'single_blank_line_before_namespace' => true,
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline' => true,
])
;
12 changes: 12 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,23 @@
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.0",
"friendsofphp/php-cs-fixer": "^3.0",
"damianopetrungaro/php-commitizen": "^0.1.2",
"php-parallel-lint/php-parallel-lint": "^1.2"
},
"autoload": {
"psr-4": {
"ReverseRegex\\": "src/ReverseRegex",
"PHPStats\\": "src/PHPStats"
}
},
"scripts": {
"tidy": "php-cs-fixer fix -v --using-cache=no",
"tidy-dry": "@tidy --dry-run",
"test": [
"parallel-lint . --exclude vendor",
"phpunit"
]
}
}

0 comments on commit 932db8f

Please sign in to comment.