Skip to content

[SPEC-003] Array callable [Class::class, 'método'] com método de instância (feat) - #22

Merged
code-cfernandes merged 1 commit into
mainfrom
feat/SPEC-003-array-callable
Oct 9, 2026
Merged

code-cfernandes merged 1 commit into
mainfrom
feat/SPEC-003-array-callable

Conversation

@code-cfernandes

Copy link
Copy Markdown
Member

Resumo

Permite array callables [Classe::class, 'métodoDeInstância']: a instância é
resolvida via container (DI) quando registrada, com fallback para instanciação
lazy. O CallableResolver do core fica consistente com o do core-routing.

Mudanças

  • src/Core/Application.php: novo resolveHandler() aplicado em get/post/put/delete/patch.
  • src/Utils/CallableResolver.php: método de instância via nome de classe → closure lazy.
  • composer.json: pivotphp/core-routing: ^1.0 → ^1.2 (necessário p/ lazy callable + {id}).
  • docs/technical/routing/SYNTAX_GUIDE.md: documenta a nova forma de handler.
  • Testes: CallableResolverTest atualizado + ArrayCallableContainerResolutionTest (DI + fallback).

Como testar

composer update pivotphp/core-routing
vendor/bin/phpunit --testsuite=CI
vendor/bin/phpunit --testsuite=Integration
composer cs:check
vendor/bin/phpstan analyse src/Core/Application.php src/Utils/CallableResolver.php --level=9

Versionamento (SemVer)

MINOR → 2.2.0 (agrupado com as demais SPECs do core; CHANGELOG no release).

Documentação

SYNTAX_GUIDE.md atualizado (gate doc-review aprovado).

Instruções de merge

- Application::resolveHandler() resolves [Class::class, 'métodoDeInstância']
  through the DI container; falls back to lazy instantiation otherwise.
- CallableResolver now returns a lazy closure for instance methods referenced
  by class name (consistent with core-routing).
- Bump pivotphp/core-routing to ^1.2 (lazy callable + brace params support).
- Update routing syntax documentation.

Refs: SPEC-003 (#17)
@code-cfernandes
code-cfernandes merged commit 6bd5ead into main Oct 9, 2026
5 of 6 checks passed
@code-cfernandes
code-cfernandes deleted the feat/SPEC-003-array-callable branch October 9, 2026 01:55
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