Deprecated PHP 8.4 Warnings: Nullable Parameters Need Explicit Type Declarations
Hello,
I'm currently using your excellent Outscraper package in a Laravel project, and I've noticed some deprecation warnings when running with PHP 8.4. These warnings are related to implicit nullable parameters that need to be explicitly typed according to PHP 8.4's stricter type system.
The affected areas are:
- In
outscraper.php:- Line 22: Constructor parameter
$api_key - Line 108:
google_search()method parameters$regionand$webhook - ...
- Line 22: Constructor parameter
Current warnings:
OutscraperClient::__construct(): Implicitly marking parameter $api_key as nullable is deprecated
OutscraperClient::google_search(): Implicitly marking parameter $region as nullable is deprecated
OutscraperClient::google_search(): Implicitly marking parameter $webhook as nullable is deprecated
To resolve these warnings, the parameters would need to be explicitly marked as nullable using the ? prefix. For example:
public function __construct(?string $api_key)
public function google_search(..., ?string $region, ?string $webhook)
Would you consider updating these method signatures to support PHP 8.4's type system requirements? This would help users who are upgrading their applications to use newer PHP versions. Thank you for maintaining this useful package!
It would be great to get php 8.4 support
patching this for now with https://github.com/symplify/vendor-patches was a smooth and easy fix for me
fixed in the latest version