try to fix an error on callable

This commit is contained in:
Jean-Christian Denis 2023-11-27 21:34:56 +01:00
parent df788d629d
commit 213e11054e
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
4 changed files with 15 additions and 7 deletions

View file

@ -1,3 +1,9 @@
myUrlHandlers 2023.11.27
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1
* Try to fix an error on callable
myUrlHandlers 2023.10.23 myUrlHandlers 2023.10.23
=========================================================== ===========================================================
* Require Dotclear 2.28 * Require Dotclear 2.28

View file

@ -1,7 +1,7 @@
# README # README
[![Release](https://img.shields.io/badge/release-2023.10.23-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/myUrlHandlers/releases) [![Release](https://img.shields.io/badge/release-2023.11.27-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/myUrlHandlers/releases)
![Date](https://img.shields.io/badge/date-2023.10.23-c44d58.svg) ![Date](https://img.shields.io/badge/date-2023.11.27-c44d58.svg)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download) [![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/myUrlHandlers) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/myUrlHandlers)
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/myUrlHandlers/src/branch/master/LICENSE) [![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/myUrlHandlers/src/branch/master/LICENSE)

View file

@ -2,10 +2,10 @@
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="myUrlHandlers"> <module id="myUrlHandlers">
<name>URL handlers</name> <name>URL handlers</name>
<version>2023.10.23</version> <version>2023.11.27</version>
<author>Alex Pirine and contributors</author> <author>Alex Pirine and contributors</author>
<desc>Change Dotclear URL handlers</desc> <desc>Change Dotclear URL handlers</desc>
<file>https://git.dotclear.watch/JcDenis/myUrlHandlers/releases/download/v2023.10.23/plugin-myUrlHandlers.zip</file> <file>https://git.dotclear.watch/JcDenis/myUrlHandlers/releases/download/v2023.11.27/plugin-myUrlHandlers.zip</file>
<da:dcmin>2.28</da:dcmin> <da:dcmin>2.28</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/myUrlHandlers/src/branch/master/README.md</da:details> <da:details>https://git.dotclear.watch/JcDenis/myUrlHandlers/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/myUrlHandlers/issues</da:support> <da:support>https://git.dotclear.watch/JcDenis/myUrlHandlers/issues</da:support>

View file

@ -27,16 +27,18 @@ class UrlDescriptor
* @param string $id The ID * @param string $id The ID
* @param string $url The URL * @param string $url The URL
* @param string $representation The representation * @param string $representation The representation
* @param ?callable $handler The callback * @param mixed $handler The callback
*/ */
public function __construct( public function __construct(
public readonly string $id, public readonly string $id,
public readonly string $url = '', public readonly string $url = '',
public readonly string $representation = '', public readonly string $representation = '',
?callable $handler = null, mixed $handler = null,
) { ) {
// As PHP does not support callable property type. // As PHP does not support callable property type.
$this->handler = $handler; if (is_callable($handler)) {
$this->handler = $handler;
}
} }
/** /**