diff --git a/.github/workflows/lock.yaml b/.github/workflows/lock.yaml new file mode 100644 index 00000000000..005a964a58e --- /dev/null +++ b/.github/workflows/lock.yaml @@ -0,0 +1,23 @@ +name: "Lock closed PRs" + +on: + schedule: + - cron: "0 3 * * *" # every day at 03:00 UTC + workflow_dispatch: + +jobs: + lock: + runs-on: ubuntu-latest + + steps: + - uses: dessant/lock-threads@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + pr-inactive-days: 150 + + pr-comment: > + This pull request has been automatically locked because it has been closed for 150 days. + Please open a new PR if you want to continue the work. + + exclude-pr-labels: "keep-open,no-lock" diff --git a/.github/workflows/stale.yaml.yml b/.github/workflows/stale.yaml similarity index 77% rename from .github/workflows/stale.yaml.yml rename to .github/workflows/stale.yaml index 6ab2ada3800..9c7e1704401 100644 --- a/.github/workflows/stale.yaml.yml +++ b/.github/workflows/stale.yaml @@ -14,4 +14,5 @@ jobs: days-before-stale: 60 days-before-close: 90 stale-issue-message: 'This issue has been automatically marked as stale due to inactivity for past 2 months. It will be closed in next 30 days if no further activity occurs.' - close-issue-message: 'Closing this issue due to prolonged inactivity.' + close-issue-message: 'Closing this issue as inactive for 30 days after marking stale.' + operations-per-run: 10 diff --git a/build/target-repository/.github/workflows/lock.yaml b/build/target-repository/.github/workflows/lock.yaml new file mode 100644 index 00000000000..28751b74fe0 --- /dev/null +++ b/build/target-repository/.github/workflows/lock.yaml @@ -0,0 +1,23 @@ +name: "Lock closed issues" + +on: + schedule: + - cron: "0 3 * * *" # every day at 03:00 UTC + workflow_dispatch: + +jobs: + lock: + runs-on: ubuntu-latest + + steps: + - uses: dessant/lock-threads@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + issue-inactive-days: 150 + + issue-comment: > + This issue has been automatically locked because it has been closed for 150 days. + Please open a new issue if you have a similar problem. + + exclude-issue-labels: "keep-open,no-lock" diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/IntegerTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/IntegerTypeMapper.php index cfc94ee3454..4762a6e4f41 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/IntegerTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/IntegerTypeMapper.php @@ -7,7 +7,6 @@ use PhpParser\Node; use PhpParser\Node\Identifier; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; -use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\IntegerType; use PHPStan\Type\Type; use Rector\Php\PhpVersionProvider; @@ -32,7 +31,7 @@ public function getNodeClass(): string /** * @param IntegerType $type */ - public function mapToPHPStanPhpDocTypeNode(Type $type): TypeNode + public function mapToPHPStanPhpDocTypeNode(Type $type): IdentifierTypeNode { // note: cannot be handled by PHPStan as uses explicit values return new IdentifierTypeNode('int'); diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/ThisTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/ThisTypeMapper.php index 024a37a03fe..fb2a26b3938 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/ThisTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/ThisTypeMapper.php @@ -4,7 +4,6 @@ namespace Rector\PHPStanStaticTypeMapper\TypeMapper; -use PhpParser\Node; use PhpParser\Node\Name; use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\ThisType; @@ -32,7 +31,7 @@ public function mapToPHPStanPhpDocTypeNode(Type $type): TypeNode /** * @param ThisType $type */ - public function mapToPhpParserNode(Type $type, string $typeKind): Node + public function mapToPhpParserNode(Type $type, string $typeKind): Name { return new Name('self'); } diff --git a/src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php b/src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php index fd162b7cfc0..3e40a981f7f 100644 --- a/src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php +++ b/src/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php @@ -12,7 +12,6 @@ use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\NullableType; use PhpParser\Node\UnionType as PhpParserUnionType; -use PHPStan\PhpDocParser\Ast\Type\TypeNode; use PHPStan\Type\ArrayType; use PHPStan\Type\MixedType; use PHPStan\Type\NeverType; @@ -55,7 +54,7 @@ public function getNodeClass(): string /** * @param UnionType $type */ - public function mapToPHPStanPhpDocTypeNode(Type $type): TypeNode + public function mapToPHPStanPhpDocTypeNode(Type $type): BracketsAwareUnionTypeNode { $unionTypesNodes = []; $existingTypes = []; diff --git a/src/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php b/src/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php index 3ab44da4c80..f2c9660129d 100644 --- a/src/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php +++ b/src/PhpAttribute/AnnotationToAttributeMapper/ArrayAnnotationToAttributeMapper.php @@ -41,7 +41,7 @@ public function isCandidate(mixed $value): bool /** * @param mixed[] $value */ - public function map($value): Expr + public function map($value): Array_ { $arrayItems = []; diff --git a/src/PhpAttribute/AnnotationToAttributeMapper/StringAnnotationToAttributeMapper.php b/src/PhpAttribute/AnnotationToAttributeMapper/StringAnnotationToAttributeMapper.php index fa3a48149aa..726a66eaf46 100644 --- a/src/PhpAttribute/AnnotationToAttributeMapper/StringAnnotationToAttributeMapper.php +++ b/src/PhpAttribute/AnnotationToAttributeMapper/StringAnnotationToAttributeMapper.php @@ -4,7 +4,6 @@ namespace Rector\PhpAttribute\AnnotationToAttributeMapper; -use PhpParser\Node\Expr; use PhpParser\Node\Scalar\String_; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface; @@ -22,7 +21,7 @@ public function isCandidate(mixed $value): bool /** * @param string $value */ - public function map($value): Expr + public function map($value): String_ { if (str_contains($value, "'") && ! str_contains($value, "\n")) { $kind = String_::KIND_DOUBLE_QUOTED; diff --git a/src/PhpAttribute/AnnotationToAttributeMapper/StringNodeAnnotationToAttributeMapper.php b/src/PhpAttribute/AnnotationToAttributeMapper/StringNodeAnnotationToAttributeMapper.php index 146e35e8619..05f7298c610 100644 --- a/src/PhpAttribute/AnnotationToAttributeMapper/StringNodeAnnotationToAttributeMapper.php +++ b/src/PhpAttribute/AnnotationToAttributeMapper/StringNodeAnnotationToAttributeMapper.php @@ -4,7 +4,6 @@ namespace Rector\PhpAttribute\AnnotationToAttributeMapper; -use PhpParser\Node\Expr; use PhpParser\Node\Scalar\String_; use Rector\BetterPhpDocParser\PhpDoc\StringNode; use Rector\NodeTypeResolver\Node\AttributeKey; @@ -23,7 +22,7 @@ public function isCandidate(mixed $value): bool /** * @param StringNode $value */ - public function map($value): Expr + public function map($value): String_ { return new String_($value->value, [ AttributeKey::KIND => $value->getAttribute(AttributeKey::KIND), diff --git a/src/StaticTypeMapper/PhpParser/IntersectionTypeNodeMapper.php b/src/StaticTypeMapper/PhpParser/IntersectionTypeNodeMapper.php index f2add6c45e7..b3b2873817f 100644 --- a/src/StaticTypeMapper/PhpParser/IntersectionTypeNodeMapper.php +++ b/src/StaticTypeMapper/PhpParser/IntersectionTypeNodeMapper.php @@ -8,7 +8,6 @@ use PhpParser\Node\Name; use PhpParser\Node\Name\FullyQualified; use PHPStan\Type\IntersectionType; -use PHPStan\Type\Type; use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface; /** @@ -31,7 +30,7 @@ public function getNodeType(): string /** * @param Node\IntersectionType $node */ - public function mapToPHPStan(Node $node): Type + public function mapToPHPStan(Node $node): IntersectionType { $types = []; foreach ($node->types as $intersectionedType) { diff --git a/src/StaticTypeMapper/PhpParser/StringNodeMapper.php b/src/StaticTypeMapper/PhpParser/StringNodeMapper.php index 496e238c7f6..39d31288f82 100644 --- a/src/StaticTypeMapper/PhpParser/StringNodeMapper.php +++ b/src/StaticTypeMapper/PhpParser/StringNodeMapper.php @@ -7,7 +7,6 @@ use PhpParser\Node; use PhpParser\Node\Scalar\String_; use PHPStan\Type\StringType; -use PHPStan\Type\Type; use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface; /** @@ -23,7 +22,7 @@ public function getNodeType(): string /** * @param String_ $node */ - public function mapToPHPStan(Node $node): Type + public function mapToPHPStan(Node $node): StringType { return new StringType(); }