mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-10-28 05:58:40 -04:00
Update registerHook docs with newer PHP 8.1+ syntax for callables (#9443)
* Update registerHook docs with newer PHP 8.1+ syntax for callables * Use the correct function name for the second hook * Use correct return type for the second hook function
This commit is contained in:
1 parent
ed34f6a21d
commit
c8d859b88d
2 files changed
+6
-6
No files matched your search
@@ -146,8 +146,8 @@ final class HelloWorldExtension extends Minz_Extension
|
||||
public function init(): void {
|
||||
parent::init();
|
||||
|
||||
$this->registerHook(Minz_HookType::EntryBeforeDisplay, [$this, 'renderEntry'], 10);
|
||||
$this->registerHook(Minz_HookType::CheckUrlBeforeAdd, [self::class, 'checkUrl'], -10);
|
||||
$this->registerHook(Minz_HookType::EntryBeforeDisplay, $this->renderEntry(...), 10);
|
||||
$this->registerHook(Minz_HookType::CheckUrlBeforeAdd, self::checkUrlBeforeAdd(...), -10);
|
||||
}
|
||||
|
||||
public function renderEntry(FreshRSS_Entry $entry): FreshRSS_Entry {
|
||||
@@ -156,7 +156,7 @@ final class HelloWorldExtension extends Minz_Extension
|
||||
return $entry;
|
||||
}
|
||||
|
||||
public static function checkUrlBeforeAdd(string $url): string {
|
||||
public static function checkUrlBeforeAdd(string $url): ?string {
|
||||
if (str_starts_with($url, 'https://')) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
@@ -200,8 +200,8 @@ final class HelloWorldExtension extends Minz_Extension
|
||||
public function init(): void {
|
||||
parent::init();
|
||||
|
||||
$this->registerHook(Minz_HookType::EntryBeforeDisplay, [$this, 'renderEntry'], 10);
|
||||
$this->registerHook(Minz_HookType::CheckUrlBeforeAdd, [self::class, 'checkUrl'], -10);
|
||||
$this->registerHook(Minz_HookType::EntryBeforeDisplay, $this->renderEntry(...), 10);
|
||||
$this->registerHook(Minz_HookType::CheckUrlBeforeAdd, self::checkUrlBeforeAdd(...), -10);
|
||||
}
|
||||
|
||||
public function renderEntry(FreshRSS_Entry $entry): FreshRSS_Entry {
|
||||
@@ -210,7 +210,7 @@ final class HelloWorldExtension extends Minz_Extension
|
||||
return $entry;
|
||||
}
|
||||
|
||||
public static function checkUrlBeforeAdd(string $url): string {
|
||||
public static function checkUrlBeforeAdd(string $url): ?string {
|
||||
if (str_starts_with($url, 'https://')) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user