Skip to content

chore: support nette/forms 3.3.0, require PHP 8.3 - #129

Merged
dakorpar merged 2 commits into
masterfrom
fix/118-nette-forms-3.3
Aug 14, 2026
Merged

chore: support nette/forms 3.3.0, require PHP 8.3#129
dakorpar merged 2 commits into
masterfrom
fix/118-nette-forms-3.3

Conversation

@dakorpar

@dakorpar dakorpar commented Aug 14, 2026

Copy link
Copy Markdown
Member

Closes #118.

What broke

Installing nette/forms 3.3.0 made the library unusable outright:

Declaration of Contributte\FormsBootstrap\Traits\BootstrapContainerTrait::addSubmit(string $name, $caption = null): SubmitButton
must be compatible with Nette\Forms\Container::addSubmit(string $name, Stringable|string|null $caption = null, ?Closure $onSubmit = null): SubmitButton

Container::addSubmit() gained a third ?Closure $onSubmit argument in 3.3.0, so every BootstrapForm / BootstrapContainer was a fatal error at class-load time.

Beyond that, 3.3.0 pulls in Nette\SmartObject on BaseControl, Container and Form, and re-tags several magic properties as @property-deprecated. Two of them are ones this library read:

  • BaseControl::$captiongetCaption() — read in BootstrapRenderer::renderLabel(), CheckboxInput::getControl(), ButtonInput::getControl()
  • Form::$renderergetRenderer() — read in BootstrapRow::render() and BootstrapCell::render()

Those emitted 14 distinct E_USER_DEPRECATED notices across 53 tests.

Changes

  • composer.json: nette/forms 3.2.93.3.0, keeping the repo's exact-pin convention.
  • BootstrapContainerTrait::addSubmit() takes ?Closure $onSubmit and appends it to the button's onClick, matching what the parent does.
  • The five deprecated magic-property reads become getCaption() / getRenderer() calls. Both getters have existed since well before 3.2.9, so this is not a 3.3-only construct.

Nothing else in the 3.2.9 → 3.3.0 diff touches what this library overrides. Container::getControls() changed its return type from \Iterator to iterable, but the renderer only ever foreaches over it; the getValues(true) and getOption($key, $default) deprecated forms that were removed are not used here.

Tests

  • testAddSubmitTakesAnOnSubmitHandler / testAddSubmitWithoutHandlerRegistersNoClickListener in tests/Traits/BootstrapContainerTraitTest.php cover the new argument.
  • testAddSubmitHandlerIsCalledWhenThatButtonSubmitsTheForm in tests/E2E/FormSubmissionTest.php drives a whole request through a real presenter and asserts the handler actually fires with the submitted values.

make tests (158 tests, 242 assertions, no deprecations), make phpstan and make cs all pass.

Note for whoever merges: the same source also passes tests and PHPStan unchanged against 3.2.9, so widening the constraint to ^3.2.9 is available if supporting both lines is ever wanted — the exact pin here is deliberate, per the convention every previous bump followed.

🤖 Generated with Claude Code


Update: PHP 8.3 minimum + dependency bumps

nette/forms 3.3.0 — along with nette/application 3.3.0 and nette/component-model 4.0.1, which it pulls in — declares php: 8.3 - 8.5. PHP 8.2 therefore cannot be supported on this line at all, which is what the --ignore-platform-reqs CI job was papering over.

  • composer.json: php: ">=8.2"">=8.3", and the exact nette/forms pin relaxed to ^3.3.0 so patch releases are picked up.
  • phpunit/phpunit ^11.5^12.5. PHPUnit 12 requires php >=8.3, so this was blocked until now. phpunit.xml points at the 12.5 schema, and the createMock(Presenter::class) calls become createStub(...) — PHPUnit 12 emits a notice for a mock with no configured expectations, and these presenters are pure stand-in parents.
  • CI: the 8.2 jobs are gone. qa, static analysis, coverage and --prefer-lowest all run on 8.3; the test matrix is 8.3 / 8.4 / 8.5. The --ignore-platform-reqs include is dropped.
  • README version table: dev row ^0.9 now reads ^8.3.

Everything else was already at its newest installable release — the remaining outdated transitives (squizlabs/php_codesniffer 4.x, slevomat/coding-standard 8.31) are held back by contributte/qa ^0.4, whose only newer version is 0.5.x-dev.

Verified on PHP 8.3.31: make tests (158 tests, 242 assertions), make phpstan, make cs all pass, and the --prefer-lowest resolution (forms 3.3.0 + application 3.2.0 + component-model 3.2.0) passes the suite too.

This is a breaking change for consumers on PHP 8.2 — intended for the next major.

dakorpar and others added 2 commits August 14, 2026 17:34
nette/forms 3.3.0 changes things this library builds on top of:

- Container::addSubmit() grew a third `?Closure $onSubmit` argument, which
  made BootstrapContainerTrait's override an incompatible declaration and
  crashed the whole library with a fatal error on load. The override takes
  the argument and wires it onto the button's onClick, as the parent does.
- BaseControl::$caption and Form::$renderer became @property-deprecated,
  so the five places reading them magically now call getCaption() and
  getRenderer() instead. The test run is clean of deprecations again.

Closes #118

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nette/forms 3.3.0 (and nette/application 3.3.0, nette/component-model
4.0.1) only support PHP 8.3 - 8.5, so PHP 8.2 can no longer be
supported. Raise the minimum to 8.3 and relax the exact 3.3.0 pin to
^3.3.0 so patch releases are picked up.

With 8.2 gone, phpunit ^12.5 (php >=8.3) becomes installable — upgrade
it, point phpunit.xml at the 12.5 schema and swap the presenter
createMock() calls for createStub(), which is what PHPUnit 12 expects
for a test double with no configured expectations.

CI drops the 8.2 jobs (and the --ignore-platform-reqs workaround that
only existed to force forms 3.3 onto an unsupported PHP); qa, static
analysis, coverage and --prefer-lowest now run on 8.3.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@dakorpar dakorpar changed the title chore: support nette/forms 3.3.0 chore: support nette/forms 3.3.0, require PHP 8.3 Aug 14, 2026
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.05%. Comparing base (c9300d6) to head (e616b87).

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #129   +/-   ##
=========================================
  Coverage     97.05%   97.05%           
- Complexity      308      309    +1     
=========================================
  Files            25       25           
  Lines           984      986    +2     
=========================================
+ Hits            955      957    +2     
  Misses           29       29           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dakorpar
dakorpar merged commit 87fa3b3 into master Aug 14, 2026
11 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.

Support for nette/forms 3.3.0

1 participant