1 | <?php |
||
2 | /** |
||
3 | * This file is part of graze/unicontroller-client. |
||
4 | * |
||
5 | * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com> |
||
6 | * |
||
7 | * For the full copyright and license information, please view the LICENSE |
||
8 | * file that was distributed with this source code. |
||
9 | * |
||
10 | * @license https://github.com/graze/unicontroller-client/blob/master/LICENSE.md |
||
11 | * @link https://github.com/graze/unicontroller-client |
||
12 | */ |
||
13 | namespace Graze\UnicontrollerClient\Parser\Parser; |
||
14 | |||
15 | use Graze\UnicontrollerClient\Parser\Parser\AbstractParser; |
||
16 | use Graze\UnicontrollerClient\Parser\Parser\ParserInterface; |
||
17 | use Graze\UnicontrollerClient\Entity\Entity\EntityVarPrompt; |
||
18 | |||
19 | class ParserVarPrompt extends AbstractParser implements ParserInterface |
||
20 | { |
||
21 | /** |
||
22 | * @return [] |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
23 | */ |
||
24 | 1 | protected function getProperties() |
|
25 | { |
||
26 | return [ |
||
27 | 1 | 'name', |
|
28 | 1 | 'prompt', |
|
29 | 1 | 'length', |
|
30 | 1 | 'inputType', |
|
31 | 1 | 'jumpSpecial', |
|
32 | 1 | 'cPadding', |
|
33 | 'mask' |
||
34 | 1 | ]; |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * @return EntityVarPrompt |
||
39 | */ |
||
40 | 1 | protected function getEntity() |
|
41 | { |
||
42 | 1 | return new EntityVarPrompt(); |
|
0 ignored issues
–
show
The expression
return new Graze\Unicont...ntity\EntityVarPrompt() returns the type Graze\UnicontrollerClien...\Entity\EntityVarPrompt which is incompatible with the return type mandated by Graze\UnicontrollerClien...ractParser::getEntity() of Graze\UnicontrollerClien...\Entity\EntityInterface .
In the issue above, the returned value is violating the contract defined by the mentioned interface. Let's take a look at an example: interface HasName {
/** @return string */
public function getName();
}
class Name {
public $name;
}
class User implements HasName {
/** @return string|Name */
public function getName() {
return new Name('foo'); // This is a violation of the ``HasName`` interface
// which only allows a string value to be returned.
}
}
![]() |
|||
43 | } |
||
44 | } |
||
45 |