Symfony.Object.ObjectInstantiation.Invalid does not seem to be working for me when the class is in the form of a variable.
For example, I have a class that instantiates with $class as a string.
abstract class AbstractClass
{
/** @var string */
protected $class;
public function __construct($class)
{
$this->class = $class;
}
public function create()
{
return new $this->class();
}
}
Historically, I would have just done return new $this->class; but due to this rule, I try to add () to it, but it's still returning an error.
Symfony.Object.ObjectInstantiation.Invalid does not seem to be working for me when the class is in the form of a variable.
For example, I have a class that instantiates with
$class
as a string.Historically, I would have just done
return new $this->class;
but due to this rule, I try to add()
to it, but it's still returning an error.Is this a bug or am I just not doing this right?