Skip to content

Conversation

@JohnVillalovos
Copy link

Add proper return types to the Iterator interface methods in Net_LDAP2_Search (current(), key(), next(), valid(), rewind()) to fix deprecation notices like:

Deprecated: Return type of Net_LDAP2_Search::current() should either
be compatible with Iterator::current(): mixed, or the
#[\ReturnTypeWillChange] attribute should be used to temporarily
suppress the notice

Add proper return types to the Iterator interface methods in
Net_LDAP2_Search (current(), key(), next(), valid(), rewind()) to
fix deprecation notices like:

  Deprecated: Return type of Net_LDAP2_Search::current() should either
  be compatible with Iterator::current(): mixed, or the
  #[\ReturnTypeWillChange] attribute should be used to temporarily
  suppress the notice
Copilot AI review requested due to automatic review settings February 8, 2026 00:33
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 updates Net_LDAP2_Search’s Iterator methods to add PHP 8.1-compatible return type declarations, addressing deprecation notices about missing/incorrect Iterator method return types.

Changes:

  • Add mixed return types to current() and key().
  • Add void return types to next() and rewind().
  • Add bool return type to valid().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +565 to 566
public function current(): mixed
{
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

mixed return types require PHP 8.0+. The package metadata currently declares PHP >= 7.4 (see package.xml), so this change makes the library fail to parse on supported PHP versions. Either avoid using mixed (not really possible pre-8.0) or bump the minimum supported PHP version and update the package/composer constraints accordingly.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

Unsure if want to make the minimum required version 8.0?

Looking at: https://www.php.net/supported-versions.php

8.1 and earlier are end-of-life. But this change will work for >= 8.0.

Comment on lines +581 to 582
public function key(): mixed
{
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

Same PHP compatibility issue as current(): mixed is PHP 8.0+, but the project metadata indicates PHP 7.4 support. If PHP 7.4 is still supported, this will be a parse error; otherwise, please update the declared PHP requirement to 8.0/8.1+ in the distribution metadata.

Copilot uses AI. Check for mistakes.
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.

1 participant