Fixes spaces in Doctrine annotations.
There must not be any space around parentheses; commas must be preceded by no space and followed by one space; there must be no space around named arguments assignment operator; there must be one space around array assignment operator.
Whether to add, remove or ignore spaces after argument assignment operator.
Allowed types: null
and bool
Default value: false
Whether to add, remove or ignore spaces after array assignment :
operator.
Allowed types: null
and bool
Default value: true
Whether to add, remove or ignore spaces after array assignment =
operator.
Allowed types: null
and bool
Default value: true
Whether to fix spaces around commas.
Allowed types: bool
Default value: true
Whether to fix spaces around parentheses.
Allowed types: bool
Default value: true
Whether to add, remove or ignore spaces before argument assignment operator.
Allowed types: null
and bool
Default value: false
Whether to add, remove or ignore spaces before array :
assignment operator.
Allowed types: null
and bool
Default value: true
Whether to add, remove or ignore spaces before array =
assignment operator.
Allowed types: null
and bool
Default value: true
List of tags that must not be treated as Doctrine Annotations.
Allowed types: array
Default value: ['abstract', 'access', 'code', 'deprec', 'encode', 'exception', 'final', 'ingroup', 'inheritdoc', 'inheritDoc', 'magic', 'name', 'toc', 'tutorial', 'private', 'static', 'staticvar', 'staticVar', 'throw', 'api', 'author', 'category', 'copyright', 'deprecated', 'example', 'filesource', 'global', 'ignore', 'internal', 'license', 'link', 'method', 'package', 'param', 'property', 'property-read', 'property-write', 'return', 'see', 'since', 'source', 'subpackage', 'throws', 'todo', 'TODO', 'usedBy', 'uses', 'var', 'version', 'after', 'afterClass', 'backupGlobals', 'backupStaticAttributes', 'before', 'beforeClass', 'codeCoverageIgnore', 'codeCoverageIgnoreStart', 'codeCoverageIgnoreEnd', 'covers', 'coversDefaultClass', 'coversNothing', 'dataProvider', 'depends', 'expectedException', 'expectedExceptionCode', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp', 'group', 'large', 'medium', 'preserveGlobalState', 'requires', 'runTestsInSeparateProcesses', 'runInSeparateProcess', 'small', 'test', 'testdox', 'ticket', 'uses', 'SuppressWarnings', 'noinspection', 'package_version', 'enduml', 'startuml', 'psalm', 'phpstan', 'template', 'fix', 'FIXME', 'fixme', 'override']
Default configuration.
--- Original
+++ New
<?php
/**
- * @Foo ( )
+ * @Foo()
*/
class Bar {}
/**
- * @Foo("bar" ,"baz")
+ * @Foo("bar", "baz")
*/
class Bar2 {}
/**
- * @Foo(foo = "foo", bar = {"foo":"foo", "bar"="bar"})
+ * @Foo(foo="foo", bar={"foo" : "foo", "bar" = "bar"})
*/
class Bar3 {}
With configuration: ['after_array_assignments_equals' => false, 'before_array_assignments_equals' => false]
.
--- Original
+++ New
<?php
/**
- * @Foo(foo = "foo", bar = {"foo":"foo", "bar"="bar"})
+ * @Foo(foo="foo", bar={"foo" : "foo", "bar"="bar"})
*/
class Bar {}
The rule is part of the following rule set:
@DoctrineAnnotation with config:
['before_array_assignments_colon' => false]
PhpCsFixer\Fixer\DoctrineAnnotation\DoctrineAnnotationSpacesFixer