A better alternative to “return early” – PHP / WordPress edition

Exit sign

Yes, complex conditionals are worse. But there is a third, better way. And no, it does not involve GOTOs. Me This post is about a coding pattern I have never seen used by anyone else for writing guard clauses, especially when those guard clauses are complex. This pattern results in code that is significantly more …

How to explicitly declare that a struct implements an interface in Go

rules to follow

One of the things I love about Go and find to be a strong supporter of serendipitous interface standardization is Go’s implicitly declared interfaces. However, there are times you really, really want to explicitly declare an interface, such as when you have a larger interface and you want your IDE and/or the compiler to tell …