Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b592625

Browse filesBrowse files
committed
Reproducer
1 parent 45d0023 commit b592625
Copy full SHA for b592625

File tree

2 files changed

+38
-0
lines changed
Filter options

2 files changed

+38
-0
lines changed

‎src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\PropertyInfo\Tests\Extractor;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
1516
use Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor;
1617
use Symfony\Component\PropertyInfo\Tests\Fixtures\DefaultValue;
1718
use Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy;
@@ -21,6 +22,8 @@
2122
use Symfony\Component\PropertyInfo\Tests\Fixtures\TraitUsage\DummyUsingTrait;
2223
use Symfony\Component\PropertyInfo\Type;
2324

25+
require_once __DIR__ . '/../Fixtures/Extractor/DummyNamespace.php';
26+
2427
/**
2528
* @author Baptiste Leduc <baptiste.leduc@gmail.com>
2629
*/
@@ -31,9 +34,15 @@ class PhpStanExtractorTest extends TestCase
3134
*/
3235
private $extractor;
3336

37+
/**
38+
* @var PhpDocExtractor
39+
*/
40+
private $phpDocExtractor;
41+
3442
protected function setUp(): void
3543
{
3644
$this->extractor = new PhpStanExtractor();
45+
$this->phpDocExtractor = new PhpDocExtractor();
3746
}
3847

3948
/**
@@ -383,6 +392,15 @@ public function testDummyNamespace()
383392
$this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\DummyNamespace', 'dummy')
384393
);
385394
}
395+
396+
public function testDummyNamespaceWithProperty()
397+
{
398+
$phpStanTypes = $this->extractor->getTypes(\B\Dummy::class, 'property');
399+
$phpDocTypes = $this->phpDocExtractor->getTypes(\B\Dummy::class, 'property');
400+
401+
$this->assertEquals('A\Property', $phpStanTypes[0]->getClassName());
402+
$this->assertEquals($phpDocTypes[0]->getClassName(), $phpStanTypes[0]->getClassName());
403+
}
386404
}
387405

388406
class PhpStanOmittedParamTagTypeDocBlock
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace A {
4+
class Property {
5+
6+
}
7+
8+
class Dummy {
9+
/**
10+
* @var Property
11+
*/
12+
public $property;
13+
}
14+
}
15+
16+
namespace B {
17+
class Dummy extends \A\Dummy {
18+
19+
}
20+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.