Skip to content

Replace self:: with static:: in schema printer #1380

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

Merged
merged 1 commit into from
May 9, 2023

Conversation

moufmouf
Copy link
Contributor

@moufmouf moufmouf commented May 9, 2023

The SchemaPrinter class uses static methods.

Those methods can be overloaded in a child class (they are protected). However, if we want the base SchemaPrinter static function to be able to call the overloaded functions in the child class, the call to these functions must be done using the static:: keyword (Late static binding).

This is done properly almost everywhere in the code, but in some places there remains calls done using self::.

This commit turns the remaining self:: into static:: to make Late Static Binding possible.

The `SchemaPrinter` class uses static methods.

Those methods can be overloaded in a child class (they are protected). However, if we want the base `SchemaPrinter` static function to be able to call the overloaded functions in the child class, the call to these functions must be done using the `static::` keyword (Late static binding).

This is done properly almost everywhere in the code, but in some places there remains calls done using `self::`.

This commit turns the remaining `self::` into `static::` to make Late Static Binding possible.
moufmouf added a commit to moufmouf/graphqlite-laravel that referenced this pull request May 9, 2023
In Webonyx, the getType() function can return null. In GraphQLite, it throws an error.
This makes using the SchemaPrinter impossible.
We override the SchemaPrinter to stop searching for the "Subscription" type.

Note: this can only work if webonyx/graphql-php#1380 is merged.
moufmouf added a commit to moufmouf/graphqlite-laravel that referenced this pull request May 9, 2023
In Webonyx, the getType() function can return null. In GraphQLite, it throws an error.
This makes using the SchemaPrinter impossible.
We override the SchemaPrinter to stop searching for the "Subscription" type.

Note: this can only work if webonyx/graphql-php#1380 is merged.
spawnia added a commit that referenced this pull request May 9, 2023
@spawnia spawnia merged commit 04987a7 into webonyx:master May 9, 2023
@spawnia
Copy link
Collaborator

spawnia commented May 9, 2023

Thanks, I documented this practice in 7d6b367.

@moufmouf
Copy link
Contributor Author

Woah! Thanks for the quick review. You rock ❤️

@moufmouf moufmouf deleted the patch-2 branch May 10, 2023 07:04
moufmouf added a commit to thecodingmachine/graphqlite-laravel that referenced this pull request May 10, 2023
In Webonyx, the getType() function can return null. In GraphQLite, it throws an error.
This makes using the SchemaPrinter impossible.
We override the SchemaPrinter to stop searching for the "Subscription" type.

Note: this can only work if webonyx/graphql-php#1380 is merged.
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