Einenlum.

This Week I Learned: 2023W18

Wed May 17 2023

PHP - PHPStan

I wondered recently how I could detect all the unused methods in my PHP projects. That could be quite useful when refactoring old code.

I found a PHPStan extension from Tomas Votruba, the creator of Rector: unused-public.

This can detect unused methods, properties and/or constants. Amazing tool. Thanks Tomas!

HTTP Status Codes

I knew the 301 and 302 status codes already (respectively permanent and temporary redirection). I didn’t know the 308 and 307 which are the respective equivalents but stricter.

Indeed, when redirecting with a 301 or 302, the browser generally tries to redirect to the new URL by using a GET request. With 308 (permanent) and 307 (temporary), the browser will use the same method as the original request as well as the same body.

I found out about this through the vercel documentation. You can also check this article.

CSS

To select all p tags hot having a class, you can use p:not([class]).