Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add Rector for automated code modernisation and refactoring

Đang mở
#24 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
38/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
php
Lĩnh vực
tooling

Hướng nghiên cứu

Start by reading composer.json and the constructor in src/Client.php, then check Rector’s PHP 8.1 rules against the SDK’s PHP 8.0 support. Decide which rule sets are safe and whether CI should run Rector; done means the dependency, configuration, and dry-run and fix scripts are defined with that compatibility decision documented.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

Motivation

As PHP evolves and the SDK targets PHP 8.0+, there are patterns that could be automatically modernised: constructor promotion, match expressions, named arguments, and more.

Example

Current code in src/Client.php:

public function __construct(?string $token = null, ...)
{
    $this->token = $token ?? getenv('OPEN_API_TOKEN');
    ...
}

With Rector + constructor promotion this could become:

public function __construct(
    private ?string $token = null,
    ...
) {
    $this->token ??= getenv('OPEN_API_TOKEN');
}

Proposal

  • Add rector/rector to require-dev
  • Configure a rector.php with the LevelSetList::UP_TO_PHP_81 preset
  • Add a composer run rector script for dry-run and composer run rector-fix to apply

Open questions

  • Should Rector run in CI as a check-only step, or only locally?
  • Which rule sets are safe to apply without risking breaking changes for consumers on PHP 8.0?
Ngôn ngữ chính
PHP
Star
20
Fork
3
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của openapi/openapi-php-sdk

Tất cả issue của openapi/openapi-php-sdk

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.