mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 10:07:12 +00:00
Fix Relative class names are not converted to fully-qualified class names (FQCNs) (#1005)
* Fix https://github.com/barryvdh/laravel-ide-helper/issues/627 * Fix codestyle * Init * composer fix-style * Actualize * Fix * normalize composer.json * Fix * composer fix-style * Replace NamespaceUses with UsesResolver * Add UsesResolver tests * Add MethodTest::testClassAliases * Fix code style * Get rid of laravel support helpers * Make class UsesResolver stateless, update tests for it * composer fix-style Co-authored-by: Andrii Savluk <[email protected]> Co-authored-by: laravel-ide-helper <[email protected]> Co-authored-by: SavKS <[email protected]> Co-authored-by: Taras Fomin <[email protected]>
This commit is contained in:
co-authored by
Andrii Savluk
laravel-ide-helper
SavKS
Taras Fomin
parent
6c4dcd9049
commit
c5e18beff1
@@ -97,6 +97,37 @@ DOC;
|
||||
$this->assertSame('$chars = \'$\\\'\\\\\'', $method->getParamsWithDefault(true));
|
||||
$this->assertSame(['$chars = \'$\\\'\\\\\''], $method->getParamsWithDefault(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the output of a class when using class aliases for it
|
||||
*/
|
||||
public function testClassAliases()
|
||||
{
|
||||
$reflectionClass = new \ReflectionClass(ExampleClass::class);
|
||||
$reflectionMethod = $reflectionClass->getMethod('getApplication');
|
||||
|
||||
$method = new Method($reflectionMethod, 'Example', $reflectionClass, null, [], [
|
||||
'Application' => '\\Illuminate\\Foundation\\Application',
|
||||
]);
|
||||
|
||||
$output = <<<'DOC'
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return \Illuminate\Foundation\Application
|
||||
* @static
|
||||
*/
|
||||
DOC;
|
||||
|
||||
$this->assertSame($output, $method->getDocComment(''));
|
||||
$this->assertSame('getApplication', $method->getName());
|
||||
$this->assertSame('\\' . ExampleClass::class, $method->getDeclaringClass());
|
||||
$this->assertSame('', $method->getParams(true));
|
||||
$this->assertSame([], $method->getParams(false));
|
||||
$this->assertSame('', $method->getParamsWithDefault(true));
|
||||
$this->assertSame([], $method->getParamsWithDefault(false));
|
||||
$this->assertTrue($method->shouldReturn());
|
||||
}
|
||||
}
|
||||
|
||||
class ExampleClass
|
||||
@@ -115,4 +146,12 @@ class ExampleClass
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Application
|
||||
*/
|
||||
public function getApplication()
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user