-
Couldn't load subscription status.
- Fork 826
Rewrite the callback and callable page #4933
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR rewrites the PHP documentation page for callbacks and callables to provide a more comprehensive and up-to-date explanation. The rewrite restructures the content with improved organization, adds detailed examples, and includes information about modern PHP features like first-class callable syntax.
- Complete restructuring of content with clearer explanations and better organization
- Addition of comprehensive examples demonstrating different ways to create and use callables
- Updated information about PHP 8.1+ features and deprecation warnings for PHP 8.2+
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Definitely an improvement. Some remarks.
language/types/callable.xml
Outdated
| // An example callback function | ||
| function my_callback_function() { | ||
| echo 'hello world!', PHP_EOL; | ||
| echo 'hello world!', "\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usual style in the documentation is PHP_EOL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. There is definitely more "\n" than PHP_EOL and I see no reason why we should use this constant here. We have been removing it in previous PRs so there is a precedent for it already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reverted it back per your request, but I believe that it is a bad practice to use this constant in a write context, and it's dangerous. We should not be teaching new users this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll let someone else take another look, but LGTM from my side.
| <simpara>String containing the name of a function or a method</simpara> | ||
| </listitem> | ||
| <listitem> | ||
| <simpara>Array containing a class name or an <type>object</type> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <simpara>Array containing a class name or an <type>object</type> | |
| <simpara>&array; containing a class name or an <type>object</type> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't that make it lowercase?
Co-authored-by: Tim Düsterhus <[email protected]>

No description provided.