mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-08 12:20:52 +00:00
merge composer_validate (#5620)
This commit is contained in:
parent
1ea1f5852b
commit
652459ad3b
4
.github/workflows/code_analysis.yaml
vendored
4
.github/workflows/code_analysis.yaml
vendored
|
@ -10,8 +10,8 @@ jobs:
|
|||
matrix:
|
||||
actions:
|
||||
-
|
||||
name: 'Show command'
|
||||
run: bin/rector show --ansi
|
||||
name: 'Composer Validate'
|
||||
run: composer validate --strict
|
||||
|
||||
-
|
||||
name: Validate Fixtures
|
||||
|
|
12
.github/workflows/code_analysis_no_dev.yaml
vendored
12
.github/workflows/code_analysis_no_dev.yaml
vendored
|
@ -15,6 +15,14 @@ jobs:
|
|||
bin/rector init-recipe --ansi
|
||||
bin/rector generate --ansi
|
||||
|
||||
-
|
||||
name: 'Rector List'
|
||||
run: bin/rector list
|
||||
|
||||
-
|
||||
name: 'Show command'
|
||||
run: bin/rector show --ansi
|
||||
|
||||
name: ${{ matrix.actions.name }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
@ -26,7 +34,9 @@ jobs:
|
|||
php-version: 7.4
|
||||
coverage: none
|
||||
|
||||
# must be removed, as local config is missing dev dependencies
|
||||
- run: rm phpstan-for-rector.neon
|
||||
|
||||
- run: composer install --no-progress --ansi
|
||||
- run: composer install --no-progress --ansi --no-dev
|
||||
|
||||
- run: ${{ matrix.actions.run }}
|
||||
|
|
14
.github/workflows/composer_validate.yaml
vendored
14
.github/workflows/composer_validate.yaml
vendored
|
@ -1,14 +0,0 @@
|
|||
name: Composer validate
|
||||
|
||||
on:
|
||||
pull_request: null
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
name: Composer validate
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- run: composer validate --strict
|
34
.github/workflows/rector.yaml
vendored
34
.github/workflows/rector.yaml
vendored
|
@ -1,34 +0,0 @@
|
|||
name: Rector Run
|
||||
|
||||
on:
|
||||
pull_request: null
|
||||
|
||||
jobs:
|
||||
matrix:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
actions:
|
||||
-
|
||||
name: Rector without Dev Dependencies
|
||||
install: composer install --no-progress --ansi --no-dev
|
||||
run: |
|
||||
# must be removed, as local config is missing dev dependencies
|
||||
rm phpstan-for-rector.neon
|
||||
bin/rector list
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
name: ${{ matrix.actions.name }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# see https://github.com/shivammathur/setup-php
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 7.4
|
||||
coverage: none
|
||||
|
||||
|
||||
- run: ${{ matrix.actions.install }}
|
||||
|
||||
- run: ${{ matrix.actions.run }}
|
|
@ -22,13 +22,14 @@ use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
|||
use Rector\Core\PhpParser\Printer\BetterStandardPrinter;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Symplify\PackageBuilder\Php\TypeChecker;
|
||||
|
||||
final class AssignManipulator
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
* @var array<class-string<Node>>
|
||||
*/
|
||||
private const MODIFYING_NODES = [
|
||||
private const MODIFYING_NODE_TYPES = [
|
||||
AssignOp::class,
|
||||
PreDec::class,
|
||||
PostDec::class,
|
||||
|
@ -56,16 +57,23 @@ final class AssignManipulator
|
|||
*/
|
||||
private $propertyFetchAnalyzer;
|
||||
|
||||
/**
|
||||
* @var TypeChecker
|
||||
*/
|
||||
private $typeChecker;
|
||||
|
||||
public function __construct(
|
||||
BetterStandardPrinter $betterStandardPrinter,
|
||||
NodeNameResolver $nodeNameResolver,
|
||||
BetterNodeFinder $betterNodeFinder,
|
||||
PropertyFetchAnalyzer $propertyFetchAnalyzer
|
||||
PropertyFetchAnalyzer $propertyFetchAnalyzer,
|
||||
TypeChecker $typeChecker
|
||||
) {
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->betterStandardPrinter = $betterStandardPrinter;
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->propertyFetchAnalyzer = $propertyFetchAnalyzer;
|
||||
$this->typeChecker = $typeChecker;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,7 +100,7 @@ final class AssignManipulator
|
|||
return true;
|
||||
}
|
||||
|
||||
if ($parent !== null && $this->isValueModifyingNode($parent)) {
|
||||
if ($parent !== null && $this->typeChecker->isInstanceOf($parent, self::MODIFYING_NODE_TYPES)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -145,17 +153,4 @@ final class AssignManipulator
|
|||
return $this->isLeftPartOfAssign($node);
|
||||
});
|
||||
}
|
||||
|
||||
private function isValueModifyingNode(Node $node): bool
|
||||
{
|
||||
foreach (self::MODIFYING_NODES as $modifyingNode) {
|
||||
if (! is_a($node, $modifyingNode)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user