« first day (3849 days earlier)      last day (1112 days later) » 
00:00 - 18:0018:00 - 00:00

6:01 PM
That still sounds like the class is trying to do too much.
If it can use a trait to implement an interface, then why isn't that trait a concrete class?
 
@Trowski possibly because @nikic hasn't gotten round to updating his delegate(? or similarly named) RFC yes, and delegating stuff to standard implementations is annoying still..
 
so if a class uses many interfaces you consider that the class is already trying to do too much ?
@Trowski
 
Depends on how small and granular your interfaces are
 
@Danack Link? I vaguely remember something about such a thing.
 
@CharlesSprayberry They are very granular yeah
 
6:08 PM
Oh god, combining array map and filter is so painful still.
 
@ln-s Another code smell. Not always wrong, but the brow is definitely going up.
 
```
trait Foo {
require extends Bar;
require implements Baz;
}
```

https://docs.hhvm.com/hack/classes/trait-and-interface-requirements 💅
 
But, yes, in general I agree with Trowski. You shouldn't be implementing that many different interfaces and those you do implement should make sense in the context of the responsibility for that class.
 
@CharlesSprayberry bit.ly/2Renkya
that's just an example so it implements mostly everything
 
@SaifEddinGmati Tangential to sealed it seems.
 
6:11 PM
Yeah it has to do with sealed classes in a way
 
@ln-s in a case like that, i usually introduce a new interface, that combines the two github.com/azjezz/psl/blob/1.7.x/src/Psl/Collection/…
 
sealed trait Foo permits Bar
 
@SaifEddinGmati I do that too
but that is a bare bones example
 
@Trowski mm no actually, trait requirement is different, it permits everyone to use it, but requires everyone using it to implement X or extend Y
 
Oh yep, I had it wrong.
 
6:12 PM
Right in my case some traits depend on others, mostly on CollectionInterfaceTrait, due to performance issues (which are part of a different package)
 
@Trowski can't find it.
 
but yeah I don't think there is anything wrong in adding or removing interfaces to introduce or take away certain functionality, and I just think of traits as a nice to have if you don't feel to write your own implementation
 
sealed trait Foo require extends Bar implements Baz
 
/me likes the idea of traits that can indicate that they fulfill an interface.
 
Yeah it's a drop in of code
friendly to the user
You can of course, not use it if you need to write something very specific
in most cases you would use the trait and your code would not duplicate
 
6:15 PM
The above requires the user of Foo to implement Baz, not that itself implements Baz
 
@ln-s combining has an advantage actually, assuming you have interface A and interface B, A::foo(): A and B::bar(): B, if i take an argument $c of type A&B, $c->foo() returns me A, while it should still return A&B, hence why i introduce a new interface that will rewrite all methods with more specific return type/
 
sealed trait Foo implements Bang requires extends Bar implements Baz There you go, lol
 
@SaifEddinGmati Yes I do the same :D But not there, that is a bare bones example
 
@Trowski nuh, actually like hack syntax in this feature
 
@SaifEddinGmati Yeah, that's definitely better :)
 
6:17 PM
I try to introduce the user to the basics, I do combine several interfaces into one in other packages
@SaifEddinGmati example, bit.ly/3nC9GkT
else the code reaches the other end of my house I feel you
 
@SaifEddinGmati That may be an approach for a sealed class. sealed class Foo { permits Bar, Baz; }
 
@Trowski could be
 
