Skip to content

Commit f3a7d5c

Browse files
committed
- aligned PHP-CS-Fixer and Rector format style configurations
- fixed some coding styles for PHP-CS-Fixer check
1 parent be24809 commit f3a7d5c

File tree

5 files changed

+51
-12
lines changed

5 files changed

+51
-12
lines changed

.php-cs-fixer.dist.php

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,49 @@
33
$finder = (new PhpCsFixer\Finder())
44
->in(__DIR__)
55
->exclude('var')
6-
;
6+
->exclude('vendor')
7+
->exclude('migrations');
78

8-
return (new PhpCsFixer\Config())
9+
$config = (new PhpCsFixer\Config())
910
->setRules([
10-
'@Symfony' => true,
11+
'@PSR12' => true,
12+
// コーディングスタイルの統一
13+
'single_quote' => true,
14+
'array_syntax' => ['syntax' => 'short'],
15+
'concat_space' => ['spacing' => 'one'],
16+
// Formatting only, let Rector handle all import logic
17+
'blank_line_after_opening_tag' => false,
18+
'linebreak_after_opening_tag' => false,
19+
// PHPDoc設定
20+
'phpdoc_order' => true,
21+
'phpdoc_separation' => true,
22+
'phpdoc_single_line_var_spacing' => true,
23+
// クラス属性の分離
24+
'class_attributes_separation' => [
25+
'elements' => [
26+
'method' => 'one',
27+
'property' => 'one',
28+
],
29+
],
30+
// Basic formatting rules
31+
'indentation_type' => true,
32+
'line_ending' => true,
33+
'lowercase_keywords' => true,
34+
'method_argument_space' => true,
35+
'no_closing_tag' => true,
36+
'no_spaces_after_function_name' => true,
37+
'no_spaces_inside_parenthesis' => true,
38+
'no_trailing_whitespace' => true,
39+
'no_trailing_whitespace_in_comment' => true,
40+
'single_blank_line_at_eof' => true,
41+
'single_class_element_per_statement' => true,
42+
'single_import_per_statement' => true,
43+
'single_line_after_imports' => true,
44+
'visibility_required' => true,
45+
'encoding' => true,
46+
'full_opening_tag' => true,
1147
])
12-
->setFinder($finder)
13-
;
48+
->setRiskyAllowed(true)
49+
->setFinder($finder);
50+
51+
return $config;

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@
9595
"bin/console lint:twig templates",
9696
"bin/console lint:container",
9797
"./vendor/bin/phpstan analyse --memory-limit=-1",
98-
"./vendor/bin/rector --dry-run"
98+
"./vendor/bin/rector --dry-run",
99+
"PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --dry-run --diff"
99100
],
100101
"security-check": [
101102
"symfony check:security"
@@ -125,4 +126,4 @@
125126
"symfony/stopwatch": "7.3.*",
126127
"symfony/web-profiler-bundle": "7.3.*"
127128
}
128-
}
129+
}

config/preload.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22

3-
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
4-
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
3+
if (file_exists(dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php')) {
4+
require dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php';
55
}

public/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use App\Kernel;
44

5-
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
5+
require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';
66

77
$environment = $_SERVER['APP_ENV'] ?? 'dev';
88
if (!is_string($environment)) {

tests/bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
use Symfony\Component\Dotenv\Dotenv;
44

5-
require dirname(__DIR__).'/vendor/autoload.php';
5+
require dirname(__DIR__) . '/vendor/autoload.php';
66

77
// if (method_exists(Dotenv::class, 'bootEnv')) {
8-
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
8+
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
99
// }
1010

1111
if ($_SERVER['APP_DEBUG']) {

0 commit comments

Comments
 (0)