Skip to content

Update array key exists key parameter for PHP 8.0.0 - #3135

Merged
Girgias merged 4 commits into
php:masterfrom
schulerj89:update-array-key-exists
Jan 25, 2024
Merged

Update array key exists key parameter for PHP 8.0.0#3135
Girgias merged 4 commits into
php:masterfrom
schulerj89:update-array-key-exists

Conversation

@schulerj89

Copy link
Copy Markdown
Contributor

As of 8.0.0 array_key_exists the $key parameter takes mixed arguments now (string, int, bool, null, and resource). So updated the docs to reflect that.

Screenshot (5)
Added screenshot for proof

<methodsynopsis>
<type>bool</type><methodname>array_key_exists</methodname>
<methodparam><type class="union"><type>string</type><type>int</type></type><parameter>key</parameter></methodparam>
<methodparam><type>mixed</type><parameter>key</parameter></methodparam>

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.

It was always mixed in reality.

Please remove the changelog.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Good point! Changelog removed

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.

Actually... it was string|int|null in PHP 7.4, and it would do the silent cast for null to an empty string.

PHP 8.0 changed this to allow all offset types that get implicitly coerced (so booleans, floats, and resources now are also accepted and might emit the corresponding warnings). So it turns out it does need a changelog, and the type actually is string|int|float|bool|resource|null.

Apologies for the mistake

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

No worries! I'll make the updates and push up.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Updated and attached a screenshot to show what the change will look like. Let me know.

Screenshot (6)

Comment threadreference/array/functions/array-key-exists.xml Outdated

@GirgiasGirgias left a comment

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.

Thank you!

Sign up for freeto 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

@schulerj89@Girgias