Skip to content

UPDATE: slevomat coding standards & Fixes#22

Merged
mantebalzaraviciute merged 4 commits intomainfrom
feature/update-slevomat
Mar 23, 2023
Merged

UPDATE: slevomat coding standards & Fixes#22
mantebalzaraviciute merged 4 commits intomainfrom
feature/update-slevomat

Conversation

@mantebalzaraviciute
Copy link
Contributor

@mantebalzaraviciute mantebalzaraviciute commented Mar 7, 2023

Updated Slevomat as they added a new Sniff $services->set(BackedEnumTypeSpacingSniff::class); requested by @AlexJump24
What: Checks the amount of spaces that is before and after the colon on the enum definition
Why: So we can keep our code consistent 🙏🏼 MantesEnum: string

$services->set(NamespaceSpacingSniff::class);
What: A little sniff to check that there is one line above the namespace and one below👃🏻
Why: To keep it nice and consistent

$services->set(MethodSpacingSniff::class);
What: Enforces one new line between methods ✅
Why: Another sniff to check the spacing between our methods

$services->set(UnusedFunctionParameterSniff::class);
What: Checks for unused parameters in functions
Why: Helps us keep our code clean and only have parameters we use 🤓

Removed: $services->set(DisallowMixedTypeHintSniff::class);
Why: Sometimes we need to have mixed in the doc blocks, but i disallowed mixed in return types and param types, will make a new PR with a custom sniff that will allow us to have mixed in the doc blocks but not the code itself.

$services->set(DeclareStrictTypesSniff::class)
        ->property('spacesCountAroundEqualsSign', 0);

What: Updated the sniff to have 0 spaces around the equals as the fixer adds them without spaces 👍🏻
Why: To keep it nice and consistent 😎

'SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSniff.MissingNativeTypeHint',
'SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff.MissingNativeTypeHint',
'SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSniff.UselessAnnotation',
'SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff.UselessAnnotation',

Why: Added some excludes for type hints. The above ignore the missing native type hint when the doc block is present. This is needed as we override some Laravel methods that do not like type hints. 🥲 This way the fixer doesn't remove the doc blocks and insert them into param type hints and break the app due to incompatibilities 🔥

@mantebalzaraviciute mantebalzaraviciute changed the title UPDATE: slevomat coding standards UPDATE: slevomat coding standards & Fixes Mar 9, 2023
@mantebalzaraviciute
Copy link
Contributor Author

Dan told me to add myself and remove Steve :D

@mantebalzaraviciute mantebalzaraviciute merged commit 310a0c0 into main Mar 23, 2023
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.

4 participants