Constructor Property Promotion in PHP 8
June 9, 2020 — Wouldn’t it be nice if you don’t have to declare the class property over and over again just to use it across the class? Currently, you’d do it by first declaring it…
A blog on PHP, JavaScript, and more
June 9, 2020 — Wouldn’t it be nice if you don’t have to declare the class property over and over again just to use it across the class? Currently, you’d do it by first declaring it…
June 6, 2020 — I used to use Adblockers on my browsers a few years ago because I used to think that Ads are annoying and they probably are. For some people. Like the younger me.
June 5, 2020 — It’s always a nice idea to add something to your workflow which can enhance your productivity. Even if it’s as small as showing the current Git branch for your project in command prompt like so.
June 4, 2020 — Have you ever wanted a feature where you would only want to call a method or fetch a property on the result of an expression if it is not null
? So, for instance, check the following code.
June 3, 2020 — VS Code extensions are a great way to enhance the experience of the already great editor of recent times. I tend to experiment different sort of extensions which can improve my workflow or help me fix some of the pain points.
June 2, 2020 — There comes a scenario when you might want to check which operating system the device is running. For instance, when you want to set device-specific download links. For windows, .exe
file, for macOS, .dmg
file and so on.
June 1, 2020 — With PHP 5, the core team had introduced type declarations (also known as type-hinting) that allow functions to require that parameters are of a certain type at call time. If the given value is of the incorrect type, then an error is generated: in PHP 5, this will be a recoverable fatal error, while PHP 7 will throw a TypeError exception.
May 31, 2020 — Sometimes, all you want to do is a custom type populated with a set of predefined strings which can be used to restrict a variable to only have values from this set of strings.
May 28, 2020 — The usual way of validating request attributes in Laravel is by making Illuminate\Support\Facades\Validator
instance with your static rules that never change like so.
May 27, 2020 — In TypeScript, you assign types to variables and function parameters to catch type related errors early, even before you run the code. But TypeScript doesn’t warn you when you assign null
and undefined
to the variables of common types.
Follow me everywhere