Repository navigation
#181 - Tests: detect the deprecations - #184
Merged
Merged
Conversation
- PHPUnit fails on deprecations (failOnDeprecation, details displayed), the silenced ones included (ignoreSuppressionOfDeprecations). The new tests/bootstrap.php enables the Symfony DebugClassLoader (@Final, @internal, return types). - Deprecations fixed in src: - ProcessExecutionRepository::getLastProcessExecution(): \SortDirection enum when doctrine/orm accepts it (3.7+, string directions deprecated there), the string otherwise (#152). - ProcessExecutionRepository::hasLogs(): count the log records without an arbitrary join (WITH deprecated by doctrine/orm 3.7), same result. - Date filters (createdAt of the log records, startDate of the process executions): single_text widget, not configuring it is deprecated by Symfony 6.4 (EasyAdmin replaces the value_type_options of its filter). - User::eraseCredentials() marked #[\Deprecated], as required by Symfony 7.3 (polyfilled before PHP 8.4). - Test application: the processes reference the tasks by code (task:) with process-bundle 5.4, by service before; failing processes fail at execution instead of initialization (deprecated by process-bundle); Symfony 7.0 defaults set explicitly (deprecated when missing with Symfony 6.4); property_info.with_constructor_extractor from Symfony 7.3; security.erase_credentials disabled before Symfony 7.3 (Symfony 6.4 calls the #[\Deprecated] eraseCredentials(), deprecation with PHP 8.4+). - Tests: expected deprecations captured (deprecated route alias, deprecated eraseCredentials()), HTML5 email validation, missing UsesClass. - masterminds/html5 ^2.7.5 in dev (2.6 triggers a PHP 8.1 deprecation). - Rector does not remove the conditions on the Symfony version of the test kernel (always true with the installed version only). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 of 4 tasks
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.
Description
Fixes #181 (bridge part of cleverage/process-bundle#303), fixes #152. The tests already boot a kernel with process-bundle: this PR adds the deprecation detection, as in the other bridges (e.g. cleverage/rest-process-bundle#66), and fixes the deprecations it reveals.
Deprecation detection
phpunit.xml.dist:failOnDeprecation,displayDetailsOnTestsThatTriggerDeprecations,<source ignoreSuppressionOfDeprecations="true">(deprecations triggered withtrigger_deprecation()are reported).tests/bootstrap.php:DebugClassLoader::enable().Deprecations fixed in
src/(no behavior change)ProcessExecutionRepository::getLastProcessExecution(): doctrine/orm 3.7 deprecates the string sort directions (Doctrine ORM 3.7 deprecation: string sort direction inProcessExecutionRepository#152). The\SortDirectionenum is passed whenorderBy()accepts it (checked once by reflection), the string otherwise.ProcessExecutionRepository::hasLogs(): "Using WITH for the join condition of arbitrary joins is deprecated" (doctrine/orm 3.7): the log records are counted with a simpleSELECT count(lr.id) FROM LogRecord lr WHERE lr.processExecution = :processExecution, same result with ORM 2 and 3.createdAtof the log records,startDateof the process executions): "Not configuring the widget option of form type datetime is deprecated" (Symfony 6.4). EasyAdmin (up to 5.7) replaces thevalue_type_optionsof its date filter type and loses itssingle_textwidget: it is set on the filters. Nothing changes with Symfony 7+ (single_textis the default there); with Symfony 6.4, the filter is a single field instead of select boxes.User::eraseCredentials()is marked#[\Deprecated], as required by Symfony 7.3 ("Implementing eraseCredentials() is deprecated",AuthenticatorManager), which then no longer calls it (symfony/polyfill-php84provides the attribute before PHP 8.4). Trade-off: Symfony 6.4 still calls it, so with Symfony 6.4 and PHP 8.4+ PHP triggers a deprecation at each login; it can be avoided withsecurity.erase_credentials: false(the method is empty). Documented in the CHANGELOG.Test application
tests/App/config/processes.yaml, written withtask: <code>;TestKernelconverts them toservice:with process-bundle < 5.4 (task:does not exist there,service:is deprecated in 5.4).test.failing/test.notification_failingnow fail at execution (missing file) instead of initialization, which process-bundle deprecates (#222 of the core).handle_all_throwables,php_errors.log,uidUUID versions, session handler and cookies;property_info.with_constructor_extractorfrom Symfony 7.3;security.erase_credentials: falsebefore Symfony 7.3 (see above).process_listroute is captured and checked,eraseCredentials()called with its deprecation silenced, HTML5 email validation inUserCreateCommandTest, missing#[UsesClass]inLogRecordCrudTest, new failure message inHttpProcessExecuteTest.masterminds/html5^2.7.5in dev: 2.6 (lowest) triggers a PHP 8.1 deprecation.rector.phpskipsRemoveAlwaysTrueIfConditionRectorfortests/App/TestKernel.php(conditions on the Symfony version, always true with the installed version only).Checked in the container (453 tests): highest (PHP 8.5, Symfony 8.1, PHPUnit 13), lowest (PHP 8.2, Symfony 6.4.33, PHPUnit 10.5), Symfony 6.4.48 on PHP 8.2 and 8.5, Symfony 7.4, process-bundle
dev-main: no deprecation, no risky test; PHPStan, PHP-CS-Fixer and Rector OK.Requirements
Breaking changes
None. With Symfony 6.4 and PHP 8.4+,
User::eraseCredentials()now triggers a PHP deprecation when called (see above).🤖 Generated with Claude Code