From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Fri, 23 Aug 2019 20:25:40 -1000
Subject: Use expectException instead of setExpectedException

---
 .../Bugs/ClassDeclarationWithoutBodyBug065Test.php | 16 ++++++-------
 .../ParentKeywordAsParameterTypeHintBug087Test.php |  4 ++--
 src/test/php/PDepend/EngineTest.php                | 14 ++++++------
 .../Issues/NamespaceSupportIssue002Test.php        |  6 ++---
 .../CodeRankAnalyzer/StrategyFactoryTest.php       |  2 +-
 src/test/php/PDepend/ParserTest.php                | 16 ++++++-------
 .../php/PDepend/Report/Dependencies/XmlTest.php    |  2 +-
 src/test/php/PDepend/Report/Jdepend/XmlTest.php    |  2 +-
 .../php/PDepend/Report/Overview/PyramidTest.php    | 12 +++++-----
 .../PDepend/Report/ReportGeneratorFactoryTest.php  |  2 +-
 src/test/php/PDepend/Report/Summary/XmlTest.php    |  2 +-
 .../Source/AST/ASTConstantDefinitionTest.php       |  2 +-
 .../PDepend/Source/AST/ASTFieldDeclarationTest.php |  2 +-
 .../PDepend/Source/AST/ASTFormalParameterTest.php  |  2 +-
 .../PDepend/Source/AST/ASTListExpressionTest.php   |  2 +-
 src/test/php/PDepend/Source/AST/ASTMethodTest.php  |  2 +-
 .../PDepend/Source/AST/ASTStaticReferenceTest.php  |  4 ++--
 .../PHP80/ConstructorPropertyPromotionTest.php     |  4 ++--
 .../PHP/Features/PHP80/MatchExpressionTest.php     |  4 ++--
 .../PHP/Features/PHP81/ReadonlyClassTest.php       |  2 +-
 .../PDepend/Source/Language/PHP/PHPBuilderTest.php | 12 +++++-----
 .../Source/Language/PHP/PHPParserVersion53Test.php |  2 +-
 .../Source/Language/PHP/PHPParserVersion54Test.php |  2 +-
 .../Source/Language/PHP/PHPParserVersion55Test.php |  2 +-
 .../Source/Language/PHP/PHPParserVersion56Test.php |  4 ++--
 .../Source/Language/PHP/PHPParserVersion70Test.php | 26 +++++++++++-----------
 .../Source/Language/PHP/PHPParserVersion71Test.php |  4 ++--
 .../Source/Language/PHP/PHPParserVersion73Test.php |  2 +-
 .../Source/Language/PHP/PHPParserVersion74Test.php |  2 +-
 .../Parser/ASTAllocationExpressionParsingTest.php  |  2 +-
 .../php/PDepend/Source/Parser/SymbolTableTest.php  |  8 +++----
 31 files changed, 84 insertions(+), 84 deletions(-)

diff --git a/src/test/php/PDepend/Bugs/ClassDeclarationWithoutBodyBug065Test.php b/src/test/php/PDepend/Bugs/ClassDeclarationWithoutBodyBug065Test.php
index 1467f5e..56be9d7 100644
--- a/src/test/php/PDepend/Bugs/ClassDeclarationWithoutBodyBug065Test.php
+++ b/src/test/php/PDepend/Bugs/ClassDeclarationWithoutBodyBug065Test.php
@@ -61,7 +61,7 @@ class ClassDeclarationWithoutBodyBug065Test extends AbstractRegressionTest
      */
     public function testInterfaceDeclarationWithoutBody()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'RuntimeException',
             'Unexpected end of token stream in file: '
         );
@@ -77,7 +77,7 @@ class ClassDeclarationWithoutBodyBug065Test extends AbstractRegressionTest
      */
     public function testInterfaceDeclarationWithExtendWithoutBody()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'RuntimeException',
             'Unexpected end of token stream in file: '
         );
@@ -93,7 +93,7 @@ class ClassDeclarationWithoutBodyBug065Test extends AbstractRegressionTest
      */
     public function testInterfaceDeclarationWithInvalidInterfaceList()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'RuntimeException',
             'Unexpected token: {, line: 2, col: 28, file: '
         );
@@ -109,7 +109,7 @@ class ClassDeclarationWithoutBodyBug065Test extends AbstractRegressionTest
      */
     public function testClassDeclarationWithoutBody()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'RuntimeException',
             'Unexpected end of token stream in file: '
         );
