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

Fix PHP 8.2 deprecations #38

Open
kohenkatz opened this issue Jan 14, 2024 · 0 comments
Open

Fix PHP 8.2 deprecations #38

kohenkatz opened this issue Jan 14, 2024 · 0 comments

Comments

@kohenkatz
Copy link
Contributor

kohenkatz commented Jan 14, 2024

'Use of "self" in callables is deprecated'

This line uses the following syntax for passing a function to array_map:

$data = array_map('self::convertObjectToArray', $data);

PHP 8.2 has deprecated this callable format, because it does not always work properly.

The following syntax should provide equivalent behavior, and is not deprecated:

$data = array_map([$this, 'convertObjectToArray'], $data);

(There are several other equivalent syntaxes, but this is the one I personally like best.)

'Creation of dynamic property ProAI\Handlebars\Compilers\HandlebarsCompiler::$options is deprecated'

This line creates an $options property on the HandlebarsCompiler object, which was not previously defined.

The class should probably have $options defined as an explicit property.

@kohenkatz kohenkatz changed the title Fix 'Deprecated: Use of "self" in callables is deprecated' Fix PHP 8.2 deprecations Jan 14, 2024
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