1
|
|
|
<?php |
2
|
|
|
namespace Doctrine\Common\Reflection; |
3
|
|
|
|
4
|
|
|
use Doctrine\Common\Proxy\Proxy; |
|
|
|
|
5
|
|
|
use ReflectionProperty; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* PHP Runtime Reflection Public Property - special overrides for public properties. |
9
|
|
|
* |
10
|
|
|
* @author Marco Pivetta <[email protected]> |
11
|
|
|
* @since 2.4 |
12
|
|
|
*/ |
13
|
|
|
class RuntimePublicReflectionProperty extends ReflectionProperty |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* {@inheritDoc} |
17
|
|
|
* |
18
|
|
|
* Checks is the value actually exist before fetching it. |
19
|
|
|
* This is to avoid calling `__get` on the provided $object if it |
20
|
|
|
* is a {@see \Doctrine\Common\Proxy\Proxy}. |
21
|
|
|
*/ |
22
|
|
|
public function getValue($object = null) |
23
|
|
|
{ |
24
|
|
|
$name = $this->getName(); |
25
|
|
|
|
26
|
|
|
if ($object instanceof Proxy && ! $object->__isInitialized()) { |
27
|
|
|
$originalInitializer = $object->__getInitializer(); |
28
|
|
|
$object->__setInitializer(null); |
29
|
|
|
$val = isset($object->$name) ? $object->$name : null; |
30
|
|
|
$object->__setInitializer($originalInitializer); |
31
|
|
|
|
32
|
|
|
return $val; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
return isset($object->$name) ? parent::getValue($object) : null; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* {@inheritDoc} |
40
|
|
|
* |
41
|
|
|
* Avoids triggering lazy loading via `__set` if the provided object |
42
|
|
|
* is a {@see \Doctrine\Common\Proxy\Proxy}. |
43
|
|
|
* @link https://bugs.php.net/bug.php?id=63463 |
44
|
|
|
*/ |
45
|
|
|
public function setValue($object, $value = null) |
46
|
|
|
{ |
47
|
|
|
if ( ! ($object instanceof Proxy && ! $object->__isInitialized())) { |
48
|
|
|
parent::setValue($object, $value); |
49
|
|
|
|
50
|
|
|
return; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
$originalInitializer = $object->__getInitializer(); |
54
|
|
|
$object->__setInitializer(null); |
55
|
|
|
parent::setValue($object, $value); |
56
|
|
|
$object->__setInitializer($originalInitializer); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths