fix(codegen): sanitiza type-hints de $ref, lint sintático fail-loud e remove spec duplicada — v3.4.1 - #33
Merged
Conversation
… remove spec duplicada — v3.4.1 - TypeMapper::resolveRef() passa pela mesma sanitização de identificador do nome de classe (novo NameMapper::phpIdentifier(), fonte única) — corrige 79 arquivos de PHP inválido em 4 namespaces de src/Generated/ - scripts/generate.php: lint sintático in-process (token_get_all TOKEN_PARSE) de todo arquivo emitido, no generate e no --check; falha listando ofensores - Sumário por spec no generate: Swagger 2.0 informativo, OpenAPI 3.x com 0 schemas vira aviso destacado (fim do skip silencioso) - Remove openapi/consumer-invoice-v3.yaml (duplicata byte-idêntica de consulta-nf-consumidor-v3.yaml) e src/Generated/ConsumerInvoiceV3/ - Regeneração completa: 576 arquivos, zero hints pontuados - Version 3.4.1 + CHANGELOG (patch: nada em runtime usa Nfe\Generated\*)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change openspec:
harden-openapi-generator(onda 2 da review OpenAPI ↔ SDK, P0-3)Por quê
O gerador emitia PHP sintaticamente inválido e falhava em silêncio: 79 arquivos em 4 namespaces de
src/Generated/(ContribuintesV241,ConsultaNfConsumidorV341,ConsumerInvoiceV341,ConsultaCteV26 — hits) carregavam type-hints com ponto, ex.:Erro de parse fatal se autoload classmap-authoritative,
opcache.preloadou análise estática do consumidor tocasse a classe. Latente porque nada em runtime usaNfe\Generated\*(e o PHPStan exclui o diretório) — por isso patch.O que muda
TypeMapper::resolveRef()agora aplica a mesma sanitização de identificador do nome de classe, via helper únicoNameMapper::phpIdentifier()(classe e hint nunca mais divergem). Cobre ref direto, nullable,oneOfe items de array.scripts/generate.phpvalida cada arquivo emitido comtoken_get_all(…, TOKEN_PARSE)in-process e falha listando os ofensores, tanto no generate quanto no--check(o CIgenerate-checkpassa a pegar PHP inválido embarcado). A classe inteira do bug vira falha de build.openapi/consumer-invoice-v3.yamlera byte-idêntica aconsulta-nf-consumidor-v3.yaml(1 linhax-displayName); saem também os 49 arquivos desrc/Generated/ConsumerInvoiceV3/. Nenhum código referenciava o namespace.generate-checkverde.Testes
TypeMapperTest(6),LinterTest(3),GeneratorSummaryTest(2)tests/Generator: 30 passed; suite completa: 275 passed (única falha local é a conhecidaCurlTransportFailurePhaseTest, ambiental — passa no CI)Validação
Mudança 100% offline (sem sondas de API — nada de rede muda).
Release
src/Version.php→ 3.4.1 dentro deste PR (release.yml confere Version vs tag). Tagv3.4.1após o merge.