mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 13:51:54 +01:00
Improved class name generation for @throws annotation
This commit is contained in:
parent
8ffc747349
commit
ab690df4da
@ -720,7 +720,14 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer
|
||||
}
|
||||
|
||||
if (!$is_expected) {
|
||||
$missingThrowsDocblockErrors[] = $possibly_thrown_exception;
|
||||
$missing_docblock_exception = new TNamedObject($possibly_thrown_exception);
|
||||
$missingThrowsDocblockErrors[] = $missing_docblock_exception->toNamespacedString(
|
||||
$this->source->getNamespace(),
|
||||
$this->source->getAliasedClassesFlipped(),
|
||||
$this->source->getFQCLN(),
|
||||
true
|
||||
);
|
||||
|
||||
foreach ($codelocations as $codelocation) {
|
||||
// issues are suppressed in ThrowAnalyzer, CallAnalyzer, etc.
|
||||
IssueBuffer::maybeAdd(
|
||||
|
@ -405,7 +405,6 @@ class FunctionDocblockManipulator
|
||||
$inferredThrowsClause = array_reduce(
|
||||
$this->throwsExceptions,
|
||||
function (string $throwsClause, string $exception) {
|
||||
$exception = '\\' . $exception;
|
||||
return $throwsClause === '' ? $exception : $throwsClause.'|'.$exception;
|
||||
},
|
||||
''
|
||||
|
@ -20,7 +20,7 @@ class ThrowsBlockAdditionTest extends FileManipulationTestCase
|
||||
}',
|
||||
'<?php
|
||||
/**
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
function foo(string $s): string {
|
||||
if("" === $s) {
|
||||
@ -45,7 +45,7 @@ class ThrowsBlockAdditionTest extends FileManipulationTestCase
|
||||
}',
|
||||
'<?php
|
||||
/**
|
||||
* @throws \InvalidArgumentException|\DomainException
|
||||
* @throws InvalidArgumentException|DomainException
|
||||
*/
|
||||
function foo(string $s): string {
|
||||
if("" === $s) {
|
||||
@ -74,7 +74,7 @@ class ThrowsBlockAdditionTest extends FileManipulationTestCase
|
||||
'<?php
|
||||
/**
|
||||
* @throws InvalidArgumentException|DomainException
|
||||
* @throws \Exception
|
||||
* @throws Exception
|
||||
*/
|
||||
function foo(string $s): string {
|
||||
if("" === $s) {
|
||||
@ -103,7 +103,7 @@ class ThrowsBlockAdditionTest extends FileManipulationTestCase
|
||||
'<?php
|
||||
/**
|
||||
* @throws InvalidArgumentException
|
||||
* @throws \DomainException
|
||||
* @throws DomainException
|
||||
*/
|
||||
function foo(string $s): string {
|
||||
if("" === $s) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user