File tree Expand file tree Collapse file tree 2 files changed +32
-5
lines changed Expand file tree Collapse file tree 2 files changed +32
-5
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,15 @@ public static function test() {
4444 static::who();
4545 }
4646
47- public function getName(): string
48- {
47+ public function getName(): string {
4948 return $this->name;
5049 }
50+
51+ public function create(): self {
52+ return new static();
53+ return new self();
54+ return parent::create();
55+ }
5156}
5257
5358class B extends A {
@@ -86,6 +91,12 @@ public function getName() : string
8691 {
8792 return $this->name;
8893 }
94+ public function create() : self
95+ {
96+ return new static();
97+ return new self();
98+ return parent::create();
99+ }
89100}
90101class B extends \A
91102{
@@ -129,10 +140,15 @@ public static function test() {
129140 static::who();
130141 }
131142
132- public function getName(): string
133- {
143+ public function getName(): string {
134144 return $this->name;
135145 }
146+
147+ public function create(): self {
148+ return new static();
149+ return new self();
150+ return parent::create();
151+ }
136152 }
137153
138154 class B extends A {
@@ -175,6 +191,12 @@ public function getName() : string
175191 {
176192 return $this->name;
177193 }
194+ public function create() : self
195+ {
196+ return new static();
197+ return new self();
198+ return parent::create();
199+ }
178200 }
179201 class B extends \Humbug\Foo\A
180202 {
Original file line number Diff line number Diff line change @@ -99,7 +99,12 @@ private function prefixName(Name $name): Node
9999 return $ name ;
100100 }
101101
102- if (($ parentNode instanceof FuncCall || $ parentNode instanceof StaticCall || $ parentNode instanceof ClassConstFetch)
102+ if ((
103+ $ parentNode instanceof FuncCall
104+ || $ parentNode instanceof StaticCall
105+ || $ parentNode instanceof ClassConstFetch
106+ || $ parentNode instanceof New_
107+ )
103108 && in_array ((string ) $ name , self ::PHP_FUNCTION_KEYWORDS )
104109 ) {
105110 return $ name ;
You can’t perform that action at this time.
0 commit comments