Skip to content

Commit

Permalink
Merge pull request #2 from Automattic/trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
OKEAMAH authored Apr 22, 2024
2 parents 86cb14a + 73b9847 commit a4eb1e3
Show file tree
Hide file tree
Showing 62 changed files with 584 additions and 224 deletions.
4 changes: 4 additions & 0 deletions .phan/config.base.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* - parse_file_list: (array) Files to parse but not analyze. Equivalent to listing in both 'file_list' and 'exclude_analysis_directory_list'.
* - stubs: (array) Predefined stubs to load. Default is `array( 'wordpress', 'wp-cli' )`.
* - akismet: Stubs from .phan/stubs/akismet-stubs.php.
* - amp: Stubs from .phan/stubs/amp-stubs.php.
* - full-site-editing: Stubs from .phan/stubs/full-site-editing-stubs.php.
* - photon-opencv: Stubs from .phan/stubs/photon-opencv-stubs.php.
* - woocommerce: Stubs from php-stubs/woocommerce.
Expand Down Expand Up @@ -59,6 +60,9 @@ function make_phan_config( $dir, $options = array() ) {
case 'akismet':
$stubs[] = "$root/.phan/stubs/akismet-stubs.php";
break;
case 'amp':
$stubs[] = "$root/.phan/stubs/amp-stubs.php";
break;
case 'full-site-editing':
$stubs[] = "$root/.phan/stubs/full-site-editing-stubs.php";
break;
Expand Down
152 changes: 152 additions & 0 deletions .phan/stubs/amp-stubs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<?php
/**
* Stubs automatically generated from AMP 2.5.3 and AMP for WP 1.0.94
* using the definition file `tools/stubs/amp-stub-defs.php` in the Jetpack monorepo.
*
* Do not edit this directly! Run tools/stubs/update-stubs.sh to regenerate it.
*/

/**
* Whether this is in 'canonical mode'.
*
* Themes can register support for this with `add_theme_support( AMP_Theme_Support::SLUG )`:
*
* ```php
* add_theme_support( AMP_Theme_Support::SLUG );
* ```
*
* This will serve templates in AMP-first, allowing you to use AMP components in your theme templates.
* If you want to make available in transitional mode, where templates are served in AMP or non-AMP documents, do:
*
* ```php
* add_theme_support( AMP_Theme_Support::SLUG, array(
* 'paired' => true,
* ) );
* ```
*
* Transitional mode is also implied if you define a `template_dir`:
*
* ```php
* add_theme_support( AMP_Theme_Support::SLUG, array(
* 'template_dir' => 'amp',
* ) );
* ```
*
* If you want to have AMP-specific templates in addition to serving AMP-first, do:
*
* ```php
* add_theme_support( AMP_Theme_Support::SLUG, array(
* 'paired' => false,
* 'template_dir' => 'amp',
* ) );
* ```
*
* @see AMP_Theme_Support::read_theme_support()
* @return boolean Whether this is in AMP 'canonical' mode, that is whether it is AMP-first and there is not a separate (paired) AMP URL.
*/
function amp_is_canonical()
{
}
/**
* Determines whether the legacy AMP post templates are being used.
*
* @since 2.0
* @return bool
*/
function amp_is_legacy()
{
}
/**
* Determine whether AMP is available for the current URL.
*
* @since 2.0
*
* @return bool Whether there is an AMP version for the provided URL.
* @global string $pagenow
* @global WP_Query $wp_query
*/
function amp_is_available()
{
}
/**
* Retrieves the full AMP-specific permalink for the given post ID.
*
* On a site in Standard mode, this is the same as `get_permalink()`.
*
* @since 0.1
*
* @param int $post_id Post ID.
* @return string AMP permalink.
*/
function amp_get_permalink($post_id)
{
}
/**
* Determine whether the current request is for an AMP page.
*
* This function cannot be called before the parse_query action because it needs to be able
* to determine the queried object is able to be served as AMP. If 'amp' theme support is not
* present, this function returns true just if the query var is present. If theme support is
* present, then it returns true in transitional mode if an AMP template is available and the query
* var is present, or else in standard mode if just the template is available.
*
* @since 2.0 Formerly known as is_amp_endpoint().
*
* @return bool Whether it is the AMP endpoint.
* @global WP_Query $wp_query
*/
function amp_is_request()
{
}
/**
* Determine whether the current response being served as AMP.
*
* This function cannot be called before the parse_query action because it needs to be able
* to determine the queried object is able to be served as AMP. If 'amp' theme support is not
* present, this function returns true just if the query var is present. If theme support is
* present, then it returns true in transitional mode if an AMP template is available and the query
* var is present, or else in standard mode if just the template is available.
*
* @since 0.1
* @since 2.0 Renamed to AMP-prefixed version, amp_is_request().
* @deprecated Use amp_is_request() instead.
*
* @return bool Whether it is the AMP endpoint.
*/
function is_amp_endpoint()
{
}
/**
* Class AMP_Options_Manager
*
* @internal
*/
class AMP_Options_Manager
{
/**
* Get plugin option.
*
* @param string $option Plugin option name.
* @param bool $default Default value.
*
* @return mixed Option value.
*/
public static function get_option($option, $default = \false)
{
}
}
/**
* Registers a submenu page to access the AMP template editor panel in the Customizer.
*
* @internal
*/
function amp_add_customizer_link()
{
}
// AMP endpoint Verifier
/**
* @phan-return mixed Dummy doc for stub.
*/
function ampforwp_is_amp_endpoint()
{
}
4 changes: 2 additions & 2 deletions projects/packages/blocks/.phan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
// # Issue statistics:
// PhanTypeMismatchArgument : 2 occurrences
// PhanUndeclaredClassMethod : 2 occurrences
// PhanDeprecatedFunction : 1 occurrence
// PhanPluginDuplicateConditionalNullCoalescing : 1 occurrence
// PhanTypeMismatchArgumentNullableInternal : 1 occurrence
// PhanUndeclaredClassInCallable : 1 occurrence
// PhanUndeclaredClassReference : 1 occurrence
// PhanUndeclaredFunction : 1 occurrence

// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
'src/class-blocks.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredClassInCallable', 'PhanUndeclaredClassMethod', 'PhanUndeclaredClassReference', 'PhanUndeclaredFunction'],
'src/class-blocks.php' => ['PhanDeprecatedFunction', 'PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredClassInCallable', 'PhanUndeclaredClassMethod', 'PhanUndeclaredClassReference'],
'tests/php/test-blocks.php' => ['PhanTypeMismatchArgument'],
],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/blocks/.phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
// Require base config.
require __DIR__ . '/../../../../.phan/config.base.php';

