From 7e9d3a577c2a3f45c39a8ec03e0a8483091070ca Mon Sep 17 00:00:00 2001 From: "m.laufer" Date: Mon, 12 Nov 2018 14:59:15 +0100 Subject: [PATCH] Added possibility to use expectedExceptionMessageRegExp in addition to expectedExceptionMessage --- .../Docblock/ExpectedExceptionMessageSniff.php | 3 ++- ...ceptionWithExpectedExceptionRegExpMessage.php | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/rules/doc/allowed/ExpectedExceptionWithExpectedExceptionRegExpMessage.php diff --git a/custom-standards/Flyeralarm/Sniffs/Docblock/ExpectedExceptionMessageSniff.php b/custom-standards/Flyeralarm/Sniffs/Docblock/ExpectedExceptionMessageSniff.php index 50c0cfc..1c5ca32 100644 --- a/custom-standards/Flyeralarm/Sniffs/Docblock/ExpectedExceptionMessageSniff.php +++ b/custom-standards/Flyeralarm/Sniffs/Docblock/ExpectedExceptionMessageSniff.php @@ -25,7 +25,8 @@ public function process(File $phpcsFile, $stackPtr) if (!$this->hasAnnotationInDoc($phpcsFile, $stackPtr, '@expectedException')) { return; } - if ($this->hasAnnotationInDoc($phpcsFile, $stackPtr, '@expectedExceptionMessage')) { + if ($this->hasAnnotationInDoc($phpcsFile, $stackPtr, '@expectedExceptionMessage') + || $this->hasAnnotationInDoc($phpcsFile, $stackPtr, '@expectedExceptionMessageRegExp')) { return; } diff --git a/tests/rules/doc/allowed/ExpectedExceptionWithExpectedExceptionRegExpMessage.php b/tests/rules/doc/allowed/ExpectedExceptionWithExpectedExceptionRegExpMessage.php new file mode 100644 index 0000000..26d12ea --- /dev/null +++ b/tests/rules/doc/allowed/ExpectedExceptionWithExpectedExceptionRegExpMessage.php @@ -0,0 +1,16 @@ +