Skip to content

Commit 63b63ed

Browse files
committed
Update PHPStan configuration and enhance type hints in tests
- Add tests/src directory to PHPStan analysis paths - Enhance type hints in CacheAllSuccessful and CacheHasher tests
1 parent b8b11da commit 63b63ed

5 files changed

Lines changed: 11 additions & 1 deletion

File tree

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ parameters:
66
paths:
77
- src
88
- tests/database
9-
- tests/src
109
tmpDir: build/phpstan
1110
checkOctaneCompatibility: true
1211
checkModelProperties: true
1312
ignoreErrors:
1413
- '#Unsafe usage of new static#'
14+
- '#is used zero times and is not analysed#'

src/Facades/ModelCache.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66

77
/**
88
* @see \Foxws\ModelCache\ModelCache
9+
*
10+
* @method static bool enabled()
11+
* @method static bool shouldCache(\Illuminate\Database\Eloquent\Model|string $model, string $key, mixed $value = null)
12+
* @method static mixed cache(\Illuminate\Database\Eloquent\Model|string $model, string $key, mixed $value = null, \DateTime|int|null $ttl = null)
13+
* @method static bool hasBeenCached(\Illuminate\Database\Eloquent\Model|string $model, string $key)
14+
* @method static mixed getCachedValue(\Illuminate\Database\Eloquent\Model|string $model, string $key)
15+
* @method static \Foxws\ModelCache\ModelCache forget(\Illuminate\Database\Eloquent\Model|string $model, array|\ArrayAccess|string $keys)
916
*/
1017
class ModelCache extends Facade
1118
{

tests/src/CacheProfiles/CacheAllSuccessful.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
uses(TestCase::class);
99

1010
beforeEach(function () {
11+
/** @var \Foxws\ModelCache\CacheProfiles\CacheAllSuccessful $cacheProfile */
1112
$this->cacheProfile = app(CacheAllSuccessful::class);
1213
});
1314

tests/src/Hashers/CacheClassHasherTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
uses(TestCase::class);
1010

1111
beforeEach(function () {
12+
/** @var \Foxws\ModelCache\CacheProfiles\CacheProfile&\Mockery\MockInterface $cacheProfile */
1213
$this->cacheProfile = Mockery::mock(CacheProfile::class);
1314

1415
$this->cacheHasher = new DefaultHasher($this->cacheProfile);

tests/src/Hashers/CacheHasherTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
uses(TestCase::class);
1010

1111
beforeEach(function () {
12+
/** @var \Foxws\ModelCache\CacheProfiles\CacheProfile&\Mockery\MockInterface $cacheProfile */
1213
$this->cacheProfile = Mockery::mock(CacheProfile::class);
1314

1415
$this->cacheHasher = new DefaultHasher($this->cacheProfile);

0 commit comments

Comments
 (0)