Skip to content
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

Objects::get_object() can't be force to return Clarkson_Object #236

Open
jmslbam opened this issue Feb 7, 2022 · 0 comments
Open

Objects::get_object() can't be force to return Clarkson_Object #236

jmslbam opened this issue Feb 7, 2022 · 0 comments

Comments

@jmslbam
Copy link
Contributor

jmslbam commented Feb 7, 2022

Objects::get_object() can't be forced to return Clarkson_Object because you can overwrite the the Object Type via the clarkson_core_create_object_callback filter.

The inline documentation gives an example that you could return the result of e.g. wc_get_order which is a WC_Order or in our case wc_get_product why this filter was initialy introduced for the use-case that @NielsdeBlaauw had. wc_get_product returns something base on WC_Product.

Method get_object: https://github.com/level-level/Clarkson-Core/blob/master/src/Objects.php#L168
Filter clarkson_core_create_object_callback https://github.com/level-level/Clarkson-Core/blob/master/src/Objects.php#L214-L241
Original Issue with explaination: #131

Easy fix would be to remove the return type, other option would be that return type should be at least an object (since 7.2) https://www.php.net/manual/en/language.types.declarations.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant