I iterated to this working point, and a few iterations ago it had errors - fair enough, but now that the code is actually fine, blade hasn’t caught up and insists there’s an error.
This is what I see, using the WHOOPS debugging tool:
This shows that blade is not catching up with the changes.
The inline bit @php( ... ) seemed to work fine before I added the @php ... @endphp bit underneath. Maybe it was loading from the blade cache, from a previous version of blade that knew how to parse it.
I was frustrated because I’d had similar things happen before where I “knew” the code was right but blade didn’t want to update its position on the matter, or would complain about an issue and then load fine on the next page reload - maybe a race condition in the webpack watcher.