From a21f8205e5b0d8f57000a1de97e2aac57cc74de7 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 4 Oct 2020 16:35:33 +0200 Subject: [PATCH] Fix hints --- src/danog/MadelineProto/AnnotationsBuilder.php | 3 ++- src/danog/MadelineProto/Db/DbArray.php | 2 +- src/danog/MadelineProto/Db/DriverArray.php | 5 ++++- src/danog/MadelineProto/Db/MemoryArray.php | 2 +- src/danog/MadelineProto/Db/MysqlArray.php | 10 ++-------- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/danog/MadelineProto/AnnotationsBuilder.php b/src/danog/MadelineProto/AnnotationsBuilder.php index f03cc7cc..ee10aecd 100644 --- a/src/danog/MadelineProto/AnnotationsBuilder.php +++ b/src/danog/MadelineProto/AnnotationsBuilder.php @@ -58,7 +58,8 @@ class AnnotationsBuilder $this->namespace = $namespace; /** @psalm-suppress InvalidArgument */ $this->TL = new TL(new class($logger) { - public function __construct($logger) + public Logger $logger; + public function __construct(Logger $logger) { $this->logger = $logger; } diff --git a/src/danog/MadelineProto/Db/DbArray.php b/src/danog/MadelineProto/Db/DbArray.php index fa01e4ee..6e0a3b2c 100644 --- a/src/danog/MadelineProto/Db/DbArray.php +++ b/src/danog/MadelineProto/Db/DbArray.php @@ -15,7 +15,7 @@ interface DbArray extends DbType, \ArrayAccess, \Countable /** * Get Array copy. * - * @psalm-return Promise $value + * @psalm-return Promise> $value * * @return Promise */ diff --git a/src/danog/MadelineProto/Db/DriverArray.php b/src/danog/MadelineProto/Db/DriverArray.php index d79360af..64b40988 100644 --- a/src/danog/MadelineProto/Db/DriverArray.php +++ b/src/danog/MadelineProto/Db/DriverArray.php @@ -29,7 +29,10 @@ abstract class DriverArray implements DbArray { if (isset($this->settings) && \is_array($this->settings)) { $clazz = (new ReflectionClass($this))->getProperty('dbSettings')->getType()->getName(); - /** @var SettingsAbstract */ + /** + * @var SettingsAbstract + * @psalm-suppress UndefinedThisPropertyAssignment + */ $this->dbSettings = new $clazz; $this->dbSettings->mergeArray($this->settings); unset($this->settings); diff --git a/src/danog/MadelineProto/Db/MemoryArray.php b/src/danog/MadelineProto/Db/MemoryArray.php index 6de20692..71d5cb31 100644 --- a/src/danog/MadelineProto/Db/MemoryArray.php +++ b/src/danog/MadelineProto/Db/MemoryArray.php @@ -24,7 +24,7 @@ class MemoryArray extends \ArrayIterator implements DbArray * @param mixed $value * @param string $tablePrefix * @param Memory $settings - * @return Promise + * @return Promise */ public static function getInstance(string $name, $value = null, string $tablePrefix = '', $settings): Promise { diff --git a/src/danog/MadelineProto/Db/MysqlArray.php b/src/danog/MadelineProto/Db/MysqlArray.php index bb7bf407..f729e822 100644 --- a/src/danog/MadelineProto/Db/MysqlArray.php +++ b/src/danog/MadelineProto/Db/MysqlArray.php @@ -79,7 +79,7 @@ class MysqlArray extends SqlArray * * @link https://php.net/manual/en/arrayiterator.offsetset.php * - * @param string $index

+ * @param string|int $index

* The index to set for. *

* @param $value @@ -118,7 +118,7 @@ class MysqlArray extends SqlArray * * @link https://php.net/manual/en/arrayiterator.offsetunset.php * - * @param string $index

+ * @param string|int $index

* The offset to unset. *

* @@ -138,12 +138,6 @@ class MysqlArray extends SqlArray ); } - /** - * Get array copy. - * - * @return Promise - * @throws \Throwable - */ public function getArrayCopy(): Promise { return call(function () {