Skip to content

Commit 28dd327

Browse files
committed
Merge branch '3.5.x' into 3.6.x
* 3.5.x: Fix missing import Remove calls to getMockForAbstractClass() (#12003) Upgrade to doctrine/coding-standard 14 Bump doctrine/.github from 7.3.0 to 8.0.0
2 parents ac19b21 + 4f3a5c5 commit 28dd327

File tree

8 files changed

+33
-36
lines changed

8 files changed

+33
-36
lines changed

.github/workflows/coding-standards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ on:
2424

2525
jobs:
2626
coding-standards:
27-
uses: "doctrine/.github/.github/workflows/coding-standards.yml@7.3.0"
27+
uses: "doctrine/.github/.github/workflows/coding-standards.yml@8.0.0"

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ on:
1717
jobs:
1818
documentation:
1919
name: "Documentation"
20-
uses: "doctrine/.github/.github/workflows/documentation.yml@7.3.0"
20+
uses: "doctrine/.github/.github/workflows/documentation.yml@8.0.0"

.github/workflows/release-on-milestone-closed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
release:
10-
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@7.3.0"
10+
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@8.0.0"
1111
secrets:
1212
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
1313
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@
3737
"symfony/var-exporter": "^6.3.9 || ^7.0 || ^8.0"
3838
},
3939
"require-dev": {
40-
"doctrine/coding-standard": "^13.0",
40+
"doctrine/coding-standard": "^14.0",
4141
"phpbench/phpbench": "^1.0",
4242
"phpdocumentor/guides-cli": "^1.4",
4343
"phpstan/extension-installer": "^1.4",
4444
"phpstan/phpstan": "2.1.22",
4545
"phpstan/phpstan-deprecation-rules": "^2",
4646
"phpunit/phpunit": "^10.5.0 || ^11.5",
4747
"psr/log": "^1 || ^2 || ^3",
48-
"squizlabs/php_codesniffer": "3.13.2",
4948
"symfony/cache": "^5.4 || ^6.2 || ^7.0 || ^8.0"
5049
},
5150
"suggest": {

phpstan-baseline.neon

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,24 +2022,12 @@ parameters:
20222022
count: 4
20232023
path: src/Persisters/Entity/BasicEntityPersister.php
20242024

2025-
-
2026-
message: '#^Access to property \$value on an unknown class Doctrine\\ORM\\Persisters\\Entity\\BackedEnum\.$#'
2027-
identifier: class.notFound
2028-
count: 1
2029-
path: src/Persisters/Entity/BasicEntityPersister.php
2030-
20312025
-
20322026
message: '#^Call to an undefined method Doctrine\\ORM\\Mapping\\ManyToManyInverseSideMapping\|Doctrine\\ORM\\Mapping\\ManyToManyOwningSideMapping\|Doctrine\\ORM\\Mapping\\ManyToOneAssociationMapping\|Doctrine\\ORM\\Mapping\\OneToManyAssociationMapping\|Doctrine\\ORM\\Mapping\\OneToOneInverseSideMapping\|Doctrine\\ORM\\Mapping\\OneToOneOwningSideMapping\:\:indexBy\(\)\.$#'
20332027
identifier: method.notFound
20342028
count: 1
20352029
path: src/Persisters/Entity/BasicEntityPersister.php
20362030

2037-
-
2038-
message: '#^Class Doctrine\\ORM\\Persisters\\Entity\\BackedEnum not found\.$#'
2039-
identifier: class.notFound
2040-
count: 1
2041-
path: src/Persisters/Entity/BasicEntityPersister.php
2042-
20432031
-
20442032
message: '#^Method Doctrine\\ORM\\Persisters\\Entity\\BasicEntityPersister\:\:__construct\(\) has parameter \$class with generic class Doctrine\\ORM\\Mapping\\ClassMetadata but does not specify its types\: T$#'
20452033
identifier: missingType.generics

src/Persisters/Entity/BasicEntityPersister.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Doctrine\ORM\Persisters\Entity;
66

7+
use BackedEnum;
78
use Doctrine\Common\Collections\Criteria;
89
use Doctrine\Common\Collections\Expr\Comparison;
910
use Doctrine\Common\Collections\Order;

tests/Tests/ORM/Functional/QueryCacheTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Doctrine\Tests\ORM\Functional;
66

7+
use Doctrine\DBAL\Connection;
78
use Doctrine\ORM\Query;
89
use Doctrine\ORM\Query\Exec\AbstractSqlExecutor;
910
use Doctrine\ORM\Query\ParserResult;
@@ -122,14 +123,15 @@ public function testQueryCacheHitDoesNotSaveParserResult(): void
122123

123124
$query = $this->_em->createQuery('select ux from Doctrine\Tests\Models\CMS\CmsUser ux');
124125

125-
$sqlExecMock = $this->createMock(AbstractSqlExecutor::class);
126-
127-
$sqlExecMock->expects(self::once())
128-
->method('execute')
129-
->willReturn(10);
126+
$sqlExecutorStub = new class extends AbstractSqlExecutor {
127+
public function execute(Connection $conn, array $params, array $types): int
128+
{
129+
return 10;
130+
}
131+
};
130132

131133
$parserResultMock = new ParserResult();
132-
$parserResultMock->setSqlExecutor($sqlExecMock);
134+
$parserResultMock->setSqlExecutor($sqlExecutorStub);
133135

134136
$cache = $this->createMock(CacheItemPoolInterface::class);
135137

tests/Tests/ORM/Hydration/AbstractHydratorTest.php

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
use Doctrine\DBAL\Result;
1111
use Doctrine\ORM\EntityManagerInterface;
1212
use Doctrine\ORM\Events;
13-
use Doctrine\ORM\Exception\ORMException;
1413
use Doctrine\ORM\Internal\Hydration\AbstractHydrator;
1514
use Doctrine\ORM\Query\ResultSetMapping;
1615
use Doctrine\Tests\Models\Hydration\SimpleEntity;
1716
use Doctrine\Tests\OrmFunctionalTestCase;
17+
use LogicException;
1818
use PHPUnit\Framework\Attributes\CoversClass;
1919
use PHPUnit\Framework\Attributes\Group;
2020
use PHPUnit\Framework\MockObject\MockObject;
@@ -27,7 +27,7 @@ class AbstractHydratorTest extends OrmFunctionalTestCase
2727
private EventManager&MockObject $mockEventManager;
2828
private Result&MockObject $mockResult;
2929
private ResultSetMapping&MockObject $mockResultMapping;
30-
private AbstractHydrator&MockObject $hydrator;
30+
private DummyHydrator $hydrator;
3131

3232
protected function setUp(): void
3333
{
@@ -52,11 +52,7 @@ protected function setUp(): void
5252
->method('fetchAssociative')
5353
->willReturn(false);
5454

55-
$this->hydrator = $this
56-
->getMockBuilder(AbstractHydrator::class)
57-
->onlyMethods(['hydrateAllData'])
58-
->setConstructorArgs([$mockEntityManagerInterface])
59-
->getMock();
55+
$this->hydrator = new DummyHydrator($mockEntityManagerInterface);
6056
}
6157

6258
/**
@@ -142,13 +138,9 @@ public function testHydrateAllClearsAllAttachedListenersEvenOnError(): void
142138
$this->assertTrue($eventListenerHasBeenRegistered);
143139
});
144140

145-
$this
146-
->hydrator
147-
->expects(self::once())
148-
->method('hydrateAllData')
149-
->willThrowException($this->createStub(ORMException::class));
141+
$this->hydrator->throwException = true;
150142

151-
$this->expectException(ORMException::class);
143+
$this->expectException(LogicException::class);
152144
$this->hydrator->hydrateAll($this->mockResult, $this->mockResultMapping);
153145
}
154146

@@ -181,3 +173,18 @@ public function testToIterableIfYieldAndBreakBeforeFinishAlwaysCleansUp(): void
181173
self::assertCount(0, $evm->getListeners(Events::onClear));
182174
}
183175
}
176+
177+
class DummyHydrator extends AbstractHydrator
178+
{
179+
public bool $throwException = false;
180+
181+
/** @return array{} */
182+
protected function hydrateAllData(): array
183+
{
184+
if ($this->throwException) {
185+
throw new LogicException();
186+
}
187+
188+
return [];
189+
}
190+
}

0 commit comments

Comments
 (0)