mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Standardize on the term "properties" instead of "members".
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@288219 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
813758ad4f
commit
459f5061ab
9 changed files with 43 additions and 41 deletions
|
@ -207,7 +207,7 @@
|
|||
<simpara>
|
||||
It is now possible to use
|
||||
<link linkend="language.types.string.syntax.heredoc">Heredoc</link>s to
|
||||
initialize static variables and class members/constants.
|
||||
initialize static variables and class properties/constants.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -2338,7 +2338,7 @@
|
|||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
<function>var_dump</function> output now includes private object members.
|
||||
<function>var_dump</function> output now includes private object properties.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 xml:id="language.oop5.cloning" xmlns="http://docbook.org/ns/docbook">
|
||||
<title>Object cloning</title>
|
||||
<title>Object Cloning</title>
|
||||
|
||||
<para>
|
||||
Creating a copy of an object with fully replicated properties is not
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</para>
|
||||
<para>
|
||||
The value must be a constant expression, not (for example) a variable, a
|
||||
class member, result of a mathematical operation or a function call.
|
||||
property, a result of a mathematical operation, or a function call.
|
||||
</para>
|
||||
<para>
|
||||
Its also possible for interfaces to have <literal>constants</literal>. Look at
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 xml:id="language.oop5.object-comparison" xmlns="http://docbook.org/ns/docbook">
|
||||
<title>Comparing objects</title>
|
||||
<title>Comparing Objects</title>
|
||||
<para>
|
||||
In PHP 5, object comparison is more complicated than in PHP 4 and more
|
||||
in accordance to what one will expect from an Object Oriented Language
|
||||
|
|
|
@ -5,17 +5,17 @@
|
|||
|
||||
<para>
|
||||
Overloading in PHP provides means to dynamically
|
||||
<quote>create</quote> members and methods.
|
||||
<quote>create</quote> properties and methods.
|
||||
These dynamic entities are processed via magic methods
|
||||
one can establish in a class for various action types.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The overloading methods are invoked when interacting with
|
||||
members or methods that have not been declared or are not
|
||||
properties or methods that have not been declared or are not
|
||||
<link linkend="language.oop5.visibility">visible</link> in
|
||||
the current scope. The rest of this section will use the terms
|
||||
<quote>inaccessible members</quote> and <quote>inaccessible
|
||||
<quote>inaccessible properties</quote> and <quote>inaccessible
|
||||
methods</quote> to refer to this combination of declaration
|
||||
and visibility.
|
||||
</para>
|
||||
|
@ -76,7 +76,7 @@
|
|||
|
||||
|
||||
<sect2 xml:id="language.oop5.overloading.members">
|
||||
<title>Member overloading</title>
|
||||
<title>Property overloading</title>
|
||||
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>__set</methodname>
|
||||
|
@ -98,35 +98,35 @@
|
|||
|
||||
<para>
|
||||
<function>__set</function> is run when writing data to
|
||||
inaccessible members.
|
||||
inaccessible properties.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<function>__get</function> is utilized for reading data from
|
||||
inaccessible members.
|
||||
inaccessible properties.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<function>__isset</function> is triggered by calling
|
||||
<function>isset</function> or <function>empty</function>
|
||||
on inaccessible members.
|
||||
on inaccessible properties.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<function>__unset</function> is invoked when
|
||||
<function>unset</function> is used on inaccessible members.
|
||||
<function>unset</function> is used on inaccessible properties.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <varname>$name</varname> argument is the name of the
|
||||
member being interacted with. The <function>__set</function>
|
||||
property being interacted with. The <function>__set</function>
|
||||
method's <varname>$value</varname> argument specifies the
|
||||
value the <varname>$name</varname>'ed member should be set
|
||||
value the <varname>$name</varname>'ed property should be set
|
||||
to.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Member overloading only works in object context. These magic
|
||||
Property overloading only works in object context. These magic
|
||||
methods will not be triggered in static context. Therefore
|
||||
these methods can not be declared
|
||||
<link linkend="language.oop5.static">static</link>.
|
||||
|
@ -144,18 +144,18 @@
|
|||
|
||||
<example>
|
||||
<title>
|
||||
Overloading members via the <function>__get</function>,
|
||||
Overloading properties via the <function>__get</function>,
|
||||
<function>__set</function>, <function>__isset</function>
|
||||
and <function>__unset</function> methods
|
||||
</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class MemberTest {
|
||||
class PropertyTest {
|
||||
/** Location for overloaded data. */
|
||||
private $data = array();
|
||||
|
||||
/** Overloading not used on declared members. */
|
||||
/** Overloading not used on declared properties. */
|
||||
public $declared = 1;
|
||||
|
||||
/** Overloading only used on this when accessed outside the class. */
|
||||
|
@ -202,7 +202,7 @@ class MemberTest {
|
|||
|
||||
echo "<pre>\n";
|
||||
|
||||
$obj = new MemberTest;
|
||||
$obj = new PropertyTest;
|
||||
|
||||
$obj->a = 1;
|
||||
echo $obj->a . "\n\n";
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
simpler terms, the double colon, is a token that allows access to
|
||||
<link linkend="language.oop5.static">static</link>,
|
||||
<link linkend="language.oop5.constants">constant</link>, and overridden
|
||||
members or methods of a class.
|
||||
properties or methods of a class.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -49,7 +49,7 @@ echo MyClass::CONST_VALUE;
|
|||
|
||||
<para>
|
||||
Two special keywords <varname>self</varname> and <varname>parent</varname>
|
||||
are used to access members or methods from inside the class definition.
|
||||
are used to access properties or methods from inside the class definition.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<title>Static Keyword</title>
|
||||
|
||||
<para>
|
||||
Declaring class members or methods as static makes them accessible
|
||||
without needing an instantiation of the class. A member declared as
|
||||
Declaring class properties or methods as static makes them accessible
|
||||
without needing an instantiation of the class. A property declared as
|
||||
static can not be accessed with an instantiated class object (though
|
||||
a static method can).
|
||||
</para>
|
||||
|
@ -13,13 +13,13 @@
|
|||
<para>
|
||||
For compatibility with PHP 4, if no <link
|
||||
linkend="language.oop5.visibility">visibility</link>
|
||||
declaration is used, then the member or method will be treated
|
||||
declaration is used, then the property or method will be treated
|
||||
as if it was declared as <literal>public</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Because static methods are callable without an instance of
|
||||
the object created, the pseudo variable <varname>$this</varname> is
|
||||
the object created, the pseudo-variable <varname>$this</varname> is
|
||||
not available inside the method declared as static.
|
||||
</para>
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
|||
</para>
|
||||
|
||||
<example>
|
||||
<title>Static member example</title>
|
||||
<title>Static property example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
|
|
@ -3,20 +3,22 @@
|
|||
<sect1 xml:id="language.oop5.visibility" xmlns="http://docbook.org/ns/docbook">
|
||||
<title>Visibility</title>
|
||||
<para>
|
||||
The visibility of a property or method can be defined by prefixing the
|
||||
declaration with the keywords: public, protected or private. Public
|
||||
declared items can be accessed everywhere. Protected limits access to
|
||||
inherited and parent classes (and to the class that defines the item).
|
||||
Private limits visibility only to the class that defines the item.
|
||||
The visibility of a property or method can be defined by prefixing
|
||||
the declaration with the keywords: public, protected or
|
||||
private. Class members declared public can be accessed
|
||||
everywhere. Members declared protected can be accessed only within
|
||||
the class itself and by inherited and parent classes. Members
|
||||
declared as private may only be accessed by the class that defines
|
||||
the member.
|
||||
</para>
|
||||
<sect2 xml:id="language.oop5.visiblity-members">
|
||||
<title>Members Visibility</title>
|
||||
<sect2 xml:id="language.oop5.visibility-members">
|
||||
<title>Property Visibility</title>
|
||||
<para>
|
||||
Class members must be defined with public, private, or protected.
|
||||
Class properties must be defined with public, private, or protected.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Member declaration</title>
|
||||
<title>Property declaration</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
|
|
@ -228,7 +228,7 @@ echo 'Variables do not $expand $either';
|
|||
</simpara>
|
||||
|
||||
<para>
|
||||
Heredocs can not be used for initializing class members. Since PHP 5.3,
|
||||
Heredocs can not be used for initializing class properties. Since PHP 5.3,
|
||||
this limitation is valid only for heredocs containing variables.
|
||||
</para>
|
||||
|
||||
|
@ -321,7 +321,7 @@ EOD
|
|||
|
||||
<para>
|
||||
As of PHP 5.3.0, its possible to initialize static variables and class
|
||||
members/constants using the Heredoc syntax:
|
||||
properties/constants using the Heredoc syntax:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
|
@ -337,7 +337,7 @@ Nothing in here...
|
|||
LABEL;
|
||||
}
|
||||
|
||||
// Class members/constants
|
||||
// Class properties/constants
|
||||
class foo
|
||||
{
|
||||
const BAR = <<<FOOBAR
|
||||
|
@ -446,7 +446,7 @@ This should not print a capital 'A': \x41]]></screen>
|
|||
<note>
|
||||
<para>
|
||||
Unlike heredocs, nowdocs can be used in any static data context. The
|
||||
typical example is initializing class members or constants:
|
||||
typical example is initializing class properties or constants:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
|
@ -834,7 +834,7 @@ $str[strlen($str)-1] = 'e';
|
|||
|
||||
<para>
|
||||
<type>Object</type>s in PHP 4 are always converted to the <type>string</type>
|
||||
<literal>"Object"</literal>. To print the values of object members for
|
||||
<literal>"Object"</literal>. To print the values of object properties for
|
||||
debugging reasons, read the paragraphs below. To get an object's class name,
|
||||
use the <function>get_class</function> function. As of PHP 5, the
|
||||
<link linkend="language.oop5.magic">__toString</link> method is used when
|
||||
|
|
Loading…
Reference in a new issue