diff --git a/src/CacheAwareProxy.php b/src/CacheAwareProxy.php index 61a20ce..dc884d9 100644 --- a/src/CacheAwareProxy.php +++ b/src/CacheAwareProxy.php @@ -40,8 +40,7 @@ public function __construct( protected bool $executingCallback = false, protected ?Lock $lockInstance = null, protected bool $bypassCacheCheck = false, - ) - { + ) { // This callback interrupts the query execution on cache hit. $this->queryBuilder->beforeQuery(function (): void { // We will avoid looping this callback if it's executing. diff --git a/src/CacheQueryServiceProvider.php b/src/CacheQueryServiceProvider.php index 5380ec6..2cf9a03 100644 --- a/src/CacheQueryServiceProvider.php +++ b/src/CacheQueryServiceProvider.php @@ -5,10 +5,10 @@ use Closure; use DateInterval; use DateTimeInterface; +use function func_get_args; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Query\Builder; use Illuminate\Support\ServiceProvider; -use function func_get_args; /** * @internal @@ -35,11 +35,11 @@ public function register(): void */ public function boot(): void { - if (!Builder::hasMacro('cache')) { + if (! Builder::hasMacro('cache')) { Builder::macro('cache', $this->macro()); } - if (!EloquentBuilder::hasGlobalMacro('cache')) { + if (! EloquentBuilder::hasGlobalMacro('cache')) { EloquentBuilder::macro('cache', function () { /** @var \Illuminate\Contracts\Database\Eloquent\Builder $this */ $this->setQuery($this->getQuery()->cache(...func_get_args())); diff --git a/src/Helpers.php b/src/Helpers.php index 26218b2..2d2314c 100644 --- a/src/Helpers.php +++ b/src/Helpers.php @@ -2,14 +2,14 @@ namespace Laragear\CacheQuery; -use Illuminate\Contracts\Cache\LockProvider; -use Illuminate\Contracts\Cache\Repository; -use Illuminate\Contracts\Database\Query\Builder; -use LogicException; use function base64_encode; use function cache; use function config; +use Illuminate\Contracts\Cache\LockProvider; +use Illuminate\Contracts\Cache\Repository; +use Illuminate\Contracts\Database\Query\Builder; use function implode; +use LogicException; use function md5; use function str; @@ -30,7 +30,7 @@ public static function store(?string $store, bool $lockable = false): Repository { $repository = cache()->store($store ?? config('cache-query.store')); - if ($lockable && !$repository->getStore() instanceof LockProvider) { + if ($lockable && ! $repository->getStore() instanceof LockProvider) { $store ??= cache()->getDefaultDriver(); throw new LogicException("The [$store] cache does not support atomic locks."); diff --git a/tests/CacheAwareProxyTest.php b/tests/CacheAwareProxyTest.php index d1cbec0..01fdd45 100644 --- a/tests/CacheAwareProxyTest.php +++ b/tests/CacheAwareProxyTest.php @@ -26,7 +26,7 @@ protected function setUp(): void { parent::setUp(); - for ($i = 0; $i < 10; ++$i) { + for ($i = 0; $i < 10; $i++) { $users[] = [ 'email' => $this->faker->freeEmail, 'name' => $this->faker->name, @@ -37,7 +37,7 @@ protected function setUp(): void $this->app->make('db')->table('users')->insert($users); - for ($i = 0; $i < 6; ++$i) { + for ($i = 0; $i < 6; $i++) { $posts[] = [ 'title' => $this->faker->text(20), 'user_id' => (int) floor(max(1, $i / 2)), diff --git a/tests/TestCase.php b/tests/TestCase.php index da5e1c9..53268c4 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -11,4 +11,4 @@ protected function getPackageProviders($app): array { return [CacheQueryServiceProvider::class]; } -} \ No newline at end of file +}