TIL that #Statamic ships with the 'isCpRoute()' function, which allowed me to make my code a little more compact. The function will check if the current route is a control panel route or not. Here's the old and new code. Feels refreshing 😁
Today I was able to implement a feature in Annotated Contain that will resolve my longest outstanding issue; injecting a collection of services. The feature will release in 2.4 but I'm so excited about getting this done I wrote an article about how to use this new functionality.
Since #PHPUnit 11 no longer has any of the CodeCoverageIgnore attributes, and the docs say “Do not use annotations in comments in new tests that you write. Use attributes instead,” does this mean PHPUnit will no longer allow you to exclude classes, functions, or blocks of code from coverage reports? #PHP
One of the things I've learned over the last twenty years is there's plenty of work in #php.
But something else I've learned is that you need a network to find the work.
Building that network should happen in the good times. You never know when you'll need it in the lean times. Plus, having a network means having a community to support you and to be a part of - and that's never a bad thing!
I just started a plain typescript project, and was too lazy for a docker setup so I just installed Node with apt and went on my way.
I installed Typescript, that went fine, but when trying to use it it gave a vague error.
Quick search fixed it, but... I'm amazed by the cause: Typescript didn't support the version of Node I had installed, which sure.. That's okay. But why didn't NPM tell me this? NPM does not have node version constraints?!?
@thomastospace every time I try another language, I feel blessed that I'm able to work with the most powerful and reliable package manager of the world. Nothing beats #composer
@jaapio While composer is useful, it's not always the bee's knees, especially during major updates involving multiple packages.
Some of the error messages are completely useless and I have spent hours trying to find the problem. I have often wished I could switch to another language because I was stuck in composer update hell.
For example, I have fewer problems with Go modules and rust dependencies via rusts cargo. Both update more smoothly.
I've just seen a #programming pattern in #PHP where a method could return two lists of things. Instead of doing that, it takes as a parameter a callable, and passes the two lists to the callable. Instead of:
[$a, $b] = getLists($param);
// Act on both lists.
we have:
$callable = function($a, $b) {
// Act on both lists
}
actOnLists($param, $callable);