mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
More PHP 7.1 nullables
This commit is contained in:
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user