Skip to content

Conversation

@kamil-tekiela
Copy link
Member

No description provided.

Copy link

Copilot AI left a 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.

@kamil-tekiela
Copy link
Member Author

This is what the page looks like now:
webphp_manual_en_language types callable php

Copy link
Member

@TimWolla TimWolla left a 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.

// An example callback function
function my_callback_function() {
echo 'hello world!', PHP_EOL;
echo 'hello world!', "\n";
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Member

@TimWolla TimWolla left a 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>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<simpara>Array containing a class name or an <type>object</type>
<simpara>&array; containing a class name or an <type>object</type>

Copy link
Member Author

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?

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