Skip to content

Use const instead of properties#2815

Merged
ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
zonuexe:refactor/class-const
Jan 3, 2024
Merged

Use const instead of properties#2815
ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
zonuexe:refactor/class-const

Conversation

@zonuexe
Copy link
Copy Markdown
Contributor

@zonuexe zonuexe commented Dec 9, 2023

No description provided.

@phpstan-bot
Copy link
Copy Markdown
Collaborator

You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x.

@zonuexe zonuexe changed the base branch from 1.11.x to 1.10.x December 9, 2023 08:58
@zonuexe zonuexe force-pushed the refactor/class-const branch from 2e4a572 to 4fadf51 Compare December 9, 2023 09:07
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why the change from array_key_exists to isset()?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Certainly there is no rational reason to replace array_key_exists() with isset to shave off a few bytes. Although both compile to a ZEND_ARRAY_KEY_EXISTS instruction rather than a function call, array_key_exists() has a very slight performance advantage since it avoids the cost of a null check.

@zonuexe zonuexe force-pushed the refactor/class-const branch from d095e5f to 5ea900c Compare December 23, 2023 11:01
@ondrejmirtes ondrejmirtes merged commit 95bea51 into phpstan:1.10.x Jan 3, 2024
@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you!

@zonuexe zonuexe deleted the refactor/class-const branch January 7, 2024 20:03
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.

4 participants