This replacement is totally safe since this works after PHP 5.3 (note the current minimum is PHP 5.5).
The goal is to avoid workarounds that only made sense in very old versions of PHP.
This also improves readability in my personal opinion.
Here the changelog for PHP 5.3 mentioning __DIR__:
https://www.php.net/ChangeLog-5.php#5.3.0
Here a source indicating that this change is totally safe:
https://stackoverflow.com/q/2749416
Here another source indicating that this is safe:
About that, this is automagic change was executed by Rector.php.
Thank you Rector.php for making this repository even more performant,
recent and readable. I also donated 15€ to Rector.php since I was really
impressed by its potential.
God bless Rector.php. I love you Rector.php. Thank you Rector.php. Such wow.
Ref T15158