More nullable and void typehints

This commit is contained in:
Dylan K. Taylor
2019-03-02 10:29:11 +00:00
parent 1f5c901f29
commit 6c8fa8ae28
108 changed files with 392 additions and 384 deletions

View File

@ -50,11 +50,11 @@ class BlockMetadataStore extends MetadataStore{
return $this->hasMetadataInternal($this->disambiguate($subject, $metadataKey));
}
public function removeMetadata(Block $subject, string $metadataKey, Plugin $owningPlugin){
public function removeMetadata(Block $subject, string $metadataKey, Plugin $owningPlugin) : void{
$this->removeMetadataInternal($this->disambiguate($subject, $metadataKey), $owningPlugin);
}
public function setMetadata(Block $subject, string $metadataKey, MetadataValue $newMetadataValue){
public function setMetadata(Block $subject, string $metadataKey, MetadataValue $newMetadataValue) : void{
$this->setMetadataInternal($this->disambiguate($subject, $metadataKey), $newMetadataValue);
}
}

View File

@ -40,11 +40,11 @@ class EntityMetadataStore extends MetadataStore{
return $this->hasMetadataInternal($this->disambiguate($subject, $metadataKey));
}
public function removeMetadata(Entity $subject, string $metadataKey, Plugin $owningPlugin){
public function removeMetadata(Entity $subject, string $metadataKey, Plugin $owningPlugin) : void{
$this->removeMetadataInternal($this->disambiguate($subject, $metadataKey), $owningPlugin);
}
public function setMetadata(Entity $subject, string $metadataKey, MetadataValue $newMetadataValue){
public function setMetadata(Entity $subject, string $metadataKey, MetadataValue $newMetadataValue) : void{
$this->setMetadataInternal($this->disambiguate($subject, $metadataKey), $newMetadataValue);
}
}

View File

@ -41,11 +41,11 @@ class LevelMetadataStore extends MetadataStore{
return $this->hasMetadataInternal($this->disambiguate($subject, $metadataKey));
}
public function removeMetadata(Level $subject, string $metadataKey, Plugin $owningPlugin){
public function removeMetadata(Level $subject, string $metadataKey, Plugin $owningPlugin) : void{
$this->removeMetadataInternal($this->disambiguate($subject, $metadataKey), $owningPlugin);
}
public function setMetadata(Level $subject, string $metadataKey, MetadataValue $newMetadataValue){
public function setMetadata(Level $subject, string $metadataKey, MetadataValue $newMetadataValue) : void{
$this->setMetadataInternal($this->disambiguate($subject, $metadataKey), $newMetadataValue);
}
}

View File

@ -38,7 +38,7 @@ abstract class MetadataStore{
* @param string $key
* @param MetadataValue $newMetadataValue
*/
protected function setMetadataInternal(string $key, MetadataValue $newMetadataValue){
protected function setMetadataInternal(string $key, MetadataValue $newMetadataValue) : void{
$owningPlugin = $newMetadataValue->getOwningPlugin();
if(!isset($this->metadataMap[$key])){
@ -83,7 +83,7 @@ abstract class MetadataStore{
* @param string $key
* @param Plugin $owningPlugin
*/
protected function removeMetadataInternal(string $key, Plugin $owningPlugin){
protected function removeMetadataInternal(string $key, Plugin $owningPlugin) : void{
if(isset($this->metadataMap[$key])){
unset($this->metadataMap[$key][$owningPlugin]);
if($this->metadataMap[$key]->count() === 0){
@ -99,7 +99,7 @@ abstract class MetadataStore{
*
* @param Plugin $owningPlugin
*/
public function invalidateAll(Plugin $owningPlugin){
public function invalidateAll(Plugin $owningPlugin) : void{
/** @var MetadataValue[] $values */
foreach($this->metadataMap as $values){
if(isset($values[$owningPlugin])){

View File

@ -36,7 +36,7 @@ abstract class MetadataValue{
/**
* @return Plugin
*/
public function getOwningPlugin(){
public function getOwningPlugin() : Plugin{
return $this->owningPlugin;
}
@ -51,5 +51,5 @@ abstract class MetadataValue{
* Invalidates this metadata item, forcing it to recompute when next
* accessed.
*/
abstract public function invalidate();
abstract public function invalidate() : void;
}

View File

@ -33,7 +33,7 @@ interface Metadatable{
* @param string $metadataKey
* @param MetadataValue $newMetadataValue
*/
public function setMetadata(string $metadataKey, MetadataValue $newMetadataValue);
public function setMetadata(string $metadataKey, MetadataValue $newMetadataValue) : void;
/**
* Returns a list of previously set metadata values from the implementing
@ -62,6 +62,6 @@ interface Metadatable{
* @param string $metadataKey
* @param Plugin $owningPlugin
*/
public function removeMetadata(string $metadataKey, Plugin $owningPlugin);
public function removeMetadata(string $metadataKey, Plugin $owningPlugin) : void;
}

View File

@ -41,11 +41,11 @@ class PlayerMetadataStore extends MetadataStore{
return $this->hasMetadataInternal($this->disambiguate($subject, $metadataKey));
}
public function removeMetadata(IPlayer $subject, string $metadataKey, Plugin $owningPlugin){
public function removeMetadata(IPlayer $subject, string $metadataKey, Plugin $owningPlugin) : void{
$this->removeMetadataInternal($this->disambiguate($subject, $metadataKey), $owningPlugin);
}
public function setMetadata(IPlayer $subject, string $metadataKey, MetadataValue $newMetadataValue){
public function setMetadata(IPlayer $subject, string $metadataKey, MetadataValue $newMetadataValue) : void{
$this->setMetadataInternal($this->disambiguate($subject, $metadataKey), $newMetadataValue);
}
}