Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved newlines in imports and case statements #2

Merged
merged 1 commit into from
Jan 11, 2023

Conversation

pkruithof
Copy link
Contributor

Updated our config to match current settings in pararius/office, with the exception of global_namespace_import/import_functions since that would still trigger a very large diff in Casco, I think.

use PhpCsFixer\RuleSet\Sets\PhpCsFixerSet;

$csFixerSet = new PhpCsFixerSet();

return (new PhpCsFixer\Config('standards'))
->setRiskyAllowed(true)
->setRules([
'@PhpCsFixer' => true,
'@Symfony:risky' => true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think at some point we have to drop the @PhpCsFixer ruleset: it has a very large overlap with the @Symfony ruleset, but has some different configuration for some rules. This is kind of confusing, especially when we look up the rules in https://mlocati.github.io/php-cs-fixer-configurator/

return (new PhpCsFixer\Config('standards'))
->setRiskyAllowed(true)
->setRules([
'@PhpCsFixer' => true,
'@Symfony:risky' => true,
'@PHP80Migration' => true,
'@PHP80Migration:risky' => true,
'@PHPUnit84Migration:risky' => true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe all projects are php >= 8.1 and phpunit >= 9 at this point.

static fn (string $statement): bool => $statement !== 'case',
)
],
'blank_line_between_import_groups' => false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prevents these messy imports:

class Foo
{
    use const AAAA;
    use const BBB;

    use Acme;

    use function DDD;

    use AAC;

    use function CCC\AA;

    use Bar;
}

(literally an example of the configurator, I don't understand why they think this is a nice configuration)

@pkruithof pkruithof merged commit eefa856 into main Jan 11, 2023
@pkruithof pkruithof deleted the improve-newlines branch January 11, 2023 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants