From e3d2922ff3cabeaf030f76eea8d4e41b7d03e2ef Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Tue, 14 May 2024 11:33:03 -0400 Subject: [PATCH] Jetpack: Fix various PhanUndefined issues (#37344) Notable changes: * Remove `Jetpack_User_Agent_Info::is_OperaMobile()`. #16434 removed the jetpack-device-detect function this was calling in October 2021, but missed this caller. * Remove `jetpack_server_sandbox()` and `jetpack_server_sandbox_request_parameters()`. Due to a wrong namespace in #21128, they'd have thrown fatals since October 2021. * Use `$skin` instead of `$upgrader->skin`, it's the same object but not typed as a parent class. Should be no change to functionality. * Add some missing methods to `WPCOM_JSON_API`. * Add some missing abstract methods to SAL_Site, and implement in Jetpack_Site. * Fix `SAL_Token::is_global()`. * Remove `views/admin/deactivation-dialog.php`, unused since #21048 in November 2021. * Add `@phan-var-force` in a lot of "template" files. I'm not entirely happy with this, it pollutes the global scope for any subsequent files processed, but short of writing a Phan plugin that somehow adjusts the scope for only the file I can't find a better idea. --- .../changelog/fix-misc-phan-undeclared-issues | 4 + .../packages/sync/src/class-replicastore.php | 6 +- .../sync/src/interface-replicastore.php | 6 +- projects/plugins/jetpack/.phan/baseline.php | 102 ++++++------------ .../jetpack/_inc/jetpack-server-sandbox.php | 38 ------- .../lib/core-api/load-wpcom-endpoints.php | 3 +- ...v2-endpoint-newsletter-categories-list.php | 4 +- ...sletter-categories-subscriptions-count.php | 2 +- .../jetpack/_inc/lib/markdown/extra.php | 1 + .../changelog/fix-misc-phan-undeclared-issues | 5 + .../fix-misc-phan-undeclared-issues#2 | 5 + .../fix-misc-phan-undeclared-issues#3 | 5 + .../fix-misc-phan-undeclared-issues#4 | 5 + .../fix-misc-phan-undeclared-issues#5 | 4 + .../fix-misc-phan-undeclared-issues#6 | 4 + .../fix-misc-phan-undeclared-issues#7 | 5 + .../plugins/jetpack/class.jetpack-cli.php | 3 + .../jetpack/class.jetpack-user-agent.php | 13 --- projects/plugins/jetpack/class.jetpack.php | 1 + .../jetpack/class.json-api-endpoints.php | 9 +- projects/plugins/jetpack/class.json-api.php | 23 ++++ .../jetpack/extensions/blocks/like/like.php | 1 + .../templates/playlist-track.php | 1 + ...class.wpcom-json-api-get-site-endpoint.php | 14 +-- ...tpack-json-api-plugins-modify-endpoint.php | 4 +- ....jetpack-json-api-plugins-new-endpoint.php | 4 +- ...s.jetpack-json-api-themes-new-endpoint.php | 4 +- .../modules/infinite-scroll/infinity.php | 1 + .../inline-help/inline-help-template.php | 4 +- .../memberships/class-jetpack-memberships.php | 1 + .../modules/sharedaddy/sharing-service.php | 6 +- .../modules/site-icon/site-icon-functions.php | 7 +- .../templates/carousel-container.php | 10 +- .../tiled-gallery/templates/circle-layout.php | 6 +- .../partials/carousel-image-args.php | 6 +- .../tiled-gallery/templates/partials/item.php | 10 +- .../templates/rectangular-layout.php | 12 ++- .../tiled-gallery/templates/square-layout.php | 10 +- .../videopress/class.videopress-cli.php | 1 + .../modules/widgets/eu-cookie-law/form.php | 5 +- .../widgets/eu-cookie-law/widget-amp.php | 8 +- .../modules/widgets/eu-cookie-law/widget.php | 8 +- .../jetpack/modules/widgets/flickr.php | 3 +- .../jetpack/modules/widgets/flickr/form.php | 5 +- .../jetpack/modules/widgets/flickr/widget.php | 7 +- .../widgets/gallery/templates/form.php | 7 +- .../modules/widgets/simple-payments/form.php | 14 ++- .../widgets/simple-payments/widget.php | 10 +- ...etpack-woocommerce-analytics-universal.php | 1 + .../jetpack/sal/class.json-api-site-base.php | 16 ++- .../sal/class.json-api-site-jetpack.php | 18 ++++ .../jetpack/sal/class.json-api-token.php | 6 +- ...rest-api-v2-attachment-videopress-data.php | 16 ++- .../php/extensions/blocks/test-story.php | 2 +- .../shortcodes/trait.http-request-cache.php | 29 +++-- .../widgets/test_wordpress-post-widget.php | 1 - .../class.jetpack-sync-server-replicator.php | 3 + .../class.jetpack-sync-test-replicastore.php | 3 +- .../test_class.jetpack-sync-callables.php | 5 +- ...st_class.jetpack-sync-full-immediately.php | 3 +- .../views/admin/deactivation-dialog.php | 58 ---------- .../views/admin/must-connect-main-blog.php | 5 +- .../jetpack/views/admin/network-settings.php | 7 +- 63 files changed, 322 insertions(+), 268 deletions(-) create mode 100644 projects/packages/sync/changelog/fix-misc-phan-undeclared-issues delete mode 100644 projects/plugins/jetpack/_inc/jetpack-server-sandbox.php create mode 100644 projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues create mode 100644 projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#2 create mode 100644 projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#3 create mode 100644 projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#4 create mode 100644 projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#5 create mode 100644 projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#6 create mode 100644 projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#7 delete mode 100644 projects/plugins/jetpack/views/admin/deactivation-dialog.php diff --git a/projects/packages/sync/changelog/fix-misc-phan-undeclared-issues b/projects/packages/sync/changelog/fix-misc-phan-undeclared-issues new file mode 100644 index 0000000000000..7033852bed5aa --- /dev/null +++ b/projects/packages/sync/changelog/fix-misc-phan-undeclared-issues @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fix phpdoc type on `Replicastore_Interface::get_term()` `$taxonomy` arg. diff --git a/projects/packages/sync/src/class-replicastore.php b/projects/packages/sync/src/class-replicastore.php index d411b7bbc1a54..6b33f3e2f1fa0 100644 --- a/projects/packages/sync/src/class-replicastore.php +++ b/projects/packages/sync/src/class-replicastore.php @@ -874,9 +874,9 @@ public function get_terms( $taxonomy ) { * * @access public * - * @param string $taxonomy Taxonomy slug. - * @param int $term_id ID of the term. - * @param string $term_key ID Field `term_id` or `term_taxonomy_id`. + * @param string|false $taxonomy Taxonomy slug. + * @param int $term_id ID of the term. + * @param string $term_key ID Field `term_id` or `term_taxonomy_id`. * * @return \WP_Term|WP_Error Term object on success, \WP_Error object on failure. */ diff --git a/projects/packages/sync/src/interface-replicastore.php b/projects/packages/sync/src/interface-replicastore.php index 73f5e18159c49..e9c5d7c69d7ef 100644 --- a/projects/packages/sync/src/interface-replicastore.php +++ b/projects/packages/sync/src/interface-replicastore.php @@ -414,9 +414,9 @@ public function get_terms( $taxonomy ); * * @access public * - * @param string $taxonomy Taxonomy slug. - * @param int $term_id ID of the term. - * @param string $term_key ID Field `term_id` or `term_taxonomy_id`. + * @param string|false $taxonomy Taxonomy slug. + * @param int $term_id ID of the term. + * @param string $term_key ID Field `term_id` or `term_taxonomy_id`. */ public function get_term( $taxonomy, $term_id, $term_key = 'term_id' ); diff --git a/projects/plugins/jetpack/.phan/baseline.php b/projects/plugins/jetpack/.phan/baseline.php index bd3608964bb96..a88877f15a612 100644 --- a/projects/plugins/jetpack/.phan/baseline.php +++ b/projects/plugins/jetpack/.phan/baseline.php @@ -17,61 +17,53 @@ // PhanTypeMismatchReturnProbablyReal : 150+ occurrences // PhanDeprecatedFunction : 120+ occurrences // PhanTypePossiblyInvalidDimOffset : 110+ occurrences - // PhanTypeArraySuspiciousNullable : 95+ occurrences + // PhanTypeArraySuspiciousNullable : 80+ occurrences // PhanRedundantCondition : 70+ occurrences - // PhanUndeclaredThis : 70+ occurrences // PhanPossiblyUndeclaredVariable : 65+ occurrences // PhanTypeMismatchArgumentNullable : 55+ occurrences - // PhanUndeclaredGlobalVariable : 55+ occurrences - // PhanParamTooMany : 45+ occurrences // PhanTypeExpectedObjectPropAccess : 45+ occurrences // PhanTypeMismatchArgumentInternal : 45+ occurrences + // PhanParamTooMany : 40+ occurrences // PhanPluginDuplicateAdjacentStatement : 40+ occurrences // PhanTypeInvalidDimOffset : 35+ occurrences // PhanUndeclaredProperty : 35+ occurrences - // PhanUndeclaredMethod : 30+ occurrences // PhanParamSignatureMismatch : 25+ occurrences // PhanPluginSimplifyExpressionBool : 25+ occurrences // PhanTypeMismatchDefault : 25+ occurrences // PhanTypeMismatchPropertyProbablyReal : 25+ occurrences // PhanTypeMissingReturn : 25+ occurrences // PhanTypeSuspiciousNonTraversableForeach : 25+ occurrences - // PhanUndeclaredFunction : 25+ occurrences // PhanDeprecatedProperty : 20+ occurrences // PhanTypeArraySuspicious : 20+ occurrences // PhanTypeMismatchDimFetch : 20+ occurrences + // PhanUndeclaredFunction : 20+ occurrences // PhanPluginDuplicateExpressionAssignmentOperation : 15+ occurrences // PhanPluginMixedKeyNoKey : 15+ occurrences // PhanSuspiciousMagicConstant : 15+ occurrences // PhanTypeExpectedObjectPropAccessButGotNull : 15+ occurrences // PhanTypeMismatchArgumentNullableInternal : 15+ occurrences // PhanTypeMismatchPropertyDefault : 15+ occurrences - // PhanUndeclaredClassMethod : 15+ occurrences + // PhanUndeclaredMethod : 15+ occurrences // PhanRedefineClass : 10+ occurrences // PhanRedundantConditionInLoop : 10+ occurrences // PhanTypeComparisonToArray : 10+ occurrences // PhanTypeInvalidLeftOperandOfNumericOp : 10+ occurrences // PhanTypeMismatchProperty : 10+ occurrences // PhanTypeMismatchReturnNullable : 10+ occurrences - // PhanUndeclaredFunctionInCallable : 9 occurrences // PhanPluginRedundantAssignment : 8 occurrences + // PhanUndeclaredClassMethod : 8 occurrences // PhanDeprecatedClass : 7 occurrences // PhanTypeArraySuspiciousNull : 7 occurrences // PhanTypeMismatchArgumentInternalReal : 7 occurrences - // PhanUndeclaredConstant : 7 occurrences - // PhanUndeclaredMethodInCallable : 7 occurrences // PhanCommentAbstractOnInheritedMethod : 6 occurrences // PhanRedefineFunction : 6 occurrences - // PhanUndeclaredVariableDim : 6 occurrences // PhanImpossibleCondition : 5 occurrences // PhanNonClassMethodCall : 5 occurrences // PhanTypeMismatchDimAssignment : 5 occurrences // PhanTypeSuspiciousStringExpression : 5 occurrences - // PhanUndeclaredStaticProperty : 5 occurrences + // PhanUndeclaredFunctionInCallable : 5 occurrences // PhanAccessMethodInternal : 4 occurrences - // PhanContextNotObject : 4 occurrences // PhanImpossibleTypeComparison : 4 occurrences - // PhanPossiblyUndeclaredGlobalVariable : 4 occurrences // PhanTypeInvalidLeftOperandOfAdd : 4 occurrences // PhanTypeInvalidLeftOperandOfBitwiseOp : 4 occurrences // PhanTypeInvalidRightOperandOfBitwiseOp : 4 occurrences @@ -83,6 +75,8 @@ // PhanTypeConversionFromArray : 3 occurrences // PhanTypeMismatchArgumentReal : 3 occurrences // PhanTypeObjectUnsetDeclaredProperty : 3 occurrences + // PhanUndeclaredConstant : 3 occurrences + // PhanUndeclaredMethodInCallable : 3 occurrences // PhanCompatibleNegativeStringOffset : 2 occurrences // PhanEmptyFQSENInCallable : 2 occurrences // PhanImpossibleConditionInLoop : 2 occurrences @@ -93,24 +87,19 @@ // PhanStaticCallToNonStatic : 2 occurrences // PhanTypeMismatchArgumentInternalProbablyReal : 2 occurrences // PhanUndeclaredClassInCallable : 2 occurrences - // PhanUndeclaredStaticMethod : 2 occurrences - // PhanAccessPropertyPrivate : 1 occurrence // PhanDeprecatedPartiallySupportedCallable : 1 occurrence // PhanEmptyForeach : 1 occurrence // PhanInfiniteRecursion : 1 occurrence // PhanPluginDuplicateSwitchCase : 1 occurrence // PhanPluginInvalidPregRegex : 1 occurrence // PhanPluginRedundantAssignmentInLoop : 1 occurrence - // PhanSuspiciousValueComparison : 1 occurrence // PhanTypeComparisonFromArray : 1 occurrence // PhanTypeInstantiateAbstract : 1 occurrence // PhanTypeInvalidCallableArraySize : 1 occurrence // PhanTypeSuspiciousEcho : 1 occurrence // PhanTypeVoidArgument : 1 occurrence - // PhanUndeclaredClassReference : 1 occurrence // PhanUndeclaredExtendedClass : 1 occurrence // PhanUndeclaredTypeReturnType : 1 occurrence - // PhanUndeclaredVariable : 1 occurrence // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ @@ -125,7 +114,6 @@ '_inc/blogging-prompts.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgumentInternal'], '_inc/class.jetpack-provision.php' => ['PhanAccessMethodInternal', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturnNullable'], '_inc/genericons.php' => ['PhanTypeMismatchArgumentProbablyReal'], - '_inc/jetpack-server-sandbox.php' => ['PhanSuspiciousMagicConstant', 'PhanUndeclaredClassMethod'], '_inc/lib/admin-pages/class-jetpack-about-page.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], '_inc/lib/admin-pages/class-jetpack-redux-state-helper.php' => ['PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimAssignment'], '_inc/lib/admin-pages/class.jetpack-admin-page.php' => ['PhanDeprecatedProperty', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredProperty'], @@ -150,13 +138,11 @@ '_inc/lib/core-api/class.jetpack-core-api-site-endpoints.php' => ['PhanTypeMismatchReturn', 'PhanUndeclaredClassMethod'], '_inc/lib/core-api/class.jetpack-core-api-widgets-endpoints.php' => ['PhanTypeMismatchReturn'], '_inc/lib/core-api/class.jetpack-core-api-xmlrpc-consumer-endpoint.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], - '_inc/lib/core-api/load-wpcom-endpoints.php' => ['PhanUndeclaredVariableDim'], '_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-admin-menu.php' => ['PhanPluginMixedKeyNoKey', 'PhanPluginSimplifyExpressionBool'], '_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-ai.php' => ['PhanPluginMixedKeyNoKey', 'PhanTypeMismatchArgument'], '_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-blog-stats.php' => ['PhanTypeMismatchReturnProbablyReal'], '_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-external-media.php' => ['PhanTypeMismatchArgumentProbablyReal'], - '_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-newsletter-categories-list.php' => ['PhanUndeclaredFunction', 'PhanUndeclaredMethod'], - '_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-newsletter-categories-subscriptions-count.php' => ['PhanUndeclaredFunction'], + '_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-newsletter-categories-list.php' => ['PhanUndeclaredMethod'], '_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-podcast-player.php' => ['PhanTypeMismatchReturn'], '_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-related-posts.php' => ['PhanPluginMixedKeyNoKey', 'PhanTypeMismatchReturn'], '_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-resolve-redirect.php' => ['PhanPluginMixedKeyNoKey'], @@ -178,7 +164,7 @@ '_inc/lib/debugger/debug-functions.php' => ['PhanTypeMismatchReturnProbablyReal'], '_inc/lib/functions.wp-notify.php' => ['PhanTypeMismatchReturn'], '_inc/lib/icalendar-reader.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset', 'PhanUndeclaredProperty'], - '_inc/lib/markdown/extra.php' => ['PhanImpossibleConditionInLoop', 'PhanPossiblyUndeclaredVariable', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchReturn', 'PhanUndeclaredProperty', 'PhanUndeclaredVariableDim'], + '_inc/lib/markdown/extra.php' => ['PhanImpossibleConditionInLoop', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchReturn', 'PhanUndeclaredProperty'], '_inc/lib/plans.php' => ['PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], '_inc/lib/tonesque.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentProbablyReal'], '_inc/lib/widgets.php' => ['PhanRedundantConditionInLoop', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchReturn'], @@ -189,7 +175,7 @@ 'class.frame-nonce-preview.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'class.jetpack-admin.php' => ['PhanPluginMixedKeyNoKey', 'PhanTypeMismatchArgumentProbablyReal'], 'class.jetpack-autoupdate.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], - 'class.jetpack-cli.php' => ['PhanAccessMethodInternal', 'PhanParamTooMany', 'PhanParamTooManyCallable', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDefault', 'PhanTypeMismatchReturn', 'PhanUndeclaredClassMethod', 'PhanUndeclaredFunctionInCallable'], + 'class.jetpack-cli.php' => ['PhanAccessMethodInternal', 'PhanParamTooMany', 'PhanParamTooManyCallable', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchDefault', 'PhanTypeMismatchReturn'], 'class.jetpack-gutenberg.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchPropertyProbablyReal', 'PhanTypeMismatchReturn', 'PhanTypeSuspiciousStringExpression'], 'class.jetpack-heartbeat.php' => ['PhanTypeMismatchPropertyDefault'], 'class.jetpack-modules-list-table.php' => ['PhanCommentAbstractOnInheritedMethod'], @@ -197,9 +183,8 @@ 'class.jetpack-network.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturnNullable', 'PhanTypeMismatchReturnProbablyReal'], 'class.jetpack-post-images.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchDefault', 'PhanTypeMismatchReturnProbablyReal'], 'class.jetpack-twitter-cards.php' => ['PhanPluginSimplifyExpressionBool', 'PhanRedundantCondition', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument', 'PhanTypePossiblyInvalidDimOffset'], - 'class.jetpack-user-agent.php' => ['PhanUndeclaredStaticMethod'], - 'class.jetpack.php' => ['PhanAccessMethodInternal', 'PhanDeprecatedFunction', 'PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantConditionInLoop', 'PhanTypeArraySuspiciousNullable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDefault', 'PhanTypeMismatchPropertyDefault', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredFunctionInCallable'], - 'class.json-api-endpoints.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanTypeArraySuspiciousNullable', 'PhanTypeComparisonToArray', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredConstant', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], + 'class.jetpack.php' => ['PhanAccessMethodInternal', 'PhanDeprecatedFunction', 'PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantConditionInLoop', 'PhanTypeArraySuspiciousNullable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDefault', 'PhanTypeMismatchPropertyDefault', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], + 'class.json-api-endpoints.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanTypeArraySuspiciousNullable', 'PhanTypeComparisonToArray', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredProperty'], 'class.json-api.php' => ['PhanPluginDuplicateSwitchCaseLooseEquality', 'PhanPluginSimplifyExpressionBool', 'PhanPossiblyUndeclaredVariable', 'PhanRedundantCondition', 'PhanTypeArraySuspicious', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchProperty', 'PhanTypeMismatchPropertyDefault', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], 'enhanced-open-graph.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspiciousNullable'], 'extensions/blocks/ai-chat/ai-chat.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument'], @@ -213,14 +198,13 @@ 'extensions/blocks/google-calendar/google-calendar.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'extensions/blocks/google-docs-embed/google-docs-embed.php' => ['PhanRedundantCondition'], 'extensions/blocks/image-compare/image-compare.php' => ['PhanTypeMismatchArgument'], - 'extensions/blocks/like/like.php' => ['PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredStaticMethod'], + 'extensions/blocks/like/like.php' => ['PhanTypeMismatchReturnProbablyReal'], 'extensions/blocks/mailchimp/mailchimp.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturnProbablyReal'], 'extensions/blocks/map/map.php' => ['PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal'], 'extensions/blocks/nextdoor/nextdoor.php' => ['PhanTypeMismatchReturnProbablyReal'], 'extensions/blocks/opentable/opentable.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturnProbablyReal'], 'extensions/blocks/pinterest/pinterest.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspiciousNullable'], 'extensions/blocks/podcast-player/podcast-player.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginDuplicateExpressionAssignmentOperation'], - 'extensions/blocks/podcast-player/templates/playlist-track.php' => ['PhanUndeclaredGlobalVariable'], 'extensions/blocks/premium-content/_inc/access-check.php' => ['PhanUndeclaredMethod'], 'extensions/blocks/premium-content/_inc/subscription-service/class-abstract-token-subscription-service.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchArgument', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredMethod'], 'extensions/blocks/premium-content/_inc/subscription-service/class-jetpack-token-subscription-service.php' => ['PhanTypeMismatchReturn'], @@ -247,10 +231,10 @@ 'json-endpoints/class.wpcom-json-api-bulk-delete-post-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-bulk-restore-post-endpoint.php' => ['PhanNoopNew', 'PhanParamSignatureMismatch', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-bulk-update-comments-endpoint.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], - 'json-endpoints/class.wpcom-json-api-comment-endpoint.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredMethod'], + 'json-endpoints/class.wpcom-json-api-comment-endpoint.php' => ['PhanTypeMismatchArgument'], 'json-endpoints/class.wpcom-json-api-delete-media-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-delete-media-v1-1-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchReturn'], - 'json-endpoints/class.wpcom-json-api-edit-media-v1-2-endpoint.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset', 'PhanUndeclaredMethod'], + 'json-endpoints/class.wpcom-json-api-edit-media-v1-2-endpoint.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypePossiblyInvalidDimOffset'], 'json-endpoints/class.wpcom-json-api-get-autosave-v1-1-endpoint.php' => ['PhanNoopNew'], 'json-endpoints/class.wpcom-json-api-get-comment-counts-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-get-comment-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn'], @@ -265,7 +249,7 @@ 'json-endpoints/class.wpcom-json-api-get-post-counts-v1-1-endpoint.php' => ['PhanNoopNew', 'PhanRedundantCondition', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], 'json-endpoints/class.wpcom-json-api-get-post-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-get-post-v1-1-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn'], - 'json-endpoints/class.wpcom-json-api-get-site-endpoint.php' => ['PhanNoopNew', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchReturn', 'PhanUndeclaredMethod', 'PhanUndeclaredMethodInCallable'], + 'json-endpoints/class.wpcom-json-api-get-site-endpoint.php' => ['PhanNoopNew', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-get-site-v1-2-endpoint.php' => ['PhanNoopNew'], 'json-endpoints/class.wpcom-json-api-get-taxonomies-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-get-taxonomy-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable'], @@ -311,7 +295,7 @@ 'json-endpoints/class.wpcom-json-api-update-term-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturn'], 'json-endpoints/class.wpcom-json-api-update-user-endpoint.php' => ['PhanDeprecatedFunction', 'PhanNoopNew', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], 'json-endpoints/class.wpcom-json-api-upload-media-endpoint.php' => ['PhanNoopNew', 'PhanTypeMismatchReturn'], - 'json-endpoints/class.wpcom-json-api-upload-media-v1-1-endpoint.php' => ['PhanNoopNew', 'PhanRedundantCondition', 'PhanUndeclaredMethod'], + 'json-endpoints/class.wpcom-json-api-upload-media-v1-1-endpoint.php' => ['PhanNoopNew', 'PhanRedundantCondition'], 'json-endpoints/jetpack/class-jetpack-json-api-delete-backup-helper-script-endpoint.php' => ['PhanParamSignatureMismatch'], 'json-endpoints/jetpack/class-jetpack-json-api-install-backup-helper-script-endpoint.php' => ['PhanParamSignatureMismatch'], 'json-endpoints/jetpack/class.jetpack-json-api-check-capabilities-endpoint.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -332,14 +316,14 @@ 'json-endpoints/jetpack/class.jetpack-json-api-plugins-get-endpoint.php' => ['PhanNoopNew'], 'json-endpoints/jetpack/class.jetpack-json-api-plugins-install-endpoint.php' => ['PhanNoopNew', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchDimAssignment'], 'json-endpoints/jetpack/class.jetpack-json-api-plugins-list-endpoint.php' => ['PhanNoopNew'], - 'json-endpoints/jetpack/class.jetpack-json-api-plugins-modify-endpoint.php' => ['PhanNoopNew', 'PhanTypeInvalidLeftOperandOfBitwiseOp', 'PhanTypeInvalidRightOperandOfBitwiseOp', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], + 'json-endpoints/jetpack/class.jetpack-json-api-plugins-modify-endpoint.php' => ['PhanNoopNew', 'PhanTypeInvalidLeftOperandOfBitwiseOp', 'PhanTypeInvalidRightOperandOfBitwiseOp', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'json-endpoints/jetpack/class.jetpack-json-api-plugins-modify-v1-2-endpoint.php' => ['PhanNoopNew', 'PhanTypeInvalidLeftOperandOfBitwiseOp', 'PhanTypeInvalidRightOperandOfBitwiseOp'], - 'json-endpoints/jetpack/class.jetpack-json-api-plugins-new-endpoint.php' => ['PhanNoopNew', 'PhanParamSignatureMismatch', 'PhanTypeMismatchArgument', 'PhanTypeMissingReturn', 'PhanUndeclaredMethod'], + 'json-endpoints/jetpack/class.jetpack-json-api-plugins-new-endpoint.php' => ['PhanNoopNew', 'PhanParamSignatureMismatch', 'PhanTypeMismatchArgument', 'PhanTypeMissingReturn'], 'json-endpoints/jetpack/class.jetpack-json-api-sync-endpoint.php' => ['PhanParamSignatureMismatch', 'PhanParamTooManyCallable', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn', 'PhanTypePossiblyInvalidDimOffset'], 'json-endpoints/jetpack/class.jetpack-json-api-themes-active-endpoint.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'json-endpoints/jetpack/class.jetpack-json-api-themes-endpoint.php' => ['PhanParamSignatureMismatch', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'], 'json-endpoints/jetpack/class.jetpack-json-api-themes-modify-endpoint.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'json-endpoints/jetpack/class.jetpack-json-api-themes-new-endpoint.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeMissingReturn', 'PhanUndeclaredMethod'], + 'json-endpoints/jetpack/class.jetpack-json-api-themes-new-endpoint.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeMissingReturn'], 'json-endpoints/jetpack/class.jetpack-json-api-updates-status-endpoint.php' => ['PhanImpossibleCondition', 'PhanPluginDuplicateConditionalNullCoalescing'], 'json-endpoints/jetpack/class.jetpack-json-api-user-connect-endpoint.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchArgument'], 'json-endpoints/jetpack/class.jetpack-json-api-user-create-endpoint.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchPropertyProbablyReal', 'PhanTypeMismatchReturnNullable'], @@ -370,7 +354,7 @@ 'modules/google-fonts/wordpress-6.3/load-google-fonts.php' => ['PhanUndeclaredFunction'], 'modules/gravatar-hovercards.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentProbablyReal'], 'modules/infinite-scroll.php' => ['PhanUndeclaredClassMethod'], - 'modules/infinite-scroll/infinity.php' => ['PhanNoopNew', 'PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanRedundantCondition', 'PhanTypeComparisonToArray', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeMissingReturn', 'PhanUndeclaredFunction'], + 'modules/infinite-scroll/infinity.php' => ['PhanNoopNew', 'PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanRedundantCondition', 'PhanTypeComparisonToArray', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeMissingReturn'], 'modules/latex.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'modules/likes.php' => ['PhanPluginRedundantAssignment', 'PhanUndeclaredFunction'], 'modules/likes/jetpack-likes-master-iframe.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], @@ -386,7 +370,6 @@ 'modules/masterbar/admin-menu/class-wpcom-admin-menu.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPluginSimplifyExpressionBool', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMissingReturn'], 'modules/masterbar/admin-menu/load.php' => ['PhanUndeclaredFunction'], 'modules/masterbar/inline-help/class-inline-help.php' => ['PhanTypeSuspiciousEcho'], - 'modules/masterbar/inline-help/inline-help-template.php' => ['PhanUndeclaredGlobalVariable'], 'modules/masterbar/masterbar/class-masterbar.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'modules/masterbar/profile-edit/bootstrap.php' => ['PhanNoopNew'], 'modules/memberships/class-jetpack-memberships.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], @@ -405,7 +388,7 @@ 'modules/seo-tools/class-jetpack-seo.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'modules/sharedaddy/recaptcha.php' => ['PhanPluginDuplicateExpressionAssignmentOperation'], 'modules/sharedaddy/sharedaddy.php' => ['PhanDeprecatedClass', 'PhanDeprecatedFunction', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredConstant'], - 'modules/sharedaddy/sharing-service.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgument', 'PhanTypeMismatchProperty', 'PhanTypeMismatchPropertyDefault', 'PhanTypeMismatchPropertyProbablyReal', 'PhanTypePossiblyInvalidDimOffset', 'PhanUndeclaredFunction', 'PhanUndeclaredMethod'], + 'modules/sharedaddy/sharing-service.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspicious', 'PhanTypeMismatchArgument', 'PhanTypeMismatchProperty', 'PhanTypeMismatchPropertyDefault', 'PhanTypeMismatchPropertyProbablyReal', 'PhanTypePossiblyInvalidDimOffset', 'PhanUndeclaredFunction'], 'modules/sharedaddy/sharing-sources.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousNonTraversableForeach'], 'modules/sharedaddy/sharing.php' => ['PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypePossiblyInvalidDimOffset'], 'modules/shortcodes/archiveorg-book.php' => ['PhanTypeMismatchArgument'], @@ -441,7 +424,6 @@ 'modules/shortcodes/youtube.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgument'], 'modules/shortlinks.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentProbablyReal'], 'modules/simple-payments/simple-payments.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchReturn'], - 'modules/site-icon/site-icon-functions.php' => ['PhanUndeclaredConstant'], 'modules/sitemaps/sitemap-buffer-fallback.php' => ['PhanTypeArraySuspicious'], 'modules/sitemaps/sitemap-buffer-image-fallback.php' => ['PhanRedefineClass', 'PhanTypeMismatchPropertyProbablyReal'], 'modules/sitemaps/sitemap-buffer-image.php' => ['PhanRedefineClass'], @@ -480,19 +462,16 @@ 'modules/theme-tools/social-menu/icon-functions.php' => ['PhanPluginSimplifyExpressionBool', 'PhanTypeExpectedObjectPropAccess'], 'modules/tiled-gallery/math/class-constrained-array-rounding.php' => ['PhanTypeMismatchDefault'], 'modules/tiled-gallery/tiled-gallery.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentProbablyReal'], - 'modules/tiled-gallery/tiled-gallery/templates/carousel-container.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredThis'], - 'modules/tiled-gallery/tiled-gallery/templates/circle-layout.php' => ['PhanUndeclaredThis'], - 'modules/tiled-gallery/tiled-gallery/templates/partials/carousel-image-args.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable'], - 'modules/tiled-gallery/tiled-gallery/templates/partials/item.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredThis'], - 'modules/tiled-gallery/tiled-gallery/templates/rectangular-layout.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredThis'], - 'modules/tiled-gallery/tiled-gallery/templates/square-layout.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredThis'], + 'modules/tiled-gallery/tiled-gallery/templates/carousel-container.php' => ['PhanTypeMismatchArgument'], + 'modules/tiled-gallery/tiled-gallery/templates/partials/carousel-image-args.php' => ['PhanTypeMismatchArgument'], + 'modules/tiled-gallery/tiled-gallery/templates/rectangular-layout.php' => ['PhanTypeMismatchArgument'], 'modules/tiled-gallery/tiled-gallery/tiled-gallery-item.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'modules/tiled-gallery/tiled-gallery/tiled-gallery-layout.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'modules/tiled-gallery/tiled-gallery/tiled-gallery-shape.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchReturnProbablyReal'], 'modules/tiled-gallery/tiled-gallery/tiled-gallery-square.php' => ['PhanTypeMismatchArgument'], 'modules/videopress/class-videopress-attachment-metadata.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument'], 'modules/videopress/class.jetpack-videopress.php' => ['PhanTypeMismatchDefault'], - 'modules/videopress/class.videopress-cli.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanUndeclaredFunctionInCallable'], + 'modules/videopress/class.videopress-cli.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'modules/videopress/class.videopress-edit-attachment.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantConditionInLoop', 'PhanTypeMismatchArgumentProbablyReal'], 'modules/videopress/class.videopress-gutenberg.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturnProbablyReal'], 'modules/videopress/class.videopress-player.php' => ['PhanImpossibleCondition', 'PhanPluginMixedKeyNoKey', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeInvalidLeftOperandOfNumericOp', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternalReal', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'], @@ -505,16 +484,11 @@ 'modules/widgets/class-jetpack-eu-cookie-law-widget.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMissingReturn'], 'modules/widgets/class-jetpack-instagram-widget.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeMissingReturn', 'PhanTypePossiblyInvalidDimOffset'], 'modules/widgets/contact-info.php' => ['PhanParamSignatureMismatch', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument'], - 'modules/widgets/eu-cookie-law/form.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredThis'], - 'modules/widgets/eu-cookie-law/widget-amp.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeArraySuspiciousNullable', 'PhanUndeclaredGlobalVariable'], - 'modules/widgets/eu-cookie-law/widget.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeArraySuspiciousNullable', 'PhanUndeclaredGlobalVariable'], 'modules/widgets/facebook-likebox.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMissingReturn', 'PhanTypePossiblyInvalidDimOffset'], 'modules/widgets/flickr.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMissingReturn'], - 'modules/widgets/flickr/form.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredThis'], - 'modules/widgets/flickr/widget.php' => ['PhanUndeclaredGlobalVariable'], + 'modules/widgets/flickr/form.php' => ['PhanTypeMismatchArgument'], 'modules/widgets/follow-button.php' => ['PhanPluginUseReturnValueInternalKnown', 'PhanTypeMissingReturn'], 'modules/widgets/gallery.php' => ['PhanParamTooMany', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeMissingReturn'], - 'modules/widgets/gallery/templates/form.php' => ['PhanContextNotObject', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredThis'], 'modules/widgets/goodreads.php' => ['PhanEmptyFQSENInCallable', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMissingReturn'], 'modules/widgets/google-translate.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeMissingReturn'], 'modules/widgets/gravatar-profile.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMissingReturn'], @@ -525,8 +499,6 @@ 'modules/widgets/my-community.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], 'modules/widgets/rsslinks-widget.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentNullableInternal'], 'modules/widgets/simple-payments.php' => ['PhanTypeMismatchReturnProbablyReal', 'PhanTypeMissingReturn'], - 'modules/widgets/simple-payments/form.php' => ['PhanAccessPropertyPrivate', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredThis'], - 'modules/widgets/simple-payments/widget.php' => ['PhanTypeArraySuspiciousNullable'], 'modules/widgets/social-icons.php' => ['PhanPluginSimplifyExpressionBool'], 'modules/widgets/social-media-icons.php' => ['PhanParamSignatureMismatch', 'PhanTypeMismatchReturn'], 'modules/widgets/top-posts.php' => ['PhanImpossibleTypeComparison', 'PhanParamSignatureMismatch', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanRedundantConditionInLoop'], @@ -537,7 +509,7 @@ 'modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-checkout-flow.php' => ['PhanDeprecatedFunction', 'PhanDeprecatedTrait', 'PhanPluginRedundantAssignment'], 'modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-my-account.php' => ['PhanDeprecatedFunction', 'PhanDeprecatedTrait'], 'modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-trait.php' => ['PhanDeprecatedFunction', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredFunction', 'PhanUndeclaredMethod'], - 'modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-universal.php' => ['PhanDeprecatedFunction', 'PhanDeprecatedTrait', 'PhanPluginRedundantAssignment', 'PhanUndeclaredMethod', 'PhanUndeclaredMethodInCallable'], + 'modules/woocommerce-analytics/classes/class-jetpack-woocommerce-analytics-universal.php' => ['PhanDeprecatedFunction', 'PhanDeprecatedTrait', 'PhanPluginRedundantAssignment'], 'modules/wordads/class-wordads.php' => ['PhanNonClassMethodCall', 'PhanPluginRedundantAssignment', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanTypeMismatchArgument', 'PhanTypeMismatchPropertyProbablyReal'], 'modules/wordads/php/class-wordads-admin.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'modules/wordads/php/class-wordads-api.php' => ['PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'], @@ -551,7 +523,7 @@ 'sal/class.json-api-site-base.php' => ['PhanRedundantCondition', 'PhanTypeMismatchArgument', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredFunction'], 'sal/class.json-api-site-jetpack-base.php' => ['PhanRedundantCondition', 'PhanTypeMismatchReturnProbablyReal'], 'sal/class.json-api-site-jetpack.php' => ['PhanParamSignatureMismatch'], - 'sal/class.json-api-token.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanSuspiciousValueComparison', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn', 'PhanUndeclaredVariable'], + 'sal/class.json-api-token.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentProbablyReal'], 'src/class-jetpack-crm-data.php' => ['PhanUndeclaredFunction'], 'src/class-jetpack-modules-overrides.php' => ['PhanRedundantCondition'], 'tests/php/3rd-party/test__atomic.php' => ['PhanTypeMismatchArgument'], @@ -566,11 +538,10 @@ 'tests/php/core-api/wpcom-endpoints/test-class-wpcom-rest-api-v2-endpoint-admin-menu.php' => ['PhanPluginMixedKeyNoKey', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchReturn'], 'tests/php/core-api/wpcom-endpoints/test-class-wpcom-rest-api-v2-endpoint-external-media.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument'], 'tests/php/core-api/wpcom-endpoints/test-class-wpcom-rest-api-v2-endpoint-publicize-share-post.php' => ['PhanTypeMismatchArgument'], - 'tests/php/core-api/wpcom-fields/class-test-wpcom-rest-api-v2-attachment-videopress-data.php' => ['PhanDeprecatedFunction', 'PhanUndeclaredClassMethod'], + 'tests/php/core-api/wpcom-fields/class-test-wpcom-rest-api-v2-attachment-videopress-data.php' => ['PhanDeprecatedFunction'], 'tests/php/core-api/wpcom-fields/test-attachment-fields-videopress.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/core-api/wpcom-fields/test-post-fields-publicize-connections.php' => ['PhanDeprecatedFunction', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeComparisonToArray', 'PhanTypeMismatchPropertyProbablyReal'], 'tests/php/extensions/blocks/premium-content/test_class.jetpack-premium-content.php' => ['PhanDeprecatedProperty', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMissingReturn', 'PhanUndeclaredMethod'], - 'tests/php/extensions/blocks/test-story.php' => ['PhanUndeclaredMethodInCallable'], 'tests/php/general/test-class.jetpack-gutenberg.php' => ['PhanPluginDuplicateAdjacentStatement'], 'tests/php/general/test-class.jetpack-options.php' => ['PhanTypeMismatchArgument'], 'tests/php/general/test_class.jetpack-client-server.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchArgumentProbablyReal'], @@ -609,25 +580,23 @@ 'tests/php/modules/shortcodes/test-class.tweet.php' => ['PhanTypeMismatchArgument'], 'tests/php/modules/shortcodes/test-class.vimeo.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'tests/php/modules/shortcodes/test-oembed-pocketcasts.php' => ['PhanTypeMismatchArgument'], - 'tests/php/modules/shortcodes/trait.http-request-cache.php' => ['PhanTypeMismatchArgumentInternal', 'PhanUndeclaredMethod', 'PhanUndeclaredStaticProperty'], 'tests/php/modules/sitemaps/test-class.sitemap-buffer.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchPropertyProbablyReal'], 'tests/php/modules/sitemaps/test-class.sitemap-librarian.php' => ['PhanTypeMismatchArgument'], 'tests/php/modules/subscriptions/test_class.jetpack-subscriptions.php' => ['PhanDeprecatedProperty', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/modules/widgets/migrate-to-core/test_migrate-to-core-gallery-widget.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/modules/widgets/test_contact-info-widget.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'tests/php/modules/widgets/test_wordpress-post-widget.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredFunctionInCallable'], + 'tests/php/modules/widgets/test_wordpress-post-widget.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/sync/class-test-jetpack-sync-search.php' => ['PhanStaticCallToNonStatic', 'PhanTypeMismatchArgumentInternal'], 'tests/php/sync/class-wp-test-jetpack-sync-queue-base-tests.php' => ['PhanDeprecatedFunction', 'PhanParamTooMany', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/sync/server/class.jetpack-sync-server-eventstore.php' => ['PhanPluginDuplicateConditionalNullCoalescing'], - 'tests/php/sync/server/class.jetpack-sync-server-replicator.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgument', 'PhanUndeclaredMethod'], 'tests/php/sync/server/class.jetpack-sync-test-object-factory.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'tests/php/sync/server/class.jetpack-sync-test-replicastore.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeInvalidLeftOperandOfAdd'], 'tests/php/sync/test-class.jetpack-sync-checksum-smoke.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchReturn'], 'tests/php/sync/test-class.jetpack-sync-checksum.php' => ['PhanNoopNew', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchReturn', 'PhanUndeclaredProperty'], 'tests/php/sync/test_class.jetpack-sync-base.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn'], - 'tests/php/sync/test_class.jetpack-sync-callables.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMissingReturn', 'PhanUndeclaredClassReference'], + 'tests/php/sync/test_class.jetpack-sync-callables.php' => ['PhanNoopNew', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMissingReturn'], 'tests/php/sync/test_class.jetpack-sync-comments.php' => ['PhanTypeMismatchArgument'], - 'tests/php/sync/test_class.jetpack-sync-full-immediately.php' => ['PhanParamTooMany', 'PhanPluginDuplicateAdjacentStatement', 'PhanPossiblyUndeclaredVariable', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredVariableDim'], + 'tests/php/sync/test_class.jetpack-sync-full-immediately.php' => ['PhanParamTooMany', 'PhanPluginDuplicateAdjacentStatement', 'PhanPossiblyUndeclaredVariable', 'PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal'], 'tests/php/sync/test_class.jetpack-sync-full.php' => ['PhanParamTooMany', 'PhanPluginDuplicateAdjacentStatement', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchArgumentReal', 'PhanUndeclaredProperty'], 'tests/php/sync/test_class.jetpack-sync-import.php' => ['PhanRedefineClass'], 'tests/php/sync/test_class.jetpack-sync-integration.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchPropertyProbablyReal'], @@ -652,9 +621,6 @@ 'tests/php/test_deprecation.php' => ['PhanDeprecatedFunction'], 'tools/build-asset-cdn-json.php' => ['PhanTypeArraySuspiciousNullable', 'PhanTypeMismatchArgument'], 'uninstall.php' => ['PhanTypeMismatchArgumentInternal'], - 'views/admin/deactivation-dialog.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], - 'views/admin/must-connect-main-blog.php' => ['PhanTypeArraySuspiciousNullable'], - 'views/admin/network-settings.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeArraySuspiciousNullable'], ], // 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed. // (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases) diff --git a/projects/plugins/jetpack/_inc/jetpack-server-sandbox.php b/projects/plugins/jetpack/_inc/jetpack-server-sandbox.php deleted file mode 100644 index a51b501625295..0000000000000 --- a/projects/plugins/jetpack/_inc/jetpack-server-sandbox.php +++ /dev/null @@ -1,38 +0,0 @@ - new URL, 'host' => new Host ]. - */ -function jetpack_server_sandbox_request_parameters( $sandbox, $url, $headers ) { - _deprecated_function( __METHOD__, 'jetpack-10.2', 'Automattic\\Jetpack\\Server_Sandbox::server_sandbox_request_parameters' ); - - return ( new Automattic\Jetpack\Server_Sandbox() )->server_sandbox_request_parameters( $sandbox, $url, $headers ); -} - -/** - * Modifies parameters of request in order to send the request to the - * server specified by `JETPACK__SANDBOX_DOMAIN`. - * - * Attached to the `requests-requests.before_request` filter. - * - * @param string $url URL of request about to be made. - * @param array $headers Headers of request about to be made. - * @return void - */ -function jetpack_server_sandbox( &$url, &$headers ) { - _deprecated_function( __METHOD__, 'jetpack-10.2', 'Automattic\\Jetpack\\Server_Sandbox::server_sandbox' ); - - ( new Automattic\Jetpack\Server_Sandbox() )->server_sandbox( $url, $headers ); -} diff --git a/projects/plugins/jetpack/_inc/lib/core-api/load-wpcom-endpoints.php b/projects/plugins/jetpack/_inc/lib/core-api/load-wpcom-endpoints.php index 2c9089a824161..05f9608fbb95f 100644 --- a/projects/plugins/jetpack/_inc/lib/core-api/load-wpcom-endpoints.php +++ b/projects/plugins/jetpack/_inc/lib/core-api/load-wpcom-endpoints.php @@ -42,8 +42,7 @@ function wpcom_rest_api_v2_load_plugin( $class_name ) { global $wpcom_rest_api_v2_plugins; if ( ! isset( $wpcom_rest_api_v2_plugins ) ) { - $wpcom_rest_api_v2_plugins = array(); - $_GLOBALS['wpcom_rest_api_v2_plugins'] = array(); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase,VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable + $wpcom_rest_api_v2_plugins = array(); } if ( ! isset( $wpcom_rest_api_v2_plugins[ $class_name ] ) ) { diff --git a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-newsletter-categories-list.php b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-newsletter-categories-list.php index 788a6a8181179..d823a50f16dd4 100644 --- a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-newsletter-categories-list.php +++ b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-newsletter-categories-list.php @@ -64,11 +64,11 @@ public function register_routes() { public function get_newsletter_categories() { require_lib( 'newsletter-categories' ); - $newsletter_categories = get_newsletter_categories(); + $newsletter_categories = \Newsletter_Categories\get_newsletter_categories(); // Include subscription counts for each category if the user can manage categories. if ( $this->can_manage_categories() === true ) { - $subscription_counts_per_category = get_blog_subscription_counts_per_category(); + $subscription_counts_per_category = \Newsletter_Categories\get_blog_subscription_counts_per_category(); array_walk( $newsletter_categories, function ( &$category ) use ( $subscription_counts_per_category ) { diff --git a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-newsletter-categories-subscriptions-count.php b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-newsletter-categories-subscriptions-count.php index 64fe8599b280b..e865e59a16228 100644 --- a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-newsletter-categories-subscriptions-count.php +++ b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-newsletter-categories-subscriptions-count.php @@ -76,7 +76,7 @@ public function get_newsletter_categories_subscriptions_count( WP_REST_Request $ $blog_id = get_current_blog_id(); $term_ids = explode( ',', $request->get_param( 'term_ids' ) ); - $subscriptions_count = get_blog_subscriptions_aggregate_count( $blog_id, $term_ids ); + $subscriptions_count = \Newsletter_Categories\get_blog_subscriptions_aggregate_count( $blog_id, $term_ids ); return rest_ensure_response( array( diff --git a/projects/plugins/jetpack/_inc/lib/markdown/extra.php b/projects/plugins/jetpack/_inc/lib/markdown/extra.php index f1fe911d0167f..cb263a21659c3 100644 --- a/projects/plugins/jetpack/_inc/lib/markdown/extra.php +++ b/projects/plugins/jetpack/_inc/lib/markdown/extra.php @@ -2608,6 +2608,7 @@ function _doTable_callback($matches) { # Reading alignement from header underline. $separators = preg_split('/ *[|] */', $underline); + $attr = array(); foreach ($separators as $n => $s) { if (preg_match('/^ *-+: *$/', $s)) $attr[$n] = ' align="right"'; else if (preg_match('/^ *:-+: *$/', $s))$attr[$n] = ' align="center"'; diff --git a/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues new file mode 100644 index 0000000000000..6961dee6c69ff --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: #16434 removed the jetpack-device-detect function this was calling, but missed this caller. + +Remove `Jetpack_User_Agent_Info::is_OperaMobile()`, it would have thrown fatals since October 2021. diff --git a/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#2 b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#2 new file mode 100644 index 0000000000000..8536bf0120fbe --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#2 @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Due to a wrong namespace in #21128, the stubs never actually worked. + +Remove `jetpack_server_sandbox()` and `jetpack_server_sandbox_request_parameters()`. They'd have thrown fatals since October 2021. diff --git a/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#3 b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#3 new file mode 100644 index 0000000000000..b0268d9c8118d --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#3 @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Use `$skin` instead of `$upgrader->skin`, it's the same object but not typed as a parent class. Should be no change to functionality. + + diff --git a/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#4 b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#4 new file mode 100644 index 0000000000000..904fd8a415f30 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#4 @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Add some missing methods to `WPCOM_JSON_API`. + + diff --git a/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#5 b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#5 new file mode 100644 index 0000000000000..b6051eb5b2585 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#5 @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Add some missing abstract methods to SAL_Site, and implement in Jetpack_Site. diff --git a/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#6 b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#6 new file mode 100644 index 0000000000000..d954eb69365b1 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#6 @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Fix `SAL_Token::is_global()`. diff --git a/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#7 b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#7 new file mode 100644 index 0000000000000..931d5cfd6284a --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-misc-phan-undeclared-issues#7 @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Remove views/admin/deactivation-dialog.php, unused since #21048. + + diff --git a/projects/plugins/jetpack/class.jetpack-cli.php b/projects/plugins/jetpack/class.jetpack-cli.php index aa2560395b726..f6c833a43f41c 100644 --- a/projects/plugins/jetpack/class.jetpack-cli.php +++ b/projects/plugins/jetpack/class.jetpack-cli.php @@ -23,6 +23,7 @@ return; } +// @phan-suppress-next-line PhanUndeclaredFunctionInCallable -- https://github.com/phan/phan/issues/4763 WP_CLI::add_command( 'jetpack', 'Jetpack_CLI' ); /** @@ -1866,9 +1867,11 @@ public function publicize( $args, $named_args ) { ); } + // @phan-suppress-next-line PhanUndeclaredClassMethod - Class is missing from php-stubs/wp-cli-stubs 🤷 $progress->tick(); } + // @phan-suppress-next-line PhanUndeclaredClassMethod - Class is missing from php-stubs/wp-cli-stubs 🤷 $progress->finish(); if ( 'all' === $service ) { diff --git a/projects/plugins/jetpack/class.jetpack-user-agent.php b/projects/plugins/jetpack/class.jetpack-user-agent.php index e50ce7ce3a414..c310fc4c427ac 100644 --- a/projects/plugins/jetpack/class.jetpack-user-agent.php +++ b/projects/plugins/jetpack/class.jetpack-user-agent.php @@ -330,19 +330,6 @@ public static function is_opera_mini_dumb() { return User_Agent_Info::is_opera_mini_dumb(); } - /** - * Detects if the current browser is Opera Mobile or Mini. - * - * Opera Mini 5 Beta: Opera/9.80 (J2ME/MIDP; Opera Mini/5.0.15650/756; U; en) Presto/2.2.0 - * Opera Mini 8: Opera/8.01 (J2ME/MIDP; Opera Mini/3.0.6306/1528; en; U; ssr) - * - * @deprecated 8.7.0 Use Automattic\Jetpack\Device_Detection\User_Agent_Info - */ - public static function is_OperaMobile() { - self::warn_deprecated( __METHOD__, '::is_opera_mini() or \Automattic\Jetpack\Device_Detection\User_Agent_Info::is_opera_mobile()' ); - return User_Agent_Info::is_OperaMobile(); - } - /** * Detects if the current browser is a Windows Phone 7 device. * ex: Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; LG; GW910) diff --git a/projects/plugins/jetpack/class.jetpack.php b/projects/plugins/jetpack/class.jetpack.php index f81a31592dcf2..4bf071a76336e 100644 --- a/projects/plugins/jetpack/class.jetpack.php +++ b/projects/plugins/jetpack/class.jetpack.php @@ -3308,6 +3308,7 @@ public function throw_error_on_activate_plugin( $plugin ) { $throw = true; } } else { + // @phan-suppress-next-line PhanUndeclaredFunctionInCallable -- Checked above. See also https://github.com/phan/phan/issues/1204. $reflection = new ReflectionFunction( 'stats_get_api_key' ); if ( basename( $plugin ) === basename( $reflection->getFileName() ) ) { $throw = true; diff --git a/projects/plugins/jetpack/class.json-api-endpoints.php b/projects/plugins/jetpack/class.json-api-endpoints.php index dd4a7ac4f941c..68e2288596ace 100644 --- a/projects/plugins/jetpack/class.json-api-endpoints.php +++ b/projects/plugins/jetpack/class.json-api-endpoints.php @@ -77,6 +77,7 @@ abstract class WPCOM_JSON_API_Endpoint { * Maximum version of the api for which to serve this endpoint * * @var string + * @phan-suppress PhanUndeclaredConstant -- https://github.com/phan/phan/issues/4855 */ public $max_version = WPCOM_JSON_API__CURRENT_VERSION; @@ -98,6 +99,7 @@ abstract class WPCOM_JSON_API_Endpoint { * Version of the endpoint this endpoint is deprecated in favor of. * * @var string + * @phan-suppress PhanUndeclaredConstant -- https://github.com/phan/phan/issues/4855 */ protected $new_version = WPCOM_JSON_API__CURRENT_VERSION; @@ -2596,8 +2598,11 @@ public function get_amp_cache_origins( $siteurl ) { */ if ( function_exists( 'idn_to_utf8' ) ) { // The third parameter is set explicitly to prevent issues with newer PHP versions compiled with an old ICU version. - // phpcs:ignore PHPCompatibility.Constants.RemovedConstants.intl_idna_variant_2003Deprecated, PHPCompatibility.Constants.RemovedConstants.intl_idna_variant_2003DeprecatedRemoved - $host = idn_to_utf8( $host, IDNA_DEFAULT, defined( 'INTL_IDNA_VARIANT_UTS46' ) ? INTL_IDNA_VARIANT_UTS46 : INTL_IDNA_VARIANT_2003 ); + $variant = defined( 'INTL_IDNA_VARIANT_UTS46' ) + ? INTL_IDNA_VARIANT_UTS46 + // phpcs:ignore PHPCompatibility.Constants.RemovedConstants.intl_idna_variant_2003Deprecated, PHPCompatibility.Constants.RemovedConstants.intl_idna_variant_2003DeprecatedRemoved + : INTL_IDNA_VARIANT_2003; // @phan-suppress-current-line PhanUndeclaredConstant + $host = idn_to_utf8( $host, IDNA_DEFAULT, $variant ); } $subdomain = str_replace( array( '-', '.' ), array( '--', '-' ), $host ); return array( diff --git a/projects/plugins/jetpack/class.json-api.php b/projects/plugins/jetpack/class.json-api.php index 490f534974456..ce868ebc2c5ed 100644 --- a/projects/plugins/jetpack/class.json-api.php +++ b/projects/plugins/jetpack/class.json-api.php @@ -381,6 +381,17 @@ public function is_jetpack_authorized_for_site( $site_id = false ) { return true; } + /** + * Checks if the current request is authorized with an upload token. + * This method is overridden by a child class in WPCOM. + * + * @since $$next-version$$ + * @return boolean + */ + public function is_authorized_with_upload_token() { + return false; + } + /** * Serve. * @@ -1016,6 +1027,18 @@ public function add_global_ID( $blog_id, $post_id ) { // phpcs:ignore VariableAn return ''; } + /** + * Return a count of comment likes. + * This method is overridden by a child class in WPCOM. + * + * @since $$next-version$$ + * @return int + */ + public function comment_like_count() { + func_get_args(); // @phan-suppress-current-line PhanPluginUseReturnValueInternalKnown -- This is just here so Phan realizes the wpcom version does this. + return 0; + } + /** * Get avatar URL. * diff --git a/projects/plugins/jetpack/extensions/blocks/like/like.php b/projects/plugins/jetpack/extensions/blocks/like/like.php index d4b1575509277..3981e6e46f38d 100644 --- a/projects/plugins/jetpack/extensions/blocks/like/like.php +++ b/projects/plugins/jetpack/extensions/blocks/like/like.php @@ -145,6 +145,7 @@ function render_iframe() { if ( ! $main_iframe_added ) { if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { + // @phan-suppress-next-line PhanUndeclaredStaticMethod -- Can't do a stub for this one since Jetpack has its own class with the same name. \Jetpack_Likes::likes_master(); } else { require_once JETPACK__PLUGIN_DIR . 'modules/likes.php'; diff --git a/projects/plugins/jetpack/extensions/blocks/podcast-player/templates/playlist-track.php b/projects/plugins/jetpack/extensions/blocks/podcast-player/templates/playlist-track.php index f49387184f31b..a3099672fea46 100644 --- a/projects/plugins/jetpack/extensions/blocks/podcast-player/templates/playlist-track.php +++ b/projects/plugins/jetpack/extensions/blocks/podcast-player/templates/playlist-track.php @@ -14,6 +14,7 @@ * * @var array $template_props */ +'@phan-var-force array $template_props'; $track_title = $template_props['attachment']['title']; $track_link = empty( $template_props['attachment']['link'] ) ? $template_props['attachment']['src'] : $template_props['attachment']['link']; diff --git a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-get-site-endpoint.php b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-get-site-endpoint.php index f0319e2067e19..96f4b016f7c4b 100644 --- a/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-get-site-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-get-site-endpoint.php @@ -289,7 +289,7 @@ class WPCOM_JSON_API_GET_Site_Endpoint extends WPCOM_JSON_API_Endpoint { /** * Site * - * @var $site. + * @var SAL_Site $site. */ private $site; @@ -560,11 +560,7 @@ protected function render_response_key( $key, &$response, $is_user_logged_in ) { $response[ $key ] = $this->site->get_products(); break; case 'zendesk_site_meta': - // D59613-code only added this function to the wpcom SAL subclasses. Absent any better idea, - // we'll just omit the key entirely in Jetpack. - if ( is_callable( array( $this->site, 'get_zendesk_site_meta' ) ) ) { - $response[ $key ] = $this->site->get_zendesk_site_meta(); - } + $response[ $key ] = $this->site->get_zendesk_site_meta(); break; case 'quota': $response[ $key ] = $this->site->get_quota(); @@ -819,11 +815,7 @@ protected function render_option_keys( &$options_response_keys ) { $options[ $key ] = $site->get_import_engine(); break; case 'is_pending_plan': - // D40032-code only added this function to the wpcom SAL subclasses. Absent any better idea, - // we'll just omit the key entirely in Jetpack. - if ( is_callable( array( $site, 'is_pending_plan' ) ) ) { - $options[ $key ] = $site->is_pending_plan(); - } + $options[ $key ] = $site->is_pending_plan(); break; case 'is_wpforteams_site': diff --git a/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-modify-endpoint.php b/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-modify-endpoint.php index f24ba12e6c9f2..60be46e04d5fc 100644 --- a/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-modify-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-modify-endpoint.php @@ -461,8 +461,8 @@ protected function update() { // This avoids the plugin to be deactivated. // Using bulk upgrade puts the site into maintenance mode during the upgrades $result = $upgrader->bulk_upgrade( array( $plugin ) ); - $errors = $upgrader->skin->get_errors(); - $this->log[ $plugin ] = $upgrader->skin->get_upgrade_messages(); + $errors = $skin->get_errors(); + $this->log[ $plugin ] = $skin->get_upgrade_messages(); // release individual plugin lock. WP_Upgrader::release_lock( 'jetpack_' . $plugin_slug ); diff --git a/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-new-endpoint.php b/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-new-endpoint.php index b839722b8e83a..760a419737256 100644 --- a/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-new-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-new-endpoint.php @@ -142,8 +142,8 @@ public function install() { $plugin = array_values( array_diff( array_keys( $after_install_plugin_list ), array_keys( $pre_install_plugin_list ) ) ); if ( ! $result ) { - $error_code = $upgrader->skin->get_main_error_code(); - $message = $upgrader->skin->get_main_error_message(); + $error_code = $skin->get_main_error_code(); + $message = $skin->get_main_error_message(); if ( empty( $message ) ) { $message = __( 'An unknown error occurred during installation', 'jetpack' ); } diff --git a/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-themes-new-endpoint.php b/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-themes-new-endpoint.php index d70fae8b13e8c..c16a804c1bf47 100644 --- a/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-themes-new-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-themes-new-endpoint.php @@ -96,8 +96,8 @@ public function install() { $plugin = array_values( array_diff( array_keys( $after_install_list ), array_keys( $pre_install_list ) ) ); if ( ! $result ) { - $error_code = $upgrader->skin->get_main_error_code(); - $message = $upgrader->skin->get_main_error_message(); + $error_code = $skin->get_main_error_code(); + $message = $skin->get_main_error_message(); if ( empty( $message ) ) { $message = __( 'An unknown error occurred during installation', 'jetpack' ); } diff --git a/projects/plugins/jetpack/modules/infinite-scroll/infinity.php b/projects/plugins/jetpack/modules/infinite-scroll/infinity.php index 29e33a1dda04a..b1ba13be5918c 100644 --- a/projects/plugins/jetpack/modules/infinite-scroll/infinity.php +++ b/projects/plugins/jetpack/modules/infinite-scroll/infinity.php @@ -214,6 +214,7 @@ public static function get_settings() { // Otherwise, if a widget area ID or array of IDs was provided in the footer_widgets parameter, check if any contains any widgets. // It is safe to use `is_active_sidebar()` before the sidebar is registered as this function doesn't check for a sidebar's existence when determining if it contains any widgets. if ( function_exists( 'infinite_scroll_has_footer_widgets' ) ) { + // @phan-suppress-next-line PhanUndeclaredFunction -- Checked above. See also https://github.com/phan/phan/issues/1204. $settings['footer_widgets'] = (bool) infinite_scroll_has_footer_widgets(); } elseif ( is_array( $settings['footer_widgets'] ) ) { $sidebar_ids = $settings['footer_widgets']; diff --git a/projects/plugins/jetpack/modules/masterbar/inline-help/inline-help-template.php b/projects/plugins/jetpack/modules/masterbar/inline-help/inline-help-template.php index 6d9aba31035a5..9b2c0ea5ca925 100644 --- a/projects/plugins/jetpack/modules/masterbar/inline-help/inline-help-template.php +++ b/projects/plugins/jetpack/modules/masterbar/inline-help/inline-help-template.php @@ -5,7 +5,9 @@ * @package automattic/jetpack */ -// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable +// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- Defined by the caller. Let Phan handle it. +'@phan-var-force array{href:string,icon:string,svg_allowed:array} $args'; + ?>
diff --git a/projects/plugins/jetpack/modules/memberships/class-jetpack-memberships.php b/projects/plugins/jetpack/modules/memberships/class-jetpack-memberships.php index 83d9dc93a9ac6..30619a296ef1f 100644 --- a/projects/plugins/jetpack/modules/memberships/class-jetpack-memberships.php +++ b/projects/plugins/jetpack/modules/memberships/class-jetpack-memberships.php @@ -414,6 +414,7 @@ public function render_button( $attributes, $content = null, $block = null ) { return $this->render_button_error( new WP_Error( 'jetpack-memberships-rb-npf', __( 'Could not find a plan for this button.', 'jetpack' ) . ' ' . __( 'Edit this post and confirm that the selected payment plan still exists and is available for purchase.', 'jetpack' ) ) ); } if ( is_wp_error( $product ) ) { + '@phan-var WP_Error $product'; // `get_post` isn't supposed to return a WP_Error, so Phan is confused here. See also https://github.com/phan/phan/issues/3127 return $this->render_button_error( new WP_Error( 'jetpack-memberships-rb-npf-we', __( 'Encountered an error when getting the plan associated with this button:', 'jetpack' ) . ' ' . $product->get_error_message() . '. ' . __( ' Edit this post and confirm that the selected payment plan still exists and is available for purchase.', 'jetpack' ) ) ); } if ( $product->post_type !== self::$post_type_plan ) { diff --git a/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php b/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php index b190974c77311..2487064126881 100644 --- a/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php +++ b/projects/plugins/jetpack/modules/sharedaddy/sharing-service.php @@ -511,12 +511,12 @@ public function get_global_options() { /** * Save a sharing service for use. * - * @param int $id Sharing unique ID. - * @param Sharing_Source $service Sharing service. + * @param int $id Sharing unique ID. + * @param Sharing_Advanced_Source $service Sharing service. * * @return void */ - public function set_service( $id, Sharing_Source $service ) { + public function set_service( $id, Sharing_Advanced_Source $service ) { // Update the options for this service $options = get_option( 'sharing-options' ); diff --git a/projects/plugins/jetpack/modules/site-icon/site-icon-functions.php b/projects/plugins/jetpack/modules/site-icon/site-icon-functions.php index b774482a35d19..15c124ba6ec14 100644 --- a/projects/plugins/jetpack/modules/site-icon/site-icon-functions.php +++ b/projects/plugins/jetpack/modules/site-icon/site-icon-functions.php @@ -9,9 +9,9 @@ /** * Returns the Jetpack Site Icon URL. * - * @param null|int $blog_id Blog ID. - * @param string $size Site icon size in pixels. - * @param bool $default If value from `SITE_ICON_DEFAULT_URL` should be used if no site icon is provided. + * @param null|int $blog_id Blog ID. + * @param string $size Site icon size in pixels. + * @param string|false $default Default to use. If false and `SITE_ICON_DEFAULT_URL` is defined, that will be used. * * @return false|string URL of site icon, or false if none. */ @@ -27,6 +27,7 @@ function jetpack_site_icon_url( $blog_id = null, $size = '512', $default = false } if ( ! $site_icon_id ) { if ( false === $default && defined( 'SITE_ICON_DEFAULT_URL' ) ) { + // @phan-suppress-next-line PhanUndeclaredConstant -- Checked above. See also https://github.com/phan/phan/issues/1204. $url = SITE_ICON_DEFAULT_URL; } else { $url = $default; diff --git a/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/carousel-container.php b/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/carousel-container.php index 43850d1867377..c91f53fb6761c 100644 --- a/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/carousel-container.php +++ b/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/carousel-container.php @@ -5,16 +5,20 @@ * @package jetpack */ +// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- Defined by the caller. Let Phan handle it. +'@phan-var-force Jetpack_Tiled_Gallery_Layout $this'; +'@phan-var-force array $context'; + // Using JSON_HEX_AMP avoids breakage due to `esc_attr()` refusing to double-encode. -$extra = wp_json_encode( $this->get_container_extra_data(), JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable +$extra = wp_json_encode( $this->get_container_extra_data(), JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT ); ?> diff --git a/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/circle-layout.php b/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/circle-layout.php index aa383f193cab2..0d035aa6390db 100644 --- a/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/circle-layout.php +++ b/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/circle-layout.php @@ -5,4 +5,8 @@ * @package automattic/jetpack */ -$this->template( 'square-layout', $context ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable +// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- Defined by the caller. Let Phan handle it. +'@phan-var-force Jetpack_Tiled_Gallery_Layout $this'; +'@phan-var-force array $context'; + +$this->template( 'square-layout', $context ); // @phan-suppress-current-line PhanAccessMethodPrivate -- Called in the scope of the class. diff --git a/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/partials/carousel-image-args.php b/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/partials/carousel-image-args.php index 276b831bf8bef..6c679c7cd0b9a 100644 --- a/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/partials/carousel-image-args.php +++ b/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/partials/carousel-image-args.php @@ -5,7 +5,11 @@ * @package automattic/jetpack */ -$item = $context['item']; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable +// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- Defined by the caller. Let Phan handle it. +'@phan-var-force Jetpack_Tiled_Gallery_Layout $this'; +'@phan-var-force array $context'; + +$item = $context['item']; $fuzzy_image_meta = $item->fuzzy_image_meta(); // See https://github.com/Automattic/jetpack/issues/2765 . if ( isset( $fuzzy_image_meta['keywords'] ) ) { unset( $fuzzy_image_meta['keywords'] ); diff --git a/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/partials/item.php b/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/partials/item.php index 144323269fc87..7e006b013a570 100644 --- a/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/partials/item.php +++ b/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/partials/item.php @@ -5,8 +5,12 @@ * @package jetpack */ -$item = $context['item']; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -$add_link = 'none' !== $this->link; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable +// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- Defined by the caller. Let Phan handle it. +'@phan-var-force Jetpack_Tiled_Gallery_Layout $this'; +'@phan-var-force array $context'; + +$item = $context['item']; +$add_link = 'none' !== $this->link; // We do this for accessibility. Titles without alt's break screen readers. if ( empty( $item->image_alt ) && ! empty( $item->image_title ) ) { @@ -26,7 +30,7 @@ partial( 'carousel-image-args', array( 'item' => $item ) ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable ?> + partial( 'carousel-image-args', array( 'item' => $item ) ); // @phan-suppress-current-line PhanAccessMethodPrivate -- Called in the scope of the class. ?> src="img_src ); ?>" img_srcset ? 'srcset="' . esc_attr( $item->img_srcset ) . '"' : ''; ?> width="image->width ); ?>" diff --git a/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/rectangular-layout.php b/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/rectangular-layout.php index aebe0c373a332..abf88a709717a 100644 --- a/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/rectangular-layout.php +++ b/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery/templates/rectangular-layout.php @@ -5,7 +5,11 @@ * @package automattic/jetpack */ -foreach ( $context['rows'] as $row ) : // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable +// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- Defined by the caller. Let Phan handle it. +'@phan-var-force Jetpack_Tiled_Gallery_Layout $this'; +'@phan-var-force array $context'; + +foreach ( $context['rows'] as $row ) : ?>