Skip to content

Commit

Permalink
feature: Add global_namespace_import to @symfony ruleset
Browse files Browse the repository at this point in the history
  • Loading branch information
chalasr committed Oct 26, 2022
1 parent a09cb9f commit fb916a0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ List of Available Rules
| Default value: ``true``

Part of rule sets `@PhpCsFixer <./ruleSets/PhpCsFixer.rst>`_ `@Symfony <./ruleSets/Symfony.rst>`_

`Source PhpCsFixer\\Fixer\\Import\\GlobalNamespaceImportFixer <./../src/Fixer/Import/GlobalNamespaceImportFixer.php>`_
- `group_import <./rules/import/group_import.rst>`_

Expand Down
3 changes: 3 additions & 0 deletions doc/ruleSets/Symfony.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ Rules
- `general_phpdoc_tag_rename <./../rules/phpdoc/general_phpdoc_tag_rename.rst>`_
config:
``['replacements' => ['inheritDocs' => 'inheritDoc']]``
- `global_namespace_import <./../rules/import/global_namespace_import.rst>`_
config:
``['import_classes' => false, 'import_constants' => false, 'import_functions' => false]``
- `include <./../rules/control_structure/include.rst>`_
- `increment_style <./../rules/operator/increment_style.rst>`_
- `integer_literal_case <./../rules/casing/integer_literal_case.rst>`_
Expand Down
15 changes: 15 additions & 0 deletions doc/rules/import/global_namespace_import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,18 @@ With configuration: ``['import_classes' => false, 'import_constants' => false, '
+ $d = new \DateTimeImmutable();
+ $p = \M_PI;
}
Rule sets
---------

The rule is part of the following rule sets:

@PhpCsFixer
Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``global_namespace_import`` rule with the config below:

``['import_classes' => false, 'import_constants' => false, 'import_functions' => false]``

@Symfony
Using the `@Symfony <./../../ruleSets/Symfony.rst>`_ rule set will enable the ``global_namespace_import`` rule with the config below:

``['import_classes' => false, 'import_constants' => false, 'import_functions' => false]``
5 changes: 5 additions & 0 deletions src/RuleSet/Sets/SymfonySet.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ public function getRules(): array
'inheritDocs' => 'inheritDoc',
],
],
'global_namespace_import' => [
'import_classes' => false,
'import_constants' => false,
'import_functions' => false,
],
'include' => true,
'increment_style' => true,
'integer_literal_case' => true,
Expand Down

0 comments on commit fb916a0

Please sign in to comment.