1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00
Files
Mikhail Alferov 79c0572a57 ReflectionProperty Fix typo, CS nits (#4481)
* getrawvalue.xml Fix typo, and add a newlines for more readable output

* getsettabletype.xml Cs nits

* hashook.xml Remove the extra dot
2025-02-22 19:29:43 +00:00

119 lines
2.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="reflectionproperty.getrawvalue" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>ReflectionProperty::getRawValue</refname>
<refpurpose>Returns the value of a property, bypassing a get hook if defined</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="ReflectionProperty">
<modifier>public</modifier> <type>mixed</type><methodname>ReflectionProperty::getRawValue</methodname>
<methodparam><type>object</type><parameter>object</parameter></methodparam>
</methodsynopsis>
&warn.undocumented.func;
<simpara>
Returns the value of a property, bypassing a <literal>get</literal> hook if defined.
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>object</parameter></term>
<listitem>
<simpara>
The object from which to retrieve a value.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
The stored value of the property, bypassing a <literal>get</literal> hook if defined.
</simpara>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<simpara>
If the property is virtual, an <classname>Error</classname> will be thrown,
as there is no raw value to retrieve.
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example xml:id="reflectionproperty.getrawvalue.example.basic">
<title><methodname>ReflectionProperty::getRawValue</methodname> example</title>
<programlisting role="php">
<![CDATA[
<?php
class Example
{
public string $tag {
get => strtolower($this->tag);
}
}
$example = new Example();
$example->tag = 'PHP';
$rClass = new \ReflectionClass(Example::class);
$rProp = $rClass->getProperty('tag');
// These would go through the get hook, so would produce "php"
echo $example->tag, PHP_EOL;
echo $rProp->getValue($example), PHP_EOL;
// But this would bypass the hook and produce "PHP"
echo $rProp->getRawValue($example);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
php
php
PHP
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><link linkend="language.oop5.visibility-members-aviz">Asymmetric property visibility</link></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->