@Girgias@phpc.social avatar

Girgias

@Girgias@phpc.social

I'm a PHP core developer and documentation writer, funded by https://phpc.social/@thephpf
Lead maintainer, and master of typos, for the French translation of the PHP documentation.
BSc in pure mathematics
Photograph/Otaku in my spare time

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

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

Hey #php people! Is there a way to implement an abstract constant? I have an abstract class which implements some stuff for my value objects and a constant IDENTIFIER I would like to enforce to be overwritten by the child classes.

It looks like there was a way in the past by using circular references: https://itecnote.com/tecnote/php-abstract-constants-in-php-force-a-child-class-to-define-a-constant/ but this doesn't work anymore.

Girgias,
@Girgias@phpc.social avatar

@Schrank Have the constant in the abstract parent class be defined as follows:

const CONST_NAME = self::CONST_NAME;  

And if the child class tries to use it without redefining it, you get an Error at runtime.

https://3v4l.org/TURXT

kisonecat, to random

<a,b> for open interval
≤a,b≥ for closed interval

Girgias,
@Girgias@phpc.social avatar

@kisonecat Why not just the French way of doing ]a,b[ for open interval and [a,b] for closed ones, have the direction of the bracket indicate the inclusion or not.

grmpyprogrammer, to random
@grmpyprogrammer@phpc.social avatar

Yes, I am aware that https://thephp.foundation/ exists. I give them US$50 a month. Is this the place where you want to send people who are interested in learning about and using PHP?

Girgias,
@Girgias@phpc.social avatar

@grmpyprogrammer @heiglandreas There already exist instruction for certain platforms and even "cloud".

I don't know what the rationale was in the past, but if you write good docs and PR them to doc-en then I'll merge them.

At this point in time, I'm one of the rare people mainting doc-en, and I don't have the time to spend on install docs that I don't even know how they work.

But I'm happy to review and merge such a PR :)

anthony, to php
@anthony@bitbang.social avatar

#PHP question: if you want to send a message with a signature so that the recipient can verify authenticity, but you want a asymmetric solution with private/public keys, are there options other than openssl_sign() and openssl_verify(), or are these the way to go?

Girgias,
@Girgias@phpc.social avatar
Girgias,
@Girgias@phpc.social avatar

@anthony Maybe use HMAC then?

OndrejMirtes, to random
@OndrejMirtes@phpc.social avatar

I'm catching some flak for requiring array_filter callback to return a strict bool in the latest PHPStan release.

Returning non-bool like int or string is most likely a bug on user's side. Zero means the value gets filtered out, same for falsey strings like '' and '0'.

Doing:
array_filter($a, fn (array $subarrays) => count($subarrays))

is probably on purpose, but what about:
array_filter($a, fn (Entity $e) => $e->getId())

Yeah, that looks more like a bug, in both cases it's returning an int.

Girgias,
@Girgias@phpc.social avatar

@OndrejMirtes IMHO it should return a boolean.

PHP doing an implicit coercion to bool is not ideal IMHO, might add this to the list of ideas to fix in core.

withinboredom, to random

PHP Strict Types: Hard to get right

Some people live and swear by strict types in PHP, and it's understandable why they do. I want to start by saying that strict types have their purpose, but many programmers don't understand what they mean and misuse them. I've seen plenty of subtle bugs related to strict types, so if you use strict types, this post is for you.

https://withinboredom.info/2024/01/27/php-strict-types-hard-to-get-right/

Girgias,
@Girgias@phpc.social avatar

@withinboredom I'll note, considering a whole part of one of my talks is about PHP's type coercions, [1] this still misses a lot of subtleties.

strict_types does prevent null coercions, but only for internals functions (which is something deprecated as of PHP 8.1).

But, also, your file might be in strict_type mode and still execute a function in weak mode if it's the engine calling the function.

[1] https://gpb.moe/doc/slides/PHP_Type_System_Talk_PHPDAY2023.pdf (slide 38/page 26 onwards)

Girgias, to random
@Girgias@phpc.social avatar

NGL, pushing wide changes on doc-en that are replicated via a script on translations, still makes me sweat as it takes a hot minute to achieve.

ciaran, to random
@ciaran@social.ciaranmc.com avatar

I've found the people r/french (Reddit) so helpful to question askers (I just lurk) that I've started flexing my pedantry on r/english

Girgias,
@Girgias@phpc.social avatar

@ciaran If you want the weird memes and no English, with hilarious French equivalents; r/rance is good.

Now, the one downside is that it can be very nationalistic and weird

nielsdos, to random
@nielsdos@phpc.social avatar

https://3v4l.org/4Nd5F (not my discovery, just stumbled across this and found this funny)

Girgias,
@Girgias@phpc.social avatar

@nielsdos AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

ramsey, to random
@ramsey@phpc.social avatar

I keep getting job rejections due to “lack of experience,” and if that isn’t the most disheartening thing to hear after having worked in an industry for over 25 years, I don’t know what is.

Girgias,
@Girgias@phpc.social avatar

@pierstoval
The UK had a lot of user group, which are more or less active, but not really an overarching body like @afup

Yes there is the national PHP UK conference, but last year it had less attendance than me Forum PHP, hopefully there are more people this year.

Girgias, to random
@Girgias@phpc.social avatar

BREAKING NEWS FROM THE UK

A NEW EPISODE OF "Should this consumable food item be subject to VAT" JUST DROPPED.

WITNESS THE BEST OF BRITISH ENTERTAINMENT

https://www.theguardian.com/business/2024/jan/19/walkers-mini-poppadoms-are-crisps-in-all-but-name-judges-rule

thephd, to random
@thephd@pony.social avatar

Stranded for a bit in Germany wooooo

Girgias,
@Girgias@phpc.social avatar

@thephd Is somewhere in France the final destination, or just crossing it to go to UK/Spain by train/bus/cycling(?!)/please fill in the blank

dseguy, to random French
@dseguy@phpc.social avatar

TIL file_put_contents() accepts an array as second argument, and will do an implode("", $array) on it when writing.

Who is using this feature?

#phptip #phptrick cc /@Girgias

https://php-tips.readthedocs.io/en/latest/tips/file_put_array.html

Girgias,
@Girgias@phpc.social avatar

@wyri @jaapio @dseguy Only arrays, in peak PHP fashion

Girgias,
@Girgias@phpc.social avatar

@wyri @jaapio @dseguy I'm not sure if it should accept an array in the first place, I only learnt of this yesterday. So I wonder how many people know about this "feature".

Girgias,
@Girgias@phpc.social avatar

@jaapio @wyri @dseguy Actually... this somewhat has a "good" reason. And this problem exists in a couple of places when objects are just interpreted as a property array.

But string|array as a union type is usually incompatible with objects because how do you handle an object that is both Stringable and Traversable? Do you think of it as a string? Do you think of it as an array?

http_build_query() is basically in this situation and causes pain and PTSD https://github.com/php/php-src/pull/10235

wffl, to random
@wffl@im-in.space avatar

[I'm in this post and I don't like it]

RE: https://tech.lgbt/@jyn/111768397510082535

Girgias,
@Girgias@phpc.social avatar

@wffl I relate to this, not for rust but for PHP.

There are things that I feel need fixing because certain aspects are so fundamentally broken, and you start and get sucked in to it for weeks/months.

I've been roughly working on 2 huge projects, which feel important to me, but no idea if anyone else will care.

Girgias,
@Girgias@phpc.social avatar

@wffl Writing RFCs sucks ass, it takes so much time, and makes me feel like I'm being paid for nothing. Triage/reviewing PRs makes me feel like I'm doing something that I can write down on the invoices to be justified being paid.

The admin is so slow and tiresome, and I have no idea how one can improve this for us, and the people after us.

The PHP Foundation is recent and has some money, but not that much, so who knows where it will be in 3 years time.

pixelambacht, to random
@pixelambacht@typo.social avatar

Problems Solved By OpenType!

Get rid of wobbly numbers! The first episode in a series of, uh... one. Made during a few lunch breaks a couple of years ago.

A quick video on how to use tabular figures on your page to prevent numbers being wider than others

Girgias,
@Girgias@phpc.social avatar

@pixelambacht The website name, I just can't, it is just perfect. 🤣

https://wakamaifondue.com/

Crell, to php
@Crell@phpc.social avatar

Dynamic type systems make writing the happy path less effort.

Static type systems force you to identify the unhappy paths and decide what to do about them (even if that's nothing), or to design them out of the code entirely.

Thus, static type systems are superior for software that needs to be reliable.

#FiteMe #PHP #Programming

Girgias,
@Girgias@phpc.social avatar

@Crell Counterpoint: C.

You need a robust type system for it to be any useful at identifying unhappy paths.

Girgias,
@Girgias@phpc.social avatar

@Crell More than weak, it is useless IMHO.

But I don't really see what typos have to do? That a more ahead of time check than a runtime check.

And C compiles are notorious for not type checking enum values, the only compiler which actually cares is MSVC... which is really bizarre.

dandb, to php
@dandb@mas.to avatar

Maybe #PHP should have a "scalar" type after all.

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

Me talking with a friend:
Okay, hear me out, new billionaire idea.
HS1 is above ground, right?
Connect HS1 to the railway that goes through Camden Road (editor note: this is the North London line)
And somehow connect the track between Kensal Green and Queen park to Old Oak Common
Just spit balling ideas

TURNS OUT, THIS WAS THE INITIAL PLAN FOR #HS2

Girgias,
@Girgias@phpc.social avatar

@derickr I need to go back to Leeds to talk with a uni friend about trains :|

Girgias,
@Girgias@phpc.social avatar

@pierstoval This has come up multiple times from friends and others.

And I still don't think so, I have a lot of friends who are on the spectrum and in different ways. And I just never really relate to anything that they tell me about experiences or others.

Like it might be, but I'm somewhat unconvinced.
And a "typical" joke I have with some Imperial friends is that the reason I "failed" Imperial (long story) is because I wasn't autistic (enough?).

So yah :')

Girgias, (edited ) to php
@Girgias@phpc.social avatar

Quick question for the masses:

When you use bitwise operators in , with what input types do you use them?

Girgias,
@Girgias@phpc.social avatar

@TimStarling It's more an idea at this point, but it's sooo far down my list that I'm not sure if I'll get round to it anytime soon.

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