-
Notifications
You must be signed in to change notification settings - Fork 841
Phan: Address issues discovered while testing against old WooCommerce stubs #46003
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
base: trunk
Are you sure you want to change the base?
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 1 file.
|
coder-karen
left a comment
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 say the Sync package changes look fine, however it'd be good for Ventures to confirm that too as the relevant code adder (I see they're included as reviewers).
anomiex
left a comment
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.
Looks reasonable from a monorepo perspective. Up to Ventures or whoever about the constant thing.
| private function get_product_cogs_data( $ids, $order = '' ) { | ||
| $is_cogs_enabled = class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) && \Automattic\WooCommerce\Utilities\FeaturesUtil::feature_is_enabled( 'cost_of_goods_sold' ); | ||
| // @phan-suppress-current-line UnusedPluginSuppression @phan-suppress-next-line PhanUndeclaredClassReference, PhanUndeclaredClassMethod -- we're checking for the class and method before using them. See also: https://github.com/phan/phan/issues/1204 | ||
| $is_cogs_enabled = class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) && method_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil', 'feature_is_enabled' ) && \Automattic\WooCommerce\Utilities\FeaturesUtil::feature_is_enabled( 'cost_of_goods_sold' ); |
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.
The extra method_exists check seems unnecessary here as the feature_is_enabled was added since the creation of the FeaturesUtil class: https://github.com/woocommerce/woocommerce/pull/34727/files#diff-f5ea913d075d5ad173fcb2099d072ce0bf286922e41a3131442ab99c6ae58263
| $product_type = 'variation'; | ||
| } elseif ( 'product' === $post_type ) { | ||
| $product_type = $product_types[ $post->ID ] ?? ProductType::SIMPLE; | ||
| $product_type = $product_types[ $post->ID ] ?? 'simple'; |
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.
This seems fine! I guess we haven't run into any issues here yet, because sync runs on newer stores? or maybe sync has a different plugin requirement?
Closes MONOREP-234
In preparation to running static analysis against old Woo 7.0 stubs, this PR addresses some existing issues. In most cases we just add Phan suppressions (see phan/phan#1204). However, Sync had two real compatibility fixes:
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
CI should be happy here, but also Phan should run against old Woo stubs with no errors: