Skip to content

Commit

Permalink
Run static analysis on PHP 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
malarzm committed Dec 28, 2020
1 parent ef3aa4f commit 7692b3c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"

- name: "Prepare PHP 8 dependencies"
run: "composer remove --no-update --ignore-platform-req=php --dev doctrine/coding-standard phpstan/phpstan squizlabs/php_codesniffer"
run: "composer remove --no-update --ignore-platform-req=php --dev doctrine/coding-standard squizlabs/php_codesniffer"
if: "${{ matrix.php-version == '8.0' }}"

- name: "Install dependencies with composer"
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"

steps:
- name: "Checkout code"
Expand Down Expand Up @@ -54,6 +54,9 @@ jobs:
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"

- name: "Prepare PHP 8 dependencies"
run: "composer remove --no-update --ignore-platform-req=php --dev doctrine/coding-standard squizlabs/php_codesniffer"

- name: "Install dependencies with composer"
run: "composer install --no-interaction --no-progress"

Expand All @@ -67,7 +70,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"

steps:
- name: "Checkout code"
Expand All @@ -87,6 +90,9 @@ jobs:
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"

- name: "Prepare PHP 8 dependencies"
run: "composer remove --no-update --ignore-platform-req=php --dev doctrine/coding-standard squizlabs/php_codesniffer"

- name: "Install dependencies with composer"
run: "composer install --no-interaction --no-progress"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use ReflectionClass;
use ReflectionException;
use ReflectionMethod;
use ReflectionNamedType;
use ReflectionParameter;
use ReflectionType;
use ReflectionUnionType;
Expand All @@ -24,7 +25,6 @@
use function interface_exists;
use function is_dir;
use function is_writable;
use function method_exists;
use function mkdir;
use function rename;
use function sprintf;
Expand Down Expand Up @@ -305,7 +305,8 @@ function (ReflectionType $unionedType) use ($method, $parameter) {
));
}

$name = method_exists($type, 'getName') ? $type->getName() : (string) $type;
assert($type instanceof ReflectionNamedType);
$name = $type->getName();
$nameLower = strtolower($name);
if ($nameLower === 'self') {
$name = $method->getDeclaringClass()->getName();
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ parameters:
paths:
- %rootDir%/../../../benchmark
- %rootDir%/../../../lib
excludes_analyse:
- lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup/Match.php
- lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Match.php

0 comments on commit 7692b3c

Please sign in to comment.