mirror of
https://github.com/danog/psalm.git
synced 2024-11-29 20:28:59 +01:00
Create new InvalidMethodCall issue for calling methods on non-objects
This commit is contained in:
parent
7d17a07cd2
commit
b3a454cf5b
@ -104,6 +104,7 @@
|
||||
<xs:element name="InvalidFunctionCall" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="InvalidGlobal" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="InvalidIterator" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="InvalidMethodCall" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="InvalidOperand" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="InvalidPropertyAssignment" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="InvalidPropertyFetch" type="IssueHandlerType" minOccurs="0" />
|
||||
|
@ -21,6 +21,7 @@ use Psalm\Issue\ForbiddenCode;
|
||||
use Psalm\Issue\ImplicitToStringCast;
|
||||
use Psalm\Issue\InvalidArgument;
|
||||
use Psalm\Issue\InvalidFunctionCall;
|
||||
use Psalm\Issue\InvalidMethodCall;
|
||||
use Psalm\Issue\InvalidScalarArgument;
|
||||
use Psalm\Issue\InvalidScope;
|
||||
use Psalm\Issue\MixedArgument;
|
||||
@ -674,7 +675,7 @@ class CallChecker
|
||||
case 'Psalm\\Type\\Atomic\\TString':
|
||||
case 'Psalm\\Type\\Atomic\\TNumericString':
|
||||
if (IssueBuffer::accepts(
|
||||
new InvalidArgument(
|
||||
new InvalidMethodCall(
|
||||
'Cannot call method ' . $stmt->name . ' on ' . $class_type . ' variable ' . $var_id,
|
||||
new CodeLocation($statements_checker->getSource(), $stmt)
|
||||
),
|
||||
|
6
src/Psalm/Issue/InvalidMethodCall.php
Normal file
6
src/Psalm/Issue/InvalidMethodCall.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
namespace Psalm\Issue;
|
||||
|
||||
class InvalidMethodCall extends CodeError
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue
Block a user