diff --git a/reference/reflection/reflectionproperty/gethook.xml b/reference/reflection/reflectionproperty/gethook.xml index a71a0149cf..ba86e033a2 100644 --- a/reference/reflection/reflectionproperty/gethook.xml +++ b/reference/reflection/reflectionproperty/gethook.xml @@ -1,5 +1,5 @@ - + @@ -59,6 +59,18 @@ var_dump($rProp->getHook(PropertyHookType::Set)); ?> ]]> + &example.outputs; + + + string(10) "$name::get" + ["class"]=> + string(7) "Example" +} +NULL +]]> + diff --git a/reference/reflection/reflectionproperty/gethooks.xml b/reference/reflection/reflectionproperty/gethooks.xml index 0e0b62bb92..448fe180b1 100644 --- a/reference/reflection/reflectionproperty/gethooks.xml +++ b/reference/reflection/reflectionproperty/gethooks.xml @@ -1,5 +1,5 @@ - + @@ -59,6 +59,22 @@ var_dump($rProp->getHooks()); ?> ]]> + &example.outputs; + + + object(ReflectionMethod)#3 (2) { + ["name"]=> + string(10) "$name::get" + ["class"]=> + string(7) "Example" + } +} +array(0) { +} +]]> + diff --git a/reference/reflection/reflectionproperty/getrawvalue.xml b/reference/reflection/reflectionproperty/getrawvalue.xml index 81734790b0..dd70009f37 100644 --- a/reference/reflection/reflectionproperty/getrawvalue.xml +++ b/reference/reflection/reflectionproperty/getrawvalue.xml @@ -1,5 +1,5 @@ - + @@ -69,14 +69,24 @@ $rClass = new \ReflectionClass(Example::class); $rProp = $rClass->getProperty('tag'); // Ceci passerait par le hook get, produisant donc "php". -print $example->tag; -print $rProp->getValue($example); +echo $example->tag; +echo "\n"; +echo $rProp->getValue($example); +echo "\n"; // Mais ceci contournerait le hook et produirait "PHP". -print $rProp->setRawValue($example); +echo $rProp->getRawValue($example); ?> ]]> + &example.outputs; + + + diff --git a/reference/reflection/reflectionproperty/getsettabletype.xml b/reference/reflection/reflectionproperty/getsettabletype.xml index 836c327ffe..9ff7b58035 100644 --- a/reference/reflection/reflectionproperty/getsettabletype.xml +++ b/reference/reflection/reflectionproperty/getsettabletype.xml @@ -1,5 +1,5 @@ - + @@ -80,6 +80,18 @@ var_dump($rClass->getProperty('untyped')->getSettableType()); ?> ]]> + &example.outputs; + + + diff --git a/reference/reflection/reflectionproperty/hashook.xml b/reference/reflection/reflectionproperty/hashook.xml index afe515572d..63c3f7ef62 100644 --- a/reference/reflection/reflectionproperty/hashook.xml +++ b/reference/reflection/reflectionproperty/hashook.xml @@ -1,5 +1,5 @@ - + @@ -58,6 +58,13 @@ var_dump($rProp->hasHook(PropertyHookType::Set)); ?> ]]> + &example.outputs; + + + diff --git a/reference/reflection/reflectionproperty/hashooks.xml b/reference/reflection/reflectionproperty/hashooks.xml index ef2e3262e4..a6ed539960 100644 --- a/reference/reflection/reflectionproperty/hashooks.xml +++ b/reference/reflection/reflectionproperty/hashooks.xml @@ -1,5 +1,5 @@ - + @@ -51,6 +51,13 @@ var_dump($rClass->getProperty('none')->hasHooks()); ?> ]]> + &example.outputs; + + + diff --git a/reference/reflection/reflectionproperty/isfinal.xml b/reference/reflection/reflectionproperty/isfinal.xml index 6681bc654d..eb5cc4e194 100644 --- a/reference/reflection/reflectionproperty/isfinal.xml +++ b/reference/reflection/reflectionproperty/isfinal.xml @@ -1,5 +1,5 @@ - + @@ -60,6 +60,14 @@ var_dump($rClass->getProperty('job')->isFinal()); ?> ]]> + &example.outputs; + + + diff --git a/reference/reflection/reflectionproperty/isvirtual.xml b/reference/reflection/reflectionproperty/isvirtual.xml index 93b60fc3fb..9d0e0a3a1a 100644 --- a/reference/reflection/reflectionproperty/isvirtual.xml +++ b/reference/reflection/reflectionproperty/isvirtual.xml @@ -1,5 +1,5 @@ - + @@ -66,6 +66,14 @@ var_dump($rClass->getProperty('job')->isVirtual()); ?> ]]> + &example.outputs; + + + diff --git a/reference/reflection/reflectionproperty/setrawvalue.xml b/reference/reflection/reflectionproperty/setrawvalue.xml index fd3496a363..72f38882ce 100644 --- a/reference/reflection/reflectionproperty/setrawvalue.xml +++ b/reference/reflection/reflectionproperty/setrawvalue.xml @@ -1,5 +1,5 @@ - + @@ -82,13 +82,31 @@ $rProp = $rClass->getProperty('age'); // Ceci passerait par le hook set, et lancerait une exception. $example->age = -2; -$rProp->setValue($example, -2); +try { + $example->age = -2; +} catch (InvalidArgumentException) { + print "InvalidArgumentException for setting property to -2\n"; +} +try { + $rProp->setValue($example, -2); +} catch (InvalidArgumentException) { + print "InvalidArgumentException for using ReflectionProperty::setValue() with -2\n"; +} // Mais cela définirait $age à -2 sans erreur. $rProp->setRawValue($example, -2); +echo $example->age; ?> ]]> + &example.outputs; + + +