diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index d82ba21f8..44737db46 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@5.0.1" + uses: "doctrine/.github/.github/workflows/coding-standards.yml@13.1.0" diff --git a/.github/workflows/composer-lint.yml b/.github/workflows/composer-lint.yml index aff94ca5a..0b76e4646 100644 --- a/.github/workflows/composer-lint.yml +++ b/.github/workflows/composer-lint.yml @@ -15,4 +15,4 @@ on: jobs: composer-lint: name: "Composer Lint" - uses: "doctrine/.github/.github/workflows/composer-lint.yml@5.0.1" + uses: "doctrine/.github/.github/workflows/composer-lint.yml@13.1.0" diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e7df8fd2f..906027555 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -14,7 +14,7 @@ env: jobs: phpunit: name: "PHPUnit" - uses: "doctrine/.github/.github/workflows/continuous-integration.yml@5.0.1" + uses: "doctrine/.github/.github/workflows/continuous-integration.yml@13.1.0" with: php-versions: '["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5"]' secrets: diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index e9b2c7185..310999284 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -17,4 +17,4 @@ on: jobs: documentation: name: "Documentation" - uses: "doctrine/.github/.github/workflows/documentation.yml@5.1.0" + uses: "doctrine/.github/.github/workflows/documentation.yml@13.1.0" diff --git a/.github/workflows/release-on-milestone-closed.yml b/.github/workflows/release-on-milestone-closed.yml index 3cac620a3..b82f876ec 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@5.0.1" + uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@13.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 b48b3a226..40402a9c2 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -10,6 +10,28 @@ on: - "*.x" jobs: - static-analysis: + phpstan: name: "Static Analysis" - uses: "doctrine/.github/.github/workflows/static-analysis.yml@5.0.1" + uses: "doctrine/.github/.github/workflows/phpstan.yml@13.1.0" + + psalm: + name: "Psalm (PHP: 8.2)" + runs-on: "ubuntu-22.04" + + steps: + - name: "Checkout code" + uses: "actions/checkout@v6" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "8.2" + + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v3" + with: + dependency-versions: "highest" + + - name: "Run a static analysis with vimeo/psalm" + run: "vendor/bin/psalm --show-info=false --stats --output-format=github --threads=$(nproc)" diff --git a/composer.json b/composer.json index 6fdded157..c4607de13 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { "name": "doctrine/annotations", - "abandoned": true, "description": "Docblock Annotations Parser", "license": "MIT", "type": "library", + "abandoned": true, "keywords": [ "annotations", "docblock", @@ -39,11 +39,10 @@ "psr/cache": "^1 || ^2 || ^3" }, "require-dev": { - "doctrine/cache": "^2.0", - "doctrine/coding-standard": "^10", - "phpstan/phpstan": "^1.10.28", + "doctrine/coding-standard": "^11.1 || ^14", + "phpstan/phpstan": "^1.11 || ^2.1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "symfony/cache": "^5.4 || ^6.4 || ^7", + "symfony/cache": "^5.4 || ^6.4 || ^7.4 || ^8", "vimeo/psalm": "^4.30 || ^5.14" }, "suggest": { diff --git a/docs/composer.json b/docs/composer.json new file mode 100644 index 000000000..c5a4e1443 --- /dev/null +++ b/docs/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "doctrine/docs-builder": "^1.0" + } +} diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 0d84d28ba..6f0d1123e 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -85,6 +85,15 @@ */tests/Doctrine/Tests/Common/Annotations/Fixtures/* + + */tests/Doctrine/Tests/Common/Annotations/Fixtures/* + + + */tests/Doctrine/Tests/Common/Annotations/Fixtures/* + + + */tests/Doctrine/Tests/Common/Annotations/Fixtures/* + diff --git a/phpstan.neon b/phpstan.neon index 08339cda9..a51733d3a 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,6 @@ parameters: level: 3 - phpVersion: 80200 + phpVersion: 80500 paths: - lib - tests @@ -14,12 +14,12 @@ parameters: - tests/Doctrine/Tests/Common/Annotations/ReservedKeywordsClasses.php - tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php - tests/Doctrine/Tests/DoctrineTestCase.php - - tests/Doctrine/Tests/Common/Annotations/CachedReaderTest.php polluteScopeWithLoopInitialAssignments: true ignoreErrors: - '#Instantiated class Doctrine_Tests_Common_Annotations_Fixtures_ClassNoNamespaceNoComment not found#' - '#Property Doctrine\\Tests\\Common\\Annotations\\DummyClassNonAnnotationProblem::\$foo has unknown class#' - '#Call to an undefined static method PHPUnit\\Framework\\TestCase::expectExceptionMessageRegExp\(\)#' - # That tag is empty on purpose - - '#PHPDoc tag @var has invalid value \(\)\: Unexpected token "\*/", expected type at offset 9#' + - + identifier: phpDoc.parseError + path: tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php diff --git a/tests/Doctrine/Tests/Common/Annotations/Fixtures/Controller.php b/tests/Doctrine/Tests/Common/Annotations/Fixtures/Controller.php index 0fe25cbda..e72e50f03 100644 --- a/tests/Doctrine/Tests/Common/Annotations/Fixtures/Controller.php +++ b/tests/Doctrine/Tests/Common/Annotations/Fixtures/Controller.php @@ -202,7 +202,10 @@ private function updateFieldAceProperty($name, array $changes): void $this->loadedAces[$aceId] = $ace; $aceIdProperty = new \ReflectionProperty('Symfony\Component\Security\Acl\Domain\Entry', 'id'); - $aceIdProperty->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $aceIdProperty->setAccessible(true); + } + $aceIdProperty->setValue($ace, (int) $aceId); } else { $currentIds[$ace->getId()] = true; @@ -274,7 +277,10 @@ private function updateAceProperty($name, array $changes): void $this->loadedAces[$aceId] = $ace; $aceIdProperty = new \ReflectionProperty($ace, 'id'); - $aceIdProperty->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $aceIdProperty->setAccessible(true); + } + $aceIdProperty->setValue($ace, (int) $aceId); } else { $currentIds[$ace->getId()] = true; diff --git a/tests/Doctrine/Tests/Common/Annotations/PsrCachedReaderTest.php b/tests/Doctrine/Tests/Common/Annotations/PsrCachedReaderTest.php index ca9a259e2..25b2be38a 100644 --- a/tests/Doctrine/Tests/Common/Annotations/PsrCachedReaderTest.php +++ b/tests/Doctrine/Tests/Common/Annotations/PsrCachedReaderTest.php @@ -20,6 +20,8 @@ use function time; use function touch; +use const PHP_VERSION_ID; + final class PsrCachedReaderTest extends AbstractReaderTest { /** @var CacheItemPoolInterface */ @@ -124,11 +126,17 @@ public function testPurgeLoadedAnnotations(): void $classReader = new ReflectionClass(PsrCachedReader::class); $loadedAnnotationsProperty = $classReader->getProperty('loadedAnnotations'); - $loadedAnnotationsProperty->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $loadedAnnotationsProperty->setAccessible(true); + } + $this->assertCount(1, $loadedAnnotationsProperty->getValue($reader)); $loadedFilemtimesProperty = $classReader->getProperty('loadedFilemtimes'); - $loadedFilemtimesProperty->setAccessible(true); + if (PHP_VERSION_ID < 80100) { + $loadedFilemtimesProperty->setAccessible(true); + } + $this->assertCount(3, $loadedFilemtimesProperty->getValue($reader)); $reader->clearLoadedAnnotations(); diff --git a/tests/Doctrine/Tests/TestInit.php b/tests/Doctrine/Tests/TestInit.php index f704c23f5..4e8657e8c 100644 --- a/tests/Doctrine/Tests/TestInit.php +++ b/tests/Doctrine/Tests/TestInit.php @@ -3,7 +3,7 @@ /* * This file bootstraps the test environment. */ -error_reporting(E_ALL | E_STRICT); +error_reporting(E_ALL); // register silently failing autoloader spl_autoload_register(static function ($class) {