Closed GuySartorelli closed 5 months ago
Is there an actual issue that got cause by this? e.g. Did we have a scenario where we called self::get()
in Link
wanting to query all Links and ended up querying only FileLink
.
Is there an actual issue that got cause by this?
Yes. I'll link you the slack thread.
PRs merged. I've raised https://github.com/silverstripe/silverstripe-standards/issues/8 to add a rule in CI to catch this happening in the future.
We had a bug which it turned out was caused by an unexpected interaction between
self
and late static binding (see this PR). This was raised in php-src where the response was that it was working as intended.Going forward we should avoid calling static methods from
self
to avoid this class of bug.Notes
self
altogether, rather than only avoiding it for calling methodsAcceptance Criteria
self
(e.g.self::get()
)self
static
is fine, because it explicitly uses late static binding anywayself
in our codebase are updated to use the actual class that is intended to received the call.self::class::myMethod()
in traitsCode writing script
Kitchen sink CI
PRs