storyblok / storyblok-php-client

Storyblok - PHP Client
https://www.storyblok.com
MIT License
33 stars 37 forks source link

Adding Rector: Dead Code, Code quality, Coding Style, Type Declarations, Early return #107

Open roberto-butti opened 6 months ago

roberto-butti commented 6 months ago

Introducing Rector and updating the code for:

The configurarion:

->withPhpSets(php73: true)
->withPreparedSets(
deadCode: true,
codeQuality: true,
codingStyle: true,
typeDeclarations: true,
earlyReturn: true

);

Running all tests are still green

roberto-butti commented 6 months ago

Hi @RicLeP i see your comments, thank you! So are you suggesting to avoid yoda style, so i can set in the PHP cs fixer configuration :

    'yoda_style' => [
        'always_move_variable' => false,
        'equal' => false,
        'identical' => false,
        'less_and_greater' => false,
    ],

What do you think ?

RicLeP commented 5 months ago

It’s a code style choice so not essential, however I think it’s usually recommended, but go with what you feel it best. :)

silasjoisten commented 3 weeks ago

Since PSR-12 its not recommended to use yoda style due to less readability of the code. However i prefer yoda style as well :)