1
0
mirror of https://github.com/flarum/core.git synced 2025-10-15 08:55:53 +02:00

Backend cleanup (#2859)

* Extender docblocks cleanup
* Excplicit type hinting in extenders
* Bring method under constructor
* Mark some classes and methods as internal
* Remove beta references

Co-authored-by: Clark Winkelmann <clark.winkelmann@gmail.com>
This commit is contained in:
Sami Mazouz
2021-05-13 15:26:24 +01:00
committed by GitHub
parent e3f506817b
commit 7bceda976b
59 changed files with 655 additions and 174 deletions

View File

@@ -22,10 +22,11 @@ class User implements ExtenderInterface
/**
* Add a display name driver.
*
* @param string $identifier Identifier for display name driver. E.g. 'username' for UserNameDriver
* @param string $driver ::class attribute of driver class, which must implement Flarum\User\DisplayName\DriverInterface
* @param string $identifier: Identifier for display name driver. E.g. 'username' for UserNameDriver
* @param string $driver: ::class attribute of driver class, which must implement Flarum\User\DisplayName\DriverInterface
* @return self
*/
public function displayNameDriver(string $identifier, $driver)
public function displayNameDriver(string $identifier, string $driver): self
{
$this->displayNameDrivers[$identifier] = $driver;
@@ -45,8 +46,10 @@ class User implements ExtenderInterface
*
* The callable should return:
* - array $groupIds: an array of ids for the groups the user belongs to.
*
* @return self
*/
public function permissionGroups($callback)
public function permissionGroups($callback): self
{
$this->groupProcessors[] = $callback;
@@ -58,9 +61,10 @@ class User implements ExtenderInterface
*
* @param string $key
* @param callable $transformer
* @param $default
* @param mixed|null $default
* @return self
*/
public function registerPreference(string $key, callable $transformer = null, $default = null)
public function registerPreference(string $key, callable $transformer = null, $default = null): self
{
$this->preferences[$key] = compact('transformer', 'default');