mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix #2890 - phpstorm.meta.php scanner should be insensitive to method names
This commit is contained in:
parent
f44c3488eb
commit
2e6fe993a8
@ -83,7 +83,7 @@ class PhpStormMetaScanner
|
|||||||
) {
|
) {
|
||||||
$meta_fq_classlike_name = implode('\\', $identifier->class->parts);
|
$meta_fq_classlike_name = implode('\\', $identifier->class->parts);
|
||||||
|
|
||||||
$meta_method_name = $identifier->name->name;
|
$meta_method_name = strtolower($identifier->name->name);
|
||||||
|
|
||||||
if ($map) {
|
if ($map) {
|
||||||
$offset = $identifier->args[0]->value->value;
|
$offset = $identifier->args[0]->value->value;
|
||||||
|
@ -75,7 +75,9 @@ class StubTest extends TestCase
|
|||||||
Config::loadFromXML(
|
Config::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -97,7 +99,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -144,7 +148,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<stubs>
|
<stubs>
|
||||||
<file name="./tests/../tests/fixtures/stubs/systemclass.php" />
|
<file name="./tests/../tests/fixtures/stubs/systemclass.php" />
|
||||||
</stubs>
|
</stubs>
|
||||||
@ -166,7 +172,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
$runDir,
|
$runDir,
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<stubs>
|
<stubs>
|
||||||
<file name="' . $runDir . '/tests/fixtures/stubs/systemclass.php" />
|
<file name="' . $runDir . '/tests/fixtures/stubs/systemclass.php" />
|
||||||
</stubs>
|
</stubs>
|
||||||
@ -187,7 +195,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -224,7 +234,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -283,19 +295,19 @@ class StubTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
function bar(array $a) {}
|
function bar(array $a) {}
|
||||||
|
|
||||||
$a1 = (new \Ns\MyClass)->create("object");
|
$a1 = (new \Ns\MyClass)->creAte("object");
|
||||||
$a2 = (new \Ns\MyClass)->create("exception");
|
$a2 = (new \Ns\MyClass)->creaTe("exception");
|
||||||
|
|
||||||
$b1 = \create("object");
|
$b1 = \Create("object");
|
||||||
$b2 = \create("exception");
|
$b2 = \cReate("exception");
|
||||||
|
|
||||||
$e2 = \create(\LogicException::class);
|
$e2 = \creAte(\LogicException::class);
|
||||||
|
|
||||||
$c1 = (new \Ns\MyClass)->foo(5);
|
$c1 = (new \Ns\MyClass)->foo(5);
|
||||||
$c2 = (new \Ns\MyClass)->bar(["hello"]);
|
$c2 = (new \Ns\MyClass)->bar(["hello"]);
|
||||||
|
|
||||||
$d1 = \foo(5);
|
$d1 = \foO(5);
|
||||||
$d2 = \bar(["hello"]);
|
$d2 = \baR(["hello"]);
|
||||||
}'
|
}'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -312,7 +324,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -350,7 +364,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -382,7 +398,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -416,7 +434,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -450,7 +470,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -573,7 +595,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -606,7 +630,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -642,7 +668,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -670,7 +698,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -702,7 +732,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -734,7 +766,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -782,7 +816,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -814,7 +850,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -863,7 +901,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -901,7 +941,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -947,7 +989,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
@ -989,7 +1033,9 @@ class StubTest extends TestCase
|
|||||||
TestConfig::loadFromXML(
|
TestConfig::loadFromXML(
|
||||||
dirname(__DIR__),
|
dirname(__DIR__),
|
||||||
'<?xml version="1.0"?>
|
'<?xml version="1.0"?>
|
||||||
<psalm>
|
<psalm
|
||||||
|
errorLevel="1"
|
||||||
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<directory name="src" />
|
<directory name="src" />
|
||||||
</projectFiles>
|
</projectFiles>
|
||||||
|
6
tests/fixtures/stubs/phpstorm.meta.php
vendored
6
tests/fixtures/stubs/phpstorm.meta.php
vendored
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace PHPSTORM_META {
|
namespace PHPSTORM_META {
|
||||||
|
|
||||||
override(\Ns\MyClass::create(0), map([
|
override(\Ns\MyClass::crEate(0), map([
|
||||||
'' => '@',
|
'' => '@',
|
||||||
'exception' => \Exception::class,
|
'exception' => \Exception::class,
|
||||||
'object' => \stdClass::class,
|
'object' => \stdClass::class,
|
||||||
@ -12,8 +12,8 @@ namespace PHPSTORM_META {
|
|||||||
'object' => \stdClass::class,
|
'object' => \stdClass::class,
|
||||||
]));
|
]));
|
||||||
|
|
||||||
override(\Ns\MyClass::foo(0), type(0));
|
override(\Ns\MyClass::foO(0), type(0));
|
||||||
override(\Ns\MyClass::bar(0), elementType(0));
|
override(\Ns\MyClass::Bar(0), elementType(0));
|
||||||
override(\foo(0), type(0));
|
override(\foo(0), type(0));
|
||||||
override(\bar(0), elementType(0));
|
override(\bar(0), elementType(0));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user