Skip to content

Commit 9f1c456

Browse files
MatmaRexWMDE bot
authored andcommitted
Replace gettype() with get_debug_type() in exception messages etc.
get_debug_type() does the same thing but better (spelling type names in the same way as in type declarations, and including names of object classes and resource types). It was added in PHP 8, but the symfony/polyfill-php80 package provides it while we still support 7.4. For reference: https://www.php.net/manual/en/function.get-debug-type.php https://www.php.net/manual/en/function.gettype.php Change-Id: I0ad6d2535c0531badf02ee8643bd7294deea0b5f
1 parent b5d881d commit 9f1c456

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/SiteLinkList.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function getBySiteId( $siteId ) {
143143
*/
144144
public function hasLinkWithSiteId( $siteId ) {
145145
if ( !is_string( $siteId ) ) {
146-
throw new InvalidArgumentException( '$siteId must be a string; got ' . gettype( $siteId ) );
146+
throw new InvalidArgumentException( '$siteId must be a string; got ' . get_debug_type( $siteId ) );
147147
}
148148

149149
return array_key_exists( $siteId, $this->siteLinks );
@@ -193,7 +193,7 @@ public function toArray() {
193193
*/
194194
public function removeLinkWithSiteId( $siteId ) {
195195
if ( !is_string( $siteId ) ) {
196-
throw new InvalidArgumentException( '$siteId must be a string; got ' . gettype( $siteId ) );
196+
throw new InvalidArgumentException( '$siteId must be a string; got ' . get_debug_type( $siteId ) );
197197
}
198198

199199
unset( $this->siteLinks[$siteId] );

0 commit comments

Comments
 (0)