expectException(\Psalm\Exception\CodeException::class); $this->expectExceptionMessage('UncaughtThrowInGlobalScope'); Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context); } public function testCaughtDocumentedThrowCall(): void { Config::getInstance()->check_for_throws_docblock = true; Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context); } public function testUncaughtUndocumentedThrowCall(): void { Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context); } public function testUncaughtDocumentedThrowCallInNamespace(): void { $this->expectException(\Psalm\Exception\CodeException::class); $this->expectExceptionMessage('UncaughtThrowInGlobalScope'); Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context); } public function testUncaughtThrow(): void { $this->expectException(\Psalm\Exception\CodeException::class); $this->expectExceptionMessage('UncaughtThrowInGlobalScope'); Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context); } public function testCaughtThrow(): void { Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context); } public function testUncaughtThrowWhenSuppressing(): void { Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context, false); } public function testUncaughtThrowInNamespaceWhenSuppressing(): void { Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context, false); } public function testUncaughtDocumentedThrowCallWhenSuppressing(): void { Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context, false); } public function testUncaughtDocumentedThrowCallInNamespaceWhenSuppressing(): void { Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context, false); } public function testUncaughtDocumentedThrowCallWhenSuppressingFirst(): void { $this->expectExceptionMessage('UncaughtThrowInGlobalScope'); $this->expectException(\Psalm\Exception\CodeException::class); Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context); } }