Skip to content

Commit

Permalink
Prepare for release
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Feb 2, 2021
1 parent b8c27c7 commit 7161b09
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
5 changes: 0 additions & 5 deletions composer.json
Expand Up @@ -43,9 +43,6 @@
"psr/simple-cache-implementation": "1.0.0"
},
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
},
"config-plugin": {
"common": "config/common.php",
"params": "config/params.php"
Expand All @@ -54,8 +51,6 @@
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"test": "phpunit --testdox --no-interaction",
"test-watch": "phpunit-watcher watch"
Expand Down
2 changes: 1 addition & 1 deletion config/common.php
Expand Up @@ -4,7 +4,7 @@

use Yiisoft\Cache\Memcached\Memcached;

/* @var $params array */
/** @var array $params */

return [
Memcached::class => [
Expand Down
2 changes: 1 addition & 1 deletion src/Memcached.php
Expand Up @@ -282,7 +282,7 @@ private function validateKeys(array $keys): void
*/
private function validateKeysOfValues(array $values): void
{
$keys = array_map('strval', array_keys($values));
$keys = array_map('\strval', array_keys($values));
$this->validateKeys($keys);
}
}
22 changes: 11 additions & 11 deletions tests/MemcachedTest.php
Expand Up @@ -34,7 +34,7 @@ public static function setUpBeforeClass(): void
self::markTestSkipped('Required extension "memcached" is not loaded');
}

// check whether memcached is running and skip tests if not.
// Check whether memcached is running and skip tests if not.
if (!@stream_socket_client(MEMCACHED_HOST . ':' . MEMCACHED_PORT, $errorNumber, $errorDescription, 0.5)) {
self::markTestSkipped('No memcached server running at ' . MEMCACHED_HOST . ':' . MEMCACHED_PORT . ' : ' . $errorNumber . ' - ' . $errorDescription);
}
Expand Down Expand Up @@ -218,14 +218,14 @@ public function testGetMultiple(): void
$data = $this->getDataProviderData();
$cache->setMultiple($data);

$this->assertSameExceptObject($data, $cache->getMultiple(array_map('strval', array_keys($data))));
$this->assertSameExceptObject($data, $cache->getMultiple(array_map('\strval', array_keys($data))));
}

public function testDeleteMultiple(): void
{
$cache = $this->createCacheInstance();
$data = $this->getDataProviderData();
$keys = array_map('strval', array_keys($data));
$keys = array_map('\strval', array_keys($data));
$cache->setMultiple($data);

$this->assertSameExceptObject($data, $cache->getMultiple($keys));
Expand Down Expand Up @@ -319,7 +319,7 @@ public function iterableProvider(): array
'IteratorAggregate' => [
['a' => 1, 'b' => 2,],
new class() implements IteratorAggregate {
public function getIterator()
public function getIterator(): ArrayIterator
{
return new ArrayIterator(['a' => 1, 'b' => 2,]);
}
Expand Down Expand Up @@ -684,26 +684,26 @@ private function getDataProviderData(): array

private function assertSameExceptObject($expected, $actual): void
{
// assert for all types
// Assert for all types.
$this->assertEquals($expected, $actual);

// no more asserts for objects
// No more asserts for objects.
if (is_object($expected)) {
return;
}

// asserts same for all types except objects and arrays that can contain objects
// Assert same for all types except objects and arrays that can contain objects.
if (!is_array($expected)) {
$this->assertSame($expected, $actual);
return;
}

// assert same for each element of the array except objects
// Assert same for each element of the array except objects.
foreach ($expected as $key => $value) {
if (!is_object($value)) {
$this->assertSame($expected[$key], $actual[$key]);
} else {
if (is_object($value)) {
$this->assertEquals($expected[$key], $actual[$key]);
} else {
$this->assertSame($expected[$key], $actual[$key]);
}
}
}
Expand Down

0 comments on commit 7161b09

Please sign in to comment.