-
-
Notifications
You must be signed in to change notification settings - Fork 560
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
Preserve extended methods from class-based types in SchemaExtender::extend()
#934
Conversation
It seems like extending class-based scalar types does not work at all as of now, given the implementation of graphql-php/src/Utils/SchemaExtender.php Lines 132 to 143 in 2abac8c
The 'serialize' => static fn ($value) => $type->serialize($value), |
I've implemented a fix using closures as you suggested and it doesn't appear to break any tests. But at the same time, the testing for scalars is probably not compleate? Only |
Codecov Report
@@ Coverage Diff @@
## master #934 +/- ##
============================================
+ Coverage 94.16% 94.18% +0.01%
Complexity 50 50
============================================
Files 117 117
Lines 9685 9659 -26
============================================
- Hits 9120 9097 -23
+ Misses 565 562 -3
Continue to review full report at Codecov.
|
I cut down the test case to be as minimal as possible and cover all three methods. |
SchemaExtender::extend()
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.
no objections, some nits
👍🏾
} | ||
} | ||
} | ||
|
||
return $interfaces; | ||
} | ||
|
||
protected static function extendType($typeDef) | ||
/** | ||
* @param ListOfType|NonNull|(Type &NamedType) $typeDef |
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.
* @param ListOfType|NonNull|(Type &NamedType) $typeDef | |
* @param ListOfType|NonNull|(Type&NamedType) $typeDef |
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.
I would prefer that, PHP_CS keeps messing it up. I don't like that tool, php-cs-fixer does a much better job in my experience.
Resolves #933