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); } /** * @return void */ public function testCaughtDocumentedThrowCall() { Config::getInstance()->check_for_throws_docblock = true; Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context); } /** * @return void */ public function testUncaughtUndocumentedThrowCall() { Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context); } /** * @return void */ public function testUncaughtDocumentedThrowCallInNamespace() { $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); } /** * @return void */ public function testUncaughtThrow() { $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); } /** * @return void */ public function testCaughtThrow() { Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context); } /** * @return void */ public function testUncaughtThrowWhenSuppressing() { Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context, false); } /** * @return void */ public function testUncaughtThrowInNamespaceWhenSuppressing() { Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context, false); } /** * @return void */ public function testUncaughtDocumentedThrowCallWhenSuppressing() { Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context, false); } /** * @return void */ public function testUncaughtDocumentedThrowCallInNamespaceWhenSuppressing() { Config::getInstance()->check_for_throws_in_global_scope = true; $this->addFile( 'somefile.php', 'analyzeFile('somefile.php', $context, false); } /** * @return void */ public function testUncaughtDocumentedThrowCallWhenSuppressingFirst() { $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); } }