Skip to content

Commit

Permalink
Merge pull request #41 from samsonasik/apply-php80
Browse files Browse the repository at this point in the history
Apply PHP 8.0 syntax
  • Loading branch information
Ocramius committed Nov 8, 2022
2 parents 1e1a076 + ea9ec57 commit 4993514
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
9 changes: 3 additions & 6 deletions src/ExtMongoDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@

use function array_key_exists;
use function assert;
use function get_class;
use function gettype;
use function get_debug_type;
use function is_array;
use function is_object;
use function microtime;
use function round;
use function sprintf;
Expand Down Expand Up @@ -138,7 +136,7 @@ protected function internalGetItem(&$normalizedKey, &$success = null, &$casToken
. ": the field 'expired' isn't an instance of MongoDate, '%s' found instead",
(string) $result['_id'],
$this->namespacePrefix . $normalizedKey,
is_object($result['expires']) ? get_class($result['expires']) : gettype($result['expires'])
get_debug_type($result['expires'])
));
}

Expand All @@ -162,11 +160,10 @@ protected function internalGetItem(&$normalizedKey, &$success = null, &$casToken
}

/**
* @param mixed $result
* @param-out array|mixed $result
* @psalm-assert-if-true array $result
*/
private function ensureArrayType(&$result): bool
private function ensureArrayType(mixed &$result): bool
{
if ($result instanceof ArrayObject) {
$result = $result->getArrayCopy();
Expand Down
1 change: 0 additions & 1 deletion src/ExtMongoDbOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ public function setServer($server)
}

/**
* @param array $connectionOptions
* @return $this Provides a fluent interface
*/
public function setConnectionOptions(array $connectionOptions)
Expand Down
7 changes: 2 additions & 5 deletions src/ExtMongoDbResourceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
use MongoDB\Driver\Exception\Exception as MongoDriverException;

use function assert;
use function gettype;
use function get_debug_type;
use function is_array;
use function is_object;
use function is_string;
use function sprintf;

Expand Down Expand Up @@ -65,7 +64,7 @@ public function setResource($id, $resource)
'%s expects an array or %s; received %s',
__METHOD__,
Collection::class,
is_object($resource) ? $resource::class : gettype($resource)
get_debug_type($resource)
));
}

Expand Down Expand Up @@ -153,7 +152,6 @@ public function getServer($id)

/**
* @param string $id
* @param array $connectionOptions
* @return void
*/
public function setConnectionOptions($id, array $connectionOptions)
Expand Down Expand Up @@ -185,7 +183,6 @@ public function getConnectionOptions($id)

/**
* @param string $id
* @param array $driverOptions
* @return void
*/
public function setDriverOptions($id, array $driverOptions)
Expand Down

0 comments on commit 4993514

Please sign in to comment.