@@ -125,7 +125,7 @@ class ClassDeclarationWithoutBodyBug065Test extends AbstractRegressionTest
      */
     public function testClassDeclarationWithExtendsWithoutClassName()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'RuntimeException',
             'Unexpected end of token stream in file: '
         );
@@ -141,7 +141,7 @@ class ClassDeclarationWithoutBodyBug065Test extends AbstractRegressionTest
      */
     public function testClassDeclarationWithExtendsWithoutInterfaceName()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'RuntimeException',
             'Unexpected end of token stream in file: '
         );
@@ -157,7 +157,7 @@ class ClassDeclarationWithoutBodyBug065Test extends AbstractRegressionTest
      */
     public function testClassDeclarationWithParentInterfaceWithoutBody()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'RuntimeException',
             'Unexpected end of token stream in file: '
         );
@@ -173,7 +173,7 @@ class ClassDeclarationWithoutBodyBug065Test extends AbstractRegressionTest
      */
     public function testClassDeclarationWithIncompleteParentInterfaceWithoutBody()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'RuntimeException',
             'Unexpected end of token stream in file: '
         );
diff --git a/src/test/php/PDepend/Bugs/ParentKeywordAsParameterTypeHintBug087Test.php b/src/test/php/PDepend/Bugs/ParentKeywordAsParameterTypeHintBug087Test.php
index 1c45a86..f802ec6 100644
--- a/src/test/php/PDepend/Bugs/ParentKeywordAsParameterTypeHintBug087Test.php
+++ b/src/test/php/PDepend/Bugs/ParentKeywordAsParameterTypeHintBug087Test.php
@@ -81,7 +81,7 @@ class ParentKeywordAsParameterTypeHintBug087Test extends AbstractRegressionTest
      */
     public function testParserThrowsExpectedExceptionForParentTypeHintInFunction()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\InvalidStateException',
             'The keyword "parent" was used as type hint but the parameter ' .
             'declaration is not in a class scope.'
@@ -97,7 +97,7 @@ class ParentKeywordAsParameterTypeHintBug087Test extends AbstractRegressionTest
      */
     public function testParserThrowsExpectedExceptionForParentTypeHintWithRootClass()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\InvalidStateException',
             'The keyword "parent" was used as type hint but the ' .
             'class "Baz" does not declare a parent.'
diff --git a/src/test/php/PDepend/EngineTest.php b/src/test/php/PDepend/EngineTest.php
index 71a5cc4..90f83c0 100644
--- a/src/test/php/PDepend/EngineTest.php
+++ b/src/test/php/PDepend/EngineTest.php
@@ -66,7 +66,7 @@ class EngineTest extends AbstractTest
         $dir = dirname(__FILE__) . '/foobar';
         $msg = "Invalid directory '{$dir}' added.";
 
-        $this->setExpectedException('InvalidArgumentException', $msg);
+        $this->expectException('InvalidArgumentException', $msg);
 
         $engine = $this->createEngineFixture();
         $engine->addDirectory($dir);
@@ -133,7 +133,7 @@ class EngineTest extends AbstractTest
     public function testAnalyzeThrowsAnExceptionForNoSourceDirectory()
     {
         $engine = $this->createEngineFixture();
-        $this->setExpectedException('RuntimeException', 'No source directory and file set.');
+        $this->expectException('RuntimeException', 'No source directory and file set.');
         $engine->analyze();
     }
 
@@ -199,7 +199,7 @@ class EngineTest extends AbstractTest
      */
     public function testCountClassesWithoutAnalyzeFail()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'RuntimeException',
             'countClasses() doesn\'t work before the source was analyzed.'
         );
@@ -232,7 +232,7 @@ class EngineTest extends AbstractTest
      */
     public function testCountNamespacesWithoutAnalyzeFail()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'RuntimeException',
             'countNamespaces() doesn\'t work before the source was analyzed.'
         );
@@ -275,7 +275,7 @@ class EngineTest extends AbstractTest
      */
     public function testGetNamespaceWithoutAnalyzeFail()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'RuntimeException',
             'getNamespace() doesn\'t work before the source was analyzed.'
         );
@@ -293,7 +293,7 @@ class EngineTest extends AbstractTest
      */
     public function testGetNamespacesWithUnknownPackageFail()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'OutOfBoundsException',
             'Unknown namespace "nspace".'
         );
@@ -332,7 +332,7 @@ class EngineTest extends AbstractTest
      */
     public function testGetNamespacesWithoutAnalyzeFail()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'RuntimeException',
             'getNamespaces() doesn\'t work before the source was analyzed.'
         );
