To set up php linting, you’ll want to install this PHP CodeSniffer repo and configure with this WordPress Coding Standards repo: . There are a number of ways to do this, whether direct download, Composer, Homebrew, Pear, etc. The following is what works for me on MacOS using Homebrew:
In a terminal window on your Mac, start by updating your Homebrew.
brew doctor
Then install the Code Sniffer: