1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PSR-2では末尾に空行が必要なのでInttelij Ideaで設定する

Last updated at Posted at 2016-09-06

知らなかったんですが、PSR-2では末尾に改行が必要なようです。

PSR-2 2.2 Files
http://www.php-fig.org/psr/psr-2/#2-2-files

2.2. Files

All PHP files MUST end with a single blank line.

全てのPHPファイルの末尾には空行が必要です。

PRで指摘されたので、早速IntellijIdeaの Editor -> PHP から設定項目を探したけど見つからず困ってたのですが、さすがStackOverflowさん何でも知ってるぜ!

How to make Intellij Idea insert a new line at every end of file?
http://stackoverflow.com/questions/16761227/how-to-make-intellij-idea-insert-a-new-line-at-every-end-of-file

Change your Editor settings:

Settings→Editor→General→Other→Ensure line feed at file end on save.

というわけで、以下の部分を設定することで無事に改行を追加できました。
「PHPファイルのときだけ」とか器用な設定ではないですが、これで十分です。

ensure_line_feed_at_file_end_on_save.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?