1 | <?php |
||
32 | class ReflectionPropertyFactory extends ReflectorFactory |
||
33 | { |
||
34 | const REFLECTION_OBJECT = ReflectionProperty::class; |
||
35 | |||
36 | /** |
||
37 | * @var PHPNativeReflectionProperty |
||
38 | */ |
||
39 | protected $reflector; |
||
40 | |||
41 | /** |
||
42 | * @var ReflectionProperty |
||
43 | */ |
||
44 | protected $object; |
||
45 | |||
46 | /** |
||
47 | * Returns a new ReflectionPropertyFactory using the given class and |
||
48 | * property names |
||
49 | * |
||
50 | * @param string $class The classname of the property |
||
51 | * @param string $property The property to reflect |
||
52 | * @return ReflectionPropertyFactory |
||
53 | */ |
||
54 | public static function fromName($class, $property) |
||
55 | { |
||
56 | return new static(new PHPNativeReflectionProperty |
||
57 | ( |
||
58 | $class, $property |
||
59 | )); |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * Builds the ReflectionProperty from the provided parameters, |
||
64 | * linking to a parent ReflectionComposite |
||
65 | * |
||
66 | * @param ReflectionCompostite $parent The reflector for the class |
||
67 | * this property belongs to |
||
68 | * @param mixed $default This property's default value |
||
69 | * @return ReflectionProperty |
||
70 | */ |
||
71 | 21 | public function build(ReflectionComposite $parent, $default) |
|
96 | |||
97 | /** |
||
98 | * Sets the property's type by parsing the @type annotation |
||
99 | * |
||
100 | * @param string $name Should be 'var' |
||
101 | * @param string $value The value of the annotation |
||
102 | */ |
||
103 | 21 | protected function setType($name, $value) |
|
111 | |||
112 | /** |
||
113 | * Sets the property's constructor options by parsing the @construct |
||
114 | * annotation |
||
115 | * |
||
116 | * @param string $name Should be 'construct' |
||
117 | * @param string $value The value of the annotation |
||
118 | */ |
||
119 | 20 | protected function setConstruct($name, $value) |
|
178 | } |
||
179 | |||
180 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.