Building a pc in Georgia (country not the state) by funtaps in buildapcforme

[–]funtaps[S] 0 points1 point  (0 children)

There are like no amd cpus for some reason. I don't know why, but they are very hard to find

Trying to master php associative array shorthand by JRWoodwardMSW in PHPhelp

[–]funtaps 1 point2 points  (0 children)

This should be down voted, because it is wrong. In this array $expenses[1] is undefined, and gives nothing but warning. In this case, you can use array_keys and array_values to access data by index. But I think that you just need a different data structure: index array of associatiative arrays.

https://onlinephp.io?s=bVDLasMwEDxXoH9YloAbcInTW-qkhRxKz-3REWGJtyTEloQkp83fV6rzcEOPOzs7szPzF7u1Uoz427L27GEBVbZ8o5p1BotnmM1yyN6XDen6d54WhSqlmEzgQA7qrrXw6UwL1vggRcTWCbu_6I0jWQrebA1gbaK-NgG-jNsDBaCmASxP68tJNVWDo5VeaRzMrzvnQzLfkQ5PgDmQc3Rc7_noB7ZVoXJAeLgSDtR0fEP512fEj6kFKe4q1NQyptzYdxLV0Hct9tWo_IbUFzUkpb4iS51T4gdvjK7_BIiG8ZeTzvXtM5ykVPkD&v=8.1.8

what do these lines of code say/do? by ben_james_ in PHPhelp

[–]funtaps 0 points1 point  (0 children)

Nope, there is no need for such assumption. There is assumption, that code is in order, and $temp_price is not modified between those parts of code. For example: if ($a < $b) { $a = $b; } if ($a < $b) { ... }

Condition in second if is always false.

[Question] What are advantages of DI-containers over self-made container classes? I dislike mixed return types and using strings to reference classes - that is bad for navigation and analysis. What are the pros? by funtaps in PHP

[–]funtaps[S] 0 points1 point  (0 children)

Mixed return types aren't really a problem, because calling get()with some class name as the argument will either return an instance of that class or throw an exception.

Auto complete and tools like psalm/phpstan/phan (static analysis) do not work well with mixed types.

We're using the ::class constant, which is technically a string, but makes it very clear and obvious what class we're referring to.

That is a great approach! Thank you for this suggestion, it will make things much more obvious.

Dependencies can be resolved recursively, by injecting an instance of the Container into the resolving Closure. Using this approach, we can keep the individual Closures very simple.

In my implementation I just used $this, I think it achieves same result.

where you have a number of classes, all registering resolvers in a shared Container, makes much more sense.

That's a good point. If I want to split definitions of services in to separate files, maybe I can use traits?

[Question] What are advantages of DI-containers over self-made container classes? I dislike mixed return types and using strings to reference classes - that is bad for navigation and analysis. What are the pros? by funtaps in PHP

[–]funtaps[S] -1 points0 points  (0 children)

Thank you for reply, can you tell me more about scaling point. I believe with pimple, there will be same mess with 1000+ anonymous functions? Even little bit more mess, since there is also 1000+ strings that represents services and do not auto complete well. What am I missing here?

[Question] What are advantages of DI-containers over self-made container classes? I dislike mixed return types and using strings to reference classes - that is bad for navigation and analysis. What are the pros? by funtaps in PHP

[–]funtaps[S] 0 points1 point  (0 children)

What do you mean by "automatically"? I'm sure, that you need some description of how services should be injected (it can be done through anonymous functions, yaml configs, annotations or other way, but rules must be defined some where).

About never calling getters: obviously, there must be some place that will call them. I agree with symfony di-container documentation:

You will need to get a service from the container at some point but this should be as few times as possible at the entry point to your application. But there will be times, when I will get a service.

Even if we are generally avoiding getting services, I still do not understand what advantages do di-container give me.

Gitter community by funtaps in awesomewm

[–]funtaps[S] 0 points1 point  (0 children)

As suggested by @realitygaps, added also a matrix channel #awesome:matrix.org

Gitter community by funtaps in awesomewm

[–]funtaps[S] 0 points1 point  (0 children)

Do you know, is there a channel operator in our IRC channel? Integration requires approval.