More PHP 7.1 nullables

This commit is contained in:
Dylan K. Taylor
2019-02-22 12:55:34 +00:00
parent 73a565355b
commit c26544475e
28 changed files with 50 additions and 50 deletions

View File

@ -118,7 +118,7 @@ class BanList{
*
* @return BanEntry
*/
public function addBan(string $target, string $reason = null, \DateTime $expires = null, string $source = null) : BanEntry{
public function addBan(string $target, ?string $reason = null, ?\DateTime $expires = null, ?string $source = null) : BanEntry{
$entry = new BanEntry($target);
$entry->setSource($source ?? $entry->getSource());
$entry->setExpires($expires);

View File

@ -35,7 +35,7 @@ abstract class DefaultPermissions{
*
* @return Permission
*/
public static function registerPermission(Permission $perm, Permission $parent = null) : Permission{
public static function registerPermission(Permission $perm, ?Permission $parent = null) : Permission{
if($parent instanceof Permission){
$parent->getChildren()[$perm->getName()] = true;

View File

@ -52,7 +52,7 @@ interface Permissible extends ServerOperator{
*
* @return PermissionAttachment
*/
public function addAttachment(Plugin $plugin, string $name = null, bool $value = null) : PermissionAttachment;
public function addAttachment(Plugin $plugin, ?string $name = null, ?bool $value = null) : PermissionAttachment;
/**
* @param PermissionAttachment $attachment

View File

@ -111,7 +111,7 @@ class PermissibleBase implements Permissible{
*
* @return PermissionAttachment
*/
public function addAttachment(Plugin $plugin, string $name = null, bool $value = null) : PermissionAttachment{
public function addAttachment(Plugin $plugin, ?string $name = null, ?bool $value = null) : PermissionAttachment{
if(!$plugin->isEnabled()){
throw new PluginException("Plugin " . $plugin->getDescription()->getName() . " is disabled");
}

View File

@ -60,7 +60,7 @@ class Permission{
* @param string $defaultValue
* @param bool[] $children
*/
public function __construct(string $name, string $description = null, string $defaultValue = null, array $children = []){
public function __construct(string $name, ?string $description = null, ?string $defaultValue = null, array $children = []){
$this->name = $name;
$this->description = $description ?? "";
$this->defaultValue = $defaultValue ?? self::$DEFAULT_PERMISSION;