Though you still have 2 keywords :(
 
Going back to the original conversation, if you have seen the examples, you can see that the interfaces are very granular for this use case. In this particular case I'm not trying to do "too much" it's just about introducing characteristics which can be or not be there, it all depends on what you want / need
 
here's an example of use case for trait requirement:

trait CollectionFilterTrait
{
require implements CollectionInterface;

public function filter(callable $c): array {
return array_filter($c, $this->toArray()); // toArray defined in CollectionInterface
}
}
 
6:22 PM
Exactly ...
so I had to hack it with ...
    ClassHelper::mustHaveTraits($class, [CollectionInterfaceTrait::class]);
:/
It's not like i have an option
(would love to tho)
@SaifEddinGmati That looks nice
 
You can declare abstract methods in traits that another interface fulfills.
So CollectionFilterTrait can declare abstract public function toArray(): array;.
 
That's interesting!
 
code duplicate + if you want to change toArray signature, you have to do it in two places ( assuming interface actually has only 1 method )
 
Right, it's not a perfect solution by any means.
 
yeah ... that's the side effect
 
6:25 PM
You could have a trait that declares the abstract method! :D
 
hahaha
I'd rather do this:


trait VerifyCollectionTrait
{
private $_tHasCollectionInterfaceTrait = false;

//<editor-fold desc="AppendableInterface methods">
protected function hasCollectionInterfaceTrait(string $class): void
{
if($this->_tHasCollectionInterfaceTrait){
return;
}

ClassHelper::mustHaveTraits($class, [CollectionInterfaceTrait::class]);
$this->_tHasCollectionInterfaceTrait = true;
}
//</editor-fold>
}
ClassHelper::mustHaveTraits($class, [CollectionInterfaceTrait::class]);

The property in place is only because ^ can be expensive
recursive, checks traits on traits, etc
@SaifEddinGmati When you guys have implemented this, I will change it ;)
 
"I don't think there is anything wrong in adding or removing interfaces to introduce or take away certain functionality" - the mistake isn't in the solution. The problem lies in choosing to need that as solution.
 
6:44 PM
Ah the problem is that is not a problem paradox
In which one could probably argue that C was not even needed rather than ASM
 
Howdy folks. Any suggestion on how to search-replace a serialized string without unserializing it?
 
@LucasBustamante Which kind of serialized string, serialized through what
through serialize ?
 
Yes, serialized through serialize()
Considering I don't know what this string contains, and I don't want to unserialize() it
But I need to replace foo with foos in it
str_replace('s:3:"foo"', 's:4:"foos"'');
 
@LucasBustamante update your CV?
 
would be simple enough, but won't handle nested serialized strings
CV?
 
6:51 PM
cleanest solution is to unserialize and modify it, very clean and proper solution is not to use serialize in the first place
And Im sure that is not an option, not to use serialize that is, so you are in preg_replace domain most likely now
 
@ln-s the other way round; the problem you've chose to solve is the problem, and you should choose to solve an easier problem to work with:
 
I will read that page, out of curiosity, but this is beyond me
I need to handle this scenario because of higher forces
 
@LucasBustamante you'd need to look for something that parses php's serialize format, without instantiating it. there might be something on packagist.
Also, the little arrow replies indicate which message people are replying to.
 
easy, write a rust program that uses serde, which takes 3 arguments, the serialized string, what you are looking for, and what to replace it with, and run it using exec() :^)

https://docs.rs/serde_php/0.5.0/serde_php/

#TechnicallyCorrect
 
@Danack that's pretty nice. what book is that from?
 
7:05 PM
@FélixGagnon-Grenier oh, haven't I mentioned systemantics already? That's weird.....it's a pretty good book imho.
 
7:22 PM
@Trowski @SaifEddinGmati Any reason to use sealed over final?
 
@kelunik yeah.....it's a completely different problem set. When you want to have a known set of types that fulfill an interface.
aka @SaifEddinGmati have you made a repo for PRs yet?
 
@Danack no, hopefully tomorrow, been really busy this week ...
 
no pressure. mañana, mañana.
 
@kelunik @Crell suggested using final class Foo permits Bar, Baz {}, but i'm not really sure it fits
been working and shopping for new stuff, new desk/bed coming next week, monitors on Monday, received the new keyboard, mouse, mouse/keyboard pad, laptop cooling pad, printer, and headset yesterday :D
 
7:56 PM
Christmas!
 
making 14yo me dreams come true :p
 
8:15 PM
 
@SaifEddinGmati it's quite similar to final and declaring a sealed class final doesn't make sense
 
