Add an empty line at end of file according to PSR-2 on PhpStorm

Viewed 19902

I use PSR-2 for code styling my code.

When I inspect a file using Codesniffer most of the times I get the following error.

332 | ERROR   | [x] Expected 1 newline at end of file; 0 found

It's obvious how to fix this. What I need to know is if PhpStorm has a way to add the 1 newline at end of file

I already loaded the predefined style from Settings -> Editor -> Code Style -> PHP -> Set From -> PSR-1/PSR-2 and also used the Reformat Code to change the CS accordingly.

Everything is fixed except from the new line. Am I missing something?

4 Answers

someone said picture speaks louder :D

you will need to tick the Ensure line feed at file end on save box

enter image description here

Related