diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 14f07c96..a5a28bba 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -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" diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 85a30fdd..498a7ca7 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -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 }}" diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 00000000..90c54d67 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -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" diff --git a/.github/workflows/release-on-milestone-closed.yml b/.github/workflows/release-on-milestone-closed.yml index 329e5571..89dba39e 100644 --- a/.github/workflows/release-on-milestone-closed.yml +++ b/.github/workflows/release-on-milestone-closed.yml @@ -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 }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 595cd96d..355099da 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -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" diff --git a/.github/workflows/website-schema.yml b/.github/workflows/website-schema.yml index e251588e..f56b7241 100644 --- a/.github/workflows/website-schema.yml +++ b/.github/workflows/website-schema.yml @@ -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" diff --git a/composer.json b/composer.json index 6e5a5ccf..fedf2061 100644 --- a/composer.json +++ b/composer.json @@ -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" } } diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 00000000..f26c03fc --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,3 @@ +/composer.lock +/vendor/ +/output/ diff --git a/docs/composer.json b/docs/composer.json new file mode 100644 index 00000000..c5a4e144 --- /dev/null +++ b/docs/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "doctrine/docs-builder": "^1.0" + } +} diff --git a/docs/en/sidebar.rst b/docs/en/sidebar.rst index f89f2bba..f18d38f4 100644 --- a/docs/en/sidebar.rst +++ b/docs/en/sidebar.rst @@ -1,3 +1,5 @@ +:orphan: + .. toctree:: :depth: 3 diff --git a/phpunit.xml.dist b/phpunit.xml.dist index bc4533ac..17c0ba0c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -5,6 +5,12 @@ beStrictAboutOutputDuringTests="true" displayDetailsOnPhpunitDeprecations="true" displayDetailsOnTestsThatTriggerDeprecations="true" + failOnDeprecation="true" + failOnNotice="true" + failOnWarning="true" + failOnIncomplete="true" + failOnRisky="true" + failOnEmptyTestSuite="true" > diff --git a/src/Persistence/Mapping/Driver/MappingDriverChain.php b/src/Persistence/Mapping/Driver/MappingDriverChain.php index e22eac77..f40c0f21 100644 --- a/src/Persistence/Mapping/Driver/MappingDriverChain.php +++ b/src/Persistence/Mapping/Driver/MappingDriverChain.php @@ -8,7 +8,6 @@ use Doctrine\Persistence\Mapping\MappingException; use function array_keys; -use function rtrim; use function spl_object_id; use function strpos; @@ -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; @@ -89,7 +88,7 @@ public function getAllClassNames(): array } foreach ($driverClasses[$oid] as $className) { - if (! $this->isInNamespace($className, $namespace)) { + if (strpos($className, $namespace) !== 0) { continue; } @@ -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); } } @@ -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; - } } diff --git a/tests/Persistence/Mapping/DriverChainTest.php b/tests/Persistence/Mapping/DriverChainTest.php index ed1a1aed..79f7a1eb 100644 --- a/tests/Persistence/Mapping/DriverChainTest.php +++ b/tests/Persistence/Mapping/DriverChainTest.php @@ -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); @@ -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);