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:
yash9265 2021-01-23 00:02:40 +05:30 committed by Polishdeveloper
parent 750b64b0a5
commit 351a003e4f

15
includes/Emptiable.php Normal file
View 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();
}