Joe T

@cautionbug@phpc.social
6 Followers
14 Following
46 Posts
Web developer, smart ass, also dumb ass.

A reminder that puberty blockers aren't being banned for cis kids, because they're safe.

It's not clinical risk, it's transphobia.

PHP 8.1 gave us "new" in constructor parameters.

Why didn't we also get static function calls?
* Still need to autoload the target class
* Constructors aren't restricted from doing anything except returning, but that's what "new" is for. What's the gap between constructing an object returned by "new" vs returning from a static function?

Also, when will "mixed" become a super-type of everything else (except maybe "void" and "never")?

Just my gripes today.

Who decided to leave interior mutability on objects as readonly properties? It's not "readonly-except-object"... On a higher level class, the modifier (or absence of) determines mutability, but stdClass should either respect the property modifier, or provide some way to declare it as locked on assignment.

It's confusing and inconsistent - especially since objects within readonly arrays can't be accessed for mutation.

Update:
$request->getBody()->getContents()

Gives

----------------------------924366111721601982714600
Content-Disposition: form-data; name="file"; filename="test.csv"
Content-Type: text/csv

{file content}

so now i just need someone to point me to a decent library to extract the file.

Any help is appreciated.

Hey much-smarter-than-me people...

i've got a project in Slim 4 that needs to follow OpenAPI. One endpoint uploads a file that replaces an older version, so "PUT" seems appropriate. But obviously $_FILES is empty, but so is the body. Image is the basic parameter setup in Postman. Anyone know of a middleware that works, or do i have to roll my own php:// parser?

Why doesn't "mixed" type in PHP permit covariance/contravariance?

https://onlinephp.io/c/6f1c9

Why doesn't this satisfy compatible signatures, given that "array" or "int" are always of pseudo-type "mixed":

class A
{ function foo (mixed $bar) {} }

class B extends A
{ function foo (int|array $bar) {} }

What am i missing?

PHP Sandbox - Execute PHP code online through your browser

Run PHP code in your browser online with this tool in 400+ PHP versions