Skip to content

path_join: narrow return type - #481

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

path_join: narrow return type#481
szepeviktor merged 1 commit into
php-stubs:masterfrom
IanDelMar:pj

Conversation

@IanDelMar

Copy link
Copy Markdown
Contributor

path_join():

/**
 * @param string $base Base path.
 * @param string $path Path relative to $base.
 * @return string The path with the base or absolute path.
 */
function path_join( $base, $path ) {
	if ( path_is_absolute( $path ) ) {
		return $path;
	}

	return rtrim( $base, '/' ) . '/' . $path;
}

Neither '' nor '0' is an absolute path. Therefore, path_join() returns a non-falsy-string.

@szepeviktor

Copy link
Copy Markdown
Member

You do much better than the oracle.

@szepeviktor
szepeviktor merged commit dc76120 into php-stubs:master Aug 24, 2026
8 checks passed
@IanDelMar
IanDelMar deleted the pj branch August 24, 2026 12:11
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