Skip to content

Commit 1eb04d6

Browse files
authored
[automated] Apply Coding Standard (#6269)
Co-authored-by: TomasVotruba <[email protected]>
1 parent 4eacb1c commit 1eb04d6

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

rules/CodingStyle/ClassNameImport/ClassNameImportSkipper.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,6 @@ public function shouldSkipNameForFullyQualifiedObjectType(
4444
return false;
4545
}
4646

47-
private function shouldSkipShortName(FullyQualified $fullyQualified): bool
48-
{
49-
// is scalar name?
50-
if (in_array($fullyQualified->toLowerString(), ['true', 'false', 'bool'], true)) {
51-
return true;
52-
}
53-
54-
if ($fullyQualified->isSpecialClassName()) {
55-
return true;
56-
}
57-
58-
if ($this->isFunctionOrConstantImport($fullyQualified)) {
59-
return true;
60-
}
61-
62-
// Importing root namespace classes (like \DateTime) is optional
63-
return ! SimpleParameterProvider::provideBoolParameter(Option::IMPORT_SHORT_CLASSES);
64-
}
65-
66-
private function isFunctionOrConstantImport(FullyQualified $fullyQualified): bool
67-
{
68-
if ($fullyQualified->getAttribute(AttributeKey::IS_CONSTFETCH_NAME) === true) {
69-
return true;
70-
}
71-
72-
return $fullyQualified->getAttribute(AttributeKey::IS_FUNCCALL_NAME) === true;
73-
}
74-
7547
/**
7648
* @param array<Use_|GroupUse> $uses
7749
*/
@@ -115,6 +87,34 @@ public function shouldSkipName(FullyQualified $fullyQualified, array $uses): boo
11587
return false;
11688
}
11789

90+
private function shouldSkipShortName(FullyQualified $fullyQualified): bool
91+
{
92+
// is scalar name?
93+
if (in_array($fullyQualified->toLowerString(), ['true', 'false', 'bool'], true)) {
94+
return true;
95+
}
96+
97+
if ($fullyQualified->isSpecialClassName()) {
98+
return true;
99+
}
100+
101+
if ($this->isFunctionOrConstantImport($fullyQualified)) {
102+
return true;
103+
}
104+
105+
// Importing root namespace classes (like \DateTime) is optional
106+
return ! SimpleParameterProvider::provideBoolParameter(Option::IMPORT_SHORT_CLASSES);
107+
}
108+
109+
private function isFunctionOrConstantImport(FullyQualified $fullyQualified): bool
110+
{
111+
if ($fullyQualified->getAttribute(AttributeKey::IS_CONSTFETCH_NAME) === true) {
112+
return true;
113+
}
114+
115+
return $fullyQualified->getAttribute(AttributeKey::IS_FUNCCALL_NAME) === true;
116+
}
117+
118118
private function isConflictedShortNameInUse(
119119
UseUse $useUse,
120120
string $useName,

0 commit comments

Comments
 (0)