diff --git a/src/test/php/PDepend/Issues/NamespaceSupportIssue002Test.php b/src/test/php/PDepend/Issues/NamespaceSupportIssue002Test.php
index 9740c26..3ef8745 100644
--- a/src/test/php/PDepend/Issues/NamespaceSupportIssue002Test.php
+++ b/src/test/php/PDepend/Issues/NamespaceSupportIssue002Test.php
@@ -113,7 +113,7 @@ class NamespaceSupportIssue002Test extends AbstractFeatureTest
      */
     public function testParserThrowsExpectedExceptionWhenUseDeclarationContextEndsOnBackslash()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: as, line: 2, col: 19, file: '
         );
@@ -177,7 +177,7 @@ class NamespaceSupportIssue002Test extends AbstractFeatureTest
      */
     public function testParserThrowsExpectedExceptionForNamespaceDeclarationWithoutIdentifierAndSemicolonSyntax()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: ;, line: 2, col: 18, file: '
         );
@@ -193,7 +193,7 @@ class NamespaceSupportIssue002Test extends AbstractFeatureTest
      */
     public function testParserThrowsExpectedExceptionForLeadingBackslashInIdentifier()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: {, line: 2, col: 13, file: '
         );
diff --git a/src/test/php/PDepend/Metrics/Analyzer/CodeRankAnalyzer/StrategyFactoryTest.php b/src/test/php/PDepend/Metrics/Analyzer/CodeRankAnalyzer/StrategyFactoryTest.php
index 8d46598..48382ec 100644
--- a/src/test/php/PDepend/Metrics/Analyzer/CodeRankAnalyzer/StrategyFactoryTest.php
+++ b/src/test/php/PDepend/Metrics/Analyzer/CodeRankAnalyzer/StrategyFactoryTest.php
@@ -66,7 +66,7 @@ class StrategyFactoryTest extends AbstractTest
     {
         $factory = new StrategyFactory();
 
-        $this->setExpectedException(
+        $this->expectException(
             'InvalidArgumentException',
             'Cannot load file for identifier "foo_bar_baz".'
         );
diff --git a/src/test/php/PDepend/ParserTest.php b/src/test/php/PDepend/ParserTest.php
index ed7f2dd..607daa9 100644
--- a/src/test/php/PDepend/ParserTest.php
+++ b/src/test/php/PDepend/ParserTest.php
@@ -132,7 +132,7 @@ class ParserTest extends AbstractTest
     public function testParserWithUnclosedClassFail()
     {
         $sourceFile = $this->createCodeResourceUriForTest();
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\TokenStreamEndException',
             "Unexpected end of token stream in file: {$sourceFile}."
         );
@@ -148,7 +148,7 @@ class ParserTest extends AbstractTest
      */
     public function testParserWithUnclosedFunctionFail()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\TokenStreamEndException',
             'Unexpected end of token stream in file: '
         );
@@ -164,7 +164,7 @@ class ParserTest extends AbstractTest
      */
     public function testParserWithInvalidFunction1Fail()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\RuntimeException',
             'Unexpected token: (, line: 3, col: 23, file: '
         );
@@ -180,7 +180,7 @@ class ParserTest extends AbstractTest
      */
     public function testParserWithInvalidFunction2Fail()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\RuntimeException',
             "Unexpected token: Bar, line: 3, col: 18, file: "
         );
@@ -1150,7 +1150,7 @@ class ParserTest extends AbstractTest
      */
     public function testParserThrowsUnexpectedTokenExceptionForBrokenParameterArrayDefaultValue()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: {, line: 2, col: 29, file: '
         );
@@ -1166,7 +1166,7 @@ class ParserTest extends AbstractTest
      */
     public function testParserThrowsUnexpectedTokenExceptionForInvalidTokenInParameterDefaultValue()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: &, line: 2, col: 27, file: '
         );
@@ -1182,7 +1182,7 @@ class ParserTest extends AbstractTest
      */
     public function testParserThrowsUnexpectedTokenExceptionForInvalidTokenInClassBody()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: ;, line: 4, col: 5, file: '
         );
@@ -1198,7 +1198,7 @@ class ParserTest extends AbstractTest
      */
     public function testParserThrowsUnexpectedTokenExceptionForInvalidTokenInMethodDeclaration()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: &, line: 4, col: 12, file: '
         );
diff --git a/src/test/php/PDepend/Report/Dependencies/XmlTest.php b/src/test/php/PDepend/Report/Dependencies/XmlTest.php
index 55bfc7b..fead881 100644
--- a/src/test/php/PDepend/Report/Dependencies/XmlTest.php
+++ b/src/test/php/PDepend/Report/Dependencies/XmlTest.php
@@ -118,7 +118,7 @@ class XmlTest extends AbstractTest
      */
     public function testThrowsExceptionForInvalidLogTarget()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Report\\NoLogOutputException',
             "The log target is not configured for 'PDepend\\Report\\Dependencies\\Xml'."
         );
diff --git a/src/test/php/PDepend/Report/Jdepend/XmlTest.php b/src/test/php/PDepend/Report/Jdepend/XmlTest.php
index bd9e5b3..71f9009 100644
--- a/src/test/php/PDepend/Report/Jdepend/XmlTest.php
+++ b/src/test/php/PDepend/Report/Jdepend/XmlTest.php
@@ -124,7 +124,7 @@ class XmlTest extends AbstractTest
      */
     public function testThrowsExceptionForInvalidLogTarget()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Report\\NoLogOutputException',
             "The log target is not configured for 'PDepend\\Report\\Jdepend\\Xml'."
         );
diff --git a/src/test/php/PDepend/Report/Overview/PyramidTest.php b/src/test/php/PDepend/Report/Overview/PyramidTest.php
index 9d1adf7..5fff42d 100644
--- a/src/test/php/PDepend/Report/Overview/PyramidTest.php
+++ b/src/test/php/PDepend/Report/Overview/PyramidTest.php
@@ -84,7 +84,7 @@ class PyramidTest extends AbstractTest
      */
     public function testThrowsExceptionForInvalidLogTarget()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Report\\NoLogOutputException',
             "The log target is not configured for 'PDepend\\Report\\Overview\\Pyramid'."
         );
@@ -111,7 +111,7 @@ class PyramidTest extends AbstractTest
      */
     public function testCloseThrowsAnExceptionIfNoCouplingAnalyzerWasSet()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\RuntimeException',
             'Missing Coupling analyzer.'
         );
@@ -132,7 +132,7 @@ class PyramidTest extends AbstractTest
      */
     public function testCloseThrowsAnExceptionIfNoCyclomaticComplexityAnalyzerWasSet()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\RuntimeException',
             'Missing Cyclomatic Complexity analyzer.'
         );
@@ -153,7 +153,7 @@ class PyramidTest extends AbstractTest
      */
     public function testCloseThrowsAnExceptionIfNoInheritanceAnalyzerWasSet()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\RuntimeException',
             'Missing Inheritance analyzer.'
         );
@@ -174,7 +174,7 @@ class PyramidTest extends AbstractTest
      */
     public function testCloseThrowsAnExceptionIfNoNodeCountAnalyzerWasSet()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\RuntimeException',
             'Missing Node Count analyzer.'
         );
@@ -195,7 +195,7 @@ class PyramidTest extends AbstractTest
      */
     public function testCloseThrowsAnExceptionIfNoNodeLOCAnalyzerWasSet()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\RuntimeException',
             'Missing Node LOC analyzer.'
         );
diff --git a/src/test/php/PDepend/Report/ReportGeneratorFactoryTest.php b/src/test/php/PDepend/Report/ReportGeneratorFactoryTest.php
index 62931bd..b53b3b4 100644
--- a/src/test/php/PDepend/Report/ReportGeneratorFactoryTest.php
+++ b/src/test/php/PDepend/Report/ReportGeneratorFactoryTest.php
@@ -97,7 +97,7 @@ class ReportGeneratorFactoryTest extends AbstractTest
      */
     public function testCreateGeneratorWithInvalidIdentifierFail()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\RuntimeException',
             'Unknown generator with identifier "foo-bar-xml".'
         );
diff --git a/src/test/php/PDepend/Report/Summary/XmlTest.php b/src/test/php/PDepend/Report/Summary/XmlTest.php
index 94f0dd9..f1cddf5 100644
--- a/src/test/php/PDepend/Report/Summary/XmlTest.php
+++ b/src/test/php/PDepend/Report/Summary/XmlTest.php
@@ -130,7 +130,7 @@ class XmlTest extends AbstractTest
      */
     public function testThrowsExceptionForInvalidLogTarget()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Report\\NoLogOutputException',
             "The log target is not configured for 'PDepend\\Report\\Summary\\Xml'."
         );
