Skip to content

fix(phpstan): resolver 3 erros nível 8 (SMSGoError + Paginated) - #1

Merged
Gabrielmoraesp merged 1 commit into
mainfrom
fix/phpstan-code-and-paginated
Jul 1, 2026
Merged

Gabrielmoraesp merged 1 commit into
mainfrom
fix/phpstan-code-and-paginated

Conversation

@Gabrielmoraesp

Copy link
Copy Markdown
Contributor

CI estava vermelho em todos os PHP (8.1–8.4) no step PHPStan (nível 8), 3 erros:

  1. SMSGoError::$code sobrescrevia Exception::$code como readonly string → "readonly overrides readwrite" + "should not have a native type". Agora declarada sem tipo nativo/readonly, tipo string via PHPDoc, atribuída no ctor. Superfície pública ($e->code) preservada.
  2. Paginated::fromArray() retornava self<array<string,mixed>|U> mas o tipo condicional declarado é self<array<string,mixed>>|self<U>. Ramos com/sem mapper separados p/ inferência correta.

Pré-requisito para publicar o SDK no Packagist (release exige CI verde).

🤖 Generated with Claude Code

… generics)

- SMSGoError::$code sobrescrevia Exception::$code como `readonly string`, o que
  o PHPStan (e o PHP 8.4) rejeitam ("readonly overrides readwrite" + tipo nativo
  sobre propriedade herdada sem tipo). Passa a ser declarada sem tipo nativo nem
  readonly, com o tipo string via PHPDoc; atribuída no construtor.
- Paginated::fromArray() inferia self<array|U>, divergindo do retorno condicional
  self<array>|self<U>. Ramos com/sem mapper separados p/ inferência correta.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Gabrielmoraesp
Gabrielmoraesp merged commit 652750e into main Jul 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant