Import from global namespace in fully_qualified_strict_types #8002
Closed
Wulfheart
started this conversation in
Feature ideas
Replies: 1 comment
-
Can be closed as it relates to #7674 (comment). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I think it would be great if it was possible to also add classes and function from the global namespace to the imports when using the
fully_qualified_strict_types
rule.Expectation
should become
'<?php use \Exception; function foo(Exception $e) {}',
A basic test case is added at #8001 in a draft PR.
Rationale
I want to import everything where possible. I managed to get the following output but that gets me an error in PHPStorm and from phpstan that says, that
Exception
is not defined.Current behavior
import_symbols
leading_backslash_in_global_namespace
<?php function foo(Exception $e) {}
<?php function foo(\Exception $e) {}
<?php function foo(Exception $e) {}
<?php function foo(\Exception $e) {}
Bug or Feature
I was not sure if this is a bug or a feature request therefore I opened a feature request.
Beta Was this translation helpful? Give feedback.
All reactions