These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * PHPUnit plugin for HiDev |
||
5 | * |
||
6 | * @link https://github.com/hiqdev/hidev-phpunit |
||
7 | * @package hidev-phpunit |
||
8 | * @license BSD-3-Clause |
||
9 | * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/) |
||
10 | */ |
||
11 | |||
12 | namespace hidev\phpunit\tests\unit\controllers; |
||
13 | |||
14 | use hidev\phpunit\controllers\PhpunitConfigController; |
||
15 | |||
16 | /** |
||
17 | * Test for PhpunitConfigController. |
||
18 | */ |
||
19 | class PhpunitConfigControllerTest extends \PHPUnit_Framework_TestCase |
||
20 | { |
||
21 | /** |
||
22 | * @var PhpunitConfigController |
||
23 | */ |
||
24 | protected $object; |
||
25 | |||
26 | protected function setUp() |
||
27 | { |
||
28 | $this->object = new PhpunitConfigController('phpunit.xml.dist', null); |
||
0 ignored issues
–
show
|
|||
29 | } |
||
30 | |||
31 | protected function tearDown() |
||
32 | { |
||
33 | } |
||
34 | |||
35 | public function testInit() |
||
36 | { |
||
37 | $this->assertSame('xml', $this->object->file->type); |
||
0 ignored issues
–
show
The property
file does not exist on object<hidev\phpunit\con...hpunitConfigController> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property.
Loading history...
|
|||
38 | } |
||
39 | } |
||
40 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: