This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
$DeviceEntities does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).
This check examines a number of code elements and verifies that they conform
to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties,
methods, parameters, interfaces, classes, exceptions and special methods.
Should the return type not be array<string,\Famoser\Sy...Property|ArrayProperty>?
This check compares the return type specified in the @return annotation of a function
or method doc comment with the types returned by the function and raises an issue if they
mismatch.
Loading history...
32
*/
33
3
public function getJsonProperties()
34
{
35
3
$arr = parent::getJsonProperties();
36
3
$arr['DeviceEntities'] = new ArrayProperty(
37
3
'DeviceEntities',
38
3
new ObjectProperty('DeviceEntities', new DeviceCommunicationEntity())
The expression return $arr; seems to be an array, but some of its elements' types (Famoser\SyncApi\Framewor...on\Models\ArrayProperty) are incompatible with the return type of the parent method Famoser\SyncApi\Models\C...uest::getJsonProperties of type array<string,Famoser\Syn...on\Models\TextProperty>.
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.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.