return make_phan_config( dirname( __DIR__ ) );
return make_phan_config( dirname( __DIR__ ), array( '+stubs' => array( 'amp' ) ) );
5 changes: 5 additions & 0 deletions projects/packages/blocks/changelog/add-phan-amp-stubs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Update Phan config to use AMP stubs. No change to functionality.


Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Monetize: Move menu item under Jetpack menu for all Classic interface users
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Automattic\Jetpack\Jetpack_Mu_Wpcom;
use Automattic\Jetpack\Redirect;
use Automattic\Jetpack\Status;
use Automattic\Jetpack\Status\Host;

/**
* Check if the current user has a WordPress.com account connected.
Expand Down Expand Up @@ -217,7 +218,11 @@ function add_all_sites_menu_to_masterbar( $wp_admin_bar ) {
* Add the WordPress.com submenu items related to Jetpack under the Jetpack menu on the wp-admin sidebar.
*/
function wpcom_add_jetpack_menu_item() {
if ( ! function_exists( 'wpcom_is_nav_redesign_enabled' ) || ! wpcom_is_nav_redesign_enabled() ) {
/*
* Do not display any menu on WoA and WordPress.com Simple sites (unless Classic wp-admin is enabled).
* They already get a menu item under Users via nav-unification.
*/
if ( ( new Host() )->is_wpcom_platform() && get_option( 'wpcom_admin_interface' ) !== 'wp-admin' ) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions projects/packages/lazy-images/.phan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
return [
// # Issue statistics:
// PhanTypeMismatchArgument : 2 occurrences
// PhanDeprecatedFunction : 1 occurrence
// PhanParamTooMany : 1 occurrence
// PhanTypeMismatchPropertyProbablyReal : 1 occurrence
// PhanUndeclaredFunction : 1 occurrence

// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
'src/lazy-images.php' => ['PhanTypeMismatchPropertyProbablyReal', 'PhanUndeclaredFunction'],
'src/lazy-images.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchPropertyProbablyReal'],
'tests/php/test_class.lazy-images.php' => ['PhanParamTooMany', 'PhanTypeMismatchArgument'],
],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/lazy-images/.phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
// Require base config.
require __DIR__ . '/../../../../.phan/config.base.php';

return make_phan_config( dirname( __DIR__ ) );
return make_phan_config( dirname( __DIR__ ), array( '+stubs' => array( 'amp' ) ) );
5 changes: 5 additions & 0 deletions projects/packages/lazy-images/changelog/add-phan-amp-stubs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Update Phan config to use AMP stubs. No change to functionality.


3 changes: 1 addition & 2 deletions projects/packages/scheduled-updates/.phan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
return [
// # Issue statistics:
// PhanUndeclaredProperty : 40+ occurrences
// PhanCompatibleAccessMethodOnTraitDefinition : 2 occurrences
// PhanPluginMixedKeyNoKey : 2 occurrences
// PhanRedundantCondition : 2 occurrences
// PhanTypeArraySuspiciousNullable : 2 occurrences
// PhanUndeclaredClassMethod : 2 occurrences
// PhanCompatibleAccessMethodOnTraitDefinition : 1 occurrence
// PhanNoopNew : 1 occurrence
// PhanTypeMismatchArgumentProbablyReal : 1 occurrence
// PhanUndeclaredFunction : 1 occurrence
Expand All @@ -24,7 +24,6 @@
'src/class-scheduled-updates.php' => ['PhanRedundantCondition', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredClassMethod'],
'src/pluggable.php' => ['PhanTypeArraySuspiciousNullable'],
'src/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-update-schedules.php' => ['PhanPluginMixedKeyNoKey', 'PhanUndeclaredFunction'],
'tests/php/class-scheduled-updates-logs-test.php' => ['PhanCompatibleAccessMethodOnTraitDefinition', 'PhanUndeclaredProperty'],
'tests/php/class-scheduled-updates-test.php' => ['PhanCompatibleAccessMethodOnTraitDefinition', 'PhanUndeclaredProperty'],
'tests/php/class-wpcom-rest-api-v2-endpoint-update-schedules-test.php' => ['PhanNoopNew'],
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: major
Type: removed

Scheduled Updates: Removed checks for valid schedules when retreiving and clearing logs
Loading

0 comments on commit a4eb1e3

Please sign in to comment.