deprecation fix

This commit is contained in:
Andy Miller 2023-05-09 11:18:36 -06:00
parent 36afa9d848
commit 3cf67cb2fd
No known key found for this signature in database
GPG Key ID: 9F2CF38AEBDB0AE0
2 changed files with 16 additions and 2 deletions

View File

@ -13,6 +13,7 @@
* Comment out `files-upload` deprecated message as this is not going to be removed
* Added various public `Twig` class variables used by admin to address deprecated messages for PHP 8.2+
* Added `parse_url` to list of PHP functions supported in Twig Extension
* Added support for dynamic functions in `Parsedown` to stop deprecation messages in PHP 8.2+
# v1.7.40
## 03/22/2023

View File

@ -25,7 +25,7 @@ trait ParsedownGravTrait
public $completable_blocks = [];
/** @var array */
public $continuable_blocks = [];
public $plugins = [];
/** @var Excerpts */
protected $excerpts;
@ -293,7 +293,12 @@ trait ParsedownGravTrait
#[\ReturnTypeWillChange]
public function __call($method, $args)
{
if (isset($this->{$method}) === true) {
if (isset($this->plugins[$method]) === true) {
$func = $this->plugins[$method];
return call_user_func_array($func, $args);
} elseif (isset($this->{$method}) === true) {
$func = $this->{$method};
return call_user_func_array($func, $args);
@ -302,5 +307,13 @@ trait ParsedownGravTrait
return null;
}
public function __set($name, $value)
{
if (is_callable($value)) {
$this->plugins[$name] = $value;
}
}
}