dantleech, (edited )
@dantleech@fosstodon.org avatar

Blog post: things that annoy me in (but I still like it): https://www.dantleech.com/blog/2024/02/18/my-php-problems

Pol,
@Pol@mathstodon.xyz avatar

@dantleech s/deserailization/deserialization

dantleech,
@dantleech@fosstodon.org avatar

@Pol thanks, pushed a fix. if only there were a way for comuters to detect spelling mistakes.

Pol,
@Pol@mathstodon.xyz avatar
dantleech,
@dantleech@fosstodon.org avatar

@Pol not yet, ir works offline right? but I really need to use the VIM spell checker properly first I think :)

Crell,
@Crell@phpc.social avatar

@dantleech Why yes, I do feel your pain on serialization and data validation. :-) Though not using doc block types was a deliberate decision, as I didn't want a doctrine annotations dependency. And because some serialization Metadata goes beyond what phpstan et al usually have.

dantleech,
@dantleech@fosstodon.org avatar

@Crell I guess it it would rather be the PHPStan docblock parser - I think the Valinor author wrote their own docblock/type parser, which is also what i did for Phpactor, and probably Psalm did the same - somehow seems like duplicated work, but it's fun.

But would love it if we didn't have to support both attributes and annotations, and espcailly if we can avoid duplicating the type info.

Crell,
@Crell@phpc.social avatar

@dantleech I agree, it would be preferable. Ideally, get the fancier type info into the code itself, then we csn all just use that.

And FTLOG, stop using the same structure for lists and dicts. The amount of pain that mistake has caused over the years is beyond measure.

I wonder if there's a way to bake a small doc block parser into AttributeUtils...

dantleech,
@dantleech@fosstodon.org avatar

@Crell problem with docblock parsers in this context is that most of the library is actually about parsing types 😅 incidentally a middle ground could be to standardise:

#[\Php\Type('Hello<World>')]  

Which is basically what JMS serializer supports (although not sure it supports generics). But then as written, it feels bad to import a class/attribute in order to declare a type 🤷 which leaves us with the only sensible solution: having generics support, somehow, in the language

Crell,
@Crell@phpc.social avatar

@dantleech We do always end up back there, don't we...

But yes, I'd be all over SA tools standardizing on some attributes for extended type information. But the SA tool authors seem quite disinterested.

zimzat,
@zimzat@mastodon.social avatar

@dantleech I really appreciate that this isn't a list of esoteric gotchas.

We really could use iterator_map/etc functions. The hard part will be convincing people whether to match callback vs iterable first parameter ordering 🙃 or if it should be lazy or immediate. I'd probably go with iterable first and lazy. They'd probably be shortcuts to creating FilterIterator/etc instances.

Crell,
@Crell@phpc.social avatar

@zimzat @dantleech Try Crell/fp. :-)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • php
  • cubers
  • magazineikmin
  • InstantRegret
  • everett
  • osvaldo12
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • kavyap
  • Durango
  • ngwrru68w68
  • thenastyranch
  • DreamBathrooms
  • provamag3
  • khanakhh
  • anitta
  • modclub
  • ethstaker
  • tester
  • GTA5RPClips
  • cisconetworking
  • tacticalgear
  • megavids
  • Leos
  • normalnudes
  • JUstTest
  • lostlight
  • All magazines