/**
* Expand a string of the form jquery.foo,bar|jquery.ui.baz,quux to
- * an array of module names like array( 'jquery.foo', 'jquery.bar',
- * 'jquery.ui.baz', 'jquery.ui.quux' )
+ * an array of module names like [ 'jquery.foo', 'jquery.bar',
+ * 'jquery.ui.baz', 'jquery.ui.quux' ]
* @param string $modules Packed module name list
* @return array Array of module names
*/
} else {
// We have a prefix and a bunch of suffixes
$prefix = substr( $group, 0, $pos ); // 'foo'
- $suffixes = explode( ',', substr( $group, $pos + 1 ) ); // array( 'bar', 'baz' )
+ $suffixes = explode( ',', substr( $group, $pos + 1 ) ); // [ 'bar', 'baz' ]
foreach ( $suffixes as $suffix ) {
$retval[] = "$prefix.$suffix";
}
* Get the possibly-cached User object for the specified username
*
* @since 1.25
- * @return User|bool false if a valid object cannot be created
+ * @return User
*/
public function getUserObj() {
if ( $this->userObj === null ) {
$username = $this->getUser();
if ( $username ) {
- $this->userObj = User::newFromName( $username );
+ // Use provided username if valid, fallback to anonymous user
+ $this->userObj = User::newFromName( $username ) ?: new User;
} else {
- $this->userObj = new User; // Anonymous user
+ // Anonymous user
+ $this->userObj = new User;
}
}
/**
* @see ResourceLoaderModule::getVersionHash
- * @see OutputPage::makeResourceLoaderLink
+ * @see ResourceLoaderClientHtml::makeLoad
* @return string|null
*/
public function getVersion() {