Edit report at https://pear.php.net/bugs/bug.php?id=19621&edit=1

ID: 19621
Updated by: gsherwood@squiz.net
Reported By: uwe dot pries at digartis dot de
Summary: Check for blank line at end of file
-Status: Open
+Status: Closed
Type: Bug
Package: PHP_CodeSniffer
Operating System: Linux
Package Version: 1.4.0
PHP Version: 5.3.10
-Assigned To:
+Assigned To: squiz
Roadmap Versions:
New Comment:

-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: squiz
This change was intentional. See the pull request for the conversation

This has been the hardest part of the standard to get right because I
don't think
anyone besides Paul knows what "a single blank line" means. But I've at
least now
got confirmation that it means "a single newline character" even if your
text editor is
not able to see it the blank line that it produces (I use Sublime Text
and mine does,
but my last editor did not).

And yes, the previous version required 2 newline characters because
that's what he
told me at the time. But he has since decided that this was wrong, hence
the change
in 1.4.0. (see the pull request)

Sorry if it is a pain to go and change all your code yet again, but
there isn't anything
I could have done differently. I'm not part of the PHP FIG group so I
have to follow
the advice I get from them. Sometimes, it is conflicting.

Previous Comments:

[2012-09-27 14:34:47] uwepries

I have an issue with all PHP files in a project since Monday's 1.4

ERROR | Expected 1 blank line at end of file; 2 found

All my files end like this: http://ideone.com/bRIzP

I found this diff between 1.3.6 and 1.4 releases:
http://pastebin.com/UUrVPzmj and I
clearly understand the code former version
but not the code of the latter version.

I had a conversation with cweiske on IRC in #cweiske and later with

14:59 <@Tyrael> equivoc: seems like that if + else if block got merged
into one into
15:01 <@Tyrael> I'm not sure about why do we $data = array($blankLines
+ 1);
instead of the previous

My current fix is: "sudo pear install --force PHP_CodeSniffer-1.3.6"

Thanks for looking


Test script:

Expected result:
1 line should be okay at end of file

Actual result:
ERROR | Expected 1 blank line at end of file; 2 found


Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
postedSep 27, '12 at 10:07p
activeSep 27, '12 at 10:07p

1 user in discussion

Gsherwood: 1 post



site design / logo © 2022 Grokbase