-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate TypeUtils::getDirectClassNames()
#1924
Deprecate TypeUtils::getDirectClassNames()
#1924
Conversation
Looks likes a deprecated method rule in the deprecation rules extension is causing a deprecation now that needs fixing then 🙃 |
b9dac7f
to
39f948e
Compare
The new failing tests here are from the deprecation extension which needs fixing afterwards. But it would be ready |
39f948e
to
5f71f70
Compare
5f71f70
to
c0fa22b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the name is OK :) Additionally, we could get rid of instanceof TypeWithClassName
in this PR. Thank you.
c0fa22b
to
978958f
Compare
978958f
to
b91b0af
Compare
getting rid of all e.g. some examples calls where we explicitly want to know the class for whatever reasons $classType = TypeTraverser::map($classType, static function (Type $type, callable $traverse) use (&$uncertainty): Type {
if ($type instanceof UnionType || $type instanceof IntersectionType) {
return $traverse($type);
}
if ($type instanceof TypeWithClassName) {
$uncertainty = true;
return $type;
}
... if (!$returnType instanceof TypeWithClassName) {
return new MixedType();
} calls where we want to know explicitly the one className $thisType instanceof TypeWithClassName ? $thisType->getClassName() : null, $isThrowable = $originalCatchType instanceof TypeWithClassName && strtolower($originalCatchType->getClassName()) === 'throwable'; elseif (
$argValueType instanceof GenericClassStringType
&& $argValueType->getGenericType() instanceof TypeWithClassName
) {
$scopeClass = $argValueType->getGenericType()->getClassName();
$thisType = $argValueType->getGenericType();
} I'm not entirely sure how to get rid of them yet, e.g. in some cases I'd need to check that |
b91b0af
to
874a1e7
Compare
874a1e7
to
0bc0ac5
Compare
This pull request has been marked as ready for review. |
It shouldn't be hard to come up with examples where those Also - UnionType::getObjectClassNames() doesn't match how it should behave. If we for example have Foo|null, the returned array should be empty. Look at getArrays() for an example how to do it. |
d751dcb
to
1aa58ed
Compare
You can now just call |
that's great! I just realised that you type-hinted |
@herndlm Nothing might break if we remove the |
no, but it starts to get weird naming-wise. |
Yeah, you can rename that to something else :) Also maybe |
5a091bc
to
569cfb0
Compare
This pull request has been marked as ready for review. |
…jectWithToStringType`
66e59f9
to
b778089
Compare
Thank you! |
Great job @herndlm 🙏 |
An idea -
There are some cases of |
Just a simple migration over to Type::, as requested in #1922 (comment)
Are you fine with that name? E.g. we also have
Type::getReferencedClasses()
which is somehow related, right?I'd try to get rid of more
instanceof TypeWithClassName
in a follow-up if that's fine