diff --git a/examples/Figure as Definition List/demo.php b/examples/Figure as Definition List/demo.php
index cfec409a..00e91bfb 100644
--- a/examples/Figure as Definition List/demo.php
+++ b/examples/Figure as Definition List/demo.php
@@ -12,7 +12,7 @@
}
-function figureHandler(Texy\HandlerInvocation $invocation, Texy\Image $image, Texy\Link $link = null, $content, Texy\Modifier $modifier): Texy\HtmlElement|string|null
+function figureHandler(Texy\HandlerInvocation $invocation, Texy\Image $image, ?Texy\Link $link, $content, Texy\Modifier $modifier): Texy\HtmlElement|string|null
{
// finish invocation by default way
$el = $invocation->proceed();
diff --git a/examples/Youtube video/demo.php b/examples/Youtube video/demo.php
index 4cbcaffe..bf2a9478 100644
--- a/examples/Youtube video/demo.php
+++ b/examples/Youtube video/demo.php
@@ -15,7 +15,7 @@
/**
* User handler for images
*/
-function imageHandler(Texy\HandlerInvocation $invocation, Texy\Image $image, Texy\Link $link = null): Texy\HtmlElement|string|null
+function imageHandler(Texy\HandlerInvocation $invocation, Texy\Image $image, ?Texy\Link $link = null): Texy\HtmlElement|string|null
{
$parts = explode(':', $image->URL);
if (count($parts) !== 2) {
diff --git a/examples/composer.json b/examples/composer.json
index 197afa87..307d8b5d 100644
--- a/examples/composer.json
+++ b/examples/composer.json
@@ -1,7 +1,7 @@
{
"type": "project",
"require": {
- "php": ">=7.1",
+ "php": ">=8.1",
"texy/texy": "^3.0",
"kukulich/fshl": "^2.1",
"geshi/geshi": "^1.0"
diff --git a/examples/handler/handler.php b/examples/handler/handler.php
index 2671dad5..fa09a20b 100644
--- a/examples/handler/handler.php
+++ b/examples/handler/handler.php
@@ -46,7 +46,7 @@ public function emoticon(Texy\HandlerInvocation $invocation, $emoticon, $rawEmot
/** @return Texy\HtmlElement|string|null */
- public function image(Texy\HandlerInvocation $invocation, Texy\Image $image, Texy\Link $link = null)
+ public function image(Texy\HandlerInvocation $invocation, Texy\Image $image, ?Texy\Link $link = null)
{
return $invocation->proceed();
}
@@ -55,7 +55,7 @@ public function image(Texy\HandlerInvocation $invocation, Texy\Image $image, Tex
public function linkReference(
Texy\HandlerInvocation $invocation,
Texy\Link $link,
- string $content
+ string $content,
): Texy\HtmlElement|string|null
{
return $invocation->proceed();
@@ -82,7 +82,7 @@ public function phrase(
$phrase,
$content,
Texy\Modifier $modifier,
- Texy\Link $link = null,
+ ?Texy\Link $link = null,
) {
return $invocation->proceed();
}
@@ -131,7 +131,7 @@ function paragraph(Texy\HandlerInvocation $invocation, $content, Texy\Modifier $
public function figure(
Texy\HandlerInvocation $invocation,
Texy\Image $image,
- Texy\Link $link = null,
+ ?Texy\Link $link,
$content,
Texy\Modifier $modifier,
) {
diff --git a/examples/images/demo.php b/examples/images/demo.php
index dcac3fd6..b75ea936 100644
--- a/examples/images/demo.php
+++ b/examples/images/demo.php
@@ -16,7 +16,7 @@
/**
* User handler for images
*/
-function imageHandler(Texy\HandlerInvocation $invocation, Texy\Image $image, Texy\Link $link = null): Texy\HtmlElement|string|null
+function imageHandler(Texy\HandlerInvocation $invocation, Texy\Image $image, ?Texy\Link $link = null): Texy\HtmlElement|string|null
{
if ($image->URL == 'user') { // accepts only [* user *]
$image->URL = 'image.gif'; // image URL
diff --git a/examples/links/demo.php b/examples/links/demo.php
index 45488f02..7b66c7f6 100644
--- a/examples/links/demo.php
+++ b/examples/links/demo.php
@@ -12,7 +12,7 @@
}
-function phraseHandler(Texy\HandlerInvocation $invocation, $phrase, $content, Texy\Modifier $modifier, Texy\Link $link = null): Texy\HtmlElement|string|null
+function phraseHandler(Texy\HandlerInvocation $invocation, $phrase, $content, Texy\Modifier $modifier, ?Texy\Link $link = null): Texy\HtmlElement|string|null
{
// is there link?
if (!$link) {
diff --git a/examples/syntax highlighting/demo-fshl-alt.php b/examples/syntax highlighting/demo-fshl-alt.php
index 07823ee8..ac614604 100644
--- a/examples/syntax highlighting/demo-fshl-alt.php
+++ b/examples/syntax highlighting/demo-fshl-alt.php
@@ -87,15 +87,15 @@ function codeBlockHandler(Texy\BlockParser $parser, array $matches, string $name
// add new syntax:
$texy->registerBlockPattern(
'codeBlockHandler',
- '#^<\\?php\n.+?\n\\?>$#ms', // block patterns must be multiline and line-anchored
- 'phpBlockSyntax'
+ '#^<\?php\n.+?\n\?>$#ms', // block patterns must be multiline and line-anchored
+ 'phpBlockSyntax',
);
// add new syntax:
$texy->registerBlockPattern(
'codeBlockHandler',
'#^$#ms', // block patterns must be multiline and line-anchored
- 'scriptBlockSyntax'
+ 'scriptBlockSyntax',
);
// processing
diff --git a/src/Texy/Modules/BlockModule.php b/src/Texy/Modules/BlockModule.php
index 7654449f..171716d4 100644
--- a/src/Texy/Modules/BlockModule.php
+++ b/src/Texy/Modules/BlockModule.php
@@ -38,7 +38,7 @@ public function __construct(Texy\Texy $texy)
$texy->registerBlockPattern(
$this->pattern(...),
- '#^/--++ *+(.*)' . Texy\Patterns::MODIFIER_H . '?$((?:\n(?0)|\n.*+)*)(?:\n\\\\--.*$|\z)#mUi',
+ '#^/--++ *+(.*)' . Texy\Patterns::MODIFIER_H . '?$((?:\n(?0)|\n.*+)*)(?:\n\\\--.*$|\z)#mUi',
'blocks',
);
}
@@ -52,7 +52,7 @@ private function beforeBlockParse(Texy\BlockParser $parser, string &$text): void
// autoclose exclusive blocks
$text = Texy\Regexp::replace(
$text,
- '#^(/--++ *+(?!div|texysource).*)$((?:\n.*+)*?)(?:\n\\\\--.*$|(?=(\n/--.*$)))#mi',
+ '#^(/--++ *+(?!div|texysource).*)$((?:\n.*+)*?)(?:\n\\\--.*$|(?=(\n/--.*$)))#mi',
"\$1\$2\n\\--",
);
}
diff --git a/src/Texy/Modules/PhraseModule.php b/src/Texy/Modules/PhraseModule.php
index 3e9be1b0..a6d78ad8 100644
--- a/src/Texy/Modules/PhraseModule.php
+++ b/src/Texy/Modules/PhraseModule.php
@@ -61,14 +61,14 @@ public function __construct(Texy\Texy $texy)
// ***strong+emphasis***
$texy->registerLinePattern(
$this->patternPhrase(...),
- '#(?registerLinePattern(
$this->patternPhrase(...),
- '#(?registerLinePattern(
$this->patternPhrase(...),
- '#(?registerLinePattern(
$this->patternPhrase(...),
- '#(?()"\'' . Patterns::MARK . '-])\*(?![\s*])((?:[^ *]++|[ *])+)' . Patterns::MODIFIER . '?(?()"?!\'-])(?::(' . Patterns::LINK_URL . '))??()#Uus',
+ '#(?()"\'' . Patterns::MARK . '-])\*(?![\s*])((?:[^ *]++|[ *])+)' . Patterns::MODIFIER . '?(?()"?!\'-])(?::(' . Patterns::LINK_URL . '))??()#Uus',
'phrase/em-alt2',
);
diff --git a/src/Texy/Modules/TypographyModule.php b/src/Texy/Modules/TypographyModule.php
index 959917a5..727c1b3e 100644
--- a/src/Texy/Modules/TypographyModule.php
+++ b/src/Texy/Modules/TypographyModule.php
@@ -50,7 +50,7 @@ final class TypographyModule extends Texy\Module
private static array $patterns = [
'#(? "\u{2026}", // ellipsis ...
'#(?<=[\d ]|^)-(?=[\d ]|$)#' /*. */ => "\u{2013}", // en dash 123-123
- '#(?<=[^!*+,/:;<=>@\\\\_|-])--(?=[^!*+,/:;<=>@\\\\_|-])#' => "\u{2013}", // en dash alphanum--alphanum
+ '#(?<=[^!*+,/:;<=>@\\\_|-])--(?=[^!*+,/:;<=>@\\\_|-])#' => "\u{2013}", // en dash alphanum--alphanum
'#,-#' /*. */ => ",\u{2013}", // en dash ,-
'#(? "\$1\u{A0}\$2\u{A0}\$3", // date 23. 1. 1978
'#(? "\$1\u{A0}\$2", // date 23. 1.