diff --git a/src/test/php/PDepend/Source/AST/ASTConstantDefinitionTest.php b/src/test/php/PDepend/Source/AST/ASTConstantDefinitionTest.php
index 483a3de..3598e2b 100644
--- a/src/test/php/PDepend/Source/AST/ASTConstantDefinitionTest.php
+++ b/src/test/php/PDepend/Source/AST/ASTConstantDefinitionTest.php
@@ -83,7 +83,7 @@ class ASTConstantDefinitionTest extends ASTNodeTest
     {
         $definition = new ASTConstantDefinition();
 
-        $this->setExpectedException(
+        $this->expectException(
             'InvalidArgumentException',
             'Invalid field modifiers given, allowed modifiers are ' .
             'IS_PUBLIC, IS_PROTECTED, IS_PRIVATE and IS_FINAL.'
diff --git a/src/test/php/PDepend/Source/AST/ASTFieldDeclarationTest.php b/src/test/php/PDepend/Source/AST/ASTFieldDeclarationTest.php
index 882fb82..362b1b2 100644
--- a/src/test/php/PDepend/Source/AST/ASTFieldDeclarationTest.php
+++ b/src/test/php/PDepend/Source/AST/ASTFieldDeclarationTest.php
@@ -149,7 +149,7 @@ class ASTFieldDeclarationTest extends ASTNodeTest
     {
         $declaration = new ASTFieldDeclaration();
 
-        $this->setExpectedException(
+        $this->expectException(
             'InvalidArgumentException',
             'Invalid field modifiers given, allowed modifiers are ' .
             'IS_PUBLIC, IS_PROTECTED, IS_PRIVATE and IS_STATIC.'
diff --git a/src/test/php/PDepend/Source/AST/ASTFormalParameterTest.php b/src/test/php/PDepend/Source/AST/ASTFormalParameterTest.php
index f64d86a..b1d510a 100644
--- a/src/test/php/PDepend/Source/AST/ASTFormalParameterTest.php
+++ b/src/test/php/PDepend/Source/AST/ASTFormalParameterTest.php
@@ -92,7 +92,7 @@ class ASTFormalParameterTest extends ASTNodeTest
         $parameter = new ASTFormalParameter();
         $parameter->addChild(new ASTVariableDeclarator());
 
-        $this->setExpectedException('\\OutOfBoundsException');
+        $this->expectException('\\OutOfBoundsException');
 
         $parameter->getType();
     }
diff --git a/src/test/php/PDepend/Source/AST/ASTListExpressionTest.php b/src/test/php/PDepend/Source/AST/ASTListExpressionTest.php
index a2c8085..4e37e0e 100644
--- a/src/test/php/PDepend/Source/AST/ASTListExpressionTest.php
+++ b/src/test/php/PDepend/Source/AST/ASTListExpressionTest.php
@@ -300,7 +300,7 @@ class ASTListExpressionTest extends ASTNodeTest
      */
     public function testListExpressionWithArrayAndEmptySlot()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: ,, line: 4, col: 18, file: '
         );
diff --git a/src/test/php/PDepend/Source/AST/ASTMethodTest.php b/src/test/php/PDepend/Source/AST/ASTMethodTest.php
index 774a91e..14e01e8 100644
--- a/src/test/php/PDepend/Source/AST/ASTMethodTest.php
+++ b/src/test/php/PDepend/Source/AST/ASTMethodTest.php
@@ -400,7 +400,7 @@ class ASTMethodTest extends AbstractASTArtifactTest
      */
     public function testSetInvalidModifierFail()
     {
-        $this->setExpectedException('InvalidArgumentException');
+        $this->expectException('InvalidArgumentException');
 
         $method = new ASTMethod('method');
         $method->setModifiers(-1);
diff --git a/src/test/php/PDepend/Source/AST/ASTStaticReferenceTest.php b/src/test/php/PDepend/Source/AST/ASTStaticReferenceTest.php
index f889891..0d90be4 100644
--- a/src/test/php/PDepend/Source/AST/ASTStaticReferenceTest.php
+++ b/src/test/php/PDepend/Source/AST/ASTStaticReferenceTest.php
@@ -105,7 +105,7 @@ class ASTStaticReferenceTest extends ASTNodeTest
      */
     public function testStaticReferenceAllocationOutsideOfClassScopeThrowsExpectedException()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\InvalidStateException',
             'The keyword "static" was used outside of a class/method scope.'
         );
@@ -120,7 +120,7 @@ class ASTStaticReferenceTest extends ASTNodeTest
      */
     public function testStaticReferenceMemberPrimaryPrefixOutsideOfClassScopeThrowsExpectedException()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\InvalidStateException',
             'The keyword "static" was used outside of a class/method scope.'
         );
diff --git a/src/test/php/PDepend/Source/Language/PHP/Features/PHP80/ConstructorPropertyPromotionTest.php b/src/test/php/PDepend/Source/Language/PHP/Features/PHP80/ConstructorPropertyPromotionTest.php
index a85e31e..a686509 100644
--- a/src/test/php/PDepend/Source/Language/PHP/Features/PHP80/ConstructorPropertyPromotionTest.php
+++ b/src/test/php/PDepend/Source/Language/PHP/Features/PHP80/ConstructorPropertyPromotionTest.php
@@ -133,11 +133,11 @@ class ConstructorPropertyPromotionTest extends PHPParserVersion80Test
 
     /**
      * @return void
-     * @expectedException \PDepend\Source\Parser\TokenException
-     * @expectedExceptionMessage Unexpected token: private, line: 5, col: 9
      */
     public function testPropertyPromotionOnRandomMethod()
     {
+        $this->expectException('\PDepend\Source\Parser\TokenException');
+        $this->expectExceptionMessage('Unexpected token: private, line: 5, col: 9');
         $this->parseCodeResourceForTest();
     }
 }
diff --git a/src/test/php/PDepend/Source/Language/PHP/Features/PHP80/MatchExpressionTest.php b/src/test/php/PDepend/Source/Language/PHP/Features/PHP80/MatchExpressionTest.php
index 5a54d5f..8f4f1ea 100644
--- a/src/test/php/PDepend/Source/Language/PHP/Features/PHP80/MatchExpressionTest.php
+++ b/src/test/php/PDepend/Source/Language/PHP/Features/PHP80/MatchExpressionTest.php
@@ -228,12 +228,12 @@ class MatchExpressionTest extends PHPParserVersion80Test
     }
 
     /**
-     * @expectedException \PDepend\Source\Parser\UnexpectedTokenException
-     * @expectedExceptionMessage Unexpected token: ,, line: 5, col: 25
      * @return void
      */
     public function testMatchExpressionWithTooManyArguments()
     {
+        $this->expectException('\PDepend\Source\Parser\UnexpectedTokenException');
+        $this->expectExceptionMessage('Unexpected token: ,, line: 5, col: 25');
         $this->parseCodeResourceForTest();
     }
 }