@kelunik yea, hence why i don't really like it. sealed has a clear meaning, it's used in kotlin, java, hacklang, and many other programming languages, i think we should do the same.
 
My only concern is limiting the number of keywords, which is generally a good thing to minimize BC issues. Other than that i have nothing against sealed as a keyword.
 
8:30 PM
RFC idea: implement all Hack OOP features in PHP, with a better syntax.
 
That's basically what we've been doing for the last 5 years.
 
well, if sealed gets merged, we have 4 left:

- trait/interface requirement https://docs.hhvm.com/hack/classes/trait-and-interface-requirements
- type constants: https://docs.hhvm.com/hack/classes/type-constants-revisited
- mock classes
- disposable objects
@Danack listen, it's a great idea, you just have to think about it for a second ...
jokes aside, i have an idea on how to get rid of declare(strict_types=1); inspired by hack
 
What are mock and disposable classes?
 
cmb
@Crell only for simple cases like php.net/manual/en/function.ereg.php
I think that PR generally makes sense
i.e. to show actual code examples
 
@SaifEddinGmati Hm, not a fan of either.
 
my preferred method of implementing mock classes would be to trigger a fatal if they are loaded via the autoloader, and only allow including them using require or eval
 
@cmb Thoughts on whether it should emulate the old is*() methods or the type checker?
 
cmb
nope :)
 
Well you're no help. :-P
@cmb For the sample code, you're saying put an <example> inside the <refsect1 role="description"> ?
 
cmb
8:51 PM
no; either put the text in the <section> into <refsect1 role="description">, or put the <section> into the <example>
but there should be no <section>
 
Ah, so the <example> is fine where it is, just move the <section> into a <para> inside the example?
 
@SaifEddinGmati what is the difference between dispose and __destruct? Doesn't it have the same purpose?
 
cmb
@Crell ah, now I see. The position of the example is fine (and the section should be moved into a para), but you better use <refsect1 role="examples">; see github.com/php/doc-base/blob/master/RFC/skeletons/…
 
function foo(): void
{
$a = new A();
using ($b = new B()) {

} // B::__dispose()
} // A::__destruct call here
 
I wasn't sure if it should be called out specially from the other existing examples since it's more of a replacement than a how-to-use.
 
cmb
8:55 PM
well, I think Phd expects pretty strictly layed out docbook
 
Likely.
 
cmb
you can put a deprecated warning in the description section, and refer to the "example below" or something
 
The deprecation warning is already there. I'll add a para to it.
 
@SaifEddinGmati that looks nice! Don't really have a use-case for it in mind though :)
 
