@cspray@phpc.social
@cspray@phpc.social avatar

cspray

@cspray@phpc.social

Makes confused expressions while writing code. Sometimes I do it for free, other times I trick Roave into paying me. When I'm not writing code or stroking my glorious beard I'm hanging out with my wife or playing with our dog & cats.

I post primarily about tech stuff, politics, and attempts at humor. I'll try to mark political posts with a content warning.

he/him

This profile is from a federated server and may be incomplete. Browse more on the original instance.

cspray, to php
@cspray@phpc.social avatar

Couple weeks ago speaking with @ocramius about Annotated Container. He brought up something about Attributes I had heard a few times before. Something along the lines of:

"I don't want container wiring code littered throughout my codebase."

So, I wrote a blog article that talks about how Attributes aren't really the point of Annotated Container and how you can use the library with no Attributes or highly limit their spread through your code.

https://www.cspray.io/blog/annotated-container-without-attributes/

-container

cspray,
@cspray@phpc.social avatar

@dantleech @edorian I tend to be in edorian's camp. But, with Annotated Container (AC) I want to support the DI config preferred by users. In AC, have a per-module DefinitionProvider and use a CompositeDefinitionProvider in your Container bootstrapping; defining whatever implementations are appropriate for your app.

My larger concern isn't where your DI is configured but how it is configured. This is a pretty strong opinion after years working on AC and apps using similar DI, but...

1/2

cspray,
@cspray@phpc.social avatar

@dantleech @edorian Service Locator is an insidious design pattern that should not be used and I see it in all the places. A Container should not be injected or passed into methods. Ever. Not for config. Not in factories. If a Container is used outside of bootstrapping code I believe it is being done wrong.

Basically this snippet is as much direct Container interaction that should be in an app:

$container = createContainer();

$container->get(Application::class)->doTheThing();  

2/2

cspray,
@cspray@phpc.social avatar

@dantleech @edorian Yea, I know. It is just a point I really wanna drive home to people that might be reading this thread.

cspray,
@cspray@phpc.social avatar

@dantleech @edorian From my conversations, this appears to be a popular line of thinking. One I understand the reasoning for and I hope my article shows AC can support!

I'm planning on continuing to eat my own dogfood with AC and create an app using the per-module DefinitionProvider design. Hopefully I might discover ways that the library can be improved when using this style of DI config.

cspray, to random
@cspray@phpc.social avatar

While house-training our pup, I've trained him to go to the bathroom on cue. Around 3:00am he's whining to go outside. I open up the back door to rain, he has a change of heart and starts to turn around. I scoot his little butt out there and, from the door, give him the cue to pee, "Go potty".

This dog, at the bottom of the steps in the rain, just sat down and stared back up at me. Give the cue again, nothing. I step outside in the rain, instantly responds to cue.

That little bastard.

cspray, to php
@cspray@phpc.social avatar

I have found myself, for the first time, having to write what I consider worse code to satisfy Psalm static analysis. Here's a watered-down example showing what I consider odd behavior.

https://psalm.dev/r/5862a290e2

I'm not certain why the 2nd call to doSomething() is valid but the 1st call is not.

cspray,
@cspray@phpc.social avatar

@herndlm This turned out leading me to what I was missing. I was operating under the assumption that the spread operator does not re-index keys. Turns out it does re-index integer keys and explains the behavior I'm seeing. Thanks!

cspray, to random
@cspray@phpc.social avatar

It is that once-every-17-years occurrence where cicadas have emerged. There's a near-constant, background buzzing.

Also, my boxer puppy, Mack, loves cicadas! As in, he eats them. Every time we bring him outside we catch him munching on one.

cspray, to random
@cspray@phpc.social avatar

I wish I had a nickel for every time I've typed:

docker composer

cspray, to random
@cspray@phpc.social avatar
cspray, to random
@cspray@phpc.social avatar

We got a Boxer puppy recently, here he is laying with our Labrador retriever.

The puppy and the cats, off screen, are now in cahoots with one another. A cat, or cats, will knock something off the counter which the puppy will then chew on or run off with.

I love it! Teamwork makes the dream work.

cspray, to random
@cspray@phpc.social avatar

Turns out, data types are important.

cspray, to random
@cspray@phpc.social avatar

At one of my first jobs as a developer I joined a small company and the week after I started the senior dev left and I found myself the only full-time programmer.

