-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP-CS-Fixer の導入 #996
Open
nanasess
wants to merge
7
commits into
EC-CUBE:master
Choose a base branch
from
nanasess:php-cs-fixer
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
PHP-CS-Fixer の導入 #996
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bfc9f5d
PHP-CS-Fixer の導入
nanasess 4381058
Merge remote-tracking branch 'upstream/master' into php-cs-fixer
nanasess 9326ac0
副作用のありそうなルールを除外
nanasess e96e7fe
php-cs-fixer を適用すると削除されるため1行に修正
nanasess 94d493c
php-cs-fixer のルールを整理
nanasess a9a7e00
Merge remote-tracking branch 'upstream/master' into php-cs-fixer
nanasess 5c6ecce
Apply PHP_CS_FIXER_IGNORE_ENV=1 data/vendor/bin/php-cs-fixer fix --al…
nanasess File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
if (php_sapi_name() !== 'cli') { | ||
throw new \LogicException(); | ||
} | ||
|
||
$rules = [ | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
// '@PHP83Migration' => true, | ||
|
||
// @Symfony のうち、以下のルールを無効化 | ||
'phpdoc_align' => false, // phpdoc の内容が削除されてしまう場合がある | ||
'phpdoc_summary' => false, // 日本語なので不要 | ||
'phpdoc_annotation_without_dot' => false, // 日本語なので不要 | ||
'no_superfluous_phpdoc_tags' => false, // 副作用があるため | ||
'increment_style' => false, // 強制しなくて良い | ||
'yoda_style' => false, // 強制しなくて良い | ||
'trailing_comma_in_multiline' => false, // `, ]` となるケースを防ぐため | ||
|
||
// @Symfony:risky のうち、以下のルールを無効化 | ||
'psr_autoloading' => false, // PSR-4 に準拠していないため | ||
'is_null' => false, // 副作用があるため | ||
'native_constant_invocation' => false, // namespace を使用していないため不要 | ||
'string_length_to_empty' => false, // 副作用があるため | ||
'ternary_to_elvis_operator' => false, // 副作用があるため | ||
]; | ||
|
||
$finder = \PhpCsFixer\Finder::create() | ||
->in(__DIR__.'/data/class') | ||
->in(__DIR__.'/data/class_extends') | ||
->in(__DIR__.'/data/module') | ||
->in(__DIR__.'/data/smarty_extends') | ||
->in(__DIR__.'/tests') | ||
->name('*.php') | ||
; | ||
$config = new \PhpCsFixer\Config(); | ||
return $config | ||
->setRules($rules) | ||
->setFinder($finder) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
設定理由をソースコメントに残していただけると、参考になります。
特に無効化している項目ですが、具体的に不都合があったのか、何となく避けたかといった辺り分かると、今回は対応を見送っても、今後の対応拡大に繋げやすいと思います。
下に、何項目かコメントつけましたが、無理に今回対応しなくても、後々で良いのかなと思う部分もあります。