Skip to content

Commit 41fe1f4

Browse files
gharlanSpacePossum
authored andcommitted
GlobalNamespaceImportFixer - Introduction
1 parent 68c932a commit 41fe1f4

12 files changed

+2084
-0
lines changed

README.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,19 @@ Choose from the list of available rules:
743743
- ``annotations`` (``array``): list of annotations to remove, e.g. ``["author"]``;
744744
defaults to ``[]``
745745

746+
* **global_namespace_import**
747+
748+
Imports or fully qualifies global classes/functions/constants.
749+
750+
Configuration options:
751+
752+
- ``import_classes`` (``false``, ``null``, ``true``): whether to import, not import or
753+
ignore global classes; defaults to ``true``
754+
- ``import_constants`` (``false``, ``null``, ``true``): whether to import, not import or
755+
ignore global constants; defaults to ``null``
756+
- ``import_functions`` (``false``, ``null``, ``true``): whether to import, not import or
757+
ignore global functions; defaults to ``null``
758+
746759
* **hash_to_slash_comment**
747760

748761
Single line comments should use double slashes ``//`` and not hash ``#``.

src/Fixer/ConstantNotation/NativeConstantInvocationFixer.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ public function getDefinition()
9292
);
9393
}
9494

95+
/**
96+
* {@inheritdoc}
97+
*/
98+
public function getPriority()
99+
{
100+
// must be run before GlobalNamespaceImportFixer
101+
return 10;
102+
}
103+
95104
/**
96105
* {@inheritdoc}
97106
*/

src/Fixer/FunctionNotation/NativeFunctionInvocationFixer.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,15 @@ function baz($options)
160160
);
161161
}
162162

163+
/**
164+
* {@inheritdoc}
165+
*/
166+
public function getPriority()
167+
{
168+
// must be run before GlobalNamespaceImportFixer
169+
return 10;
170+
}
171+
163172
/**
164173
* {@inheritdoc}
165174
*/

0 commit comments

Comments
 (0)