Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove & before $db #5726

Merged
merged 1 commit into from
Feb 24, 2022
Merged

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Feb 22, 2022

Description

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • [] User guide updated
  • Conforms to style guide

$db is an object. We don't need to use reference.
@kenjis kenjis added the refactor Pull requests that refactor code label Feb 22, 2022
@kenjis kenjis marked this pull request as draft February 22, 2022 12:27
@kenjis kenjis marked this pull request as ready for review February 22, 2022 23:27
Copy link
Member

@paulbalandan paulbalandan left a comment

Choose a reason for hiding this comment

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

My thoughts, exactly.

@kenjis
Copy link
Member Author

kenjis commented Feb 23, 2022

In my understanding, we only need to use the reference when we have to change the property outside.
https://3v4l.org/QN7F9

However, the usage destroys the encapsulation. Generally speaking, it is not good design.

In this $db case, I don't see any reason to use the reference.

@kenjis kenjis merged commit 9ce15a9 into codeigniter4:develop Feb 24, 2022
@kenjis kenjis deleted the fix-db-reference branch February 24, 2022 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Pull requests that refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants