You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally, part of what I'd wanted Berlin to be able to do, was allow for object variables to be retrieved from methods inside the calling class, like this very bad example below:
Say you want $this->thing but you always want it formatted a certain way. In theory, you could just add this method and it would always get returned formatted as you wanted it:
public function get_thing() {
return sanitize_key( $this->thing );
}
Unfortunately, the magic getter isn't actually working because all of the class definitions currently require - as a best practice - that their default object variables be defined. This causes PHP to always skip the magic getter and use the property that is defined.
The bug here, is that you should be able to override properties simply but you can't, even though there is code inside of Base::__get() that tries to support it.
You also cannot work around it by omitting object properties, because they are required as part of the way that Berlin expects for classes to be written.
The text was updated successfully, but these errors were encountered:
Originally, part of what I'd wanted Berlin to be able to do, was allow for object variables to be retrieved from methods inside the calling class, like this very bad example below:
Say you want
$this->thing
but you always want it formatted a certain way. In theory, you could just add this method and it would always get returned formatted as you wanted it:Unfortunately, the magic getter isn't actually working because all of the class definitions currently require - as a best practice - that their default object variables be defined. This causes PHP to always skip the magic getter and use the property that is defined.
The bug here, is that you should be able to override properties simply but you can't, even though there is code inside of
Base::__get()
that tries to support it.You also cannot work around it by omitting object properties, because they are required as part of the way that Berlin expects for classes to be written.
The text was updated successfully, but these errors were encountered: