waleedmazhar / lightopenid

Automatically exported from code.google.com/p/lightopenid
0 stars 0 forks source link

magic get/set methods #73

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

could you please replace these with just getters/setters or declare appropriate 
fields as protected?

The presence of magic get/set hides the real presence/absence of fields, thus 
accessing any not existent field from a derived class does not produce any 
errors. 

This increase debugging time significantly, while having regular 
getters/setters would be able to detect such issues during a few seconds

Thanks

Original issue reported on code.google.com by m...@mail.ru on 18 Sep 2013 at 10:08

GoogleCodeExporter commented 9 years ago
same here, ready to prepare a patch

Original comment by m...@mail.ru on 18 Sep 2013 at 10:16

GoogleCodeExporter commented 9 years ago
In my opinion, getter and setter functions would decrease readability without 
offering any real benefit. I can't really think of any situation where someone 
would spend significantly more time because he's misspelled a variable name.

If and when php will implement proper getter/setter syntax (not defining 
getVariable/setVariable functions) functions, I will use them.

Your concern about hiding the real presence of fields is somewhat valid though, 
but can be solved by implementing __isset. And that's what I'll do (or you can 
submit a patch/pull request, if you want to).

Original comment by mewp...@gmail.com on 19 Sep 2013 at 11:27

GoogleCodeExporter commented 9 years ago
at least could you please throw an exception on access to not existent fields? 
It is really easy fix, just to add one more  'else'

thanks

Original comment by m...@mail.ru on 19 Sep 2013 at 12:08