diff --git a/src/test/php/PDepend/Source/Language/PHP/Features/PHP81/ReadonlyClassTest.php b/src/test/php/PDepend/Source/Language/PHP/Features/PHP81/ReadonlyClassTest.php
index 5d37018..eb80fcc 100644
--- a/src/test/php/PDepend/Source/Language/PHP/Features/PHP81/ReadonlyClassTest.php
+++ b/src/test/php/PDepend/Source/Language/PHP/Features/PHP81/ReadonlyClassTest.php
@@ -54,7 +54,7 @@ class ReadonlyClassTest extends PHPParserVersion81Test
      */
     public function testReadonlyClass()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: readonly, line: 2, col: 1, file: '
         );
diff --git a/src/test/php/PDepend/Source/Language/PHP/PHPBuilderTest.php b/src/test/php/PDepend/Source/Language/PHP/PHPBuilderTest.php
index 2dc4728..e19fbee 100644
--- a/src/test/php/PDepend/Source/Language/PHP/PHPBuilderTest.php
+++ b/src/test/php/PDepend/Source/Language/PHP/PHPBuilderTest.php
@@ -657,7 +657,7 @@ class PHPBuilderTest extends AbstractTest
         // Freeze object
         $builder->getClass('Foo');
 
-        $this->setExpectedException(
+        $this->expectException(
             'BadMethodCallException',
             'Cannot create new nodes, when internal state is frozen.'
         );
@@ -679,7 +679,7 @@ class PHPBuilderTest extends AbstractTest
         // Freeze object
         $builder->getClass('Foo');
 
-        $this->setExpectedException(
+        $this->expectException(
             'BadMethodCallException',
             'Cannot create new nodes, when internal state is frozen.'
         );
@@ -701,7 +701,7 @@ class PHPBuilderTest extends AbstractTest
         // Freeze object
         $builder->getClass('Foo');
 
-        $this->setExpectedException(
+        $this->expectException(
             'BadMethodCallException',
             'Cannot create new nodes, when internal state is frozen.'
         );
@@ -723,7 +723,7 @@ class PHPBuilderTest extends AbstractTest
         // Freeze object
         $builder->getInterface('Inter');
 
-        $this->setExpectedException(
+        $this->expectException(
             'BadMethodCallException',
             'Cannot create new nodes, when internal state is frozen.'
         );
@@ -745,7 +745,7 @@ class PHPBuilderTest extends AbstractTest
         // Freeze object
         $builder->getInterface('Inter');
 
-        $this->setExpectedException(
+        $this->expectException(
             'BadMethodCallException',
             'Cannot create new nodes, when internal state is frozen.'
         );
@@ -767,7 +767,7 @@ class PHPBuilderTest extends AbstractTest
         // Freeze object
         $builder->getInterface('Inter');
 
-        $this->setExpectedException(
+        $this->expectException(
             'BadMethodCallException',
             'Cannot create new nodes, when internal state is frozen.'
         );
diff --git a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion53Test.php b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion53Test.php
index 6952b91..a87b779 100644
--- a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion53Test.php
+++ b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion53Test.php
@@ -133,7 +133,7 @@ class PHPParserVersion53Test extends AbstractTest
      */
     public function testParserThrowsUnexpectedTokenExceptionForInvalidTokenInPropertyDeclaration()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: const, line: 4, col: 13, file: '
         );
diff --git a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion54Test.php b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion54Test.php
index 3a9907a..81758a8 100644
--- a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion54Test.php
+++ b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion54Test.php
@@ -395,7 +395,7 @@ class PHPParserVersion54Test extends AbstractTest
      */
     public function testParserThrowsUnexpectedTokenExceptionForInvalidTokenInPropertyDeclaration()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: const, line: 4, col: 13, file: '
         );
diff --git a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion55Test.php b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion55Test.php
index 3879cf7..e711b1a 100644
--- a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion55Test.php
+++ b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion55Test.php
@@ -129,7 +129,7 @@ class PHPParserVersion55Test extends AbstractTest
      */
     public function testParserThrowsUnexpectedTokenExceptionForInvalidTokenInPropertyDeclaration()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: const, line: 4, col: 13, file: '
         );
diff --git a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion56Test.php b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion56Test.php
index fc52801..2e48ec4 100644
--- a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion56Test.php
+++ b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion56Test.php
@@ -195,7 +195,7 @@ class PHPParserVersion56Test extends AbstractTest
      */
     public function testParserThrowsUnexpectedTokenExceptionForInvalidTokenInPropertyDeclaration()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: const, line: 4, col: 13, file: '
         );
@@ -294,7 +294,7 @@ class PHPParserVersion56Test extends AbstractTest
      */
     public function testReservedKeyword()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: NEW, line: 5, col: 11, file: '
         );
diff --git a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion70Test.php b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion70Test.php
index a53b385..8ae93b3 100644
--- a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion70Test.php
+++ b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion70Test.php
@@ -545,7 +545,7 @@ class PHPParserVersion70Test extends AbstractTest
      */
     public function testParseListWithSquaredBrackets()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: [, line: 2, col: 26, file: '
         );
@@ -561,7 +561,7 @@ class PHPParserVersion70Test extends AbstractTest
      */
     public function testParserThrowsUnexpectedTokenExceptionForInvalidTokenInPropertyDeclaration()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: const, line: 4, col: 13, file: '
         );
