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
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:
jobs:
coding-standards:
name: "Coding Standards"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@12.0.0"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@12.1.0"
3 changes: 2 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ on:
jobs:
phpunit:
name: "PHPUnit"
uses: "doctrine/.github/.github/workflows/continuous-integration.yml@12.0.0"
uses: "doctrine/.github/.github/workflows/continuous-integration.yml@12.1.0"
with:
php-versions: '["8.1", "8.2", "8.3", "8.4", "8.5"]'
phpunit-options-lowest: "--do-not-fail-on-deprecation"
secrets:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
20 changes: 20 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Documentation"

on:
pull_request:
branches:
- "*.x"
paths:
- .github/workflows/documentation.yml
- docs/**
push:
branches:
- "*.x"
paths:
- .github/workflows/documentation.yml
- docs/**

jobs:
documentation:
name: "Documentation"
uses: "doctrine/.github/.github/workflows/documentation.yml@12.2.0"
2 changes: 1 addition & 1 deletion .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
release:
name: "Git tag, release & create merge-up PR"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@12.0.0"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@12.1.0"
secrets:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:
jobs:
static-analysis:
name: "Static Analysis"
uses: "doctrine/.github/.github/workflows/phpstan.yml@12.0.0"
uses: "doctrine/.github/.github/workflows/phpstan.yml@12.1.0"
2 changes: 1 addition & 1 deletion .github/workflows/website-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ on:
jobs:
json-validate:
name: "Validate JSON schema"
uses: "doctrine/.github/.github/workflows/website-schema.yml@7.1.0"
uses: "doctrine/.github/.github/workflows/website-schema.yml@12.1.0"
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,8 @@
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/package-versions-deprecated": true
}
},
"scripts": {
"docs": "composer --working-dir docs update && ./docs/vendor/bin/build-docs.sh @additional_args"
}
}
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/composer.lock
/vendor/
/output/
5 changes: 5 additions & 0 deletions docs/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"doctrine/docs-builder": "^1.0"
}
}
2 changes: 2 additions & 0 deletions docs/en/sidebar.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
:orphan:

.. toctree::
:depth: 3

Expand Down
6 changes: 6 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
beStrictAboutOutputDuringTests="true"
displayDetailsOnPhpunitDeprecations="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
failOnDeprecation="true"
failOnNotice="true"
failOnWarning="true"
failOnIncomplete="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
>
<testsuites>
<testsuite name="Doctrine Persistence Test Suite">
Expand Down
14 changes: 3 additions & 11 deletions src/Persistence/Mapping/Driver/MappingDriverChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Doctrine\Persistence\Mapping\MappingException;

use function array_keys;
use function rtrim;
use function spl_object_id;
use function strpos;

Expand Down Expand Up @@ -57,7 +56,7 @@ public function getDrivers(): array
public function loadMetadataForClass(string $className, ClassMetadata $metadata): void
{
foreach ($this->drivers as $namespace => $driver) {
if ($this->isInNamespace($className, $namespace)) {
if (strpos($className, $namespace) === 0) {
$driver->loadMetadataForClass($className, $metadata);

return;
Expand Down Expand Up @@ -89,7 +88,7 @@ public function getAllClassNames(): array
}

foreach ($driverClasses[$oid] as $className) {
if (! $this->isInNamespace($className, $namespace)) {
if (strpos($className, $namespace) !== 0) {
continue;
}

Expand All @@ -109,7 +108,7 @@ public function getAllClassNames(): array
public function isTransient(string $className): bool
{
foreach ($this->drivers as $namespace => $driver) {
if ($this->isInNamespace($className, $namespace)) {
if (strpos($className, $namespace) === 0) {
return $driver->isTransient($className);
}
}
Expand All @@ -120,11 +119,4 @@ public function isTransient(string $className): bool

return true;
}

private function isInNamespace(string $className, string $namespace): bool
{
$namespace = rtrim($namespace, '\\') . '\\';

return strpos($className, $namespace) === 0;
}
}
10 changes: 5 additions & 5 deletions tests/Persistence/Mapping/DriverChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

class DriverChainTest extends DoctrineTestCase
{
#[TestWith(['Doctrine\Tests\Models\Company'])]
#[TestWith(['Doctrine\Tests\Persistence\Map'])]
public function testDelegateToMatchingNamespaceDriver(string $namespace): void
#[TestWith(['Doctrine\Tests\Models\Company', 'Doctrine\Tests\Persistence\Mapping'])]
#[TestWith(['Doctrine\Tests\Persistence\Map\\', 'Doctrine\Tests\Persistence\Map'])]
public function testDelegateToMatchingNamespaceDriver(string $namespace1, string $namespace2): void
{
$className = DriverChainEntity::class;
$classMetadata = $this->createMock(ClassMetadata::class);
Expand All @@ -41,8 +41,8 @@ public function testDelegateToMatchingNamespaceDriver(string $namespace): void
->with(self::equalTo($className))
->willReturn(true);

$chain->addDriver($driver1, $namespace);
$chain->addDriver($driver2, 'Doctrine\Tests\Persistence\Mapping');
$chain->addDriver($driver1, $namespace1);
$chain->addDriver($driver2, $namespace2);

$chain->loadMetadataForClass($className, $classMetadata);

Expand Down