[DOC-CVS] [doc-en] master: Fix grammar in oop5 (#5728)
[email protected] (Kamil Tekiela via GitHub) Mon, 3 Aug 2026 10:30:56 +0000
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Kamil Tekiela (kamil-tekiela)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2026-08-03T11:30:53+01:00
Commit: https://github.com/php/doc-en/commit/dff848b17dafaabfb7662ffb5fecfcb04e3b771d
Raw diff: https://github.com/php/doc-en/commit/dff848b17dafaabfb7662ffb5fecfcb04e3b771d.diff
Fix grammar in oop5 (#5728)
Changed paths:
M language/oop5/anonymous.xml
M language/oop5/autoload.xml
M language/oop5/changelog.xml
M language/oop5/cloning.xml
M language/oop5/constants.xml
M language/oop5/decon.xml
M language/oop5/inheritance.xml
M language/oop5/interfaces.xml
M language/oop5/iterations.xml
M language/oop5/late-static-bindings.xml
M language/oop5/magic.xml
M language/oop5/object-comparison.xml
M language/oop5/paamayim-nekudotayim.xml
M language/oop5/properties.xml
M language/oop5/property-hooks.xml
M language/oop5/references.xml
M language/oop5/serialization.xml
M language/oop5/traits.xml
M language/oop5/variance.xml
Diff:
diff --git a/language/oop5/anonymous.xml b/language/oop5/anonymous.xml
index e2281847d315..a551897f0f7b 100644
--- a/language/oop5/anonymous.xml
+++ b/language/oop5/anonymous.xml
@@ -153,11 +153,11 @@ same class
</informalexample>
<note>
- <para>
+ <simpara>
Note that anonymous classes are assigned a name by the engine, as
- demonstrated in the following example. This name has to be regarded an
+ demonstrated in the following example. This name has to be regarded as an
implementation detail, which should not be relied upon.
- </para>
+ </simpara>
<informalexample>
<programlisting role="php">
<![CDATA[
diff --git a/language/oop5/autoload.xml b/language/oop5/autoload.xml
index b9621d9ef7bc..b96459e24f27 100644
--- a/language/oop5/autoload.xml
+++ b/language/oop5/autoload.xml
@@ -8,24 +8,24 @@
annoyances is having to write a long list of needed includes
at the beginning of each script (one for each class).
</para>
- <para>
+ <simpara>
The <function>spl_autoload_register</function> function registers any number of
- autoloaders, enabling for classes and interfaces to be automatically loaded
+ autoloaders, enabling classes and interfaces to be automatically loaded
if they are currently not defined. By registering autoloaders, PHP is given
a last chance to load the class or interface before it fails with an error.
- </para>
+ </simpara>
<para>
Any class-like construct may be autoloaded the same way. That includes classes,
interfaces, traits, and enumerations.
</para>
<caution>
- <para>
+ <simpara>
Prior to PHP 8.0.0, it was possible to use <function>__autoload</function>
to autoload classes and interfaces. However, it is a less flexible
alternative to <function>spl_autoload_register</function> and
<function>__autoload</function> is deprecated as of PHP 7.2.0, and removed
as of PHP 8.0.0.
- </para>
+ </simpara>
</caution>
<note>
<para>
diff --git a/language/oop5/changelog.xml b/language/oop5/changelog.xml
index bc711a7c29e9..00dd1bb97d99 100644
--- a/language/oop5/changelog.xml
+++ b/language/oop5/changelog.xml
@@ -43,7 +43,7 @@
<row>
<entry>7.4.0</entry>
<entry>
- Changed: It is now possible to throw exception within
+ Changed: It is now possible to throw an exception within
<function>__toString</function>.
</entry>
</row>
@@ -299,7 +299,7 @@
<function>echo</function> or <function>print</function>.
But now, it is called in any &string; context (e.g. in
<function>printf</function> with <literal>%s</literal> modifier) but not
- in other types contexts (e.g. with <literal>%d</literal> modifier).
+ in other type contexts (e.g. with <literal>%d</literal> modifier).
As of PHP 5.2.0, converting &object;s without a
<link linkend="object.tostring">__toString</link> method to &string;
emits a <constant>E_RECOVERABLE_ERROR</constant> level error.
diff --git a/language/oop5/cloning.xml b/language/oop5/cloning.xml
index 836cd0babcc0..5b7b91cfed02 100644
--- a/language/oop5/cloning.xml
+++ b/language/oop5/cloning.xml
@@ -3,17 +3,17 @@
<sect1 xml:id="language.oop5.cloning" xmlns="http://docbook.org/ns/docbook">
<title>Object Cloning</title>
- <para>
+ <simpara>
Creating a copy of an object with fully replicated properties is not
always the wanted behavior. A good example of the need for copy
- constructors, is if you have an object which represents a GTK window and the
+ constructors is if you have an object which represents a GTK window and the
object holds the resource of this GTK window, when you create a duplicate
you might want to create a new window with the same properties and have the
new object hold the resource of the new window. Another example is if your
object holds a reference to another object which it uses and when you
replicate the parent object you want to create a new instance of this other
object so that the replica has its own separate copy.
- </para>
+ </simpara>
<para>
An object copy is created by using the <literal>clone</literal> keyword
@@ -40,11 +40,11 @@ $copy_of_object = clone $object;
<void/>
</methodsynopsis>
- <para>
+ <simpara>
Once the cloning is complete, if a <link linkend="object.clone">__clone()</link> method is defined, then
the newly created object's <link linkend="object.clone">__clone()</link> method will be called, to allow any
- necessary properties that need to be changed.
- </para>
+ necessary properties to be changed.
+ </simpara>
<example>
<title>Cloning an object</title>
diff --git a/language/oop5/constants.xml b/language/oop5/constants.xml
index cf4ac7b47e41..ba5449c0f28f 100644
--- a/language/oop5/constants.xml
+++ b/language/oop5/constants.xml
@@ -2,11 +2,11 @@
<!-- $Revision$ -->
<sect1 xml:id="language.oop5.constants" xmlns="http://docbook.org/ns/docbook">
<title>Class Constants</title>
- <para>
+ <simpara>
It is possible to define <link linkend="language.constants">constants</link>
- on a per-class basis remaining the same and unchangeable.
+ on a per-class basis.
The default visibility of class constants is <literal>public</literal>.
- </para>
+ </simpara>
<note>
<para>
Class constants can be redefined by a child class.
diff --git a/language/oop5/decon.xml b/language/oop5/decon.xml
index dd17425e800c..ccea97efc23a 100644
--- a/language/oop5/decon.xml
+++ b/language/oop5/decon.xml
@@ -156,11 +156,11 @@ class Point {
</para>
</note>
<note>
- <para>
- Object properties may not be typed <type>callable</type> due to engine ambiguity that would
+ <simpara>
+ Object properties may not be typed <type>callable</type> due to engine ambiguity that this would
introduce. Promoted arguments, therefore, may not be typed <type>callable</type> either. Any
other <link linkend="language.types.declarations">type declaration</link> is permitted, however.
- </para>
+ </simpara>
</note>
<note>
<para>
@@ -352,7 +352,7 @@ $obj = new MyDestructableClass();
a second time when the reference count reaches zero again or during the
shutdown sequence.
</para>
- <para>
+ <simpara>
As of PHP 8.4.0, when
<link linkend="features.gc.collecting-cycles">cycle collection</link>
occurs during the execution of a
@@ -364,9 +364,9 @@ $obj = new MyDestructableClass();
The previous <literal>gc_destructor_fiber</literal> will no longer be
referenced by the garbage collector and may be collected if it is not
referenced elsewhere.
- Objects whose destructor are suspended will not be collected until the
+ Objects whose destructor is suspended will not be collected until the
destructor returns or the Fiber itself is collected.
- </para>
+ </simpara>
<note>
<para>
Destructors called during the script shutdown have HTTP headers already
diff --git a/language/oop5/inheritance.xml b/language/oop5/inheritance.xml
index 445fa5930463..e49ab4a36693 100644
--- a/language/oop5/inheritance.xml
+++ b/language/oop5/inheritance.xml
@@ -26,16 +26,16 @@
restriction that is enforced is <literal>private final</literal> constructors, as that
is a common way to "disable" the constructor when using static factory methods instead.
</para>
- <para>
+ <simpara>
The <link linkend="language.oop5.visibility">visibility</link>
of methods, properties and constants can be relaxed, e.g. a
<literal>protected</literal> method can be marked as
<literal>public</literal>, but they cannot be restricted, e.g.
marking a <literal>public</literal> property as <literal>private</literal>.
- An exception are constructors, whose visibility can be restricted, e.g.
+ One exception is constructors, whose visibility can be restricted, e.g.
a <literal>public</literal> constructor can be marked as <literal>private</literal>
in a child class.
- </para>
+ </simpara>
<note>
<para>
diff --git a/language/oop5/interfaces.xml b/language/oop5/interfaces.xml
index 3979da93a2ba..b4fe86d4dd6a 100644
--- a/language/oop5/interfaces.xml
+++ b/language/oop5/interfaces.xml
@@ -31,7 +31,7 @@
To allow a function or method to accept and operate on a parameter that conforms to an
interface, while not caring what else the object may do or how it is implemented. These interfaces
are often named like <literal>Iterable</literal>, <literal>Cacheable</literal>, <literal>Renderable</literal>,
- or so on to describe the significance of the behavior.
+ and so on to describe the significance of the behavior.
</member>
</simplelist>
<para>
diff --git a/language/oop5/iterations.xml b/language/oop5/iterations.xml
index 7266838fb1f2..f15b1ee419c5 100644
--- a/language/oop5/iterations.xml
+++ b/language/oop5/iterations.xml
@@ -2,14 +2,12 @@
<!-- $Revision$ -->
<sect1 xml:id="language.oop5.iterations" xmlns="http://docbook.org/ns/docbook">
<title>Object Iteration</title>
- <para>
-
+ <simpara>
PHP provides a way for objects to be defined so it is possible to iterate
- through a list of items, with, for example a &foreach; statement. By default,
+ through a list of items with, for example, a &foreach; statement. By default,
all <link linkend="language.oop5.visibility">visible</link> properties will be used
for the iteration.
-
- </para>
+ </simpara>
<example>
<title>Simple Object Iteration</title>
diff --git a/language/oop5/late-static-bindings.xml b/language/oop5/late-static-bindings.xml
index 60fb5cf41e74..01a637c91330 100644
--- a/language/oop5/late-static-bindings.xml
+++ b/language/oop5/late-static-bindings.xml
@@ -2,10 +2,10 @@
<!-- $Revision$ -->
<sect1 xml:id="language.oop5.late-static-bindings" xmlns="http://docbook.org/ns/docbook">
<title>Late Static Bindings</title>
- <para>
+ <simpara>
PHP implements a feature called late static bindings which
- can be used to reference the called class in a context of static inheritance.
- </para>
+ can be used to reference the called class in the context of static inheritance.
+ </simpara>
<para>
More precisely, late static bindings work by storing the class named in the
diff --git a/language/oop5/magic.xml b/language/oop5/magic.xml
index 425f3c0a6c6f..c37257eed24c 100644
--- a/language/oop5/magic.xml
+++ b/language/oop5/magic.xml
@@ -2,13 +2,13 @@
<!-- $Revision$ -->
<sect1 xml:id="language.oop5.magic" xmlns="http://docbook.org/ns/docbook">
<title>Magic Methods</title>
- <para>
- Magic methods are special methods which override PHP's default's action
+ <simpara>
+ Magic methods are special methods which override PHP's default action
when certain actions are performed on an object.
- </para>
+ </simpara>
<caution>
<simpara>
- All methods names starting with <literal>__</literal> are reserved by PHP.
+ All method names starting with <literal>__</literal> are reserved by PHP.
Therefore, it is not recommended to use such method names unless overriding
PHP's behavior.
</simpara>
@@ -549,8 +549,9 @@ object(A)#2 (2) {
internal classes.
</simpara>
<simpara>
- It is the responsibility of the programmer to verify that only objects will
- be re-imported, whose class implements __set_state().
+ It is the responsibility of the programmer to verify that only objects
+ whose class implements <methodname>__set_state</methodname> will
+ be re-imported.
</simpara>
</note>
</sect2>
diff --git a/language/oop5/object-comparison.xml b/language/oop5/object-comparison.xml
index a47afaccf40e..d3cff6988ab6 100644
--- a/language/oop5/object-comparison.xml
+++ b/language/oop5/object-comparison.xml
@@ -96,10 +96,10 @@ o1 !== o2 : TRUE
</example>
</para>
<note>
- <para>
- Extensions can define own rules for their objects comparison
+ <simpara>
+ Extensions can define their own rules for comparing their objects
(<literal>==</literal>).
- </para>
+ </simpara>
</note>
</sect1>
<!-- Keep this comment at the end of the file
diff --git a/language/oop5/paamayim-nekudotayim.xml b/language/oop5/paamayim-nekudotayim.xml
index c106746d9cab..a856373dd03b 100644
--- a/language/oop5/paamayim-nekudotayim.xml
+++ b/language/oop5/paamayim-nekudotayim.xml
@@ -84,14 +84,14 @@ OtherClass::doubleColon();
</programlisting>
</example>
- <para>
+ <simpara>
When an extending class overrides the parent's definition of a method,
PHP will not call the parent's method. It's up to the extended class
- on whether or not the parent's method is called. This also applies to <link
+ whether or not the parent's method is called. This also applies to <link
linkend="language.oop5.decon">Constructors and Destructors</link>, <link
linkend="language.oop5.overloading">Overloading</link>, and <link
linkend="language.oop5.magic">Magic</link> method definitions.
- </para>
+ </simpara>
<example>
<title>Calling a parent's method</title>
diff --git a/language/oop5/properties.xml b/language/oop5/properties.xml
index d88dceb322e5..9fc60965ea20 100644
--- a/language/oop5/properties.xml
+++ b/language/oop5/properties.xml
@@ -17,10 +17,10 @@
must be a <link linkend="language.constants">constant</link> value.
</para>
<note>
- <para>
- An obsolete way of declaring class properties, is by using the
+ <simpara>
+ An obsolete way of declaring class properties is by using the
<literal>var</literal> keyword instead of a modifier.
- </para>
+ </simpara>
</note>
<note>
<simpara>
@@ -164,7 +164,7 @@ class Shape
$triangle = new Shape();
$triangle->setName("triangle");
-$triangle->setNumberofSides(3);
+$triangle->setNumberOfSides(3);
var_dump($triangle->getName());
var_dump($triangle->getNumberOfSides());
@@ -379,7 +379,7 @@ var_dump($test2->prop); // NULL
To handle arbitrary property names, the class should implement the magic
methods <link linkend="object.get">__get()</link> and
<link linkend="object.set">__set()</link>.
- At last resort the class can be marked with the
+ As a last resort the class can be marked with the
<code>#[\AllowDynamicProperties]</code> attribute.
</simpara>
</warning>
diff --git a/language/oop5/property-hooks.xml b/language/oop5/property-hooks.xml
index 468f3232ff8d..b02c0db611a6 100644
--- a/language/oop5/property-hooks.xml
+++ b/language/oop5/property-hooks.xml
@@ -203,7 +203,7 @@ class Example
A property may implement zero, one, or both hooks as the situation requires.
All shorthand versions are mutually-independent.
That is, using a short-get with a long-set,
- or a short-set with an explicit type, or so on is all valid.
+ a short-set with an explicit type, and so on is all valid.
</simpara>
<simpara>
On a backed property, omitting a <literal>get</literal> or <literal>set</literal>
@@ -379,7 +379,7 @@ class Person {
<sect2>
<title>References</title>
<simpara>
- Because the presence of hooks intercept the read and write process for properties,
+ Because the presence of hooks intercepts the read and write process for properties,
they cause issues when acquiring a reference to a property or with indirect
modification, such as <code>$this->arrayProp['key'] = 'value';</code>.
That is because any attempted modification of the value by reference would bypass a set hook,
@@ -407,7 +407,7 @@ class Person {
</simpara>
<simpara>
Overwriting the entire array property is fine, and behaves the same as any other property.
- Only working with elements of the array require special care.
+ Only working with elements of the array requires special care.
</simpara>
</sect2>
<sect2>
diff --git a/language/oop5/references.xml b/language/oop5/references.xml
index 62824b0f9eb1..1a02c4b28123 100644
--- a/language/oop5/references.xml
+++ b/language/oop5/references.xml
@@ -2,11 +2,11 @@
<!-- $Revision$ -->
<sect1 xml:id="language.oop5.references" xmlns="http://docbook.org/ns/docbook">
<title>Objects and references</title>
- <para>
- One of the key-points of PHP OOP that is often mentioned is that
- "objects are passed by references by default". This is not completely true.
+ <simpara>
+ One of the key-points of PHP OOP that is often mentioned is that
+ "objects are passed by reference by default". This is not completely true.
This section rectifies that general thought using some examples.
- </para>
+ </simpara>
<para>
A PHP reference is an alias, which allows two different variables to write
diff --git a/language/oop5/serialization.xml b/language/oop5/serialization.xml
index a141530a9ab6..1965bf999d2c 100644
--- a/language/oop5/serialization.xml
+++ b/language/oop5/serialization.xml
@@ -15,18 +15,18 @@
the class.
</para>
- <para>
+ <simpara>
In order to be able to <function>unserialize</function> an object, the
class of that object needs to be defined. That is, if you have an object
- of class A and serialize this, you'll
+ of class A and serialize this, you'll
get a string that refers to class A and contains all values of variables
contained in it. If you want to be able to unserialize
- this in another file, an object of class A, the
+ an object of class A in another file, the
definition of class A must be present in that file first.
This can be done for example by storing the class definition of class A
in an include file and including this file or making use of the
<function>spl_autoload_register</function> function.
- </para>
+ </simpara>
<informalexample>
<programlisting role="php">
@@ -66,14 +66,14 @@
</programlisting>
</informalexample>
- <para>
+ <simpara>
It is strongly recommended that if an application serializes objects, for use
- later in the application, that the application includes the class definition
+ later in the application, the application includes the class definition
for that object throughout the application. Not doing so might result in an
object being unserialized without a class definition, which will result in
PHP giving the object a class of <classname>__PHP_Incomplete_Class_Name</classname>,
which has no methods and would render the object useless.
- </para>
+ </simpara>
<para>
So if in the example above <varname>$a</varname> became part of a session
diff --git a/language/oop5/traits.xml b/language/oop5/traits.xml
index 2fab3a7290a0..b9866d6e2b4d 100644
--- a/language/oop5/traits.xml
+++ b/language/oop5/traits.xml
@@ -209,12 +209,12 @@ Hello World!
</para>
<example xml:id="language.oop5.traits.conflict.ex1">
<title>Conflict Resolution</title>
- <para>
+ <simpara>
In this example, Talker uses the traits A and B.
- Since A and B have conflicting methods, it defines to use
+ Since A and B have conflicting methods, it specifies that it uses
the variant of smallTalk from trait B, and the variant of bigTalk from
trait A.
- </para>
+ </simpara>
<para>
The Aliased_Talker makes use of the <literal>as</literal> operator
to be able to use B's bigTalk implementation under an additional alias
diff --git a/language/oop5/variance.xml b/language/oop5/variance.xml
index 79d19ea47187..22cfd92b529a 100644
--- a/language/oop5/variance.xml
+++ b/language/oop5/variance.xml
@@ -40,17 +40,17 @@
</listitem>
</itemizedlist>
- A type class is considered less specific if the opposite is true.
+ A type declaration is considered less specific if the opposite is true.
</para>
<sect2 xml:id="language.oop5.variance.covariance">
<title>Covariance</title>
- <para>
+ <simpara>
To illustrate how covariance works, a simple abstract parent class, <varname>Animal</varname>
- is created. <varname>Animal</varname> will be extended by children classes,
+ is created. <varname>Animal</varname> will be extended by child classes,
<varname>Cat</varname>, and <varname>Dog</varname>.
- </para>
+ </simpara>
<informalexample>
<programlisting role="php">