protected function createSetter($name, Type $type, $namespace)
    {
        return new Stmt\ClassMethod(
            // setProperty
            $this->getNaming()->getPrefixedMethodName('set', $name),
            [
                // public function
                'type' => Stmt\Class_::MODIFIER_PUBLIC,
                // ($property)
                'params' => [
                    new Param($this->getNaming()->getPropertyName($name), new Expr\ConstFetch(new Name('null')), $type->getTypeHint($namespace)),
                ],
                'stmts' => [
                    // $this->property = $property;
                    new Expr\Assign(
                        new Expr\PropertyFetch(
                            new Expr\Variable('this'),
                            $this->getNaming()->getPropertyName($name)
                        ), new Expr\Variable($this->getNaming()->getPropertyName($name))
                    ),
                    // return $this;
                    new Stmt\Return_(new Expr\Variable('this')),
                ],
            ], [
                'comments' => [$this->createSetterDoc($name, $type, $namespace)],
            ]
        );
    }
protected function createSetter($name, Type $type, $namespace)
    {
        return new Stmt\ClassMethod(
            // setProperty
            $this->getNaming()->getPrefixedMethodName('set', $name),
            [
                // public function
                'type' => Stmt\Class_::MODIFIER_PUBLIC,
                // ($property)
                'params' => [
                    new Param($this->getNaming()->getPropertyName($name), new Expr\ConstFetch(new Name('null')), $type->getTypeHint($namespace)),
                ],
                'stmts' => [
                    // $this->property = $property;
                    new Expr\Assign(
                        new Expr\PropertyFetch(
                            new Expr\Variable('this'),
                            $this->getNaming()->getPropertyName($name)
                        ), new Expr\Variable($this->getNaming()->getPropertyName($name))
                    ),
                    // return $this;
                    new Stmt\Return_(new Expr\Variable('this')),
                ],
            ], [
                'comments' => [$this->createSetterDoc($name, $type, $namespace)],
            ]
        );
    }
protected function createSetter ( $ name , Type $ type , $ namespace ) { return new Stmt \ ClassMethod ( // setProperty $ this -> getNaming ( ) -> getPrefixedMethodName ( 'set' , $ name ) , [ // public function 'type' => Stmt \ Class_ :: MODIFIER_PUBLIC , // ($property) 'params' => [ new Param ( $ this -> getNaming ( ) -> getPropertyName ( $ name ) , new Expr \ ConstFetch ( new Name ( 'null' ) ) , $ type -> getTypeHint ( $ namespace ) ) , ] , 'stmts' => [ // $this->property = $property; new Expr \ Assign ( new Expr \ PropertyFetch ( new Expr \ Variable ( 'this' ) , $ this -> getNaming ( ) -> getPropertyName ( $ name ) ) , new Expr \ Variable ( $ this -> getNaming ( ) -> getPropertyName ( $ name ) ) ) , // return $this; new Stmt \ Return_ ( new Expr \ Variable ( 'this' ) ) , ] , ] , [ 'comments' => [ $ this -> createSetterDoc ( $ name , $ type , $ namespace ) ] , ] ) ; }
Create set method.

@param $name
@param Type $type
@param string $namespace

@return Stmt\ClassMethod
Create set method .