Skip to content

refactor: remove & before $db - #5726

Merged
kenjis merged 1 commit into
codeigniter4:developfrom
kenjis:fix-db-reference
Feb 24, 2022
Merged

refactor: remove & before $db#5726
kenjis merged 1 commit into
codeigniter4:developfrom
kenjis:fix-db-reference

Conversation

@kenjis

@kenjis kenjis commented Feb 22, 2022

Copy link
Copy Markdown
Member

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

@paulbalandan paulbalandan 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.

My thoughts, exactly.

@kenjis

kenjis commented Feb 23, 2022

Copy link
Copy Markdown
Member Author

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