B
B
BonBon Slick2019-01-15 13:31:57
phpstorm
BonBon Slick, 2019-01-15 13:31:57

Variable name hints passed to method parameters like in Java?

I noticed that in Java their IDE the name of the variable passed to the method must match the name of the variable in the method, or the IDE will issue a yellow underlined warning.

function test (Class $user){....}


user ($currentUser) // выдаст варнинг что переменаня должна называться $user

How to do this for RnR?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2019-01-15
@402d

/**
     * @param int $id
     * @param string $key
     * @param string $type
     * @param bool $cache
     * @return Entity_car|object
     */
    public function get_by($id = -1, $key = 'id', $type = 'and', $cache = TRUE)
    {
        return parent::get_by($id, $key, $type, $cache);
    }

If you use the documentation, then the
eclipse and the storm will at least prompt.
But for the name of the variable to match the name of the argument for php, it sounds like nonsense.
Although if you delve into the settings of the storm Editor - Inspections, this may be the case.
And there are many additional plugins.
PHP Toolbox, in my opinion, reveals the name of the argument, as a result, the code looks like this
$this->orders_model->get_part(offset:0,count:1000,$where_order);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question