squizlabs/PHP_CodeSniffer — pull request #25 by andygrunwald (2012-04-19 21:32:24+00:00)
Title: [FEATURE] Add support to import namespaces for sniffs

During the development of PHP_CodeSniffer-Sniffs for the CMS TYPO3 and the framework FLOW3 we create some own codesniffs. Our folder structure looks like:

|-TYPO3
|--Sniffs
|-TYPO3v4
|--ruleset.xml
|-FLOW3
|--ruleset.xml

Folder "TYPO3" contains all sniffs (Sniffpool). TYPO3v4 and FLOW3 implement only a subset of the sniffs, which are located in TYPO3. At the moment we have to symlink the TYPO3-Folder into the PHP_CodeSniffer standard directory to use this standard. This is not a nice solution.

This pull request try to fix this problem. This commit introduces the possibility to import sniff namespaces. Imagine you add your rules like

in your ruleset.xml. If there is no symlink in your standard directory for TYPO3 during execution of your ruleset an exception will be thrown. With this commit you have the possibility to import the namespace TYPO3 like

Now the TYPO3 standard is known without symlinking :)

This feature makes it more easier for us and more independent from the standard directory.
What do you think about this? Your feedback is very welcome.