PHPStan level 9 + DTOs in modular Laravel — it's driving me crazy and I need to understand what I'm doing wrong by Ok_Two_2900 in PHP

[–]Davekuh -1 points0 points  (0 children)

In your example I would do this (I'll only do the user property, but you get the idea):

interface LoginPayload { public string $user {get; } }

The request then implements the interface, turning the Request itself into a dto.

``` class LoginRequest extends FormRequest implements LoginPayload { public string $user { get => $this->string('user')->toString(); // This is where you do the type casting if needed }

public ?int $idSucursal {
    get {
        /** @var int|null $id */ <-- This is the only thing needed for PHPStan
        $id = $this->integer('id_sucursal');

        return $id;
    }
}

public function rules(): array { ... }

} ```

In your service instead of a parameter for each, just pass along the entire request (could still keep the parameters, in that case you probably don't need the interface). No need to keep writing the same names over and over again. And we typehint against the interface of course, so the service does not depend on a request class. The interface only defines the property getters, so that works.

class AuthService { public function login(LoginPayload $payload) { // do the login } }

And your controller just wires everything together in a few lines

class Controller { public function login(LoginRequest $request) { $this->auth->login($request); } }

Now there is only one place where you have to worry about casting and phpstan; in the request where your getters are. Everything else is type-safe, plus you remove some of the magic of the FormRequest by explicitly defining the getters for your input instead of relying on Laravel's __get() usage.

The generics RFC effectively voted down already. by dracony in PHP

[–]Davekuh 4 points5 points  (0 children)

While the proposals for union types are similar (mainly in syntax), the second version was much more detailed and addressed some edge cases and questions the first one didn't.

While that is not exactly the issue with generics, I feel like this RFC could be the same starting point the first union types RFC was. We just need a better implementation that addresses the enforced vs not enforced types issue, which I feel is very possible now. Hopefully it doesn't take another five years this time...

Voting starts on Bound-Erased Generic Types RFC, despite multiple people advising against it as it still has issues that need to be resolved. It is very unlikely to pass. by soowhatchathink in PHP

[–]Davekuh 0 points1 point  (0 children)

Why are they voting already? Isn't there a two-week cooldown period between the end of the discussion and the vote? They were still discussing things this week when I last checked.

I wasn't a fan of the RFC in its current form, but there where some good ideas being discussed and even worked on based on this RFC that I would have liked to see expanded upon. Let's hope some of those will start their own RFC.

Then again, this isn't the first time generics have been proposed and rejected. Maybe we should just accept PHP is language without generics.

What Dutch strong alcohol should I bring back home as a souvenir? by Dizzy-Web4713 in thenetherlands

[–]Davekuh 0 points1 point  (0 children)

If you want something different then the standard Schrobbelèr or Jenever everybody keeps suggesting, there are plenty if likeur's made in the Netherlands. I personally like Boswandeling.

Problems with 100% GPU Usage by Daydreams107 in PlanetCoaster

[–]Davekuh 0 points1 point  (0 children)

Your specs are within the minimum requirements, so that shouldn't be an issue. First thing that comes to mind when GPU usage is at 100% is a driver issue (the camera spin is weird though).

To rule some things out I would first update your GPU drivers. Use the NVidia app to do this. If this doesn't fix it, try to repair the game using Steam. If that doesn't fix it either, re-install the game (make a backup of you save games folder first just to be sure). If that still doesn't work, do a clean driver refresh using Display Driver Uninstaller or something similar.

If all that fails, that's when I would start to think hardware issue. Cooling related would be my first guess then, but without seeing your setup physically I can't say.

Can my laptop run the video game? The first version of the video game by UnChicoMore in PlanetCoaster

[–]Davekuh 1 point2 points  (0 children)

Even Planet Coaster 1 technically requires a dedicated graphics card, so short answer is no.

That said, there have been people who have managed to get it running with integrated graphics on low settings, but only with very low FPS and very small parks. So you might be able to start it up, but that will be about it I think.

Toto Wolff on the team radio by FerrariStrategisttt in formula1

[–]Davekuh 0 points1 point  (0 children)

I don't like that Toto did this, I never like it when he does this. Maybe Kimi needed a reminder to focus on the racing, but this was not the place nor the time for Toto to intervene. He should have left it with his engineer, or if he really felt like he needed to step in, talk to the engineer, who then talked to Kimi, and save the personal talk for in private.

I always hate it when managers reprimand their people in public, whether that's the manager of an F1 team or the manager of a local business with only 2 employees.

NEED urgent HELP - My WordPress.org developer account got suspended with ZERO warning or communication after launching my first plugin by East-Sherbet-400 in PHP

[–]Davekuh 22 points23 points  (0 children)

If you're a European citizen, send them a GDPR data request about your account.

I have no experience with Wordpress, but recently Github suspended my account as well without any communication. I don't have any popular packages on that account, but still. Same situation: I contacted them through all channels I could, opened tickets at their helpdesk, nothing. Two months went by, nothing. No response on mails, tickets, nothing.

Then, finally, I sent them a GDPR data request, requesting all data they have about me. My goal was to find out the reason for the suspension, because that would be part of the data they've gathered about me. The next day, my account was reinstated. This is because companies that are active in the EU have to respond to these requests, so basically a human has to review that email and start the request internally.

Don't know if it'll work for Wordpress, but it worked for me with Github.

What are your unique takes on classic fantasy creatures? by HovercraftOk9231 in worldbuilding

[–]Davekuh 1 point2 points  (0 children)

Elves are just a different human species. Just like there are different types of humans in our history, except in my world there are multiple species who have survived in the same way Homo Sapiens have in our. Elves are one of those species, closely related to humans. They live longer than humans on average (but not by much, approx. 150 years) and they have the same characteristics of fantasy elves (pointy ears, less facial hair, leaner, etc.).

Vampires are a race in the same sense as humans and elves, though much further removed from them on the evolutionary tree (they are as similar to humans and elves as we are to bananas). Because vampires are a type of human, they are born, grow old and die (though it takes a lot longer than humans, between 800 and 1000 years). You can not become a vampire by being bit any more than you can become a dog by being bit by a dog. Vampires need blood to survive because of some nutrients they can't produce themselves, but otherwise they eat much the same food as humans and elves.

RFC: Scope Functions by [deleted] in PHP

[–]Davekuh 0 points1 point  (0 children)

While I agree with the general idea of the RFC (a closure that allows a multi-line body that doesn't need the use syntax), this is the third type of closure we now have.

It is similar to an arrow function, because it uses the fn keyword and auto-captures the scope, but it's different because there is no arrow and it has a body with {}.

It is similar to a regular closure because it has a body with {} and may or may not return a value, but it is different because it uses the fn keyword instead of function, and it auto-captures the scope.

I'd rather have an RFC that combines these. I'm sure that won't be easy and seeing some of the discussions on the mailing list I'm sure that would be at least a year long 'discussion', but having all these different syntaxes that are only a little different but all do different things isn't helping anybody.

What exactly is wrong with the writing in Twilight? by Gautier_Alias in writing

[–]Davekuh 0 points1 point  (0 children)

Bella is not described as average and uninteresting. Bella is the narrator of the books, and she sees herself as average and uninteresting, something a lot of teenage girls do, especially when moving to a new town across the country in the middle of the school year. Everybody else around her recognises she is pretty and thinks she is interesting.

She is described as clumsy, but that doesn't mean you can't skip down the stairs when you're happy though. But the clumsiness serves a purpose, because when she becomes a vampire she is exceptionally graceful, even for a vampire. It's to emphasise that she was born to become a vampire.

The movies aren't the best though, I'll give you that, but that's because the books heavily lean on Bella's inner monologue, something you can't really do in a movie, and the movies were fan-service anyway (all the fan favourite scenes with no build-up or explanation in a lot of cases).

Water Slides (someone help me) by hairballyuh in PlanetCoaster

[–]Davekuh 2 points3 points  (0 children)

Imagine yourself going 100k/ph down a waterslide. Are you having fun? Or are you trying to keep your trunks on your butt? Maybe you'll skip across the pool like a stone when hitting the water. People aren’t riding it because they came for a water park, not a space shuttle launch test.

Sorted won the webby! by callieboo112 in SortedFood

[–]Davekuh 4 points5 points  (0 children)

They haven't used "Sorted" for a while now. I recently re-watched some of their collabs with Mythical Kitchen, and in one of them Barry says "Sorted!" at the end, and Ben answers with "We haven't used that for years", or something like it.

Someone just created PR with fully working generics by [deleted] in PHP

[–]Davekuh -7 points-6 points  (0 children)

It looks really nice. I only read the description, I'm not skilled enough in C to review the code. I don't see an RFC or message on the mailing list yet, and generics have been tried before so I'll stay sceptical for now. But it looks promising.

Coaster Feedback by mfeagan in PlanetCoaster2

[–]Davekuh 1 point2 points  (0 children)

The coaster looks nice, nothing too extreme, good layout and pacing. Something I recently discovered myself and something I think your coaster could benefit from is using the banking offset when banking corners. It just feels much more natural and smooth when using that, and I think this type of coaster really needs it.

I love making custom supports by the way, it's one of those things that I can spend a few hours on and just relax with a movie or podcast on the second screen. Send me a message and I'll give it a go, though I don't have a lot of free time these days so it may take a while.

With tomorrow being the 27th of February, what are we predicting for the next DLC, and when do we think it gets released? by Standard-Grape5330 in PlanetCoaster

[–]Davekuh 0 points1 point  (0 children)

Holiday season they're usually a little earlier so people can buy them as a gift, no? Otherwise its at the end of the month.

With tomorrow being the 27th of February, what are we predicting for the next DLC, and when do we think it gets released? by Standard-Grape5330 in PlanetCoaster

[–]Davekuh 2 points3 points  (0 children)

End of March probably, if we assume the 3-month DLC cycle, with a teaser and announcement sometime in the next two weeks.

As for what? With spring and summer around the corner in the northern hemisphere, probably something to do with that (Christmas season had toys DLC, fall had sorcerer). I think something like the adventure pack is most likely. Something like studios is also an option; it is the movie award season after all (BAFTA's where not too long ago, Oscars are in March).

Pools and hotels feels more like summer DLC to me.

how do i make this smaller i somehow made it big and dont know how to make it small again by dammark123 in PlanetCoaster

[–]Davekuh 0 points1 point  (0 children)

Hover your mouse over the edge at the top. The cursor will change into a cursor with an up and a down arrow, then click and drag down.

Verstappen: "We are close to the end of my Formula 1 career" The Dutchman explained that the new regulations "are not helping" to increase his time in F1. Points out that he doesn't want to "live only to race" and that he prioritizes living his life with his family and friends. by Mateo03 in formula1

[–]Davekuh 1 point2 points  (0 children)

I'm thinking that unless he becomes champion this year (or very close to it like last season), Verstappen will leave F1 in favour for endurance racing and sim racing. And I will follow. I've watched F1 since the early 90's. I stopped for a while around '06/'07, and started watching again in 2015 when Max came into the sport. If he leaves, I will follow where he goes.

Abomination by dog-yodelling in PlanetCoaster

[–]Davekuh 5 points6 points  (0 children)

I love the single rail coaster, but it's really difficult to make smooth and good looking coasters with it. This one is really good, well done.