journal
all all entries rss SoML excited dreams runes YRUU ultimate KTRU skate sleepy nihongo
Rob is 20,355 days old today.
prev day next day printable version

Entries this day: busy-train-this-morning first-foray-into-automatic-php-code-upgrades

busy train this morning

Trains in Tokyo have largely been the basis of why I've lived here so long, going on 21 years.

From my experience, here are levels of crowdedness on Tokyo trains:

Level 0: can get a seat of your choice (next to a door)

Level 1: can get easily get a seat, with an empty seat on each side

Level 2: you and your friend can sit together

Level 3: you can sit, but your friend would have to stand, (so you both decide to stand)

Level 4: You cannot sit down, but you can stand by the door

Level 5: You have plenty of hanging straps to choose from

Level 6: You have your own hanging strap

Level 7: No hanging straps available, but you can see the floor of the train

Level 8: You can't see the floor, but you can use your phone

Level 9: You cannot use your phone comfortably, but you can still try

Level 10: You cannot use your phone, but you can still breathe (depends on height)

Level 11: You can breathe, but have to contort your body to stay intact.

Level 12: You cannot breathe easily because your chest is compressed

Level 13: You cannot breathe much, but you can lift your legs and be supported by the crowd (depends on weight)

Based on my scale above, this morning around 8:15am inbound on Odakyu Line was crowded at Level 10.

permalink

first foray into automatic php code upgrades

Travis Trigger Warning: PHP

Today I created a PR:

This is a first foray into using Rector for automatic PHP upgrades.

Rector config file rector.php controls what is upgraded.

In this PR, the rector.php rule AddVoidReturnTypeWhereNoReturnRector allows Rector to add : void to each function definition that had no return.

After Rector added : void, our linter then removed @return void from the phpdocs.

Fortunately, Rector doesn't mind the linter's change so at least they are in agreement now.

  • - -

Tex pointed out:

After Rector added : void, our linter then removed @return void from the phpdocs.

Yes, the linter will remove all useless annotations.

In this case, @return void in conjunction with an explicit return type is considered useless, because the explicit return type is authoritative and no additional context is being added with the annotation. This is because the docs are very likely to get out of sync, and you can find many examples of this in our code.

It's basically to prevent situations like this:

    /**
     * @return void
     */
    function test(): int

If you add context to the annotation, it will not be removed.

    /**
     * @return void More context here!
     */
    function test(): void

This should be largely safe. The only place this may cause issues is where it adds the return type to a function that is implemented as part of an interface incorrectly. Particularly an untyped interface.

permalink
prev day next day