mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Prevent false-positive for Exception::__toString overriding
This commit is contained in:
parent
0c582e9993
commit
cb94764d22
@ -60,9 +60,10 @@ interface Throwable
|
||||
public function getTraceAsString() : string;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @psalm-taint-source input
|
||||
*/
|
||||
public function __toString() : string;
|
||||
public function __toString();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -137,9 +138,10 @@ class Exception implements Throwable
|
||||
public final function getTraceAsString() : string {}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @psalm-taint-source input
|
||||
*/
|
||||
public function __toString() : string {}
|
||||
public function __toString() {}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -212,7 +214,8 @@ class Error implements Throwable
|
||||
public final function getTraceAsString() : string {}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @psalm-taint-source input
|
||||
*/
|
||||
public function __toString() : string {}
|
||||
public function __toString() {}
|
||||
}
|
||||
|
@ -791,6 +791,25 @@ class MethodSignatureTest extends TestCase
|
||||
public function getPrevious(): ?\Throwable;
|
||||
public function getTraceAsString(): string;
|
||||
}'
|
||||
],
|
||||
'allowExecptionToStringWithNoType' => [
|
||||
'<?php
|
||||
class E extends Exception {
|
||||
public function __toString() {
|
||||
return "hello";
|
||||
}
|
||||
}'
|
||||
],
|
||||
'allowExecptionToStringIn71' => [
|
||||
'<?php
|
||||
class E extends Exception {
|
||||
public function __toString() : string {
|
||||
return "hello";
|
||||
}
|
||||
}',
|
||||
[],
|
||||
[],
|
||||
'7.1'
|
||||
]
|
||||
];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user