From a1b343daa92c52cb74424791b98a0f373c1dda5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 15 Oct 2021 19:42:58 +0200 Subject: [PATCH 1/2] Reuse workflows from upstream --- .github/workflows/coding-standards.yml | 27 +------ .github/workflows/continuous-integration.yml | 77 +------------------ .../workflows/release-on-milestone-closed.yml | 52 ++----------- 3 files changed, 11 insertions(+), 145 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index f710db645..352847e3b 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -12,29 +12,4 @@ on: jobs: coding-standards: name: "Coding Standards" - runs-on: "ubuntu-20.04" - - strategy: - matrix: - php-version: - - "7.4" - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - coverage: "none" - php-version: "${{ matrix.php-version }}" - tools: "cs2pr" - - - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v1" - with: - dependency-versions: "highest" - - # https://github.com/doctrine/.github/issues/3 - - name: "Run PHP_CodeSniffer" - run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr" + uses: "doctrine/.github/.github/workflows/coding-standards.yml@1.1.1" diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e4bdcf4b7..2720d0b2e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -14,77 +14,6 @@ env: jobs: phpunit: name: "PHPUnit" - runs-on: "ubuntu-20.04" - - strategy: - matrix: - php-version: - - "7.1" - - "7.2" - - "7.3" - - "7.4" - - "8.0" - dependencies: - - "highest" - include: - - php-version: "7.2" - dependencies: "lowest" - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - with: - fetch-depth: 2 - - - name: "Install PHP with PCOV" - uses: "shivammathur/setup-php@v2" - if: "${{ matrix.php-version != '7.1' }}" - with: - php-version: "${{ matrix.php-version }}" - coverage: "pcov" - ini-values: "zend.assertions=1" - - - name: "Install PHP with XDebug" - uses: "shivammathur/setup-php@v2" - if: "${{ matrix.php-version == '7.1' }}" - with: - php-version: "${{ matrix.php-version }}" - coverage: "xdebug" - ini-values: "zend.assertions=1" - - - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v1" - with: - dependency-versions: "${{ matrix.dependencies }}" - composer-options: "--prefer-dist" - - - name: "Run PHPUnit" - run: "vendor/bin/phpunit --coverage-clover=coverage.xml" - - - name: "Upload coverage file" - uses: "actions/upload-artifact@v2" - with: - name: "phpunit-${{ matrix.php-version }}.coverage" - path: "coverage.xml" - - upload_coverage: - name: "Upload coverage to Codecov" - runs-on: "ubuntu-20.04" - needs: - - "phpunit" - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - with: - fetch-depth: 2 - - - name: "Download coverage files" - uses: "actions/download-artifact@v2" - with: - path: "reports" - - - name: "Upload to Codecov" - uses: "codecov/codecov-action@v1" - with: - directory: "reports" + uses: "doctrine/.github/.github/workflows/continuous-integration.yml@1.1.1" + with: + php-versions: '["7.1", "7.2", "7.3", "7.4", "8.0"]' diff --git a/.github/workflows/release-on-milestone-closed.yml b/.github/workflows/release-on-milestone-closed.yml index 70ccbdb2d..563333bb4 100644 --- a/.github/workflows/release-on-milestone-closed.yml +++ b/.github/workflows/release-on-milestone-closed.yml @@ -8,48 +8,10 @@ on: jobs: release: name: "Git tag, release & create merge-up PR" - runs-on: "ubuntu-20.04" - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - - - name: "Release" - uses: "laminas/automatic-releases@v1" - with: - command-name: "laminas:automatic-releases:release" - env: - "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} - "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} - "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} - "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} - - - name: "Create Merge-Up Pull Request" - uses: "laminas/automatic-releases@v1" - with: - command-name: "laminas:automatic-releases:create-merge-up-pull-request" - env: - "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} - "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} - "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} - "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} - - - name: "Create and/or Switch to new Release Branch" - uses: "laminas/automatic-releases@v1" - with: - command-name: "laminas:automatic-releases:switch-default-branch-to-next-minor" - env: - "GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }} - "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} - "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} - "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} - - - name: "Create new milestones" - uses: "laminas/automatic-releases@v1" - with: - command-name: "laminas:automatic-releases:create-milestones" - env: - "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} - "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} - "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} - "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@1.1.1" + secrets: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} + GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} + ORGANIZATION_ADMIN_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }} + SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }} From 93e1ecf2047b9e33230e2f6fb04b24b735adffcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 15 Oct 2021 20:02:53 +0200 Subject: [PATCH 2/2] Setup Psalm --- .github/workflows/static-analysis.yml | 29 ++----------------- composer.json | 3 +- .../Common/Annotations/IndexedReader.php | 12 ++++---- psalm.xml | 15 ++++++++++ 4 files changed, 26 insertions(+), 33 deletions(-) create mode 100644 psalm.xml diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index d0e0d857d..ddcf2ddf7 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -10,29 +10,6 @@ on: - "*.x" jobs: - static-analysis-phpstan: - name: "Static Analysis with PHPStan" - runs-on: "ubuntu-20.04" - - strategy: - matrix: - php-version: - - "7.4" - - steps: - - name: "Checkout code" - uses: "actions/checkout@v2" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - coverage: "none" - php-version: "${{ matrix.php-version }}" - - - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v1" - with: - dependency-versions: "highest" - - - name: "Run a static analysis with phpstan/phpstan" - run: "vendor/bin/phpstan analyse" + static-analysis: + name: "Static Analysis" + uses: "doctrine/.github/.github/workflows/static-analysis.yml@1.1.1" diff --git a/composer.json b/composer.json index 00d023107..a29863a71 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,8 @@ "doctrine/coding-standard": "^6.0 || ^8.1", "phpstan/phpstan": "^0.12.20", "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", - "symfony/cache": "^4.4 || ^5.2" + "symfony/cache": "^4.4 || ^5.2", + "vimeo/psalm": "^4.10" }, "config": { "sort-packages": true diff --git a/lib/Doctrine/Common/Annotations/IndexedReader.php b/lib/Doctrine/Common/Annotations/IndexedReader.php index 42e70765d..62dcf7487 100644 --- a/lib/Doctrine/Common/Annotations/IndexedReader.php +++ b/lib/Doctrine/Common/Annotations/IndexedReader.php @@ -38,9 +38,9 @@ public function getClassAnnotations(ReflectionClass $class) /** * {@inheritDoc} */ - public function getClassAnnotation(ReflectionClass $class, $annotation) + public function getClassAnnotation(ReflectionClass $class, $annotationName) { - return $this->delegate->getClassAnnotation($class, $annotation); + return $this->delegate->getClassAnnotation($class, $annotationName); } /** @@ -59,9 +59,9 @@ public function getMethodAnnotations(ReflectionMethod $method) /** * {@inheritDoc} */ - public function getMethodAnnotation(ReflectionMethod $method, $annotation) + public function getMethodAnnotation(ReflectionMethod $method, $annotationName) { - return $this->delegate->getMethodAnnotation($method, $annotation); + return $this->delegate->getMethodAnnotation($method, $annotationName); } /** @@ -80,9 +80,9 @@ public function getPropertyAnnotations(ReflectionProperty $property) /** * {@inheritDoc} */ - public function getPropertyAnnotation(ReflectionProperty $property, $annotation) + public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) { - return $this->delegate->getPropertyAnnotation($property, $annotation); + return $this->delegate->getPropertyAnnotation($property, $annotationName); } /** diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 000000000..e6af38923 --- /dev/null +++ b/psalm.xml @@ -0,0 +1,15 @@ + + + + + + + + +