@@ -576,7 +576,7 @@ class PHPParserVersion70Test extends AbstractTest
      */
     public function testVoidTypeHintReturn()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: void, line: 2, col: 23, file: '
         );
@@ -591,7 +591,7 @@ class PHPParserVersion70Test extends AbstractTest
      */
     public function testListExpressionWithSquaredBrackets()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: [, line: 4, col: 5, file: '
         );
@@ -606,7 +606,7 @@ class PHPParserVersion70Test extends AbstractTest
      */
     public function testListExpressionWithKeys()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: "a", line: 4, col: 10, file: '
         );
@@ -621,7 +621,7 @@ class PHPParserVersion70Test extends AbstractTest
      */
     public function testListExpressionWithKeysAndNestedList()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: \'a\', line: 4, col: 10, file: '
         );
@@ -675,7 +675,7 @@ class PHPParserVersion70Test extends AbstractTest
 
     public function testCallableKeywordAsClassName()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: callable, line: 3, col: 7, file: '
         );
@@ -685,7 +685,7 @@ class PHPParserVersion70Test extends AbstractTest
 
     public function testTraitKeywordAsClassName()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: trait, line: 3, col: 7, file: '
         );
@@ -695,7 +695,7 @@ class PHPParserVersion70Test extends AbstractTest
 
     public function testInsteadofKeywordAsClassName()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: insteadof, line: 3, col: 7, file: '
         );
@@ -705,7 +705,7 @@ class PHPParserVersion70Test extends AbstractTest
 
     public function testCallableKeywordAsInterfaceName()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: callable, line: 3, col: 11, file: '
         );
