Creating an interface to check for emptiness of an object
Basically, MobileFrontEnd PHP codebase has a use case where it would be more efficient to check for emptiness of a collection rather than counting its elements and comparing it to 0. bug: T151797 Change-Id: I309a549c82c0bdd80640f509557f2a48278e13ce
This commit is contained in:
parent
750b64b0a5
commit
351a003e4f
1 changed files with 15 additions and 0 deletions
15
includes/Emptiable.php
Normal file
15
includes/Emptiable.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
namespace MediaWiki;
|
||||
|
||||
/**
|
||||
* An interface to check for emptiness of an object
|
||||
*/
|
||||
interface Emptiable {
|
||||
|
||||
/**
|
||||
* Check if object is empty
|
||||
* @return bool Is it empty
|
||||
*/
|
||||
public function isEmpty();
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue