Skip to content

Add missing ext/operator documentation#4669

Open
jb-lopez wants to merge 2 commits intophp:masterfrom
jb-lopez:master
Open

Add missing ext/operator documentation#4669
jb-lopez wants to merge 2 commits intophp:masterfrom
jb-lopez:master

Conversation

@jb-lopez
Copy link
Copy Markdown

This pull request is to add the missing documentation for the PECL operator extension. I have taken over as the lead maintainer for that extension, but this is my first contribution to the PHP documentation so any feedback is welcome. There is a companion pull request to doc-base that goes with one and is required by this one. php/doc-base#246

There appears to never have been any documentation for the PECL operator extension. For this pull request I've added the test class that ext/operator uses all of its overloading capabilities as a complete code sample.

@jb-lopez
Copy link
Copy Markdown
Author

I would like to note that since this is a new documentation the workflow run https://github.com/php/doc-en/actions/runs/14958493251/job/42050000015 is going to fail until the related pull request php/doc-base#246 is merged.

@bettykadondi12
Copy link
Copy Markdown

Great👍

Comment on lines +11 to +14
<para>
This extension allows you to define and implement operator overloading for objects.
It is possible to define how an object reacts when an operator is used on it.
</para>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<para>
This extension allows you to define and implement operator overloading for objects.
It is possible to define how an object reacts when an operator is used on it.
</para>
<simpara>
This extension defines and implements operator overloading for objects.
It allows defining how an object reacts when an operator is used on it.
</simpara>

operator overloaded to allow repeating the string a certain number of times.
</para>
<section>
&reftitle.seealso;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
&reftitle.seealso;

Comment on lines +15 to +19
<para>
One example of this is creating a collection type object that has the addition
operator overloaded to allow adding elements to the collection or adding two
collections together.
</para>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<para>
One example of this is creating a collection type object that has the addition
operator overloaded to allow adding elements to the collection or adding two
collections together.
</para>
<simpara>
One example of this is creating a collection type object that has the addition
operator overloaded to allow adding elements to the collection or adding two
collections together.
</simpara>

Comment on lines +20 to +23
<para>
Another example is creating an enhanced string class that has the multiplication
operator overloaded to allow repeating the string a certain number of times.
</para>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<para>
Another example is creating an enhanced string class that has the multiplication
operator overloaded to allow repeating the string a certain number of times.
</para>
<simpara>
Another example is creating an enhanced string class that has the multiplication
operator overloaded to allow repeating the string a certain number of times.
</simpara>

Comment on lines +12 to +14
<para>
Windows users can download prebuilt release binaries from the <link xlink:href="&url.pecl.package;operator">PECL</link> website.
</para>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<para>
Windows users can download prebuilt release binaries from the <link xlink:href="&url.pecl.package;operator">PECL</link> website.
</para>
<simpara>
Windows users can download prebuilt release binaries from the <link xlink:href="&url.pecl.package;operator">PECL</link> website.
</simpara>

Comment on lines +15 to +18
<para>
operator releases are hosted by PECL and the source code by
<link xlink:href="&url.git.hub;jb-lopez/pecl-php-operator">github</link>.
</para>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<para>
operator releases are hosted by PECL and the source code by
<link xlink:href="&url.git.hub;jb-lopez/pecl-php-operator">github</link>.
</para>
<simpara>
operator releases are hosted by PECL and the source code by
<link xlink:href="&url.git.hub;jb-lopez/pecl-php-operator">github</link>.
</simpara>

<member><literal>$a::__is_smaller($b)</literal></member>
<member><literal>$a::__is_smaller_or_equal($b)</literal></member>
<member><literal>$a::__is_greater($b)</literal></member>
<member><literal>$a::__is_greater_or_equal($b)</literal></member>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<member><literal>$a::__is_greater_or_equal($b)</literal></member>
<member><literal>$a::__is_greater_or_equal($b)</literal></member>
<member><literal>$a::__spaceship($b)</literal></member>

Comment thread language/operators.xml
Comment on lines +32 to 37
<para>
There is a PECL extension that allows for overloading of some operators for
objects. For more information, see the <link linkend="book.operator">Operator
Overloading for Objects</link> section.
</para>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<para>
There is a PECL extension that allows for overloading of some operators for
objects. For more information, see the <link linkend="book.operator">Operator
Overloading for Objects</link> section.
</para>
<simpara>
There is a PECL extension that allows for overloading of some operators for
objects. For more information, see the <link linkend="book.operator">Operator
Overloading for Objects</link> section.
</simpara>

Comment on lines +30 to +32
<member><literal>$a::__assign_and($b)</literal></member>
<member><literal>$a::__assign_or($b)</literal></member>
<member><literal>$a::__assign_xor($b)</literal></member>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<member><literal>$a::__assign_and($b)</literal></member>
<member><literal>$a::__assign_or($b)</literal></member>
<member><literal>$a::__assign_xor($b)</literal></member>
<member><literal>$a::__assign_bw_and($b)</literal></member>
<member><literal>$a::__assign_bw_or($b)</literal></member>
<member><literal>$a::__assign_bw_xor($b)</literal></member>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +45 to +46
<member><literal>$a::__bw_sl($b)</literal></member>
<member><literal>$a::__bw_sr($b)</literal></member>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<member><literal>$a::__bw_sl($b)</literal></member>
<member><literal>$a::__bw_sr($b)</literal></member>
<member><literal>$a::__sl($b)</literal></member>
<member><literal>$a::__sr($b)</literal></member>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants