gcc-4.8: error: unrecognized command line option ‘-fnested-functions’

Tried to install phplinter by running the command brew install homebrew/php/phplint for sublime text and this error came up:
gcc-4.8: error: unrecognized command line option ‘-fnested-functions

If you also have this problem please try and run first:

brew upgrade
brew update

Then install command line tools again:
xcode-select --install

If the above fails install it from here: https://developer.apple.com/downloads

Quit all terminal windows, if any and then open a new one.

Now run again
brew install homebrew/php/phplint

As of 2014-06-19 when the above reproduces the error you have to tap gcc, so write:
brew install gcc

If your are still experiencing problems, be sure to check brew doctor for solutions.

EDIT: user ‘droob’ gave a final solution on github!

Just type brew install apple-gcc42 and then try to install phplint again.
If this doesn’t work again try installing with this command:
brew install phplint -cc=apple-gcc42 as user ‘Daisuke Nakai’ commented here.