Skip to content

Commit 8e8dd2e

Browse files
committed
changed var, props and methods FQCN displaying
1 parent 9f4d1cf commit 8e8dd2e

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/Complete/Completer/ObjectCompleter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function createEntryForMethod(MethodData $method){
6868
}
6969

7070
protected function createEntryForProperty(ClassProperty $prop){
71-
$type = $prop->type instanceof FQCN ? $prop->type->toString() : 'mixed';
71+
$type = $prop->type instanceof FQCN ? $prop->type->getClassName() : 'mixed';
7272
return new Entry(
7373
$prop->name,
7474
$type

src/Complete/Completer/VarCompleter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Entity\Project;
88
use Entity\Node\Variable;
99
use Entity\Completion\Entry;
10+
use Entity\FQCN;
1011

1112
class VarCompleter implements CompleterInterface
1213
{
@@ -17,8 +18,12 @@ public function getEntries(Project $project, Context $context)
1718

1819
protected function createEntry(Variable $var)
1920
{
21+
$type = $var->getType() instanceof FQCN ?
22+
$var->getType()->toString() :
23+
$var->getType();
2024
return new Entry(
21-
$var->getName()
25+
$var->getName(),
26+
$type
2227
);
2328
}
2429
}

src/Entity/Node/MethodData.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,14 @@ public function addParam(MethodParam $param){
3535
public function getParamsStr(){
3636
$paramsStr = [];
3737
foreach($this->arguments as $argument){
38+
/** @var MethodParam $argument */
3839
$curParam = [];
3940
if($argument->getType()){
40-
$curParam[] = $argument->getType();
41+
if ($argument->getType() instanceof FQCN) {
42+
$curParam[] = $argument->getType()->getClassName();
43+
} else {
44+
$curParam[] = $argument->getType();
45+
}
4146
}
4247
$curParam[] = sprintf("$%s", $argument->getName());
4348
$paramsStr[] = implode(" ", $curParam);
@@ -46,7 +51,7 @@ public function getParamsStr(){
4651
}
4752
public function getReturnStr(){
4853
if($this->return instanceof FQCN){
49-
return $this->return->toString();
54+
return $this->return->getClassName();
5055
}
5156
return "mixed";
5257
}

0 commit comments

Comments
 (0)