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

Deprecated PHP 8.4 Warnings: Nullable Parameters Need Explicit Type Declarations #7

Open
wemadefoxnever opened this issue Feb 15, 2025 · 0 comments

Comments

@wemadefoxnever
Copy link

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:

  1. In outscraper.php:
    • Line 22: Constructor parameter $api_key
    • Line 108: google_search() method parameters $region and $webhook
    • ...

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!

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