| 1 | <?php |
||
| 17 | class Input |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * The process input. |
||
| 21 | * |
||
| 22 | * @var null|string|resource |
||
| 23 | */ |
||
| 24 | private $processInput; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * The PostScript code. |
||
| 28 | * |
||
| 29 | * @var null|string |
||
| 30 | */ |
||
| 31 | private $postScriptCode; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * The files. |
||
| 35 | * |
||
| 36 | * @var null|string[] |
||
| 37 | */ |
||
| 38 | private $files; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Get process input. |
||
| 42 | * |
||
| 43 | * @return null|string|resource |
||
| 44 | */ |
||
| 45 | 4 | public function getProcessInput() |
|
| 49 | |||
| 50 | /** |
||
| 51 | * Set process input. |
||
| 52 | * |
||
| 53 | * @param mixed $processInput |
||
| 54 | * |
||
| 55 | * @throws \InvalidArgumentException |
||
| 56 | * |
||
| 57 | * @return $this |
||
| 58 | */ |
||
| 59 | 2 | public function setProcessInput($processInput) |
|
| 65 | |||
| 66 | /** |
||
| 67 | * Get PostScript code. |
||
| 68 | * |
||
| 69 | * @return null|string |
||
| 70 | */ |
||
| 71 | 4 | public function getPostScriptCode() |
|
| 75 | |||
| 76 | /** |
||
| 77 | * Set PostScript code. |
||
| 78 | * |
||
| 79 | * @param null|string $postScriptCode |
||
| 80 | * |
||
| 81 | * @return $this |
||
| 82 | */ |
||
| 83 | 2 | public function setPostScriptCode($postScriptCode) |
|
| 89 | |||
| 90 | /** |
||
| 91 | * Get files. |
||
| 92 | * |
||
| 93 | * @return string[] |
||
| 94 | */ |
||
| 95 | 4 | public function getFiles() |
|
| 103 | |||
| 104 | /** |
||
| 105 | * Add file. |
||
| 106 | * |
||
| 107 | * @param string $file |
||
| 108 | * |
||
| 109 | * @return $this |
||
| 110 | */ |
||
| 111 | 2 | public function addFile($file) |
|
| 112 | { |
||
| 113 | 2 | if (null === $this->files) { |
|
| 114 | 2 | $this->files = []; |
|
| 115 | 1 | } |
|
| 116 | |||
| 117 | 2 | $this->files[] = $file; |
|
| 118 | |||
| 119 | 2 | return $this; |
|
| 120 | } |
||
| 121 | |||
| 122 | /** |
||
| 123 | * Set files. |
||
| 124 | * |
||
| 125 | * @param string[] $files |
||
| 126 | * |
||
| 127 | * @return $this |
||
| 128 | */ |
||
| 129 | 2 | public function setFiles(array $files) |
|
| 135 | } |
||
| 136 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountIdthat can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theidproperty of an instance of theAccountclass. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.