Modernize property type declarations

This commit is contained in:
Dylan K. Taylor
2022-06-04 18:16:32 +01:00
parent 23695fb900
commit 083a35f970
114 changed files with 431 additions and 863 deletions

View File

@ -81,19 +81,17 @@ class Language{
throw new LanguageNotFoundException("Language directory $path does not exist or is not a directory");
}
/** @var string */
protected $langName;
protected string $langName;
/**
* @var string[]
* @phpstan-var array<string, string>
*/
protected $lang = [];
protected array $lang = [];
/**
* @var string[]
* @phpstan-var array<string, string>
*/
protected $fallbackLang = [];
protected array $fallbackLang = [];
/**
* @throws LanguageNotFoundException

View File

@ -24,18 +24,16 @@ declare(strict_types=1);
namespace pocketmine\lang;
final class Translatable{
/** @var string $text */
protected $text;
/** @var string[]|Translatable[] $params */
protected $params = [];
protected array $params = [];
/**
* @param (float|int|string|Translatable)[] $params
*/
public function __construct(string $text, array $params = []){
$this->text = $text;
public function __construct(
protected string $text,
array $params = []
){
foreach($params as $k => $param){
if(!($param instanceof Translatable)){
$this->params[$k] = (string) $param;