Skip to content

Conversation

@LolGleb
Copy link
Contributor

@LolGleb LolGleb commented Dec 5, 2025

No description provided.

…type normalization logic in StubsTypeHintsTest
* @param array $types Array of strings with types for processing
* @return array Normalized types
*/
private static function processTypes(array $types): array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, process is quite a generic and not descriptive name here. How do we process types? AFAIU we convert a string of types to array of types and make them unified, right? Would something like convertToArrayOfUnifiedTypes or convertToArrayOfNormalizedTypes be more descriptive here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you are right. Your variants are much more descriptive

$result[] = self::replaceArrayNotations($simpleType);
}

return array_filter(array_unique($result));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but I'm not sure I get why we need array_filter without a callback here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was made to remove possible falsy elements like null, false, 0 etc.
But since tests pass even without it, I removed it

}

/**
* @param array $types Array of strings with types for processing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to replace array with string[] here since we pass an array of strings, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we can do that

…tToArrayOfNormalizedTypes` and update references in StubsTypeHintsTest
@LolGleb LolGleb requested a review from isfedorov December 16, 2025 16:10
@LolGleb
Copy link
Contributor Author

LolGleb commented Dec 22, 2025

I take responsibility🫡

@LolGleb LolGleb merged commit 2a3e20f into JetBrains:master Dec 22, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants