Skip to content

Commit e78a731

Browse files
author
Jeroen de Graaf
committed
Install quality tools
1 parent 2e2a2a0 commit e78a731

File tree

8 files changed

+3186
-2
lines changed

8 files changed

+3186
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
/var/
12
/vendor/

.php-cs-fixer.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$finder = (new PhpCsFixer\Finder())
6+
->in(['src']);
7+
8+
return (new PhpCsFixer\Config())
9+
->setCacheFile('var/.php-cs-fixer.cache')
10+
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
11+
->setRiskyAllowed(true)
12+
->setRules([
13+
'@PhpCsFixer' => true,
14+
'@Symfony' => true,
15+
'@PER-CS2.0' => true,
16+
'binary_operator_spaces' => false,
17+
'cast_spaces' => true,
18+
'concat_space' => ['spacing' => 'one'],
19+
'declare_strict_types' => true,
20+
'global_namespace_import' => [
21+
'import_classes' => true,
22+
'import_constants' => null,
23+
'import_functions' => null,
24+
],
25+
'multiline_whitespace_before_semicolons' => false,
26+
'phpdoc_align' => ['align' => 'left'],
27+
'phpdoc_order' => true,
28+
'phpdoc_to_comment' => false,
29+
'php_unit_test_class_requires_covers' => false,
30+
'single_line_throw' => false,
31+
'trailing_comma_in_multiline' => [
32+
'elements' => ['arrays', 'arguments', 'parameters'],
33+
],
34+
'void_return' => true,
35+
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
36+
])
37+
->setFinder($finder);

captainhook.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"pre-push": {
3+
"enabled": true,
4+
"actions": [
5+
{
6+
"action": "composer cs:dry-run"
7+
},
8+
{
9+
"action": "composer rector:dry-run"
10+
},
11+
{
12+
"action": "composer phpstan"
13+
}
14+
]
15+
}
16+
}

composer.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,31 @@
2222
"require": {
2323
"php": "^8.3"
2424
},
25+
"require-dev": {
26+
"captainhook/captainhook": "^5.25",
27+
"friendsofphp/php-cs-fixer": "^3.87",
28+
"phpstan/phpstan": "^2.1",
29+
"rector/rector": "^2.1"
30+
},
2531
"autoload": {
2632
"psr-4": {
2733
"Gember\\DependencyContracts\\": "src/"
2834
}
2935
},
3036
"config": {
3137
"sort-packages": true
38+
},
39+
"scripts": {
40+
"cs": "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php",
41+
"cs:dry-run": "PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --diff --dry-run --config=.php-cs-fixer.php",
42+
"phpstan": "vendor/bin/phpstan analyse -c phpstan.neon",
43+
"phpstan:baseline": "vendor/bin/phpstan analyse -c phpstan.neon --generate-baseline phpstan-baseline.php src tests",
44+
"rector": "vendor/bin/rector process --ansi",
45+
"rector:dry-run": "vendor/bin/rector process --ansi --dry-run",
46+
"test": [
47+
"@rector:dry-run",
48+
"@cs:dry-run",
49+
"@phpstan"
50+
]
3251
}
3352
}

0 commit comments

Comments
 (0)