cmb
poor doc translators :(
 
9:05 PM
@VeeWee That becomes Python's with keyword. Which is useful, but I don't see why B needs a different version of a __destruct method for it.
 
@cmb Yeah I'm hating my life, don't know why I even came up with this script
 
cmb
well, the script is a good idea; there are just too many PRs recently
 
Would be great to get at a state where we even can run this on CI, but yeah it's just everyone has decided to do doc works for some reason lol
 
@SaifEddinGmati Thanks for the idea protected function requireImplements(iterable $interfaces, string $class=null) : void
Cheers o/
 
9:22 PM
I mean, docs work is important, and badly needed, and easier to get into than core work...
 
Right, I'd just love to have more translators :)
My doc-fr stats are getting kinda stupid:
Girgias
973 commits 103,896 ++ 302,768 --
 
OK, well, there's that...
 
10:18 PM
@IMSoP just fyi, I was tab-pruning and I closed this, then immediately regretted it so found it in recently closed and perusing it for like 50th time
it's oddly captivating, maybe because I know it so well but haven't seen it for so long
also apparently at some point in the distant past I google image searched "low airships", I assume for some terrible pun that I couldn't bring together
 
10:39 PM
I think we should add stuff like php-config --thread-safety and php-config --debug which print "enabled" or "disabled" (suggestions welcome on exact values). Also php-config --module-api-no. As far as I can tell, if you don't have the autotools stuff installed then the only way to know if it's a zts or debug is to parse php -i or php --version. Shouldn't have to do that.
 
Especially because you have to determine if something is not there, which is more error prone.
 
> decliend
 
i blame my new keyboard
 
also, there's often enough discussions per RFC to make separate repos per idea.
sure, blame the keyboard.....
6 hours ago, by Danack
so, i might have a problem with my shift key.
 
10:42 PM
doubt there will be more than 1 in draft at the time
 
shit. Think I have like 12.
 
doubt i will have 12 in total before i quite this industry
 
What's your plan for when you ragequit? Because you have to have a plan:
May 13 '20 at 13:15, by Danack
@StatikStasis Thanks. When I ragequit the PHP project, I will go through the chat log of this room and find who it was who said the problem that PHP internals has it "not enough community involvement" and take the piss out of them until I get kicked.
 
no plans for when i quite PHP, but i am working on my plans for when i quite this whole industry
 
when I ragequit I plan to develop a serious substance abuse problem and end up in rehab. wait...
 
10:51 PM
how is your 'SW' 'client'?
 
yeh it's all a bit brokeback mountain tbh
 
@DaveRandom … well. Too much truth there in your case
 
@Danack a legit client, who are only still in business because it's a charity afaict
the phrase "couldn't organise your way out of a paper bag" implies that you are organised enough to acquire paper bags
I have been in lancaster lately doing shit though so it is still happening, just chaotically
more definitely, and in almost direct contradiction to the whole rehab business, I will be in brizzle after the weekend of 12th june, but I will be hanging af because it will be post-stag do
may be up for a small pub crawl tho :-P
 
Cool. plans exact details of the "three hills challenge".
 
ftr I don't generally do stags but this is someone I can't really say no to, and it will be good tbf, got this like 20-bed mansion thing for the weekend and booked one of those godawful narrowboats in the docks
going full club 18-30 on this shit in the day
 
10:57 PM
thekla?
 
> We're on the Bristol Redshank....
> There's no BYOB on the boot but we have a bar and a bog
the need to include "bog" feels bleak
I'm looking at a picture of it and it seems to be an old coal carrier narrow barge
 
11:27 PM
open.spotify.com/track/… MOAR TERRORVISION
 
11:51 PM
@DaveRandom I actually need to create some useful drama on that repo soon. So will reply here instead:
> Please check the security advisory "Do not run Imagick in a server that is directly accessible from outside your network." - if people don't listen to that one....
 
if you got some consensual trolling that needs doing I am 100% game
 
/waves hello to "the register" people...
@DaveRandom Not so much, more talking about companies depending on using Imagick, and not sponsoring....so kind of an important thing.
 
are we talking memory-based DoS vector or something more serious?
i.e. is it the obvious problem or a less obvious one
hopefully not something that can't be discussed publicly :-P
 
The Laravel and Symfony demo apps are both ~20% faster on PHP 8.1 than on 8.0, at least according to my benchmark. It's mostly due to Dmitry's inheritance class, I suppose
 
@Danack ah kk
 
11:56 PM
@DaveRandom it's an approach to security. And it's also one of the things that I've been struggling with the morals of. Basically.....I don't think Imagick is actually safe to use in production.
There are too many dependencies that have too many interactions, and some of the bugs that have been reported have almost certainly been exploited by the NSA for years.
/hey guys!
 
@MateKocsis that seems like a borderline suspicious level of gain, but awesome :-)
 
Yeah that seems extreme
 
@Danack *cough* libxml2
but also yeh
we really really really badly need to use one of the squillions of mature sax parsers that exist
 
Imagick is almost certainly much more reasonably safe on a background job processor with locked down access to DB/files on server/limited output.
/PRs welcome nsa dudes....
 
lol you are literally singing my libxml song
 
00:00 - 18:0018:00 - 00:00

« first day (3849 days earlier)      last day (1112 days later) »