Closed chrillep closed 1 year ago
@chrillep Thanks for your request!
In this case, is your request to suggest replacing optional()
with null safe operator? Maybe it's a nice addition to the php-hammer brother. What do you think?
In this case, is your request to suggest replacing
optional()
with null safe operator?
hello. yes exactly, i mean optional() is a Laravel function but it works either way for me :)
https://github.com/laravel/framework/blob/9.x/src/Illuminate/Support/Optional.php
@chrillep Nice! I'll see if I can make this possible in php-hammer, so I can cover other frameworks if they have similar functionality.
@chrillep Nice! I'll see if I can make this possible in php-hammer, so I can cover other frameworks if they have similar functionality.
added an issue in php-hammer aswell :) https://github.com/hammer-tools/php-hammer/issues/1
https://github.com/driftingly/rector-laravel/blob/main/docs/rector_rules_overview.md#optionaltonullsafeoperatorrector
OptionalToNullsafeOperatorRector Convert simple calls to optional helper to use the nullsafe operator
🔧 configure it!
class: Rector\Laravel\Rector\PropertyFetch\OptionalToNullsafeOperatorRector
↓