summaryrefslogtreecommitdiffstats
path: root/lib/private/CapabilitiesManager.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-01-13 19:53:31 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-01-13 19:53:31 +0100
commit758cb4d0085cc2db2ac86dc65bd7d54c71b62fad (patch)
treeecc64f9bacc575406e3a97f421fd6bed312c2010 /lib/private/CapabilitiesManager.php
parent60f38d37fe5ca505258510adc1e106da54426510 (diff)
downloadnextcloud-server-758cb4d0085cc2db2ac86dc65bd7d54c71b62fad.tar.gz
nextcloud-server-758cb4d0085cc2db2ac86dc65bd7d54c71b62fad.zip
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>
Diffstat (limited to 'lib/private/CapabilitiesManager.php')
-rw-r--r--lib/private/CapabilitiesManager.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/private/CapabilitiesManager.php b/lib/private/CapabilitiesManager.php
index b3db9231972..5b114bffac2 100644
--- a/lib/private/CapabilitiesManager.php
+++ b/lib/private/CapabilitiesManager.php
@@ -20,8 +20,10 @@
* 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\Capabilities\ICapability;
@@ -47,7 +49,7 @@ class CapabilitiesManager {
* @throws \InvalidArgumentException
* @return array
*/
- public function getCapabilities($public = false) {
+ public function getCapabilities(bool $public = false) : array {
$capabilities = [];
foreach($this->capabilities as $capability) {
try {
@@ -78,6 +80,6 @@ class CapabilitiesManager {
* @param \Closure $callable
*/
public function registerCapability(\Closure $callable) {
- array_push($this->capabilities, $callable);
+ $this->capabilities[] = $callable;
}
}