Make the capabilities manager strict
* Add return types * Add scalar type hints * Use [] instead of array_push (PHPStromg inspection recommendation) Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
60f38d37fe
commit
758cb4d008
|
@ -20,8 +20,10 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
namespace OC;
|
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace OC;
|
||||||
|
|
||||||
use OCP\AppFramework\QueryException;
|
use OCP\AppFramework\QueryException;
|
||||||
use OCP\Capabilities\ICapability;
|
use OCP\Capabilities\ICapability;
|
||||||
|
@ -47,7 +49,7 @@ class CapabilitiesManager {
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getCapabilities($public = false) {
|
public function getCapabilities(bool $public = false) : array {
|
||||||
$capabilities = [];
|
$capabilities = [];
|
||||||
foreach($this->capabilities as $capability) {
|
foreach($this->capabilities as $capability) {
|
||||||
try {
|
try {
|
||||||
|
@ -78,6 +80,6 @@ class CapabilitiesManager {
|
||||||
* @param \Closure $callable
|
* @param \Closure $callable
|
||||||
*/
|
*/
|
||||||
public function registerCapability(\Closure $callable) {
|
public function registerCapability(\Closure $callable) {
|
||||||
array_push($this->capabilities, $callable);
|
$this->capabilities[] = $callable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue