php-getter-setter.vim icon indicating copy to clipboard operation
php-getter-setter.vim copied to clipboard

Getters and setters are not generated where they should

Open BAD-WOLF opened this issue 1 year ago • 0 comments

If there is any content below the vavariable, getters and setters will be generated above the selected block or line and not below at the end of the class even with zero being assigned to "b:phpgetset_insertPosition"

This is my code

<?php
namespace Pessoa;

abstract class Pessoa{

    protected string $nome;
    protected int    $idade;
    protected string $sexo;

    public function __construct(string $nome, int $idade, string $sexo) {
        $this->nome  = $nome;
        $this->idade = $idade;
        $this->sexo  = $sexo;
    }

   /*
    public function __call($name, $arguments): string|int|null {
        $prefix = substr($name, 0, 3);
        $var    = lcfirst(substr($name, 3));
        if ($prefix == "get") {
            return $this->$var;
        }elseif ($prefix == "set") {
            $this->$var = $arguments;
        }
    */

}

?>

Here, as you can see, I have a commented code below the variables, that's why the getters and setters were generated above the variables I did the test to see if this happened only because of the comment, I deleted only the comment and the getters and setters were generated below the construct

BAD-WOLF avatar May 22 '23 20:05 BAD-WOLF