Skip to content

Fix incorrect return type description for Set#contains().#104

Merged
rtheunissen merged 1 commit into
php-ds:masterfrom
ZebulanStanphill:patch-1
May 18, 2025
Merged

Fix incorrect return type description for Set#contains().#104
rtheunissen merged 1 commit into
php-ds:masterfrom
ZebulanStanphill:patch-1

Conversation

@ZebulanStanphill

Copy link
Copy Markdown
Contributor

The current return type description is confusing, since it implies that an empty $values would cause the method to return false, when in fact, it would return true.

The corrected description is based on https://www.php.net/manual/en/ds-set.contains.php#refsect1-ds-set.contains-returnvalues

Comment thread src/Set.php
* @return bool true if at least one value was provided and the set
* contains all given values, false otherwise.
* @return bool false if any of the provided values are not in the set;
* true otherwise.

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.

This is a correction, yes. I wonder if we should instead reason in the positive, in this case

@return bool true if all values exist in the set, or none given.

@rtheunissen
rtheunissen merged commit 017fb5c into php-ds:master May 18, 2025
@ZebulanStanphill
ZebulanStanphill deleted the patch-1 branch May 18, 2025 20:22
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