Skip to content

fix: make nullable parameter types explicit for PHP 8.1+ compatibility#73

Merged
butschster merged 1 commit into
butschster:3.xfrom
ihxnnxs:fix/php81-deprecations
May 28, 2025
Merged

fix: make nullable parameter types explicit for PHP 8.1+ compatibility#73
butschster merged 1 commit into
butschster:3.xfrom
ihxnnxs:fix/php81-deprecations

Conversation

@ihxnnxs

@ihxnnxs ihxnnxs commented Apr 30, 2025

Copy link
Copy Markdown
Contributor

When running the application on PHP 8.1+, the following deprecation warnings appear:

PHP Deprecated:  Butschster\Head\MetaTags\Concerns\ManageTitle::setTitle(): Implicitly marking parameter $maxLength as nullable is deprecated, the explicit nullable type must be used instead
PHP Deprecated:  Butschster\Head\Contracts\MetaTags\MetaInterface::setTitle(): Implicitly marking parameter $maxLength as nullable is deprecated, the explicit nullable type must be used instead
PHP Deprecated:  Butschster\Head\Packages\Manager::create(): Implicitly marking parameter $callback as nullable is deprecated, the explicit nullable type must be used instead

These warnings are caused by parameters that are nullable (= null) but not explicitly typed with a nullable type (?type). This PR resolves the warnings by explicitly declaring the types as nullable, ensuring compatibility with PHP 8.1+ while remaining backward-compatible with PHP 8.0.

@butschster butschster merged commit 4800e22 into butschster:3.x May 28, 2025
3 checks passed
@butschster butschster self-assigned this May 28, 2025
@butschster butschster added the enhancement New feature or request label May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants