« first day (4090 days earlier)      last day (1083 days later) » 

10:05
public function method(): ?array
{
//
}

`Return value must be of type ?array, none returned`

Which types should i use to accept void|null|array ?
10:18
@Mwthreex: void specifically means a function that never returns. You can't use void with anything else. If you specify any other return type, you must return a value. You probably want to return null in the case that you want to not return an array.
10:32
I asked because the interface i decraled has so many function like this
i have to return return null in so many methods
10:53
"I have never, even considered the idea of separating the concepts of in/out requests and responses and I believe it is a cursed though" so how can the codebase be clean if you don't specify? You just have "request" and "response" and they can be in or out?
11:08
@FélixAdriyelGagnon-Grenier it makes sense to separate the two concepts since they're different things; http requests and http responses are structured in a different way. Take a look here developer.mozilla.org/en-US/docs/Web/HTTP/Messages
Wes
Wes
i have another computer in my office that i never use
it just turned itself on automatically
i am actually scared
ghost in the machine
how the hell does that even happen
super freaky
power interrupted with bios set to reboot on power loss?
Wes
Wes
ah, dunno. maybe it's something like that
Wes
Wes
11:29
might be a dead bios battery
 
1 hour later…
12:44
@yessure you misunderstand, of course response and request are different. I mean OutboundResponse vs InboudResponse and OutboundRequest vs InboundRequest, as James was expressing it a bit sooner.
> [...] use Response and Request abstractions" [...]
is actually what I go for. using two different Response abstractions to make a difference between a response being sent to the client of an api vs the response being received for a request from said api is not useful, in my opinion
I understand that the sentence "I hereby encourage anyone who's been cursed to literally ignore this, use Response and Request abstractions and free themselves of that lich" is possibly misleading, granted :)
if I can structure it better, I would say:
I encourage anyone who's been cursed to: (a list of things to *do*)
- ignore this [said duplication of abstractions]
- use Response and Request abstractions
- free themselves from that lich
@James yes, exactly.
I mean, the fact that at some point a request is going from or to an application doesn't change anything to the structure of that request. it's an http request
now, maybe one could name it $outbound_request vs $inbound_request if both of them somehow interact within the same scope, but in my experience, handling inbound requests happens somewhere in a "front" controller, whereas outbound requests happen in a handler somewhere
if a middleware with a constructor signature like __construct(HttpClient $client, Request $request) ($request here being the client request we are answering at the moment) exists, then here it could probably be useful to name one of them inbound_request to differentiate, but having a whole other abstraction seems to lead directly to nightmare, to me
/spam :)
13:09
Morning!
13:25
@Mwthreex for stuff like this, if I haven't fleshed out a method, just doing return []; satisfies the return type, but shouldn't break anything.
13:40
@FélixAdriyelGagnon-Grenier but inbound responses have different needs to outbound responses. Inbound response is data as the API being a client, and likely expecting a data response with headers that the API (as a client) expects. An outbound response is a response TO a client, and headers etc have to be set based on the original request sent by the client
Just feels like they're all separate to me, with different implications. Outbound response is a response to an inbound request and needs to obey certain things from the inbound request, e.g. HTTP content, etc. Whereas inbound response is just data from a request. Likely just store in DB, or add to some inbound request
Yes, I believe I agree with most of what you said here, yet I think I would make these distinction live elsewhere. let me hack some lines together to see if I really get it!
(don't hold your breath, I'm also making coffee :)
@FélixAdriyelGagnon-Grenier ah my bad. I see your point now, makes sense yeah.
14:11
@FélixAdriyelGagnon-Grenier that would be good. I'm not so much debating that I'm right as debating the validity. More so, where best to put the separation - as 2 or 4 DIRs, or classname separation, etc
PSR7 has done this, but IMO the names are not to my liking or logical imo (no offence to those who did it ;) )
@James oh yeah, totally understood :) I'm currently also trying to explore my gut feeling about this, thanks for giving me a context to do so!
user17161735
14:44
hello, good morning guys; help me with a post of SE meta ???
15:06
Morning
@SaifEddinGmati Nice. Remembered that Amp has the Parcel interface, which provides exclusive access to a value.
Sequence could be built on top of that. How were you envisioning Sequence being used?
15:54
o/
16:09
@James What is not logical in PSR7's naming?
16:25
@Crell "ServerRequestInterface" and "ResponseInterface" deal with Inbound request and Outbound response. Then "RequestInterface" for Outbound Request, but no Interface to deal with an Inbound Response?
ServerRequest extends Request, to add the extra stuff that CGI throws at you. You can, if you want, pass it directly to Guzzle as a Request and it will type check.
It's just request and response, symmetrically... with a few extra bits for the common case of the inbound server request that you need, because of how PHP/CGI works.
I guess I need to read them more? I just see three scenarios and only three interface, and I did read them through a few times and it wasn't obvious to me how to do e.g. InboundResponse, OutboundResponse, InboundRequest, OutboundRequest
but there is a difference between in inbound request and an outbound one. Inbound the server adheres to the client (Sender) things like HTTP content etc, whereas the outbound one sets that
maybe I'm being dumb/uninformed and need to do more reading
Dumb, no. Uninformed, maybe. :-)
:P
The tricky bit is that the goal of PSR7 was HTTP messages, symmetrically. However, there are slight differences in how PHP lets you send a request vs receive a request, both in the basic APIs and in the usage patterns. The conclusion was to have core messages (request/response, url, etc.), and then for the inbound server special case, extend it.
16:31
I realize there's a userland perspective, that is distinct from "core" perspective, for lack of an immediate better word
The core APIs (superglobals) don't have any of this. It's just CGI mapped into arrays, go have fun.
yeah, core was poor choice on my end as it was completely not what you used it for in the previous sentence :)
English has insufficient nouns...
so I guess then, request is the same in that setting request data in some class (PSR7 interface) E.G. the HTTP "accept" is either the server sets it on an outbound request, or was set by the client on an inbound request, but either way it's a value in a class/interface, and the rest of the code should handle/know whether it was inbound or outbound?
Correct. $request = $request->withHeader('accept', 'application/json') is the same whether you are building a request to send through Guzzle, or modifying the incoming ServerRequest as part of a middleware pipeline. (though IMO modifying the incoming request like that is frequently a code smell, and you should put derived info in the attributes.)
16:43
> This is an exercise in userland usage of Request and Response Http abstractions.
What I try to express here, is that while the directions (php runtime -> something else, something else -> php runtime) may vary, essentially these reside elsewhere than where I'm trying to reason about things, within userland
17:39
I need to run out, but in short... reasoning about all of these ins and outs is what FIG already did, so that you didn't have to. :-) PSR-7, PSR-18, and friends cover more edge cases than you can yourself, and unify the server/client sides as much as is feasible in PHP. 9/10, just using those is going to be your best bet.
ubuntu: troubleshooting why my external keyboard is defaulting the Fn key as "pressed" with my external keyboard... that was a fun bit of troubleshooting
press F5 on external keyboard => keyboard light would dim on laptop keyboard
18:00
@Trowski the main use case for it i have in mind, is when using twig, or any other template engine, as they tend to use ob_start()/ob_end_clean(), if the template contains any non-blocking I/O, it could cause concurrent template rendering, which would result in a mess. having a wrapper for the engine that uses sequence would ensure that render is never called concurrently.
or any service that has a state ( which seems to be common, as people don't tend to put in mind applications using amphp/http-server for example. )
@SaifEddinGmati Ok, so Parcel could serve the same purpose by using the stateful service as the parcel value.
18:35
@Trowski should it be moved to sync? i think it makes more sense there
@SaifEddinGmati Yes, probably.
also, Amp\Sync and Amp\Parallel\Sync are a bit confusing for me ^^
We might move everything in that directory except IpcHub to amphp/sync.
Eh, I take that back. Channel is dependent on another lib that's dependent on sync.
However, if Parcel was in amphp/sync, I think then I'd rename that namespace to Channel.
maybe have only local channels ( similar to Psl\Channel ) in amphp/sync, and leave the stream implementation in amphp/parallel?
The local channels are dependent upon the other lib.
sync <- pipeline <- parallel
18:59
i think that could be dropped, no need for pipeline
( array + suspension )
19:32
@SaifEddinGmati Which is fundamentally what pipeline is. It's a lot easier to reuse it.
Channel could be its own library too. We have so many libraries already though I don't like to do that unless there's a clear reason it needs to be separate.
20:03
yea, it's a pain to maintain, and keep things up to date together
i suggested it previously ( not sure to you or @kelunik ), to use mono-repo, and split it similarly to what symfony does.
20:59
Hello guys

#Q Does anyone know how can I delete records which have foreign keys that piont to deleted or non-existent records(primary keys)?

I didn't set constraints for my relationships in the past; so, there are some mistakes in my database table records.
@SaifEddinGmati I think that would be not too bad, especially with things like renames … @Trowski
@bwoebi That sounds like a BC nightmare. We wouldn't be able to make BC breaks in a higher-level lib without tagging a new version of effectively everything.
@Trowski not sure how this is related
you'd have your (untagged) monorepo … and then split this out into the different subtrees which are tagged individually
^ exactly
but you can also automate this process, symfony currently doesn't tag bug fix releases for packages with no changes, same can be done to not tag minor or major!
github.com/Roave/BackwardCompatibilityCheck could be used to determine if a new major is needed.
tho, this way, you lose the ability to have same version for all amphp packages in composer.json, which would be really nice
21:31
@bwoebi I assumed the monorepo would be tagged, so that was my confusion.
21:43
"Each day we stray from the Omnissiah..."
user17161735
hello.
user17161735
suggest me some way to add a pie chart to pdf with mpdf ??? I only need to represent a percentage of cash, for example 95% of 100%
21:59
Pie charts are a bad form of visualization: data-to-viz.com/caveat/pie.html.
@Arcanis-TheOmnipotent mpdf.github.io/html-support/html-tags.html Never used mpdf but it looks like mpdf doesn't support canvas so your best bet is gonna be using some other library to create an image and embedding that in the PDF. Alternative, fpdf (which I also haven't used) has some examples on how to draw graphs. fpdf.org/en/script/script28.php
cmb
cmb
22:30
"The problem is that humans are pretty bad at reading angles." – citation needed
Furthermore, you can compare the arc lengths.
Creating a minimal pie chart with imagearc shouldn't be hard, but caveat: it only supports integer angles, and several relatively new versions of libgd have a serious bug there, and even the latest version isn't really good at it.
@NikiC I'm finally reading that ssa book you suggested. Did you have preexisting knowledge on graph theory before reading the book? There's so much jargon in there it's hard for me to get through any page without reading it 5 times :D
 
1 hour later…
23:57
@LeviMorrison pie charts with added numbers are pretty fine
Just use bar charts or lolipop charts, IMO.

« first day (4090 days earlier)      last day (1083 days later) »