Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format.xml: add both class method names or replcate to interface name #3693

Merged
merged 3 commits into from
Aug 31, 2024

Conversation

mmalferov
Copy link
Member

We must either add the names of the format methods of both classes — DateTime::format and DateTimeImmutable::format and names of the both class names — DateTime and DateTimeImmutable, or replace the name of the method of the DateTime::format class with the name of the interface method — DateTimeInterface::format, and the name of the DateTime class with the name of the interface common to these classes — DateTimeInterface.

Otherwise, the description of the u parameter behaves as if it does not concern the DateTimeImmutable::format() method (although it is assumed that every PHP programmer knows about this; but in reality not everyone knows).

Alternative:

Microseconds. Note that
<function>date</function> will always generate
<literal>000000</literal> since it takes an <type>int</type>
parameter, whereas <methodname>DateTimeInterface::format</methodname> does
support microseconds if [object implementing the] <interfacename>DateTimeInterface</interfacename> was
created with microseconds.

We must either add the names of the methods of both classes — DateTime and DateTimeImmutable, or replace the name of the method of the DateTime::format class with the name of the interface method — DateTimeInterface::format, and the name of the DateTime class with the name of the interface common to these classes — DateTimeInterface. Otherwise, the description of the `u` parameter behaves as if it does not concern the DateTimeImmutable::format() method (although it is assumed that every PHP programmer knows about this; but in reality not everyone knows).

Alternative:

```Microseconds. Note that
           <function>date</function> will always generate
           <literal>000000</literal> since it takes an <type>int</type>
           parameter, whereas <methodname>DateTimeInterface::format</methodname> does
           support microseconds if <interfacename>DateTimeInterface</interfacename> was
           created with microseconds.```
@cmb69
Copy link
Member

cmb69 commented Aug 27, 2024

I would go with DateTimeInterface; mentioning both implementations seems to be superfluous.

The paragraph describes working with microseconds only through the `DateTime::format` method, which does not include working with microseconds through the `DateTimeImmutable::format` method. In order for the description to affect the methods of these classes, I suggest mentioning the `DateTimeInterface::format` interface method and an object with the DateTimeInterface type: this will show the reader that we are talking about both the DateTime::format method and the DateTimeImmutable::format method
@mmalferov
Copy link
Member Author

I changed the wording. Please check if everything is done correctly ;-)

Wrap the interface name interfacename tag

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
@cmb69 cmb69 merged commit 7f7fce5 into php:master Aug 31, 2024
2 checks passed
@cmb69
Copy link
Member

cmb69 commented Aug 31, 2024

Thank you!

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.

2 participants