- if ( is_array( $name ) ) {
- foreach ( $name as $key => $value ) {
- $this->register( $key, $value );
+ $registrations = is_array( $name ) ? $name : array( $name => $info );
+ foreach ( $registrations as $name => $info ) {
+ // Disallow duplicate registrations
+ if ( isset( $this->moduleInfos[$name] ) ) {
+ // A module has already been registered by this name
+ throw new MWException(
+ 'ResourceLoader duplicate registration error. ' .
+ 'Another module has already been registered as ' . $name
+ );