While I was refactoring code in D7,my drupalcs linter in my Atom Editor showed following error – a function needs a blank line above it. When I added a blank line, another error throws up – the function comment needs a blank line below it. How in the world could both of them be true at the same time, like the status of Schrodinger’s cat?
So, I thought it was some error in the drupalcs linter and was moving on when I came across another function which didn’t have that error. When I compared it with my function, I found that I had no blank line above the function comment. So the error was about a blank line above the function comment not directly above the function itself. Even though it wasn’t intuitive enough at first, this should help anyone grappling with this error in future.
Long story short – Add a blank line above the function comment not above the function itself.