Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update @since @todo comments and @todo placeholders in _deprecated_function calls #289

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tame-spoons-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wpengine/wp-graphql-content-blocks": patch
---

Update @since @todo tags and @todo placeholders in \_deprecated_function calls
2 changes: 1 addition & 1 deletion includes/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Includes the Composer Autoloader used for packages and classes in the includes/ directory.
*
* @package WPGraphQL\ContentBlocks
* @since @todo
* @since 4.2.0
*/

declare( strict_types = 1 );
Expand Down
24 changes: 12 additions & 12 deletions includes/Utilities/DOMHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ public static function find_nodes( string $html, ?string $selector = null ) {
* @param string $attribute The attribute to extract.
* @param mixed $default_value The default value to return if the selector is not found.
*
* @deprecated @todo Use parse_attribute instead.
* @deprecated 4.2.0 Use parse_attribute instead.
*/
public static function parseAttribute( $html, $selector, $attribute, $default_value = null ): ?string {
_deprecated_function( __METHOD__, '@todo', self::class . '::parse_attribute' );
_deprecated_function( __METHOD__, '4.2.0', self::class . '::parse_attribute' );

return self::parse_attribute( $html, $selector, $attribute, $default_value );
}
Expand All @@ -226,10 +226,10 @@ public static function parseAttribute( $html, $selector, $attribute, $default_va
*
* @return string|null extracted attribute
*
* @deprecated @todo Use parse_first_node_attribute instead.
* @deprecated 4.2.0 Use parse_first_node_attribute instead.
*/
public static function parseFirstNodeAttribute( $html, $attribute ) {
_deprecated_function( __METHOD__, '@todo', self::class . '::parse_first_node_attribute' );
_deprecated_function( __METHOD__, '4.2.0', self::class . '::parse_first_node_attribute' );

return self::parse_first_node_attribute( $html, $attribute );
}
Expand All @@ -245,10 +245,10 @@ public static function parseFirstNodeAttribute( $html, $attribute ) {
*
* @return string extracted innerHTML of selector
*
* @deprecated @todo Use parse_html instead.
* @deprecated 4.2.0 Use parse_html instead.
*/
public static function parseHTML( $html, $selector, $default_value = null ) {
_deprecated_function( __METHOD__, '@todo', self::class . '::parse_html' );
_deprecated_function( __METHOD__, '4.2.0', self::class . '::parse_html' );

return (string) self::parse_html( $html, $selector, $default_value );
}
Expand All @@ -263,10 +263,10 @@ public static function parseHTML( $html, $selector, $default_value = null ) {
*
* @return string the HTML string of the extracted elements
*
* @deprecated @todo Use get_elements_from_html instead.
* @deprecated 4.2.0 Use get_elements_from_html instead.
*/
public static function getElementsFromHTML( $html, $selector ) {
_deprecated_function( __METHOD__, '@todo', self::class . '::get_elements_from_html' );
_deprecated_function( __METHOD__, '4.2.0', self::class . '::get_elements_from_html' );

return (string) self::get_elements_from_html( $html, $selector );
}
Expand All @@ -282,10 +282,10 @@ public static function getElementsFromHTML( $html, $selector ) {
*
* @return ?string The text content of the selector if found.
*
* @deprecated @todo Use parse_text instead.
* @deprecated 4.2.0 Use parse_text instead.
*/
public static function parseText( $html, $selector ) {
_deprecated_function( __METHOD__, '@todo', self::class . '::parse_text' );
_deprecated_function( __METHOD__, '4.2.0', self::class . '::parse_text' );

return self::parse_text( $html, $selector );
}
Expand All @@ -300,10 +300,10 @@ public static function parseText( $html, $selector ) {
*
* @return \DiDom\Element[]|\DiDom\Element
*
* @deprecated @todo Use find_nodes instead.
* @deprecated 4.2.0 Use find_nodes instead.
*/
public static function findNodes( $html, $selector = null ) {
_deprecated_function( __METHOD__, '@todo', self::class . '::find_nodes' );
_deprecated_function( __METHOD__, '4.2.0', self::class . '::find_nodes' );

return self::find_nodes( $html, $selector );
}
Expand Down
10 changes: 5 additions & 5 deletions includes/Utilities/TraverseHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
*
* Provides utility functions to traverse and manipulate blocks.
*
* @deprecated @todo Blocks should be manipulated directly inside ContentBlocksResolver::handle_do_block()
* @deprecated 4.2.0 Blocks should be manipulated directly inside ContentBlocksResolver::handle_do_block()
*/
final class TraverseHelpers {
/**
* Traverse blocks and apply a callback with optional depth limit.
*
* @deprecated @todo Blocks should be manipulated directly inside ContentBlocksResolver::handle_do_block()
* @deprecated 4.2.0 Blocks should be manipulated directly inside ContentBlocksResolver::handle_do_block()
*
* @param array &$blocks The blocks to traverse.
* @param callable $callback The callback function to apply to each block.
Expand All @@ -30,7 +30,7 @@ final class TraverseHelpers {
public static function traverse_blocks( &$blocks, $callback, $depth = 0, $max_depth = PHP_INT_MAX ): void {
_deprecated_function(
__METHOD__,
'@todo',
'4.2.0',
sprintf(
// translators: %s: class name
esc_html__( 'Manipulate blocks directly inside %s::handle_do_block', 'wp-graphql-content-blocks' ),
Expand All @@ -49,12 +49,12 @@ public static function traverse_blocks( &$blocks, $callback, $depth = 0, $max_de
/**
* Example callback function to replace reusable blocks.
*
* @deprecated @todo Blocks should be manipulated directly inside ContentBlocksResolver::handle_do_block()
* @deprecated 4.2.0 Blocks should be manipulated directly inside ContentBlocksResolver::handle_do_block()
*
* @param array $block The block to potentially replace.
*/
public static function replace_reusable_blocks( &$block ): void {
_deprecated_function( __METHOD__, '@todo', ContentBlocksResolver::class . '::populate_reusable_blocks' );
_deprecated_function( __METHOD__, '4.2.0', ContentBlocksResolver::class . '::populate_reusable_blocks' );

if ( 'core/block' === $block['blockName'] && isset( $block['attrs']['ref'] ) ) {
$post = get_post( $block['attrs']['ref'] );
Expand Down
8 changes: 4 additions & 4 deletions includes/WPGraphQLContentBlocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,23 +133,23 @@ public function init_block_editor_registry( \WPGraphQL\Registry\TypeRegistry $ty
/**
* Sets up deprecated constants.
*
* @deprecated @todo This can be removed in a major version bump.
* @deprecated 4.2.0 This can be removed in a major version bump.
*/
private function deprecated_constants(): void {
if ( defined( 'WPGRAPHQL_CONTENT_BLOCKS_FILE' ) ) {
_doing_it_wrong( 'WPGRAPHQL_CONTENT_BLOCKS_FILE', 'The WPGRAPHQL_CONTENT_BLOCKS_VERSION constant has been deprecated. Use the WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_FILE constant instead.', '@todo' );
_doing_it_wrong( 'WPGRAPHQL_CONTENT_BLOCKS_FILE', 'The WPGRAPHQL_CONTENT_BLOCKS_VERSION constant has been deprecated. Use the WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_FILE constant instead.', '4.2.0' );
} else {
define( 'WPGRAPHQL_CONTENT_BLOCKS_FILE', WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_FILE );
}

if ( defined( 'WPGRAPHQL_CONTENT_BLOCKS_PATH' ) ) {
_doing_it_wrong( 'WPGRAPHQL_CONTENT_BLOCKS_PATH', 'The WPGRAPHQL_CONTENT_BLOCKS_PATH constant has been deprecated. Use the WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_PATH constant instead.', '@todo' );
_doing_it_wrong( 'WPGRAPHQL_CONTENT_BLOCKS_PATH', 'The WPGRAPHQL_CONTENT_BLOCKS_PATH constant has been deprecated. Use the WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_PATH constant instead.', '4.2.0' );
} else {
define( 'WPGRAPHQL_CONTENT_BLOCKS_PATH', WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_PATH );
}

if ( defined( 'WPGRAPHQL_CONTENT_BLOCKS_MIN_PHP_VERSION' ) ) {
_doing_it_wrong( 'WPGRAPHQL_CONTENT_BLOCKS_MIN_PHP_VERSION', 'The WPGRAPHQL_CONTENT_BLOCKS_VERSION constant has been deprecated, with no replacement. It will be removed in a future release.', '@todo' );
_doing_it_wrong( 'WPGRAPHQL_CONTENT_BLOCKS_MIN_PHP_VERSION', 'The WPGRAPHQL_CONTENT_BLOCKS_VERSION constant has been deprecated, with no replacement. It will be removed in a future release.', '4.2.0' );
} else {
define( 'WPGRAPHQL_CONTENT_BLOCKS_MIN_PHP_VERSION', WPGRAPHQL_CONTENT_BLOCKS_VERSION );
}
Expand Down
2 changes: 1 addition & 1 deletion wp-graphql-content-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* Defines plugin constants.
*
* @since @todo
* @since 4.2.0
*/
function wpgraphql_content_blocks_constants(): void {
// Whether to autoload the files or not.
Expand Down
Loading