I have found myself, for the first time, having to write what I consider worse code to satisfy Psalm static analysis. Here's a watered-down example showing what I consider odd behavior.
@cspray Oh, and to your specific example, if phpstan is anything to go by, it seems php stores non associative arrays internally AS associative, it’s just that the keys are indexes (0, 1, 2…) so that’s the “expects array <int, string >, was provided array<string >” malarkey.
In phpstan you can go either array<int, string> (or array<array-key, string>), or, more simply string[] - but the latter form avoids those sorts of complaints. Might be worth having a looksee if psalm is similar.
@sidawson@cspray that's not the issue here. The same snippet should trigger PHPStan errors too, because it was the starting definition too strict, since it requires "list".
List is an array with only consecutive integer keys. If you don't re-index (and the spread operator does) you don't have a (guaranteed) list anymore.
Working on a new idea for a talk. It’s called DRM - developer resource management - and it’s a framework for helping projects succeed, developers thrive, and companies avoid embarrassing incidents of security and downtime.
Modern React.js with Vite is really nice, with out of the box TypeScript support and all, but by far my favourite text stack is most likely #php with #htmx. It's the simplicity that gets me.
@maxalmonte14 Yeah! And HTMx is really powerful with its X-Trigger headers (https://htmx.org/headers/hx-trigger/) that can do events and so forth if you need a little more oomph, and then there's plenty extensions as well to make, for example, dependent things trigger (https://htmx.org/extensions/path-deps/).
I even made a block based WYSIWYG editor entirely with PHP + HTMx just to prove that you can do some very interactive things usually thought to be only possible in SPA's.
I'm about to go live with Brent Roose of #JetBrains for his podcast, talking about the new #PHP Property Hooks RFC, the RFC process, improving PHP, and all that stuff.
I'd like to become more involved in Open Source. Any suggestions for an interesting Open Source #PHP project that needs some help?
(And sorry, no, I don't want to write docs :-) #oss
@phpstan has many open issues, but the learning curve is steep, I have to admit. Sometimes there are very simple things to adapt, like function signatures, sometimes a "small" bug turns out to need a huge refactor.
composer might be interesting too. I think they always appreciate when new tests are added (not all commands are tested), but if that's too boring - there are also various edge case bugs and such.
Now if only we could get the pipeline operator into #php, I could die happy. Meanwhile however @Crell 's fp library will fit the bill nicely: https://github.com/Crell/fp