diff --git a/projects/packages/classic-theme-helper/.phan/baseline.php b/projects/packages/classic-theme-helper/.phan/baseline.php
index aede0f74752cc..47e19ffe57e80 100644
--- a/projects/packages/classic-theme-helper/.phan/baseline.php
+++ b/projects/packages/classic-theme-helper/.phan/baseline.php
@@ -10,13 +10,14 @@
return [
// # Issue statistics:
// PhanTypeMismatchArgumentInternal : 10+ occurrences
+ // PhanUndeclaredClassMethod : 9 occurrences
// PhanTypePossiblyInvalidDimOffset : 8 occurrences
- // PhanUndeclaredClassMethod : 7 occurrences
// PhanUndeclaredClassReference : 4 occurrences
+ // PhanTypeMismatchArgumentProbablyReal : 3 occurrences
+ // PhanTypeSuspiciousNonTraversableForeach : 3 occurrences
// PhanTypeInvalidDimOffset : 2 occurrences
// PhanTypeMismatchArgument : 2 occurrences
// PhanTypeComparisonToArray : 1 occurrence
- // PhanTypeMismatchArgumentProbablyReal : 1 occurrence
// PhanTypeMismatchProperty : 1 occurrence
// PhanUndeclaredTypeProperty : 1 occurrence
@@ -26,6 +27,8 @@
'src/class-featured-content.php' => ['PhanTypeComparisonToArray', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgument', 'PhanTypeMismatchProperty', 'PhanTypePossiblyInvalidDimOffset'],
'src/class-social-links.php' => ['PhanUndeclaredClassMethod', 'PhanUndeclaredClassReference', 'PhanUndeclaredTypeProperty'],
'src/content-options/featured-images-fallback.php' => ['PhanTypePossiblyInvalidDimOffset'],
+ 'src/custom-content-types.php' => ['PhanUndeclaredClassMethod'],
+ 'src/custom-post-types/class-jetpack-portfolio.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeSuspiciousNonTraversableForeach'],
],
// '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/packages/classic-theme-helper/src/custom-content-types.php b/projects/packages/classic-theme-helper/src/custom-content-types.php
index 8c5bcf496e7dd..704fb7f082be3 100644
--- a/projects/packages/classic-theme-helper/src/custom-content-types.php
+++ b/projects/packages/classic-theme-helper/src/custom-content-types.php
@@ -33,7 +33,9 @@ function jetpack_load_custom_post_types() {
* Make module configurable.
*/
function jetpack_custom_post_types_loaded() {
- Jetpack::enable_module_configurable( __FILE__ );
+ if ( class_exists( 'Jetpack' ) ) {
+ Jetpack::enable_module_configurable( __FILE__ );
+ }
}
add_action( 'jetpack_modules_loaded', 'jetpack_custom_post_types_loaded' );
}
@@ -58,12 +60,14 @@ function jetpack_cpt_settings_api_init() {
* Settings Description
*/
function jetpack_cpt_section_callback() {
- ?>
-
-
-
-
-
+
+
+
+
+ New Activation stat.
*/
public function new_activation_stat_bump() {
- bump_stats_extras( 'portfolios', 'new-activation' );
+ if ( function_exists( 'bump_stats_extras' ) ) {
+ bump_stats_extras( 'portfolios', 'new-activation' ); // @phan-suppress-current-line PhanUndeclaredFunction -- only calling if it exists.
+ }
}
/**
@@ -219,11 +223,17 @@ public function new_activation_stat_bump() {
*/
public function update_option_stat_bump( $old, $new ) {
if ( empty( $old ) && ! empty( $new ) ) {
- bump_stats_extras( 'portfolios', 'option-on' );
+ if ( function_exists( 'bump_stats_extras' ) ) {
+
+ bump_stats_extras( 'portfolios', 'option-on' ); // @phan-suppress-current-line PhanUndeclaredFunction -- only calling if it exists.
+ }
}
if ( ! empty( $old ) && empty( $new ) ) {
- bump_stats_extras( 'portfolios', 'option-off' );
+ if ( function_exists( 'bump_stats_extras' ) ) {
+
+ bump_stats_extras( 'portfolios', 'option-off' ); // @phan-suppress-current-line PhanUndeclaredFunction -- only calling if it exists.
+ }
}
}
@@ -231,7 +241,10 @@ public function update_option_stat_bump( $old, $new ) {
* Bump Portfolio > Published Projects stat when projects are published.
*/
public function new_project_stat_bump() {
- bump_stats_extras( 'portfolios', 'published-projects' );
+ if ( function_exists( 'bump_stats_extras' ) ) {
+
+ bump_stats_extras( 'portfolios', 'published-projects' ); // @phan-suppress-current-line PhanUndeclaredFunction -- only calling if it exists.
+ }
}
/**
@@ -1025,7 +1038,7 @@ private static function get_project_type( $post_id ) {
// If no types, return empty string.
if ( empty( $project_types ) || is_wp_error( $project_types ) ) {
- return;
+ return '';
}
$html = '' . __( 'Types:', 'jetpack-classic-theme-helper' ) . '';
@@ -1058,7 +1071,7 @@ private static function get_project_tags( $post_id ) {
// If no tags, return empty string.
if ( empty( $project_tags ) || is_wp_error( $project_tags ) ) {
- return false;
+ return '';
}
$html = '
';
diff --git a/projects/plugins/jetpack/.phan/baseline.php b/projects/plugins/jetpack/.phan/baseline.php
index 63c5c04ab2a06..30a47dd3b9b97 100644
--- a/projects/plugins/jetpack/.phan/baseline.php
+++ b/projects/plugins/jetpack/.phan/baseline.php
@@ -20,32 +20,32 @@
// PhanRedundantCondition : 70+ occurrences
// PhanPossiblyUndeclaredVariable : 60+ occurrences
// PhanTypeArraySuspiciousNullable : 60+ occurrences
- // PhanRedefineFunction : 50+ occurrences
+ // PhanRedefineFunction : 55+ occurrences
// PhanTypeMismatchArgumentNullable : 50+ occurrences
- // PhanTypeExpectedObjectPropAccess : 45+ occurrences
// PhanParamTooMany : 40+ occurrences
// PhanPluginDuplicateAdjacentStatement : 40+ occurrences
+ // PhanTypeExpectedObjectPropAccess : 40+ occurrences
// PhanTypeMismatchArgumentInternal : 40+ occurrences
// PhanUndeclaredProperty : 35+ occurrences
// PhanParamSignatureMismatch : 25+ occurrences
- // PhanPluginSimplifyExpressionBool : 25+ occurrences
// PhanTypeMismatchDefault : 25+ occurrences
// PhanTypeMismatchPropertyProbablyReal : 25+ occurrences
// PhanTypeMissingReturn : 25+ occurrences
// PhanTypeSuspiciousNonTraversableForeach : 25+ occurrences
// PhanDeprecatedProperty : 20+ occurrences
+ // PhanPluginSimplifyExpressionBool : 20+ occurrences
// PhanTypeArraySuspicious : 20+ occurrences
// PhanTypeMismatchDimFetch : 20+ occurrences
// PhanPluginMixedKeyNoKey : 15+ occurrences
// PhanSuspiciousMagicConstant : 15+ occurrences
// PhanTypeExpectedObjectPropAccessButGotNull : 15+ occurrences
- // PhanTypeMismatchArgumentNullableInternal : 15+ occurrences
// PhanTypeMismatchPropertyDefault : 15+ occurrences
// PhanUndeclaredMethod : 15+ occurrences
// PhanPluginDuplicateExpressionAssignmentOperation : 10+ occurrences
// PhanRedefineClass : 10+ occurrences
// PhanRedundantConditionInLoop : 10+ occurrences
// PhanTypeInvalidDimOffset : 10+ occurrences
+ // PhanTypeMismatchArgumentNullableInternal : 10+ occurrences
// PhanTypeMismatchProperty : 10+ occurrences
// PhanTypeMismatchReturnNullable : 10+ occurrences
// PhanUndeclaredFunction : 10+ occurrences
@@ -56,12 +56,12 @@
// PhanTypeMismatchArgumentInternalReal : 7 occurrences
// PhanCommentAbstractOnInheritedMethod : 6 occurrences
// PhanDeprecatedClass : 5 occurrences
- // PhanImpossibleCondition : 5 occurrences
// PhanNonClassMethodCall : 5 occurrences
// PhanTypeArraySuspiciousNull : 5 occurrences
// PhanTypeMismatchDimAssignment : 5 occurrences
// PhanTypeSuspiciousStringExpression : 5 occurrences
// PhanAccessMethodInternal : 4 occurrences
+ // PhanImpossibleCondition : 4 occurrences
// PhanTypeInvalidLeftOperandOfAdd : 4 occurrences
// PhanTypeInvalidLeftOperandOfBitwiseOp : 4 occurrences
// PhanTypeInvalidRightOperandOfBitwiseOp : 4 occurrences
@@ -71,15 +71,12 @@
// PhanImpossibleTypeComparison : 3 occurrences
// PhanPluginUnreachableCode : 3 occurrences
// PhanStaticPropIsStaticType : 3 occurrences
- // PhanTypeConversionFromArray : 3 occurrences
// PhanTypeMismatchArgumentReal : 3 occurrences
// PhanTypeObjectUnsetDeclaredProperty : 3 occurrences
// PhanUndeclaredMethodInCallable : 3 occurrences
- // PhanCompatibleNegativeStringOffset : 2 occurrences
// PhanImpossibleConditionInLoop : 2 occurrences
// PhanParamTooManyCallable : 2 occurrences
// PhanPluginDuplicateSwitchCaseLooseEquality : 2 occurrences
- // PhanRedefineFunctionInternal : 2 occurrences
// PhanStaticCallToNonStatic : 2 occurrences
// PhanTypeMismatchArgumentInternalProbablyReal : 2 occurrences
// PhanUndeclaredClassInCallable : 2 occurrences
@@ -87,13 +84,10 @@
// PhanDeprecatedPartiallySupportedCallable : 1 occurrence
// PhanEmptyFQSENInCallable : 1 occurrence
// PhanEmptyForeach : 1 occurrence
- // PhanInfiniteRecursion : 1 occurrence
// PhanPluginDuplicateSwitchCase : 1 occurrence
// PhanPluginInvalidPregRegex : 1 occurrence
- // PhanPluginRedundantAssignmentInLoop : 1 occurrence
// PhanPluginUseReturnValueInternalKnown : 1 occurrence
- // PhanTypeComparisonFromArray : 1 occurrence
- // PhanTypeInvalidRightOperandOfNumericOp : 1 occurrence
+ // PhanTypeConversionFromArray : 1 occurrence
// PhanTypeVoidArgument : 1 occurrence
// PhanUndeclaredConstant : 1 occurrence
// PhanUndeclaredExtendedClass : 1 occurrence
@@ -329,6 +323,7 @@
'modules/comments/comments.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanUndeclaredFunction'],
'modules/comments/subscription-modal-on-comment/class-jetpack-subscription-modal-on-comment.php' => ['PhanTypeMismatchReturnNullable'],
'modules/copy-post.php' => ['PhanNoopNew'],
+ 'modules/custom-content-types.php' => ['PhanRedefineFunction'],
'modules/custom-post-types/nova.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeSuspiciousNonTraversableForeach'],
'modules/custom-post-types/portfolios.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal', 'PhanTypeSuspiciousNonTraversableForeach'],
'modules/custom-post-types/testimonial.php' => ['PhanTypeMismatchArgumentProbablyReal'],