Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

PHP 8.4 compatibility #77

Open
mcaskill opened this issue Sep 23, 2024 · 0 comments
Open

PHP 8.4 compatibility #77

mcaskill opened this issue Sep 23, 2024 · 0 comments

Comments

@mcaskill
Copy link

mcaskill commented Sep 23, 2024

Describe the bug

While doing some application testing in PHP 8.4-dev, I launched Alfred to use mattstein/alfred-tower-bookmarks-workflow and the following deprecation notices were logged:

PHP Deprecated:  Alfred\Workflows\Workflow::env(): Implicitly marking parameter $key as nullable is deprecated, the explicit nullable type must be used instead in ~/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.***/vendor/joetannenbaum/alfred-workflow/src/Workflow.php on line 98
PHP Deprecated:  CFPropertyList\CFPropertyList::add(): Implicitly marking parameter $value as nullable is deprecated, the explicit nullable type must be used instead in ~/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.***/vendor/rodneyrehm/plist/src/CFPropertyList/CFPropertyList.php on line 526
PHP Deprecated:  CFPropertyList\CFDictionary::add(): Implicitly marking parameter $value as nullable is deprecated, the explicit nullable type must be used instead in ~/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.***/vendor/rodneyrehm/plist/src/CFPropertyList/CFDictionary.php on line 89
PHP Deprecated:  CFPropertyList\CFArray::add(): Implicitly marking parameter $value as nullable is deprecated, the explicit nullable type must be used instead in ~/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.***/vendor/rodneyrehm/plist/src/CFPropertyList/CFArray.php on line 87

For your classes, the fixes are simple (I have not checked other occurrences):

CFArray:

- public function add(CFType $value = null)
+ public function add(?CFType $value = null)

CFDictionary:

- public function add($key, CFType $value = null)
+ public function add($key, ?CFType $value = null)

CFPropertyList:

- public function add(CFType $value = null)
+ public function add(?CFType $value = null)

To Reproduce

Steps to reproduce the behavior:

  1. Install PHP 8.4
  2. Install Alfred
  3. Install mattstein/alfred-tower-bookmarks-workflow
  4. Launch Alfred
  5. Use Tower workflow keyword ("tower")
  6. Consult PHP error log

Expected behavior

Not to see deprecation notices in the error log.

Related issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant