I know the list is about 8.0, but in PHP 8.1 you can add readonly to the public parameter to prevent this con: Anyone can change the value. Nice list though!
readonly
Anyone can change the value
Thanks, I'll add it as soon as PHP 8.1 comes out. There won't be much need for 99% of getters after that release 😅
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I know the list is about 8.0, but in PHP 8.1 you can add
readonly
to the public parameter to prevent this con:Anyone can change the value
. Nice list though!Thanks, I'll add it as soon as PHP 8.1 comes out. There won't be much need for 99% of getters after that release 😅