The property Chubbyphp\Serialization\...ContextBuilder::$groups has been deprecated.
This property has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the property will be
removed from the class and what other property to use instead.
The return type of return $this; (Chubbyphp\Serialization\...ormalizerContextBuilder) is incompatible with the return type declared by the interface Chubbyphp\Serialization\...derInterface::setGroups of type self.
If you return a value from a function or method, it should be a sub-type of the
type that is given by the parent type f.e. an interface, or abstract method.
This is more formally defined by the
Lizkov substitution principle,
and guarantees that classes that depend on the parent type can use any instance
of a child type interchangably. This principle also belongs to the
SOLID principles
for object oriented design.
Our function my_function expects a Post object, and outputs the author
of the post. The base class Post returns a simple string and outputting a
simple string will work just fine. However, the child class BlogPost which
is a sub-type of Post instead decided to return an object, and is
therefore violating the SOLID principles. If a BlogPost were passed to
my_function, PHP would not complain, but ultimately fail when executing the
strtoupper call in its body.
Loading history...
52
}
53
54
/**
55
* @param array $attributes
56
*
57
* @return NormalizerContextBuilderInterface
58
*/
59
1
public function setAttributes(array $attributes): NormalizerContextBuilderInterface
60
{
61
1
$this->attributes = $attributes;
62
63
1
return $this;
64
}
65
66
/**
67
* @param ServerRequestInterface|null $request
68
*
69
* @return NormalizerContextBuilderInterface
70
*/
71
2
public function setRequest(ServerRequestInterface $request = null): NormalizerContextBuilderInterface
The return type of return $this; (Chubbyphp\Serialization\...ormalizerContextBuilder) is incompatible with the return type declared by the interface Chubbyphp\Serialization\...erInterface::setRequest of type self.
If you return a value from a function or method, it should be a sub-type of the
type that is given by the parent type f.e. an interface, or abstract method.
This is more formally defined by the
Lizkov substitution principle,
and guarantees that classes that depend on the parent type can use any instance
of a child type interchangably. This principle also belongs to the
SOLID principles
for object oriented design.
Our function my_function expects a Post object, and outputs the author
of the post. The base class Post returns a simple string and outputting a
simple string will work just fine. However, the child class BlogPost which
is a sub-type of Post instead decided to return an object, and is
therefore violating the SOLID principles. If a BlogPost were passed to
my_function, PHP would not complain, but ultimately fail when executing the
strtoupper call in its body.
Loading history...
76
}
77
78
/**
79
* @return NormalizerContextInterface
80
*/
81
3
public function getContext(): NormalizerContextInterface
82
{
83
3
return new NormalizerContext($this->groups, $this->request, $this->attributes);
The property Chubbyphp\Serialization\...ContextBuilder::$groups has been deprecated.
This property has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the property will be
removed from the class and what other property to use instead.
This property has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.