File tree Expand file tree Collapse file tree 5 files changed +8
-12
lines changed
Expand file tree Collapse file tree 5 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -289,7 +289,7 @@ public function addMember($member): self
289289 if ($ this ->type === self ::TYPE_INTERFACE ) {
290290 $ member ->setBody (null );
291291 }
292- $ this ->methods [$ member ->getName ()] = $ member-> setNamespace ( $ this -> namespace ) ;
292+ $ this ->methods [$ member ->getName ()] = $ member ;
293293
294294 } elseif ($ member instanceof Property) {
295295 $ this ->properties [$ member ->getName ()] = $ member ;
@@ -411,7 +411,7 @@ public function setMethods(array $methods): self
411411 if (!$ v instanceof Method) {
412412 throw new Nette \InvalidArgumentException ('Argument must be Nette\PhpGenerator\Method[]. ' );
413413 }
414- $ this ->methods [$ v ->getName ()] = $ v-> setNamespace ( $ this -> namespace ) ;
414+ $ this ->methods [$ v ->getName ()] = $ v ;
415415 }
416416 return $ this ;
417417 }
@@ -437,7 +437,7 @@ public function getMethod(string $name): Method
437437
438438 public function addMethod (string $ name ): Method
439439 {
440- $ method = ( new Method ($ name))-> setNamespace ( $ this -> namespace );
440+ $ method = new Method ($ name );
441441 if ($ this ->type === self ::TYPE_INTERFACE ) {
442442 $ method ->setBody (null );
443443 } else {
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public function fromClassReflection(\ReflectionClass $from): ClassType
5050 $ class ->setProperties ($ props );
5151 foreach ($ from ->getMethods () as $ method ) {
5252 if ($ method ->getDeclaringClass ()->getName () === $ from ->getName ()) {
53- $ methods [] = $ this ->fromMethodReflection ($ method )-> setNamespace ( $ class -> getNamespace ()) ;
53+ $ methods [] = $ this ->fromMethodReflection ($ method );
5454 }
5555 }
5656 $ class ->setMethods ($ methods );
Original file line number Diff line number Diff line change @@ -35,6 +35,6 @@ public static function from(string $function): self
3535
3636 public function __toString (): string
3737 {
38- return (new Printer )->printFunction ($ this , $ this -> namespace );
38+ return (new Printer )->printFunction ($ this );
3939 }
4040}
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public static function from($method): self
5050
5151 public function __toString (): string
5252 {
53- return (new Printer )->printMethod ($ this , $ this -> namespace );
53+ return (new Printer )->printMethod ($ this );
5454 }
5555
5656
Original file line number Diff line number Diff line change 1212use Nette ;
1313use Nette \PhpGenerator \Helpers ;
1414use Nette \PhpGenerator \Parameter ;
15- use Nette \PhpGenerator \PhpNamespace ;
1615
1716
1817/**
@@ -38,9 +37,6 @@ trait FunctionLike
3837 /** @var bool */
3938 private $ returnNullable = false ;
4039
41- /** @var PhpNamespace|null */
42- private $ namespace ;
43-
4440
4541 /**
4642 * @return static
@@ -183,11 +179,11 @@ public function getReturnNullable(): bool
183179
184180
185181 /**
186- * @return static
182+ * @deprecated
187183 */
188184 public function setNamespace (PhpNamespace $ val = null ): self
189185 {
190- $ this -> namespace = $ val ;
186+ trigger_error ( __METHOD__ . ' () is deprecated ' , E_USER_DEPRECATED ) ;
191187 return $ this ;
192188 }
193189}
You can’t perform that action at this time.
0 commit comments