Fix implicitly nullable parameters deprecated in PHP 8.4 - #165
Open
peterschade wants to merge 1 commit into
Open
Fix implicitly nullable parameters deprecated in PHP 8.4#165peterschade wants to merge 1 commit into
peterschade wants to merge 1 commit into
Conversation
Explicitly mark nullable parameters (`?Type`) instead of relying on the implicit nullability of a typed parameter with a `null` default, which is deprecated as of PHP 8.4 and emits a deprecation notice at runtime. Affected signatures: - QueryBuilderHandler::__construct(), delete(), getEvent() - Exception::__construct(), create() - BaseAdapter::delete() - Sqlserver::delete() - NestedCriteria::whereHandler()
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.
Summary
PHP 8.4 deprecates implicitly nullable parameters — a typed parameter with a
nulldefault (e.g.Connection $connection = null) now emits:This surfaces as a runtime deprecation notice the moment a
QueryBuilderHandleris constructed (and in several other call paths). This PR marks every such parameter explicitly nullable (?Type).Changes
Explicit
?added to these signatures:QueryBuilderHandler::__construct(?Connection $connection = null)QueryBuilderHandler::delete(?array $columns = null)QueryBuilderHandler::getEvent(string $name, ?string $table = null)Exception::__construct(..., ?Throwable $previous = null, ?QueryObject $query = null)Exception::create(\Exception $e, ?string $adapterName = null, ?QueryObject $query = null)BaseAdapter::delete(array $statements, ?array $columns = null)Sqlserver::delete(array $statements, ?array $columns = null)NestedCriteria::whereHandler($key, ?string $operator = null, ...)Notes
?Typeis valid syntax since PHP 7.1, and the library already requires PHP >= 7.1.