gharlan / alfred-github-workflow

GitHub Workflow for Alfred
MIT License
2.89k stars 147 forks source link

PHP Deprecated Warning: Add Explicit Nullable Type for $curl Parameter #149

Open romantech opened 1 week ago

romantech commented 1 week ago

Description:

Running the Alfred GitHub workflow on PHP 8.1+ triggers deprecation warnings:

PHP Deprecated: Workflow::request(): Implicitly marking parameter $curl as nullable is deprecated in workflow.php on line 137
PHP Deprecated: Workflow::requestCache(): Implicitly marking parameter $curl as nullable is deprecated in workflow.php on line 175
PHP Deprecated: Workflow::requestApi(): Implicitly marking parameter $curl as nullable is deprecated in workflow.php on line 299

This is due to the $curl parameter being implicitly nullable. PHP 8.1 requires explicit declaration using the ? operator.

Proposed Solution:

Update the method signatures to explicitly mark $curl as nullable. Example:

public static function request(string $url, ?Curl $curl = null, $callback = null, bool $withAuthorization = true)

Similar updates are needed for requestCache() and requestApi().

Environment:

steveoh commented 1 week ago

This is breaking my workflow also. thanks for the pr @romantech ❤️