diff --git a/composer.json b/composer.json index ce4a689..24b246b 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,8 @@ "phpunit/phpunit": "^6.0.0", "sebastian/phpcpd": "^3.0", "squizlabs/php_codesniffer": "^3.0.0RC3", - "theseer/phpdox": "^0.9.0" + "theseer/phpdox": "^0.9.0", + "phpstan/phpstan": "^0.6.4" }, "suggest": { "monolog/monolog": "A good standard logging library", @@ -51,5 +52,10 @@ "name": "Timothy J Warren", "email": "tim@timshomepage.net" } - ] + ], + "scripts": { + "test": "vendor/bin/phpunit", + "coverage": "phpdbg -qrr -- vendor/bin/phpunit -c build", + "phpstan": "vendor/bin/phpstan analyse src tests" + } } diff --git a/src/Driver/AbstractDriver.php b/src/Driver/AbstractDriver.php index cb6aa7b..4fdc5d7 100644 --- a/src/Driver/AbstractDriver.php +++ b/src/Driver/AbstractDriver.php @@ -15,6 +15,7 @@ */ namespace Aviat\Banker\Driver; +use Aviat\Banker\LoggerTrait; use Psr\Log\LoggerAwareInterface; /** @@ -22,7 +23,7 @@ use Psr\Log\LoggerAwareInterface; */ abstract class AbstractDriver implements DriverInterface, LoggerAwareInterface { - use \Aviat\Banker\LoggerTrait; + use LoggerTrait; /** * The object encapsulating the connection to the cache backend diff --git a/src/Driver/ApcuDriver.php b/src/Driver/ApcuDriver.php index d0c71d0..abd2ccc 100644 --- a/src/Driver/ApcuDriver.php +++ b/src/Driver/ApcuDriver.php @@ -38,7 +38,7 @@ class ApcuDriver extends AbstractDriver { */ public function __construct(array $config = [], array $options = []) { - + // noop } /** @@ -46,7 +46,7 @@ class ApcuDriver extends AbstractDriver { */ public function __destruct() { - + // noop } /** diff --git a/src/Driver/MemcacheDriver.php b/src/Driver/MemcacheDriver.php index 7c1e4f6..4666e37 100644 --- a/src/Driver/MemcacheDriver.php +++ b/src/Driver/MemcacheDriver.php @@ -16,6 +16,7 @@ namespace Aviat\Banker\Driver; use Aviat\Banker\Exception\CacheException; +use Memcache; /** * Redis cache backend @@ -31,14 +32,12 @@ class MemcacheDriver extends AbstractDriver { */ public function __construct(array $config = [], array $options = []) { - // @codeCoverageIgnoreStart if ( ! class_exists('Memcache')) { throw new CacheException('Memcache driver requires the PHP memcache extension'); } - // @codeCoverageIgnoreEnd - $this->conn = new \Memcache(); + $this->conn = new Memcache(); $method = ($config['persistent'] === TRUE) ? 'pconnect' : 'connect'; diff --git a/src/Driver/RedisDriver.php b/src/Driver/RedisDriver.php index ec2afba..e293c7f 100644 --- a/src/Driver/RedisDriver.php +++ b/src/Driver/RedisDriver.php @@ -26,7 +26,7 @@ class RedisDriver extends AbstractDriver { /** * The object encapsulating the connection to the Redis server * - * @var Predis\Client + * @var \Predis\Client */ protected $conn; diff --git a/tests/ItemCollectionTest.php b/tests/ItemCollectionTest.php index 13967d8..654c0fe 100644 --- a/tests/ItemCollectionTest.php +++ b/tests/ItemCollectionTest.php @@ -20,6 +20,8 @@ use PHPUnit\Framework\TestCase; class ItemCollectionTest extends TestCase { + protected $collection; + public function setUp() { $this->collection = new ItemCollection([]);