« first day (4243 days earlier)      last day (696 days later) » 

8:09 AM
morning all
recently I saw the revival of no-body function declarations, but just though what is anyone wants to go further?
class Foo {
    public function bar(): void {}
    public function baz: void;
}
I know it's crazy but...
What I am about to say is reducing empty statement parts is not making things easier in any way IMO
 
 
6 hours later…
2:04 PM
@brzuchal I refer the honourable gentleman to my previous answer.
And although the "last line of a Rust function has an implicit return" is cute, and probably the strongest contender for 'less typing is better', I also don't particularly like that either. At least there it does make the code a lot shorter once you grok that pattern.
From Julie's expand deprecation notices RFC there is:
class Foo {
    public function bar() {
        // Do something conditionally if a child class has implemented a certain method.
        if (is_callable('static::methodName')) {
            // For valid callbacks, this call will be executed in PHP 8.x,
            // but will no longer execute in PHP 9.x.
            static::methodName();
        }
    }
}
is that true?
The RFC to deprecate them lists string callables, not syntax callables. Or whatever static::methodName(); is properly called.
 
cmb
2:22 PM
@Danack is_callable('static::methodName') will return false in PHP 9, so the if-body won't get executed. That's because of the mismatch. The check should have been is_callable([static, "methodName"]).
 
Or the other way round, calling it with ('static::methodName')(); would give a deprecation notice in >8.2?
(just firing up a machine to test).
 
2:37 PM
Fatal error: Uncaught Error: Class "static" not found in /var/app/debug.php:9
call_user_func('static::methodName', []); is the one that works....
 
2:54 PM
@cmb Ugh, actually it appears that:
is_callable(static::class . '::methodName')
is the way to check....
 
cmb
@Danack oh, right
 
Here's a joke - how many senior PHP developers does it take to write a callable correctly?
 
cmb
static::methodName(...) to the rescue
 
And that's probably how people should be passing the callable around anyway....rather than strings.
 
3:24 PM
@Danack how many?
 
More than 2 apparently. Sorry, I had a good opening line, and thought there'd be a punchline somewhere, but no.
 
n + 1?
meh, not that funny
 
@Danack If only that syntax had existed 20 years ago we wouldn't be having this issue.
So the best "answer" is probably... 44 - wiki.php.net/rfc/first_class_callable_syntax
 
yeah, just posted to internals.
 
3:40 PM
fonts?
 
my brain on autocomplete.
 
Ah the good ol true type fonts RFC, I remember it well, when we embedded 400MB of fonts into the php binary that could be accessed with magic URLs, just to make sure phpinfo() could print in whatever font you liked, even if it wasn't installed locally
 
Let go back to ye olden days
 
> This RFC introduces deprecation notices, not TypeErrors. It does not force
legacy applications to change anything, it just points out boolean
coercions that seem dodgy. If these deprecation notices provide little
value in the upcoming years, there is no need to promote them to a
TypeError, they could even be removed again
 
what rfc is that?
 
3:49 PM
The "Stricter implicit boolean coercions" discussion thread.
 
I'm still not really onboard for that RFC
 
I can't figure out a way of expressing what exactly is wrong with that other than, this 'approach is bad'.
oh, and the amount of work is would cause.
 
i have just seen wiki.php.net/rfc/global_login — which could be nice in theory, but will vastly underestimate work required
 
The only thing I care about on that front is "0" being the only non-empty string that's false.
IMO though it should be across the board, at the very least in strict typing mode.
 
 
1 hour later…
4:59 PM
@Danack She is called Juliette, not Julie. It's disrespectful to get names wrong.
 
@Derick Thanks.
 
@Danack something wrong with the dates there: "Voting started on 2022-03-12 and will end on 2022-03-26."
or maybe I'm -2mo off
 
@Girgias You time travelling again?
 
@brzuchal Ah, that's a mistake from me copy pasting the section from another RFC
@Danack Yeah sadly I didn't manage to go far enough yet to prevent the creation of SPL
 
@Girgias Punish yourself publicly now :D
Joking
 
5:05 PM
@Girgias I don't think you can. That's protected by "The Moment, previously called the Eye of Discord, was the most powerful and most dangerous weapon in all of creation"
 
@brzuchal Fixed it now :p
 
Perfect, voted
 
@Danack Honestly, I fixed a bug in SPL, I apparently introduced 4 others (or they now show up), there is fuck all test coverage and it's just batshit insane
I'm truly a masochist
 
Apr 25, 2015 at 1:58, by Danack
@Worf I'm not going to say that drugs are bad, I'm just going to say that some of the SPL was designed when people were discovering Mescaline, and that the results were bad.
Apr 25, 2015 at 6:41, by Sara
@Danack I've got this visual of Marcus doing mushrooms and repeatedly muttering iterator iterator iterator iterator iterator iterator iterator iterator iterator iterator iterator iterator iterator iterator iterator iterator iterator iterator in the corner.
 
He did say iterator a lot, but he was definitely not into drugs.
 
5:17 PM
How can i dynamicity access cases in enum ?
I got this error: Error : Access to undeclared static property App\Enums\PosterSize::$type
 
Why would you want to access static things dynamically instead of doing a match ?
you got 4 cases, instead of inventing wheel just write return match($name) { ... and put the options here... } - in 5m you're done
also if I were you instead of using int baked enum would use string baked enum with values you have in $name
then PosterSize::from($name) does the job
 
Yeah match working but wanted to know if i could do the same in one line of code
 
@Mwthreex PosterSize::from($name) if you replace 1, 2, 3, 4 into "small", "medium", ...
 
@Mwthreex yeah - I was going to ask, why do you want the enum values to be digits, and not the strings themselves?
 
5:39 PM
I changed my mind to accept string, ty guys
 
Anyone experienced with Dockerfile configuration for PHP?
I am having the following error:
executor failed running [/bin/sh -c apt-get update && apt-get install -y libmcrypt-dev mariadb-client     && docker-php-ext-install mcrypt pdo_mysql mysqli json]: exit code: 1
ERROR: Service 'php-fpm' failed to build : Build faile
It's coming from this file: github.com/samayo/docker-simple-lemp/blob/master/php7-fpm/… after I change php from 7.1 to 8.1
What could prevent the installation to work for php 7.1 but not 8.1?
 
6:20 PM
Nevermind, removed && docker-php-ext-install mcrypt pdo_mysql mysqli json and it worked
 
6:43 PM
@MateKocsis I am getting "TypeError: ini_set(): Argument #2 ($value) must be of type string, int given in D:\projects\php-src\build\gen_stub.php on line 18" Should I update something in my GIT?
I don't see any way to fix this locally. I don't understand why I am seeing this error
 
cmb
7:01 PM
@Dharman I guess you're running gen_stub.php of master with PHP 8.0.
 
@cmb correct. What do I need to change?
Should I switch to PHP 8.1?
 
cmb
That's one possibility. Or simply fix gen_stub.php locally (ini_set("precision", "17")); maybe we should do that in the repo.
 

« first day (4243 days earlier)      last day (696 days later) »