-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
phan: Add stubs for the WordPress.com Editing Toolkit plugin (#36957)
A few functions from this plugin are called from Jetpack and the jetpack-mu-wpcom package.
- Loading branch information
Showing
10 changed files
with
121 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Stubs automatically generated from WordPress.com Editing Toolkit 4.19624 | ||
* using the definition file `tools/stubs/full-site-editing-stub-defs.php` in the Jetpack monorepo. | ||
* | ||
* Do not edit this directly! Run tools/stubs/update-stubs.sh to regenerate it. | ||
*/ | ||
|
||
namespace { | ||
/** | ||
* Limit Global Styles on WP.com to paid plans. | ||
* | ||
* @package full-site-editing-plugin | ||
*/ | ||
/** | ||
* Checks if Global Styles should be limited on the given site. | ||
* | ||
* @param int $blog_id Blog ID. | ||
* @return bool Whether Global Styles are limited. | ||
*/ | ||
function wpcom_should_limit_global_styles($blog_id = 0) | ||
{ | ||
} | ||
/** | ||
* Checks if the current blog has custom styles in use. | ||
* | ||
* @return bool Returns true if custom styles are in use. | ||
*/ | ||
function wpcom_global_styles_in_use() | ||
{ | ||
} | ||
} | ||
namespace A8C\FSE { | ||
/** | ||
* Whether or not FSE is active. | ||
* If false, FSE functionality should be disabled. | ||
* | ||
* @returns bool True if FSE is active, false otherwise. | ||
* @phan-return mixed Dummy doc for stub. | ||
*/ | ||
function is_full_site_editing_active() | ||
{ | ||
} | ||
/** | ||
* Whether or not the site is eligible for FSE. This is essentially a feature | ||
* gate to disable FSE on some sites which could theoretically otherwise use it. | ||
* | ||
* By default, sites should not be eligible. | ||
* | ||
* @return bool True if current site is eligible for FSE, false otherwise. | ||
*/ | ||
function is_site_eligible_for_full_site_editing() | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
projects/packages/jetpack-mu-wpcom/changelog/add-phan-full-site-editing-stubs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Significance: patch | ||
Type: added | ||
Comment: Update Phan config to use new WordPress.com Editing Toolkit stubs. No change to functionality. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
projects/plugins/jetpack/changelog/add-phan-full-site-editing-stubs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Significance: patch | ||
Type: other | ||
Comment: Update Phan config to use new WordPress.com Editing Toolkit stubs. No change to functionality. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* Stub config for WordPress.com Editing Toolkit classes and such needed in the Jetpack monorepo. | ||
* | ||
* @package automattic/jetpack-monorepo | ||
*/ | ||
|
||
// phpcs:disable PHPCompatibility.Syntax.NewFlexibleHeredocNowdoc.ClosingMarkerNoNewLine -- https://github.com/PHPCompatibility/PHPCompatibility/issues/1696 | ||
|
||
$work_dir = getenv( 'WORK_DIR' ); | ||
if ( ! is_dir( $work_dir ) ) { | ||
throw new RuntimeException( 'WORK_DIR is not set or does not refer to a directory' ); | ||
} | ||
|
||
$data = file_get_contents( "$work_dir/full-site-editing/full-site-editing-plugin.php" ); | ||
if ( ! preg_match( '/^ \* Version: (\d+\.\d+.*)/m', (string) $data, $m ) ) { | ||
throw new RuntimeException( "Failed to extract version from $work_dir/full-site-editing/full-site-editing-plugin.php" ); | ||
} | ||
$version = $m[1]; | ||
|
||
return array( | ||
'header' => <<<HEAD | ||
/** | ||
* Stubs automatically generated from WordPress.com Editing Toolkit $version | ||
* using the definition file `tools/stubs/full-site-editing-stub-defs.php` in the Jetpack monorepo. | ||
* | ||
* Do not edit this directly! Run tools/stubs/update-stubs.sh to regenerate it. | ||
*/ | ||
HEAD, | ||
'basedir' => "$work_dir/full-site-editing/", | ||
'files' => array( | ||
'wpcom-global-styles/index.php' => array( | ||
'function' => array( 'wpcom_global_styles_in_use', 'wpcom_should_limit_global_styles' ), | ||
), | ||
'dotcom-fse/helpers.php' => array( | ||
'function' => array( 'A8C\FSE\is_full_site_editing_active', 'A8C\FSE\is_site_eligible_for_full_site_editing' ), | ||
), | ||
), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters