Skip to content

Commit 55d4aa8

Browse files
committed
Removed scrutinizer, fixed cache middleware
1 parent be935f1 commit 55d4aa8

File tree

5 files changed

+16
-35
lines changed

5 files changed

+16
-35
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,3 @@ jobs:
4040
pipenv run python bin/ci.py --verbose --teardown
4141
env:
4242
COMPOSER_ROOT_VERSION: ${{ vars.COMPOSER_ROOT_VERSION }}
43-
44-
- name: Upload Scrutinizer coverage
45-
uses: sudo-bot/action-scrutinizer@latest
46-
# Do not run this step on forked versions of the main repository (example: contributor forks)
47-
if: github.repository == 'runopencode/query-resources-loader-bundle'
48-
with:
49-
cli-args: "--format=php-clover build/phpunit/clover.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}"
50-

.scrutinizer.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ Query resources loader bundle
22
=============================
33

44
[![Packagist](https://img.shields.io/packagist/v/RunOpenCode/query-resources-loader-bundle.svg)](https://packagist.org/packages/runopencode/query-resources-loader-bundle)
5-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/RunOpenCode/query-resources-loader-bundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/RunOpenCode/query-resources-loader-bundle/?branch=master)
6-
[![Build Status](https://scrutinizer-ci.com/g/RunOpenCode/query-resources-loader-bundle/badges/build.png?b=master)](https://scrutinizer-ci.com/g/RunOpenCode/query-resources-loader-bundle/build-status/master)
7-
[![Code Coverage](https://scrutinizer-ci.com/g/RunOpenCode/query-resources-loader-bundle/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/RunOpenCode/query-resources-loader-bundle/?branch=master)
85

96
The purpose of query resources loader is to help you manage and organize your big, long, database queries, especially in
107
application that deals with reporting.

src/RunOpenCode/Bundle/QueryResourcesLoader/Cache/CacheMiddleware.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\Cache\Adapter\TagAwareAdapter;
1616
use Symfony\Contracts\Cache\CacheInterface;
1717
use Symfony\Contracts\Cache\ItemInterface;
18-
use Symfony\Contracts\Cache\TagAwareCacheInterface;
1918

2019
/**
2120
* Cache middleware.
@@ -27,8 +26,8 @@
2726
public const TAG = 'runopencode_query_resources_loader_cache';
2827

2928
public function __construct(
30-
private CacheInterface&TagAwareCacheInterface $cache = new TagAwareAdapter(new ArrayAdapter()),
31-
private ?int $defaultTtl = null,
29+
private CacheInterface $cache = new TagAwareAdapter(new ArrayAdapter()),
30+
private ?int $defaultTtl = null,
3231
) {
3332
// noop
3433
}
@@ -71,11 +70,13 @@ public function __invoke(string $query, Parameters $parameters, Options $options
7170
* @var CacheIdentityInterface $identity
7271
*/
7372
$item->expiresAfter($identity->getTtl());
74-
/** @psalm-suppress UndefinedInterfaceMethod */
75-
$item->tag(\array_merge(
76-
$identity->getTags(),
77-
[self::TAG]
78-
));
73+
74+
if (method_exists($item, 'tag')) {
75+
$item->tag(\array_merge(
76+
$identity->getTags(),
77+
[self::TAG]
78+
));
79+
}
7980

8081
return $result;
8182
});

src/RunOpenCode/Bundle/QueryResourcesLoader/Executor/Dbal/DbalParameters.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,17 @@ final public function timeImmutable(string $name, ?\DateTimeInterface $value): s
195195
* $parameters->set($name, $value->name, Types::STRING);
196196
* ```
197197
*
198-
* @param string $name Parameter name.
199-
* @param \UnitEnum $value Parameter value.
198+
* @param string $name Parameter name.
199+
* @param ?\UnitEnum $value Parameter value.
200200
*
201201
* @return self Fluent return.
202202
*/
203-
final public function enum(string $name, \UnitEnum $value): self
203+
final public function enum(string $name, ?\UnitEnum $value): self
204204
{
205+
if (null === $value) {
206+
return $this->set($name, null, Types::STRING);
207+
}
208+
205209
$reflection = new \ReflectionEnum($value::class);
206210

207211
if (!$reflection->isBacked()) {

0 commit comments

Comments
 (0)