@Crell@phpc.social avatar

Crell

@Crell@phpc.social

Anything worth doing is worth doing well.

Anything worth doing well is worth teaching others to do well.

Author of Thinking Functionally in PHP, now on LeanPub: https://leanpub.com/thinking-functionally-in-php

#tootfinder

This profile is from a federated server and may be incomplete. Browse more on the original instance.

Crell, to php
@Crell@phpc.social avatar

Proposal for a conference talk: How to configure and all its tooling extensions (xdebug, phpstan, php-cs-fixer, etc.) to use a docker container consistently.

That could easily fill a tutorial...

Crell, to random
@Crell@phpc.social avatar

Tim's hand is contained. Or the sock puppet is a container. One of the two...

Crell, to random
@Crell@phpc.social avatar

Ancient Chinese wisdom. via Keith Casey

Crell, to random
@Crell@phpc.social avatar

When complex things become easier, it opens up new possibilities.

Crell, to random
@Crell@phpc.social avatar

is off to am auspicious start...

joachim, to php
@joachim@drupal.community avatar

What's the generic term for keywords in like 'static', 'public', 'final', etc?

Crell,
@Crell@phpc.social avatar

@joachim In PER-CS, we refer to these as "Modifier Keywords."

https://www.php-fig.org/per/coding-style/#46-modifier-keywords

(Honestly I think I just made the term up as I was writing that section. I don't know of any other de facto standard name.)

Crell, to random
@Crell@phpc.social avatar
mwop, to firefox
@mwop@phpc.social avatar

So irritated that #firefox decided NOT to support PWAs on Linux. (Yes, I know about the extension, but it's a PITA to keep up-to-date, and because it uses an ADDITIONAL runtime in the background, it's a waste of system resources.)

I've concluded that the only way to use Outlook consistently on Linux is via the web (love OWL for TB, but invites/events often disappear)... and without reasonable PWA support in FF, I'm having to contemplate returning to a chromium-based browser. 😥

Crell,
@Crell@phpc.social avatar

@mwop They don't on Mac, either. It's extremely annoying.

ramsey, to php
@ramsey@phpc.social avatar

Who will I see at next week? I’m giving a keynote on Thursday, and I’m super nervous. It’s only the second keynote I’ve ever given, and the first one was over 10 years ago. 😬😰

Crell,
@Crell@phpc.social avatar

@ramsey I'll be there to heckle, worry not.

(Heckling may or may not include hugging.)

Crell, to random
@Crell@phpc.social avatar
Crell, to random
@Crell@phpc.social avatar

Reminder: US courts have decided the 5th amendment does not apply to your body. Only to your brain (for now).

Never, ever, rely on a fingerprint or face sac for auth. The Cops can legally hold you down and force your finger on the sensor.

This is why passwords/passcodes are a must, permanently forever.

https://arstechnica.com/tech-policy/2024/04/cops-can-force-suspect-to-unlock-phone-with-thumbprint-us-court-rules/

Crell, to random
@Crell@phpc.social avatar

Object IDs for humans.

Interesting approach. I kinda like it, especially if combined with a UUIDv7 base ID.

https://dev.to/stripe/designing-apis-for-humans-object-ids-3o5a

Crell,
@Crell@phpc.social avatar

@Alister I'm more interested in using a native field in Postgres, personally.

Crell, to random
@Crell@phpc.social avatar

Valid.

TerribleMaps, to random
@TerribleMaps@en.osm.town avatar
Crell,
@Crell@phpc.social avatar

@TerribleMaps No wonder Russia is doing nothing to stop global warming. They stand to benefit the most of anyone.

cabbey, to php
@cabbey@phpc.social avatar

Does anyone have a better way to write the conditional calls to foo at lines 5-9 of this code? https://3v4l.org/fqCvv The goal is to have the default argument for bar trigger the default argument for foo, but they're different defaults (since one is nullable and the other isn't), and bar should not need to know what foo's default is. (obviously in my real code it's a much more complex signature, and separate classes.)

Crell,
@Crell@phpc.social avatar

@cabbey You're trying to avoid the null? You can use an enum to create an out of type default, that no person would ever pass in. That let's you differentiate between "nothing was specified" and "the same thing as the default was specified."

Though I may be misunderstanding you.

Crell,
@Crell@phpc.social avatar

@cabbey Ah, that's tricky. In this simple case the enum trick could work if you put it on foo(). In a more complex case with multiple params, it's probably not worth it.

In theory you could use reflection on Foo to find its default value and pass that, but that's a stupid idea. :-)

Crell,
@Crell@phpc.social avatar

@cabbey Hm, that is actually a very reasonable idea. Especially in php8 with named args.

PHP reflection isn't as slow as Java, but still inappropriate here.

Crell, to random
@Crell@phpc.social avatar

"We need to rewild the Internet."

This is long, but very good.

https://www.noemamag.com/we-need-to-rewild-the-internet/

Crell, to random
@Crell@phpc.social avatar

We've got to make the damned websites work:

https://another.rodeo/make-the-damn-web-sites-work/

SenseException, to php German
@SenseException@phpc.social avatar

talks 10 years ago: "Use value objects instead of arrays."

PHP talks nowadays: "Use value objects instead of arrays."

Crell,
@Crell@phpc.social avatar

@mwop @heiglandreas @ramsey @SenseException It absolutely will work with generic properties. A plain boring public property will satisfy an interface requirement for both get and set. A readonly public property will satisfy a get-only interface requirement.

Crell,
@Crell@phpc.social avatar

@mwop

interface Named {
public string $name { get; }
}

class Bar implements Named {
public function __construct(public readonly string $name) {}
}

That should totally work. (To not need to go through the constructor we'll need asymmetric visibility, because of readonly's brokenness.)

Crell,
@Crell@phpc.social avatar

@mwop Ah. That isn't allowed, no. Specifically, the interface can say "this property must be readable" and/or "this property must be writeable." That's the minimum set of requirements you can place.

Those can be satisfied by plain properties or hooked properties, as your implementation prefers.

Crell,
@Crell@phpc.social avatar

@heiglandreas See my reply to @mwop just now.

Crell,
@Crell@phpc.social avatar

@deleugpn @ramsey @SenseException Arrays are easy to write the first time, and hell to maintain the next day.

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