1 | <?php |
||
20 | class QRCodeTest extends \PHPUnit_Framework_TestCase{ |
||
21 | |||
22 | /** |
||
23 | * @var \chillerlan\QRCode\QROptions |
||
24 | */ |
||
25 | protected $options; |
||
26 | |||
27 | /** |
||
28 | * @var \chillerlan\QRCode\Output\QROutputInterface |
||
29 | */ |
||
30 | protected $output; |
||
31 | |||
32 | /** |
||
33 | * @var \ReflectionClass |
||
34 | */ |
||
35 | protected $reflectionClass; |
||
36 | |||
37 | protected function setUp(){ |
||
42 | |||
43 | public function testInstance(){ |
||
48 | |||
49 | public function stringDataProvider(){ |
||
57 | |||
58 | /** |
||
59 | * @dataProvider stringDataProvider |
||
60 | */ |
||
61 | public function testDataCoverage($data){ |
||
64 | |||
65 | /** |
||
66 | * @dataProvider stringDataProvider |
||
67 | */ |
||
68 | public function testTypeAndErrorcorrectlevelCoverage($data){ |
||
77 | |||
78 | /** |
||
79 | * @dataProvider stringDataProvider |
||
80 | */ |
||
81 | public function testTypeAutoOverride($data){ |
||
85 | |||
86 | |||
87 | public function getTypeNumberDataProvider(){ |
||
107 | |||
108 | /** |
||
109 | * @dataProvider getTypeNumberDataProvider |
||
110 | */ |
||
111 | public function testInternalGetTypeNumber($test, $type, $data){ |
||
120 | |||
121 | /** |
||
122 | * @expectedException \chillerlan\QRCode\QRCodeException |
||
123 | * @expectedExceptionMessage No data given. |
||
124 | */ |
||
125 | public function testNoDataException(){ |
||
128 | |||
129 | /** |
||
130 | * @expectedException \chillerlan\QRCode\QRCodeException |
||
131 | * @expectedExceptionMessage Invalid error correct level: 42 |
||
132 | */ |
||
133 | public function testErrorCorrectLevelException(){ |
||
137 | |||
138 | /** |
||
139 | * @expectedException \chillerlan\QRCode\QRCodeException |
||
140 | * @expectedExceptionMessage code length overflow. (261 > 72bit) |
||
141 | */ |
||
142 | public function testCodeLengthOverflowException(){ |
||
149 | |||
150 | } |
||
151 |
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
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. 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.