@@ -715,7 +715,7 @@ class PHPParserVersion70Test extends AbstractTest
 
     public function testTraitKeywordAsInterfaceName()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: trait, line: 3, col: 11, file: '
         );
@@ -725,7 +725,7 @@ class PHPParserVersion70Test extends AbstractTest
 
     public function testInsteadofKeywordAsInterfaceName()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: insteadof, line: 3, col: 11, file: '
         );
@@ -751,7 +751,7 @@ class PHPParserVersion70Test extends AbstractTest
      */
     public function testSymmetricArrayDestructuringEmptySlot()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\InvalidStateException',
             'The parser has reached an invalid state near line "4" in file'
         );
diff --git a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion71Test.php b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion71Test.php
index c7ac589..8e4719f 100644
--- a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion71Test.php
+++ b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion71Test.php
@@ -77,7 +77,7 @@ class PHPParserVersion71Test extends AbstractTest
      */
     public function testConstVisibilityInInterfaceProtected()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\InvalidStateException',
             'Constant can\'t be declared private or protected in interface "TestInterface".'
         );
@@ -90,7 +90,7 @@ class PHPParserVersion71Test extends AbstractTest
      */
     public function testConstVisibilityInInterfacePrivate()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\InvalidStateException',
             'Constant can\'t be declared private or protected in interface "TestInterface".'
         );
diff --git a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion73Test.php b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion73Test.php
index b776364..23e9e97 100644
--- a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion73Test.php
+++ b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion73Test.php
@@ -72,7 +72,7 @@ class PHPParserVersion73Test extends AbstractTest
             $this->markTestSkipped('This test requires PHP < 7.4');
         }
 
-        $this->setExpectedException(
+        $this->expectException(
             'PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: =>, line: 4, col: 34, file:'
         );
diff --git a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion74Test.php b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion74Test.php
index 729acb5..a2b155d 100644
--- a/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion74Test.php
+++ b/src/test/php/PDepend/Source/Language/PHP/PHPParserVersion74Test.php
@@ -160,7 +160,7 @@ class PHPParserVersion74Test extends AbstractTest
 
     public function testTypedPropertiesSyntaxError()
     {
-        $this->setExpectedException(
+        $this->expectException(
             'PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: string, line: 4, col: 16, file:'
         );
diff --git a/src/test/php/PDepend/Source/Parser/ASTAllocationExpressionParsingTest.php b/src/test/php/PDepend/Source/Parser/ASTAllocationExpressionParsingTest.php
index 8424fd9..ae63c06 100644
--- a/src/test/php/PDepend/Source/Parser/ASTAllocationExpressionParsingTest.php
+++ b/src/test/php/PDepend/Source/Parser/ASTAllocationExpressionParsingTest.php
@@ -273,7 +273,7 @@ class ASTAllocationExpressionParsingTest extends AbstractParserTest
      */
     public function testInvalidAllocationExpressionResultsInExpectedException()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\\PDepend\\Source\\Parser\\UnexpectedTokenException',
             'Unexpected token: ;, line: 4, col: 9, file: '
         );
diff --git a/src/test/php/PDepend/Source/Parser/SymbolTableTest.php b/src/test/php/PDepend/Source/Parser/SymbolTableTest.php
index 66128c3..ddac678 100644
--- a/src/test/php/PDepend/Source/Parser/SymbolTableTest.php
+++ b/src/test/php/PDepend/Source/Parser/SymbolTableTest.php
@@ -58,7 +58,7 @@ class SymbolTableTest extends AbstractTest
      */
     public function testCannotAddSymbolToASymbolTableWithoutActiveScope()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\PDepend\Source\Parser\NoActiveScopeException',
             'No active scope in symbol table.'
         );
@@ -73,7 +73,7 @@ class SymbolTableTest extends AbstractTest
      */
     public function testCannotPerformLookupOnASymbolTableWithoutActiveScope()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\PDepend\Source\Parser\NoActiveScopeException',
             'No active scope in symbol table.'
         );
@@ -88,7 +88,7 @@ class SymbolTableTest extends AbstractTest
      */
     public function testCannotResetWithoutActiveScope()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\PDepend\Source\Parser\NoActiveScopeException',
             'No active scope in symbol table.'
         );
@@ -103,7 +103,7 @@ class SymbolTableTest extends AbstractTest
      */
     public function testCannotDestroyWithoutActiveScope()
     {
-        $this->setExpectedException(
+        $this->expectException(
             '\PDepend\Source\Parser\NoActiveScopeException',
             'No active scope in symbol table.'
         );
