From a204b112652215e604855c6117cebf3102042961 Mon Sep 17 00:00:00 2001 From: Larry Garfield Date: Fri, 13 Dec 2024 22:58:05 -0600 Subject: [PATCH] Make examples generate output. --- .../reflection/reflectionproperty/gethook.xml | 4 ++-- .../reflectionproperty/gethooks.xml | 7 +++---- .../reflectionproperty/getsettabletype.xml | 20 ++++--------------- .../reflection/reflectionproperty/hashook.xml | 4 ++-- .../reflectionproperty/hashooks.xml | 4 ++-- .../reflection/reflectionproperty/isfinal.xml | 7 ++++--- .../reflectionproperty/isprotectedset.xml | 1 - .../reflectionproperty/isvirtual.xml | 6 +++--- 8 files changed, 20 insertions(+), 33 deletions(-) diff --git a/reference/reflection/reflectionproperty/gethook.xml b/reference/reflection/reflectionproperty/gethook.xml index 46f123f669fb..21b9b237c976 100644 --- a/reference/reflection/reflectionproperty/gethook.xml +++ b/reference/reflection/reflectionproperty/gethook.xml @@ -52,8 +52,8 @@ class Example $rClass = new \ReflectionClass(Example::class); $rProp = $rClass->getProperty('name'); -$rProp->getHook(PropertyHookType::Get); // Returns an instance of \ReflectionMethod. -$rProp->getHook(PropertyHookType::Set); // Returns null. +var_dump($rProp->getHook(PropertyHookType::Get)); +var_dump($rProp->getHook(PropertyHookType::Set)); ?> ]]> diff --git a/reference/reflection/reflectionproperty/gethooks.xml b/reference/reflection/reflectionproperty/gethooks.xml index 2173dbfe7164..6c920172962a 100644 --- a/reference/reflection/reflectionproperty/gethooks.xml +++ b/reference/reflection/reflectionproperty/gethooks.xml @@ -48,13 +48,12 @@ class Example } $rClass = new \ReflectionClass(Example::class); + $rProp = $rClass->getProperty('name'); -// Returns ['get' => ReflectionMethod()] -$rProp->getHooks(); +var_dump($rProp->getHooks()); $rProp = $rClass->getProperty('count'); -// Returns [] -$rProp->getHooks(); +var_dump($rProp->getHooks()); ?> ]]> diff --git a/reference/reflection/reflectionproperty/getsettabletype.xml b/reference/reflection/reflectionproperty/getsettabletype.xml index ffb3137b49bf..da625a7d717c 100644 --- a/reference/reflection/reflectionproperty/getsettabletype.xml +++ b/reference/reflection/reflectionproperty/getsettabletype.xml @@ -70,26 +70,14 @@ class Example } $rClass = new \ReflectionClass(Example::class); -// No set-type defined, so returns ReflectionType('string') -$rType = $rClass->getProperty('basic')->getSettableType(); -// A set-type is defined, so returns ReflectionUnionType('string|Sstringable') -$rType = $rClass->getProperty('wider')->getSettableType(); - -// Virtual property, so returns ReflectionUnionType('never') -$rType = $rClass->getProperty('virtual')->getSettableType(); - -// Untyped property, so returns null -$rType = $rClass->getProperty('untyped')->getSettableType(); +var_dump($rClass->getProperty('basic')->getSettableType()); +var_dump($rClass->getProperty('wider')->getSettableType()); +var_dump($rClass->getProperty('virtual')->getSettableType()); +var_dump($rClass->getProperty('untyped')->getSettableType()); ?> ]]> - &example.outputs; - - - diff --git a/reference/reflection/reflectionproperty/hashook.xml b/reference/reflection/reflectionproperty/hashook.xml index c58f0294a576..ed2ee56c3d22 100644 --- a/reference/reflection/reflectionproperty/hashook.xml +++ b/reference/reflection/reflectionproperty/hashook.xml @@ -51,8 +51,8 @@ class Example $rClass = new \ReflectionClass(Example::class); $rProp = $rClass->getProperty('name'); -$rProp->hasHook(PropertyHookType::Get); // Returns true -$rProp->hasHook(PropertyHookType::Set); // Returns false +var_dump($rProp->hasHook(PropertyHookType::Get)); +var_dump($rProp->hasHook(PropertyHookType::Set)); ?> ]]> diff --git a/reference/reflection/reflectionproperty/hashooks.xml b/reference/reflection/reflectionproperty/hashooks.xml index e2c46212b33e..0fbb37f42bda 100644 --- a/reference/reflection/reflectionproperty/hashooks.xml +++ b/reference/reflection/reflectionproperty/hashooks.xml @@ -44,8 +44,8 @@ class Example } $rClass = new \ReflectionClass(Example::class); -$rClass->getProperty('name')->hasHooks(); // Returns true -$rClass->getProperty('none')->hasHooks(); // Returns false +var_dump($rClass->getProperty('name')->hasHooks()); +var_dump($rClass->getProperty('none')->hasHooks()); ?> ]]> diff --git a/reference/reflection/reflectionproperty/isfinal.xml b/reference/reflection/reflectionproperty/isfinal.xml index 696bd6c8eb97..d4612b7fd781 100644 --- a/reference/reflection/reflectionproperty/isfinal.xml +++ b/reference/reflection/reflectionproperty/isfinal.xml @@ -51,9 +51,10 @@ class Example } $rClass = new \ReflectionClass(Example::class); -$rType = $rClass->getProperty('name')->isFinal(); // False -$rType = $rClass->getProperty('age')->isFinal(); // True -$rType = $rClass->getProperty('job')->isFinal(); // True, implicitly. + +var_dump($rClass->getProperty('name')->isFinal()); +var_dump($rClass->getProperty('age')->isFinal()); +var_dump($rClass->getProperty('job')->isFinal()); ?> ]]> diff --git a/reference/reflection/reflectionproperty/isprotectedset.xml b/reference/reflection/reflectionproperty/isprotectedset.xml index 3c10ef5d9136..d9178058ab67 100644 --- a/reference/reflection/reflectionproperty/isprotectedset.xml +++ b/reference/reflection/reflectionproperty/isprotectedset.xml @@ -11,7 +11,6 @@ public boolReflectionProperty::isProtectedSet - &warn.undocumented.func; Checks whether the property is protected for writing. diff --git a/reference/reflection/reflectionproperty/isvirtual.xml b/reference/reflection/reflectionproperty/isvirtual.xml index 3ec8dc2999e3..401663a6d859 100644 --- a/reference/reflection/reflectionproperty/isvirtual.xml +++ b/reference/reflection/reflectionproperty/isvirtual.xml @@ -58,9 +58,9 @@ class Example $rClass = new \ReflectionClass(Example::class); -$rClass->getProperty('name')->isVirtual(); // True -$rClass->getProperty('age')->isVirtual(); // False -$rClass->getProperty('job')->isVirtual(); // False +var_dump($rClass->getProperty('name')->isVirtual()); +var_dump($rClass->getProperty('age')->isVirtual()); +var_dump($rClass->getProperty('job')->isVirtual()); ?> ]]>