chore: support nette/forms 3.3.0, require PHP 8.3 - #129
Merged
Conversation
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>
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
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.
Closes #118.
What broke
Installing
nette/forms3.3.0 made the library unusable outright:Container::addSubmit()gained a third?Closure $onSubmitargument in 3.3.0, so everyBootstrapForm/BootstrapContainerwas a fatal error at class-load time.Beyond that, 3.3.0 pulls in
Nette\SmartObjectonBaseControl,ContainerandForm, and re-tags several magic properties as@property-deprecated. Two of them are ones this library read:BaseControl::$caption→getCaption()— read inBootstrapRenderer::renderLabel(),CheckboxInput::getControl(),ButtonInput::getControl()Form::$renderer→getRenderer()— read inBootstrapRow::render()andBootstrapCell::render()Those emitted 14 distinct
E_USER_DEPRECATEDnotices across 53 tests.Changes
composer.json:nette/forms3.2.9→3.3.0, keeping the repo's exact-pin convention.BootstrapContainerTrait::addSubmit()takes?Closure $onSubmitand appends it to the button'sonClick, matching what the parent does.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\Iteratortoiterable, but the renderer only everforeaches over it; thegetValues(true)andgetOption($key, $default)deprecated forms that were removed are not used here.Tests
testAddSubmitTakesAnOnSubmitHandler/testAddSubmitWithoutHandlerRegistersNoClickListenerintests/Traits/BootstrapContainerTraitTest.phpcover the new argument.testAddSubmitHandlerIsCalledWhenThatButtonSubmitsTheFormintests/E2E/FormSubmissionTest.phpdrives 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 phpstanandmake csall 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.9is 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/forms3.3.0 — along withnette/application3.3.0 andnette/component-model4.0.1, which it pulls in — declaresphp: 8.3 - 8.5. PHP 8.2 therefore cannot be supported on this line at all, which is what the--ignore-platform-reqsCI job was papering over.composer.json:php: ">=8.2"→">=8.3", and the exactnette/formspin relaxed to^3.3.0so patch releases are picked up.phpunit/phpunit^11.5→^12.5. PHPUnit 12 requiresphp >=8.3, so this was blocked until now.phpunit.xmlpoints at the 12.5 schema, and thecreateMock(Presenter::class)calls becomecreateStub(...)— PHPUnit 12 emits a notice for a mock with no configured expectations, and these presenters are pure stand-in parents.--prefer-lowestall run on 8.3; the test matrix is 8.3 / 8.4 / 8.5. The--ignore-platform-reqsinclude is dropped.^0.9now reads^8.3.Everything else was already at its newest installable release — the remaining outdated transitives (
squizlabs/php_codesniffer4.x,slevomat/coding-standard8.31) are held back bycontributte/qa^0.4, whose only newer version is0.5.x-dev.Verified on PHP 8.3.31:
make tests(158 tests, 242 assertions),make phpstan,make csall pass, and the--prefer-lowestresolution (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.