Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.4 deprecation notices: "Implicitly marking parameter $xxx as nullable is deprecated" #117

Open
heldchen opened this issue Jan 16, 2025 · 1 comment

Comments

@heldchen
Copy link

A clear and concise description of what the bug is.

Pre-requisites

  1. lastest stable composer
  2. latest vaimo/composer-patches
  3. php 8.4

To Reproduce

$ ./composer.phar info vaimo/composer-patches
Deprecation Notice: Vaimo\ComposerPatches\Factories\BootstrapFactory::create(): Implicitly marking parameter $listResolver as nullable is deprecated, the explicit nullable type must be used instead in /srv/projects/php/php-core/src/lib/vendor/vaimo/composer-patches/src/Factories/BootstrapFactory.php:37
Deprecation Notice: Vaimo\ComposerPatches\Factories\BootstrapFactory::create(): Implicitly marking parameter $outputStrategy as nullable is deprecated, the explicit nullable type must be used instead in /srv/projects/php/php-core/src/lib/vendor/vaimo/composer-patches/src/Factories/BootstrapFactory.php:37
Deprecation Notice: Vaimo\ComposerPatches\Bootstrap::__construct(): Implicitly marking parameter $listResolver as nullable is deprecated, the explicit nullable type must be used instead in /srv/projects/php/php-core/src/lib/vendor/vaimo/composer-patches/src/Bootstrap.php:63
Deprecation Notice: Vaimo\ComposerPatches\Bootstrap::__construct(): Implicitly marking parameter $outputStrategy as nullable is deprecated, the explicit nullable type must be used instead in /srv/projects/php/php-core/src/lib/vendor/vaimo/composer-patches/src/Bootstrap.php:63
name     : vaimo/composer-patches
descrip. : Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.
keywords : Fixes, back-ports, backports, bulk patches, bundled patches, composer command, composer plugin, configurable patch applier, development patches, downloaded patches, environment flags, hot-fixes, hotfixes, indirect restrictions, maintenance, maintenance tools, multi-version patches, multiple formats, os-specific config, package bug-fix, package patches, patch branching, patch command, patch description, patch exclusion, patch header, patch meta-data, patch resolve, patch search, patch skipping, patcher, patching, plugin, remote patch files, resolve patches, skipped packages, tools, utilities, utility, utils, version restriction
versions : * 5.2.0
released : 2024-04-18, 8 months ago
type     : composer-plugin
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : 
source   : [git] https://github.com/vaimo/composer-patches.git ad249f8851902a71f0bdd2f03a89bb8956049ec5
dist     : [zip] https://api.github.com/repos/vaimo/composer-patches/zipball/ad249f8851902a71f0bdd2f03a89bb8956049ec5 ad249f8851902a71f0bdd2f03a89bb8956049ec5
path     : /srv/projects/php/php-core/src/lib/vendor/vaimo/composer-patches
names    : vaimo/composer-patches

support
docs : https://github.com/vaimo/composer-patches
issues : https://github.com/vaimo/composer-patches/issues
source : https://github.com/vaimo/composer-patches

autoload
psr-4
Vaimo\ComposerPatches\ => src

requires
composer-plugin-api ^1.0 || ^2.0
composer-runtime-api ^1.0 || ^2.0
ext-json *
loophp/phposinfo ^1.6
php >=7.0.0
seld/jsonlint ^1.7.1
vaimo/topological-sort ^1.0

requires (dev)
composer/composer ^1.0 || ^2.0
phpcompatibility/php-compatibility >=9.1.1
phpmd/phpmd >=2.6.0
sebastian/phpcpd >=1.4.3
squizlabs/php_codesniffer >=2.9.2
vaimo/composer-changelogs ^1.0.0
vaimo/composer-patches-proxy 1.0.0

conflicts
cweagans/composer-patches *

Expected
no deprecation notices are outputted

Actual
5 deprecation notices are outputted

Notes
null-able parameters must be marked explicitly if they have a type defined.
for example ListResolver $listResolver = null must be updated to ListResolver|null $listResolver = null or ?ListResolver $listResolver = null

@heldchen
Copy link
Author

heldchen commented Jan 16, 2025

in phpstorm, I used this in "Replace in files" for my custom code to find single-line functions that need updating:

from: ((, |\()(?![^, ]*(\?|null|mixed)[^, ]*)[^, ]+) (\$[^ ,\n]+ = null) (with regex-option active)
to: $1|null $4

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

No branches or pull requests

1 participant