I’ve written before about the benefits of using PHP’s Anonymous Classes for test doubles; but Anonymous Classes also have potential usecases within production code as well. In this article I’m going to describe one such usecase that can be particularly useful within libraries, and that is replicating the access of Package Private (in Java), or Protected Internal Classes (as per C#).
Hey Laravel friends! 1000s of Ruby developers know and love Honeybadger. We recently attended our first Laracon, though, and OMG, you are all awesome. Naturally, we're rebuilding Honeybadger from scratch, just for you. Learn more here (sponsored link)