Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: 7.2
php-version: 8.1
coverage: none
tools: cs2pr, phpstan, composer:v2

Expand All @@ -42,7 +42,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.1
coverage: none
tools: cs2pr, php-cs-fixer

Expand Down
23 changes: 3 additions & 20 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,11 @@ jobs:
- lowest
- highest
php-version:
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'
variant: [normal]
include:
- php-version: '7.2'
dependencies: highest
variant: 'doctrine/orm:~2.5'
- php-version: '7.2'
dependencies: highest
variant: 'doctrine/orm:~2.6'
- php-version: '7.2'
dependencies: highest
variant: 'doctrine/orm:~2.7'
- php-version: '8.0'
dependencies: highest
variant: 'doctrine/orm:~2.7 symfony/property-access:^6.0'
- php-version: '8.2'
dependencies: highest
variant: 'doctrine/orm:~2.7 symfony/property-access:^7.0'
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/.php_cs
/.php_cs.cache
/.php-cs-fixer.cache
/.idea
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
}
],
"require": {
"php": ">=7.2",
"doctrine/orm": "~2.5",
"symfony/property-access": "^4.0 || ^5.2 || ^6.0 || ^7.0",
"symfony/polyfill-php80": "^1.20"
"php": ">=8.1",
"doctrine/orm": "^3.0",
"symfony/property-access": "^5.2 || ^6.0 || ^7.0"
},
"require-dev": {
"phpspec/phpspec": "~6.3 || ^7.0"
Expand Down
2 changes: 1 addition & 1 deletion src/DBALTypesResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
$classNameParts = explode('\\', str_replace('_', '\\', $className));
$typeName = array_pop($classNameParts);

if (null !== $typeName && array_key_exists($typeName, Type::getTypesMap())) {
if (null !== $typeName && Type::hasType($typeName)) {

Check failure on line 55 in src/DBALTypesResolver.php

View workflow job for this annotation

GitHub Actions / PHPStan

Strict comparison using !== between null and string will always evaluate to true.
return Type::getType($typeName);
}

Expand Down
8 changes: 1 addition & 7 deletions src/Repository/EntitySpecificationRepositoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,7 @@ public function iterate($specification, ?ResultModifier $modifier = null): \Trav
{
$query = $this->getQuery($specification, $modifier);

if (method_exists($query, 'toIterable')) {
yield from $query->toIterable();
} else {
foreach ($query->iterate() as $key => $row) {
yield $key => current($row);
}
}
yield from $query->toIterable();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Result/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ public function __construct(int $cacheLifetime)
*/
public function modify(AbstractQuery $query): void
{
$query->setResultCacheLifetime($this->cacheLifetime);
$query->enableResultCache($this->cacheLifetime);
}
}
22 changes: 11 additions & 11 deletions tests/Filter/EqualsSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function it_returns_comparison_object(QueryBuilder $qb, ArrayCollection $
$qb->getParameters()->willReturn($parameters);
$parameters->count()->willReturn(10);

$qb->setParameter('comparison_10', 18, null)->shouldBeCalled();
$qb->setParameter('comparison_10', 18, null)->willReturn($qb)->shouldBeCalled();

$comparison = $this->getFilter($qb, 'a');

Expand All @@ -56,7 +56,7 @@ public function it_returns_comparison_object_in_context(QueryBuilder $qb, ArrayC
$qb->getParameters()->willReturn($parameters);
$parameters->count()->willReturn(10);

$qb->setParameter('comparison_10', 18, null)->shouldBeCalled();
$qb->setParameter('comparison_10', 18, null)->willReturn($qb)->shouldBeCalled();

$qb->getDQLPart('join')->willReturn([]);
$qb->getAllAliases()->willReturn([]);
Expand All @@ -70,8 +70,8 @@ public function it_filter_array_collection(): void
$this->beConstructedWith('gender', 'F', null);

$players = [
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001],
];

Expand All @@ -95,7 +95,7 @@ public function it_is_satisfied_with_array(): void
{
$this->beConstructedWith('gender', 'F', null);

$playerA = ['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500];
$playerA = ['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500];
$playerB = ['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001];

$this->isSatisfiedBy($playerA)->shouldBe(false);
Expand Down Expand Up @@ -140,8 +140,8 @@ public function it_filter_array_collection_in_context(): void
$releaseAt = new \DateTimeImmutable();
$game = ['name' => 'Tetris', 'releaseAt' => $releaseAt];
$players = [
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001, 'inGame' => $game],
];

Expand All @@ -155,8 +155,8 @@ public function it_filter_array_collection_in_global_context(): void
$releaseAt = new \DateTimeImmutable();
$game = ['name' => 'Tetris', 'releaseAt' => $releaseAt];
$players = [
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001, 'inGame' => $game],
];

Expand All @@ -181,8 +181,8 @@ public function it_filter_array_collection_in_combo_context(): void
$owner = ['name' => 'ABC', 'based' => 123];
$game = ['name' => 'Tetris', 'owner' => $owner];
$players = [
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001, 'inGame' => $game],
];

Expand Down
24 changes: 12 additions & 12 deletions tests/Filter/GreaterOrEqualThanSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function it_returns_comparison_object(QueryBuilder $qb, ArrayCollection $
$qb->getParameters()->willReturn($parameters);
$parameters->count()->willReturn(10);

$qb->setParameter('comparison_10', 18, null)->shouldBeCalled();
$qb->setParameter('comparison_10', 18, null)->willReturn($qb)->shouldBeCalled();

$comparison = $this->getFilter($qb, 'a');

Expand All @@ -56,7 +56,7 @@ public function it_returns_comparison_object_in_context(QueryBuilder $qb, ArrayC
$qb->getParameters()->willReturn($parameters);
$parameters->count()->willReturn(10);

$qb->setParameter('comparison_10', 18, null)->shouldBeCalled();
$qb->setParameter('comparison_10', 18, null)->willReturn($qb)->shouldBeCalled();

$qb->getDQLPart('join')->willReturn([]);
$qb->getAllAliases()->willReturn([]);
Expand All @@ -70,8 +70,8 @@ public function it_filter_array_collection(): void
$this->beConstructedWith('points', 9000, null);

$players = [
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9000],
];

Expand All @@ -95,8 +95,8 @@ public function it_is_satisfied_with_array(): void
{
$this->beConstructedWith('points', 2500, null);

$playerA = ['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500];
$playerB = ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230];
$playerA = ['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500];
$playerB = ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230];
$playerC = ['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001];

$this->isSatisfiedBy($playerA)->shouldBe(true);
Expand Down Expand Up @@ -144,8 +144,8 @@ public function it_filter_array_collection_in_context(): void
$releaseAt = new \DateTimeImmutable();
$game = ['name' => 'Tetris', 'releaseAt' => $releaseAt];
$players = [
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001, 'inGame' => $game],
];

Expand All @@ -159,8 +159,8 @@ public function it_filter_array_collection_in_global_context(): void
$releaseAt = new \DateTimeImmutable();
$game = ['name' => 'Tetris', 'releaseAt' => $releaseAt];
$players = [
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001, 'inGame' => $game],
];

Expand All @@ -185,8 +185,8 @@ public function it_filter_array_collection_in_combo_context(): void
$owner = ['name' => 'ABC', 'based' => 123];
$game = ['name' => 'Tetris', 'owner' => $owner];
$players = [
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001, 'inGame' => $game],
];

Expand Down
24 changes: 12 additions & 12 deletions tests/Filter/GreaterThanSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function it_returns_comparison_object(QueryBuilder $qb, ArrayCollection $
$qb->getParameters()->willReturn($parameters);
$parameters->count()->willReturn(10);

$qb->setParameter('comparison_10', 18, null)->shouldBeCalled();
$qb->setParameter('comparison_10', 18, null)->willReturn($qb)->shouldBeCalled();

$comparison = $this->getFilter($qb, 'a');

Expand All @@ -56,7 +56,7 @@ public function it_returns_comparison_object_in_context(QueryBuilder $qb, ArrayC
$qb->getParameters()->willReturn($parameters);
$parameters->count()->willReturn(10);

$qb->setParameter('comparison_10', 18, null)->shouldBeCalled();
$qb->setParameter('comparison_10', 18, null)->willReturn($qb)->shouldBeCalled();

$qb->getDQLPart('join')->willReturn([]);
$qb->getAllAliases()->willReturn([]);
Expand All @@ -70,8 +70,8 @@ public function it_filter_array_collection(): void
$this->beConstructedWith('points', 9000, null);

$players = [
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001],
];

Expand All @@ -95,8 +95,8 @@ public function it_is_satisfied_with_array(): void
{
$this->beConstructedWith('points', 2500, null);

$playerA = ['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500];
$playerB = ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230];
$playerA = ['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500];
$playerB = ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230];
$playerC = ['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001];

$this->isSatisfiedBy($playerA)->shouldBe(false);
Expand Down Expand Up @@ -147,8 +147,8 @@ public function it_filter_array_collection_in_context(): void
$releaseAt = new \DateTimeImmutable('+1 day');
$game = ['name' => 'Tetris', 'releaseAt' => $releaseAt];
$players = [
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001, 'inGame' => $game],
];

Expand All @@ -163,8 +163,8 @@ public function it_filter_array_collection_in_global_context(): void
$releaseAt = new \DateTimeImmutable('+1 day');
$game = ['name' => 'Tetris', 'releaseAt' => $releaseAt];
$players = [
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230],
['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001, 'inGame' => $game],
];

Expand Down Expand Up @@ -192,8 +192,8 @@ public function it_filter_array_collection_in_combo_context(): void
$tetris = ['name' => 'Tetris', 'owner' => $tetrisOwner];
$mahjong = ['name' => 'Mahjong', 'owner' => $mahjongOwner];
$players = [
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500, 'inGame' => $mahjong],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230, 'inGame' => $mahjong],
['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500, 'inGame' => $mahjong],
['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230, 'inGame' => $mahjong],
['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001, 'inGame' => $tetris],
];

Expand Down
Loading
Loading