Skip to content

block_core_breadcrumbs_create_item: add cond. return type - #483

Merged
szepeviktor merged 1 commit into
php-stubs:masterfrom
IanDelMar:block_core_breadcrumbs_create_item
Aug 24, 2026
Merged

block_core_breadcrumbs_create_item: add cond. return type#483
szepeviktor merged 1 commit into
php-stubs:masterfrom
IanDelMar:block_core_breadcrumbs_create_item

Conversation

@IanDelMar

@IanDelMar IanDelMar commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

block_core_breadcrumbs_create_item():

 * @param string $text       The text content.
 * @param bool   $is_paged   Whether we're on a paginated view.
 *
 * @return array The breadcrumb item data.
 */
function block_core_breadcrumbs_create_item( $text, $is_paged = false ) {
	$item = array( 'label' => $text );
	if ( $is_paged ) {
		$item['url'] = get_pagenum_link( 1 );
	}
	return $item;
}

block_core_breadcrumbs_create_item() returns an array with $text as is keyed by 'label' (template T). If $is_paged is truthy a key 'url' with string value is added (conditional return type).

oracle-inspired

@szepeviktor
szepeviktor merged commit 6aff6fe into php-stubs:master Aug 24, 2026
8 checks passed
@IanDelMar
IanDelMar deleted the block_core_breadcrumbs_create_item branch August 25, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants