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
The class StaticInstance does not do anything meaningful (and thus is misleading).
It has a static property $instance that is probably meant to store the instance so that it can be retrieved later on and that one instance is shared across all requests.
However, in the getInstance() method, that property is always overwritten by a new instance of the extending class, rendering it useless. So, each call to getInstance() will create a new instance instead of sharing the previous one.
The getInstance() is probably missing a check to only create a new instance when the $instance property has not been set yet.
The text was updated successfully, but these errors were encountered:
The class
StaticInstance
does not do anything meaningful (and thus is misleading).It has a static property
$instance
that is probably meant to store the instance so that it can be retrieved later on and that one instance is shared across all requests.However, in the
getInstance()
method, that property is always overwritten by a new instance of the extending class, rendering it useless. So, each call togetInstance()
will create a new instance instead of sharing the previous one.The
getInstance()
is probably missing a check to only create a new instance when the$instance
property has not been set yet.The text was updated successfully, but these errors were encountered: