Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add Rector for automated code modernisation and refactoring

Aperta
#24 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
php
Ambito
tooling

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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?
Lingua principale
PHP
Stelle
20
Fork
3
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openapi/openapi-php-sdk

Tutte le issue di openapi/openapi-php-sdk

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.