@cabbey@phpc.social avatar

cabbey

@cabbey@phpc.social

sourcerer @ SmugMug, photo geek, dad, licensed rocket scientist (L2 w/ NAR and Tripoli).

This is MY stream of consciousness. I don’t speak for my employer, club, or hobby.

Fiscally conservative, socially liberal; he/him

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

dseguy, to php French
@dseguy@phpc.social avatar

question of the day : when you know that
2*2 = 4
2^2 = 4 (too)
2.5^2.5 = 9.8821176880262..

Where is this 6 coming from ?

cabbey,
@cabbey@phpc.social avatar

@dseguy I assume this https://3v4l.org/3E7BL snippet captures your complaint? (3v4l is the preferred way to share code snippets over screen shots.) specifically that the fourth print should be 4 not 6

If I had to guess, it’s something about operator precedence between the cast and the exponent. But that’s downright weird given the multiplication gets it right. Probes out by adding more parentheses: https://3v4l.org/gXvRL

cabbey, to php
@cabbey@phpc.social avatar

ok folks, you were right Rector is pretty cool. The learning curve is steep AF, and the docs are, well, let's just say they're written by engineers for engineers. But given the target audience for this tool, that's OK. I've not yet done the changes I was originally asking about with it, because the config for it is going to be a PITA to build. I've been starting small. But what I've done so far has been pretty cool! I've done some wild things with RenameClassConstFetchRector for example. 🧵

cabbey,
@cabbey@phpc.social avatar

BUT... this brings me to two questions that don't seem obvious from the docs and sources. 1. as a result of moving some consts from one class to another, I now have a lot of files that went from 1 long use SomePackage\Name\Space\Here\To\AClass; and a ton of AClass::SomeConst to a lot of files with an unused import and a ton of very long fully qualified consts sprinkled through the code. Has anyone seen a rector to collapse frequently used namespaces into a use statement?

cabbey,
@cabbey@phpc.social avatar

@shudder no… 2000+ files that it touched to change “class Yada implements \NameSpace\Foo\Bar\SoupInterface” to “use \NameSpace\Foo\Bar\SoupInterface;
class Yada implements SoupInterface”

The vast majority of our codebase only imports the class if it’s used more than once in the file… this just undid that globally for two big classes of use cases: implementing interfaces and trait usage.

The actual changes I had been making in rector.php only impacted a couple dozen files.

cabbey,
@cabbey@phpc.social avatar

AAHHHH... because it's not a Rector it's just a config option... ->withImportNames()

but that changes everything not just the things it touches... which ... omg ..... just no. (2000 files touched just by changing that setting.)

cabbey,
@cabbey@phpc.social avatar

@alessandrolai @shudder yeah, played with them to not much improvement. Currently thinking I’ll do a two pass approach. First use the renaming rectors I’ve configured against the whole codebase, then got diff to get the list of changes files and run a separate rector on just those files with this option. Will experiment with that in the morning.

cabbey, to ubuntu
@cabbey@phpc.social avatar

Anyone know how long it usually is between a release going GA and do-release-upgrade seeing it? Seems odd that I could download and burn the iso and do an upgrade with that, but can't do it from within the system yet.

cabbey,
@cabbey@phpc.social avatar

@Crell yeah, just trying to get a feel for how long the stagger is. But also meh… it’s not a lot of data, and it’s CDN’d pretty hard.

ian, to random
@ian@phpc.social avatar

I hear RISC is good

cabbey,
@cabbey@phpc.social avatar

@kboyd @ian Power (PC) to the people!

ramsey, to php
@ramsey@phpc.social avatar

I’m about to do something that could either be very controversial or not controversial at all and result in a bunch of shrugs and nods.

cabbey,
@cabbey@phpc.social avatar

@ramsey gunna use a goto in production code?

kboyd, to random
@kboyd@phpc.social avatar

Ran a database query at work to investigate a hunch, and forgot about it.

And, an hour and 19 minutes later ... the hunch played out, but much less severely than I had anticipated. Most curious. Yay results!

cabbey,
@cabbey@phpc.social avatar

@kboyd data driven whatever for the win.

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