laravel-handlebars icon indicating copy to clipboard operation
laravel-handlebars copied to clipboard

Fix PHP 8.2 deprecations

Open kohenkatz opened this issue 1 year ago • 0 comments

'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 avatar Jan 14 '24 19:01 kohenkatz