Company was in a situation where there was a hard deadline to change payment processors or lose the ability to take payments. I spent a couple months testing, building a layer that acted as an emulator for the old processor and translated requests/responses to a new API.

1/

cspray,
@cspray@phpc.social avatar

While this was happening I was helping an agency rewrite a very legacy app that would improve the payment processing significantly, including not storing credit card info on-site among many other improvements.

That rewrite wouldn't be ready for some time and my emulator layer lasted for nearly 10 months processing payments.

2/

cspray,
@cspray@phpc.social avatar

I didn't last at that company for very long. The burden of that emulator layer being solely responsible for my colleagues getting paid was too much, especially at that point in my career.

A lasting impact from that experience is being very sensitive to the slightest payment processor problems. It seems kinda obvious but successfully accepting payments is a pretty big deal and one that can be easily taken for granted.

Until it is taken away.

fin/

cspray, to random
@cspray@phpc.social avatar

I haven't posted an answer on Stack Overflow in a long time. I've got a few answers that net me a couple hundred points every now and then.

In one, I give a detailed explanation of routing and dispatching concepts, along with an interactive example that works in PHP 5.4 to 8.3. https://stackoverflow.com/questions/11700603/what-is-the-difference-between-url-router-and-dispatcher/11711542#11711542

The other, I basically regurgitate the PHP docs. https://stackoverflow.com/questions/6511020/get-2-levels-up-from-dirname-file/6511038#6511038

Both have the same exact number of votes. I hope they stay tied.

cspray, to random
@cspray@phpc.social avatar

Well, I can tell the weather is warming up. The birds are chirping, the grass is growing, and people are back to shooting firearms in their backyards in residential neighborhoods.

Smells like spring!

cspray, to random
@cspray@phpc.social avatar

Today I marked "Open a Pull Request to a Pull Request" off my Programmer Bingo Card.

cspray, to random
@cspray@phpc.social avatar

My cat has 4 phases of attention seeking behavior.

Phase 1 - Sits next to you and meows
Phase 2 - Brushes up against your legs
Phase 3 - Plops down on her side and rolls over on her back
Phase 4 - The claws come out

Ignore Phase 3 at your own peril.

asgrim, to random
@asgrim@phpc.social avatar

Hey 🇺🇸 friends, I have a PSA for you.

We need to get something ironed out here:

Fried chicken is NOT an item of food that should appear on a breakfast menu.

Thanks for your time! ❤️

cspray,
@cspray@phpc.social avatar

@asgrim Generally, I agree with you. However, like all rules there's an exception to this one; if you also include the words "& Waffles" next to fried chicken.

cspray, to random
@cspray@phpc.social avatar

Over the weekend my wife and I visited a local antique market and I found something I think is pretty neat... a cribbage board made into a truck! When my mom was alive we'd routinely play cribbage and seeing this brought back a flood of memories.

The truck itself is clearly handmade and well constructed. There's no visible screws or nails, everything detaches, and it rolls across the table.

I'm excited to teach my wife how to play cribbage and use it!

A top down view of a wooden tractor-trailer cribbage set, with the cribbage board detached from the trailer chassis. The trailer chassis has 4 divots that correspond to spots on the bottom of the cribbage board, ensuring it stays in place during game play.
A top down view of a tractor-trailer cribbage set with all pieces detached and pegs in the board. The trailer chassis detaches from the truck, showing a wooden fifth-wheel. The sleeper comes off to reveal a slot designed to snugly fit a deck of regular-size playing cards.

cspray, to random
@cspray@phpc.social avatar

Well, it finally happened.

I installed a Perl support plugin into PHPStorm.

cspray, to random
@cspray@phpc.social avatar

I decided I wanted to build my first ever model car. So last night I assembled and painted the engine and transmission! Hoping I can get more of it together this weekend.

cspray,
@cspray@phpc.social avatar

@sidawson Yea, and this is just a level 2 model, about 70 pieces to the whole car. Level 3 models have over 100 pieces and they go up to level 5!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • kavyap
  • DreamBathrooms
  • cisconetworking
  • magazineikmin
  • InstantRegret
  • Durango
  • thenastyranch
  • Youngstown
  • rosin
  • slotface
  • mdbf
  • khanakhh
  • tacticalgear
  • megavids
  • everett
  • modclub
  • Leos
  • cubers
  • ngwrru68w68
  • ethstaker
  • osvaldo12
  • GTA5RPClips
  • anitta
  • provamag3
  • normalnudes
  • tester
  • lostlight
  • All magazines