Skip to content

Commit

Permalink
Merge 2614c4c into 032dd51
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Dec 16, 2021
2 parents 032dd51 + 2614c4c commit fc12505
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/compiler-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: "composer install --no-dev --no-interaction --no-progress"

- name: "Transform source code"
run: php bin/transform-source.php
run: build/transform-source

- name: "Tests"
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- name: "Transform source code"
if: matrix.php-version != '7.4' && matrix.php-version != '8.0' && matrix.php-version != '8.1'
run: php bin/transform-source.php
run: build/transform-source

- name: "Lint"
run: "make lint"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phar-old.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: "composer install --no-interaction --no-progress --working-dir=compiler"

- name: "Transform source code"
run: php bin/transform-source.php
run: build/transform-source

- name: "Compile PHAR"
run: php compiler/bin/compile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: "composer install --no-interaction --no-progress --working-dir=compiler"

- name: "Transform source code"
run: php bin/transform-source.php
run: build/transform-source

- name: "Compile PHAR"
run: php compiler/bin/compile
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ jobs:
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"

- name: "Transform source code"
if: matrix.php-version != '7.4' && matrix.php-version != '8.0' && matrix.php-version != '8.1'
shell: bash
run: build/transform-source

- name: "Downgrade PHPUnit"
if: matrix.php-version == '7.1' || matrix.php-version == '7.2'
run: "composer require --dev phpunit/phpunit:^7.5.20 brianium/paratest:^4.0 --update-with-dependencies"

- name: "Transform source code"
if: matrix.php-version != '7.4' && matrix.php-version != '8.0' && matrix.php-version != '8.1'
run: php bin/transform-source.php

- name: "PHPStan"
run: ${{ matrix.script }}

Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ jobs:

- name: "Transform source code"
if: matrix.php-version != '7.4' && matrix.php-version != '8.0' && matrix.php-version != '8.1'
run: php bin/transform-source.php
shell: bash
run: build/transform-source

- name: "Tests"
run: "${{ matrix.script }}"
Expand Down Expand Up @@ -87,12 +88,13 @@ jobs:
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"

- name: "Transform source code"
shell: bash
run: build/transform-source

- name: "Downgrade PHPUnit"
run: "composer require --dev phpunit/phpunit:^7.5.20 brianium/paratest:^4.0 --update-with-dependencies"

- name: "Transform source code"
run: php bin/transform-source.php

- name: "Tests"
run: "${{ matrix.script }}"

Expand Down
122 changes: 0 additions & 122 deletions bin/transform-source.php

This file was deleted.

18 changes: 18 additions & 0 deletions build/rector-downgrade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Rector\DowngradePhp74\Rector\Property\DowngradeTypedPropertyRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();

$parameters->set(Option::SKIP, [
'tests/*/data/*',
'tests/PHPStan/Analyser/traits/*',
'tests/PHPStan/Generics/functions.php',
]);

$services = $containerConfigurator->services();
$services->set(DowngradeTypedPropertyRector::class);
};
7 changes: 7 additions & 0 deletions build/transform-source
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -o errexit
set -o pipefail
set -o nounset

docker run --rm -v $(pwd):/app -w /app php:8.0-cli vendor/bin/rector process src tests/PHPStan -c build/rector-downgrade.php
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^9.5.4",
"rector/rector": "0.12.5",
"vaimo/composer-patches": "^4.22"
},
"config": {
Expand Down
62 changes: 61 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions patches/PHPStanNodeScopeResolver.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@package rector/rector

--- packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php 2021-12-16 21:10:20.000000000 +0100
+++ packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php 2021-12-16 21:10:27.000000000 +0100
@@ -226,12 +226,12 @@
{
// 1. get PHPStan locator
/** @var ClassReflector $classReflector */
- $classReflector = $this->privatesAccessor->getPrivateProperty($nodeScopeResolver, 'classReflector');
+ //$classReflector = $this->privatesAccessor->getPrivateProperty($nodeScopeResolver, 'classReflector');
/** @var SourceLocator $sourceLocator */
- $sourceLocator = $this->privatesAccessor->getPrivateProperty($classReflector, 'sourceLocator');
+ //$sourceLocator = $this->privatesAccessor->getPrivateProperty($classReflector, 'sourceLocator');
// 2. get Rector locator
- $aggregateSourceLocator = new \PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator([$sourceLocator, $this->renamedClassesSourceLocator, $this->parentAttributeSourceLocator]);
- $this->privatesAccessor->setPrivateProperty($classReflector, 'sourceLocator', $aggregateSourceLocator);
+ //$aggregateSourceLocator = new \PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator([$sourceLocator, $this->renamedClassesSourceLocator, $this->parentAttributeSourceLocator]);
+ //$this->privatesAccessor->setPrivateProperty($classReflector, 'sourceLocator', $aggregateSourceLocator);
}
private function createDummyClassScopeContext(\PHPStan\Analyser\MutatingScope $mutatingScope) : \PHPStan\Analyser\ScopeContext
{
6 changes: 5 additions & 1 deletion tests/PHPStan/Composer/AutoloadFilesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use function sort;
use function strlen;
use function substr;
use const DIRECTORY_SEPARATOR;
use const PHP_VERSION_ID;

class AutoloadFilesTest extends TestCase
Expand Down Expand Up @@ -43,7 +44,10 @@ public function testExpectedFiles(): void
}

foreach ($json['autoload']['files'] as $file) {
$autoloadFile = substr(dirname($realpath) . '/' . $file, strlen($vendorPath) + 1);
$autoloadFile = substr(dirname($realpath) . DIRECTORY_SEPARATOR . $file, strlen($vendorPath) + 1);
if (strpos($autoloadFile, 'rector' . DIRECTORY_SEPARATOR . 'rector' . DIRECTORY_SEPARATOR) === 0) {
continue;
}
$autoloadFiles[] = $fileHelper->normalizePath($autoloadFile);
}
}
Expand Down

0 comments on commit fc12505

Please sign in to comment.