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

Exclude Doctrine documents from final fixer #5622

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/rules/class_notation/final_internal_class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ of the white list ones are used as well. (case insensitive)

Allowed types: ``array``

Default value: ``['@final', '@Entity', '@ORM\\Entity', '@ORM\\Mapping\\Entity', '@Mapping\\Entity']``
Default value: ``['@final', '@Entity', '@ORM\\Entity', '@ORM\\Mapping\\Entity', '@Mapping\\Entity', '@Document', '@ODM\\Document']``

``consider_absent_docblock_as_internal_class``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions src/Fixer/ClassNotation/FinalInternalClassFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ protected function createConfigurationDefinition()
'@ORM\Entity',
'@ORM\Mapping\Entity',
'@Mapping\Entity',
'@Document',
'@ODM\Document',
])
->setNormalizer($annotationsNormalizer)
->getOption(),
Expand Down
2 changes: 2 additions & 0 deletions tests/Fixer/ClassNotation/FinalClassFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public function provideFixCases()
['<?php use Doctrine\ORM\Mapping as ORM; /** @ORM\Entity */ class MyEntity {}'],
['<?php use Doctrine\ORM\Mapping; /** @Mapping\Entity */ class MyEntity {}'],
['<?php use Doctrine\ORM; /** @ORM\Mapping\Entity */ class MyEntity {}'],
['<?php /** @Document */ class MyDocument {}'],
['<?php use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; /** @ODM\Document */ class MyEntity {}'],
['<?php /** @entity */ class MyEntity {}'],
['<?php use Doctrine\ORM\Mapping as ORM; /** @orm\entity */ class MyEntity {}'],
['<?php abstract class MyAbstract {}'],
Expand Down