Skip to content
Snippets Groups Projects
Unverified Commit 3f200702 authored by Morris Jobke's avatar Morris Jobke Committed by GitHub
Browse files

Merge pull request #7845 from nextcloud/capabilties_manager_strict

Make the capabilities manager strict
parents 3ade5ccb 758cb4d0
No related branches found
No related tags found
No related merge requests found
...@@ -20,8 +20,10 @@ ...@@ -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 { ...@@ -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 { ...@@ -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;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment