1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Add reproducer for stub parent class not being loaded.

This commit is contained in:
AndrolGenhald 2021-12-09 09:22:35 -06:00
parent 39052d9c5e
commit 2f2c24cb4f

View File

@ -212,6 +212,48 @@ class StubTest extends TestCase
$this->analyzeFile($file_path, new Context());
}
public function testStubFileParentClass(): void
{
$this->expectException(CodeException::class);
$this->expectExceptionMessage('ImplementedParamTypeMismatch');
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(
TestConfig::loadFromXML(
dirname(__DIR__),
'<?xml version="1.0"?>
<psalm
errorLevel="1"
>
<projectFiles>
<directory name="src" />
</projectFiles>
<stubs>
<file name="tests/fixtures/stubs/systemclass.phpstub" />
</stubs>
</psalm>'
)
);
$file_path = getcwd() . '/src/somefile.php';
$this->addFile(
$file_path,
'<?php
namespace A\B\C;
class Foo extends \SystemClass
{
public function foo(string $a, string $b): string
{
return $a . $b;
}
}
'
);
$this->analyzeFile($file_path, new Context());
}
public function testPhpStormMetaParsingFile(): void
{
$this->project_analyzer = $this->getProjectAnalyzerWithConfig(