Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ruleset/basic validation: improve error messages
While the `libxml` error messages are far from perfect, they at least give some clue as to where to look for the error in a ruleset file. This PR changes two things: 1. Previously, a PHP warning would also be thrown for a ruleset of a standard which is not used in the current run. This warning is now silenced. 2. However, for the standards and rulesets actually _used_ by the current run, any potential warnings are made more readable and will now also mention the file in which they were encountered. Previously the output would be along the lines of: ``` Warning: simplexml_load_string(): Entity: line 82: parser error : Opening and ending tag mismatch: rule line 80 and rue in /path/to/PHP_CodeSniffer/src/Util/Standards.php on line 119 Warning: simplexml_load_string(): </rue> in /path/to/PHP_CodeSniffer/src/Util/Standards.php on line 119 Warning: simplexml_load_string(): ^ in /path/to/PHP_CodeSniffer/src/Util/Standards.php on line 119 ``` Now, it will look like: ``` ERROR: Ruleset /path/to/ruleset.xml is not valid - On line 82, column 10: Opening and ending tag mismatch: rule line 80 and rue ``` Loosely related to squizlabs#2188
- Loading branch information