diff --git a/psalm-baseline.xml b/psalm-baseline.xml index dc98f2176..dceee1ba0 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + decrypt($document->encryptedField)]]> @@ -148,14 +148,6 @@ current()]]> - - - $key - - - info[$key]]]> - - @@ -164,14 +156,6 @@ - - - $key - - - info[$key]]]> - - databases)]]> @@ -181,14 +165,6 @@ databases)]]> - - - $key - - - info[$key]]]> - - index]]> @@ -663,6 +639,13 @@ changeStreamOptions['startAfter']]]> + + + $domain + $level + $message + + $id diff --git a/src/Model/CollectionInfo.php b/src/Model/CollectionInfo.php index ad5fdf8c7..20f72b14e 100644 --- a/src/Model/CollectionInfo.php +++ b/src/Model/CollectionInfo.php @@ -147,39 +147,41 @@ public function isCapped() * Check whether a field exists in the collection information. * * @see https://php.net/arrayaccess.offsetexists - * @param mixed $key + * @param mixed $offset * @return boolean + * @psalm-param array-key $offset */ #[ReturnTypeWillChange] - public function offsetExists($key) + public function offsetExists($offset) { - return array_key_exists($key, $this->info); + return array_key_exists($offset, $this->info); } /** * Return the field's value from the collection information. * * @see https://php.net/arrayaccess.offsetget - * @param mixed $key + * @param mixed $offset * @return mixed + * @psalm-param array-key $offset */ #[ReturnTypeWillChange] - public function offsetGet($key) + public function offsetGet($offset) { - return $this->info[$key]; + return $this->info[$offset]; } /** * Not supported. * * @see https://php.net/arrayaccess.offsetset - * @param mixed $key + * @param mixed $offset * @param mixed $value * @throws BadMethodCallException * @return void */ #[ReturnTypeWillChange] - public function offsetSet($key, $value) + public function offsetSet($offset, $value) { throw BadMethodCallException::classIsImmutable(self::class); } @@ -188,12 +190,12 @@ public function offsetSet($key, $value) * Not supported. * * @see https://php.net/arrayaccess.offsetunset - * @param mixed $key + * @param mixed $offset * @throws BadMethodCallException * @return void */ #[ReturnTypeWillChange] - public function offsetUnset($key) + public function offsetUnset($offset) { throw BadMethodCallException::classIsImmutable(self::class); } diff --git a/src/Model/DatabaseInfo.php b/src/Model/DatabaseInfo.php index 534481f6c..05cb312b9 100644 --- a/src/Model/DatabaseInfo.php +++ b/src/Model/DatabaseInfo.php @@ -89,39 +89,41 @@ public function isEmpty() * Check whether a field exists in the database information. * * @see https://php.net/arrayaccess.offsetexists - * @param mixed $key + * @param mixed $offset * @return boolean + * @psalm-param array-key $offset */ #[ReturnTypeWillChange] - public function offsetExists($key) + public function offsetExists($offset) { - return array_key_exists($key, $this->info); + return array_key_exists($offset, $this->info); } /** * Return the field's value from the database information. * * @see https://php.net/arrayaccess.offsetget - * @param mixed $key + * @param mixed $offset * @return mixed + * @psalm-param array-key $offset */ #[ReturnTypeWillChange] - public function offsetGet($key) + public function offsetGet($offset) { - return $this->info[$key]; + return $this->info[$offset]; } /** * Not supported. * * @see https://php.net/arrayaccess.offsetset - * @param mixed $key + * @param mixed $offset * @param mixed $value * @throws BadMethodCallException * @return void */ #[ReturnTypeWillChange] - public function offsetSet($key, $value) + public function offsetSet($offset, $value) { throw BadMethodCallException::classIsImmutable(self::class); } @@ -130,12 +132,12 @@ public function offsetSet($key, $value) * Not supported. * * @see https://php.net/arrayaccess.offsetunset - * @param mixed $key + * @param mixed $offset * @throws BadMethodCallException * @return void */ #[ReturnTypeWillChange] - public function offsetUnset($key) + public function offsetUnset($offset) { throw BadMethodCallException::classIsImmutable(self::class); } diff --git a/src/Model/IndexInfo.php b/src/Model/IndexInfo.php index 0c36dd4d5..a5df7111c 100644 --- a/src/Model/IndexInfo.php +++ b/src/Model/IndexInfo.php @@ -183,13 +183,14 @@ public function isUnique() * Check whether a field exists in the index information. * * @see https://php.net/arrayaccess.offsetexists - * @param mixed $key + * @param mixed $offset * @return boolean + * @psalm-param array-key $offset */ #[ReturnTypeWillChange] - public function offsetExists($key) + public function offsetExists($offset) { - return array_key_exists($key, $this->info); + return array_key_exists($offset, $this->info); } /** @@ -201,26 +202,27 @@ public function offsetExists($key) * * @see https://php.net/arrayaccess.offsetget * @see https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.rst#getting-full-index-information - * @param mixed $key + * @param mixed $offset * @return mixed + * @psalm-param array-key $offset */ #[ReturnTypeWillChange] - public function offsetGet($key) + public function offsetGet($offset) { - return $this->info[$key]; + return $this->info[$offset]; } /** * Not supported. * * @see https://php.net/arrayaccess.offsetset - * @param mixed $key + * @param mixed $offset * @param mixed $value * @throws BadMethodCallException * @return void */ #[ReturnTypeWillChange] - public function offsetSet($key, $value) + public function offsetSet($offset, $value) { throw BadMethodCallException::classIsImmutable(self::class); } @@ -229,12 +231,12 @@ public function offsetSet($key, $value) * Not supported. * * @see https://php.net/arrayaccess.offsetunset - * @param mixed $key + * @param mixed $offset * @throws BadMethodCallException * @return void */ #[ReturnTypeWillChange] - public function offsetUnset($key) + public function offsetUnset($offset) { throw BadMethodCallException::classIsImmutable(self::class); } diff --git a/src/PsrLogAdapter.php b/src/PsrLogAdapter.php index bed61a350..d042963d6 100644 --- a/src/PsrLogAdapter.php +++ b/src/PsrLogAdapter.php @@ -90,21 +90,21 @@ public static function addLogger(LoggerInterface $logger): void * * @see LogSubscriber::log() */ - public function log(int $mongocLevel, string $domain, string $message): void + public function log(int $level, string $domain, string $message): void { - if (! isset(self::MONGOC_TO_PSR[$mongocLevel])) { + if (! isset(self::MONGOC_TO_PSR[$level])) { throw new UnexpectedValueException(sprintf( 'Expected level to be >= %d and <= %d, %d given for domain "%s" and message: %s', LogSubscriber::LEVEL_ERROR, LogSubscriber::LEVEL_DEBUG, - $mongocLevel, + $level, $domain, $message, )); } $instance = self::getInstance(); - $psrLevel = self::MONGOC_TO_PSR[$mongocLevel]; + $psrLevel = self::MONGOC_TO_PSR[$level]; $context = ['domain' => $domain]; foreach ($instance->loggers as $logger) {