547n00n
547n00n

Reputation: 1536

Symfony 4 : The type hint of parameter is invalid

I'm getting this error when trying to clear cache and composer install in prod server :

!! The type hint of parameter "show" in method "addShow" in class "App\Entity\ !! Type" is invalid.

this is the addShow method :

   public function addShow(Show $show): self
    {
        if (!$this->shows->contains($show)) {
            $this->shows[] = $show;
            $show->setType($this);
        }

        return $this;
    }

Upvotes: 0

Views: 2473

Answers (1)

Rodrigo Medeiros
Rodrigo Medeiros

Reputation: 21

You need to specify class that you passing as parameter.

You can put all path to class to specify the type:

public function addShow(App\Bundle\Show $show): self
 {
     if (!$this->shows->contains($show)) {
         $this->shows[] = $show;
         $show->setType($this);
     }

    return $this;
 }

or add:

use App\Bundle\Show; 

Upvotes: 2

Related Questions