diff --git a/psalm.xml b/psalm.xml
index de47136..3b0a03d 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -25,6 +25,8 @@
+
+
diff --git a/src/Components/Blocks/Comment.php b/src/Components/Blocks/Comment.php
index eff4d2a..751dd8e 100644
--- a/src/Components/Blocks/Comment.php
+++ b/src/Components/Blocks/Comment.php
@@ -78,7 +78,7 @@ final class Comment implements ContinuableBlock
return new Handler(
/** @return Text|RawHtml */
function (State $State) {
- if ($State->getOrDefault(SafeMode::class)->enabled()) {
+ if ($State->getOrDefault(SafeMode::class)->isEnabled()) {
return new Text($this->html);
} else {
return new RawHtml($this->html);
diff --git a/src/Components/Blocks/Header.php b/src/Components/Blocks/Header.php
index 2198baf..aadcc50 100644
--- a/src/Components/Blocks/Header.php
+++ b/src/Components/Blocks/Header.php
@@ -56,7 +56,7 @@ final class Header implements Block
$StrictMode = $State->getOrDefault(StrictMode::class);
- if ($StrictMode->enabled() && isset($text[0]) and $text[0] !== ' ') {
+ if ($StrictMode->isEnabled() && isset($text[0]) and $text[0] !== ' ') {
return null;
}
diff --git a/src/Components/Blocks/Markup.php b/src/Components/Blocks/Markup.php
index 9d59317..babc4b6 100644
--- a/src/Components/Blocks/Markup.php
+++ b/src/Components/Blocks/Markup.php
@@ -78,7 +78,7 @@ final class Markup implements ContinuableBlock
function (State $State) {
$SafeMode = $State->getOrDefault(SafeMode::class);
- if ($SafeMode->enabled()) {
+ if ($SafeMode->isEnabled()) {
return new Element('p', [], [new Text($this->html)]);
} else {
return new RawHtml($this->html);
diff --git a/src/Components/Inlines/Image.php b/src/Components/Inlines/Image.php
index f20f4d3..71cf7c0 100644
--- a/src/Components/Inlines/Image.php
+++ b/src/Components/Inlines/Image.php
@@ -83,7 +83,7 @@ final class Image implements Inline
$attributes['title'] = $title;
}
- if ($State->getOrDefault(SafeMode::class)->enabled()) {
+ if ($State->getOrDefault(SafeMode::class)->isEnabled()) {
$attributes['src'] = Element::filterUnsafeUrl($attributes['src']);
}
diff --git a/src/Components/Inlines/Link.php b/src/Components/Inlines/Link.php
index 0a948ca..0d4bdc4 100644
--- a/src/Components/Inlines/Link.php
+++ b/src/Components/Inlines/Link.php
@@ -122,7 +122,7 @@ final class Link implements Inline
$attributes['title'] = $this->title;
}
- if ($State->getOrDefault(SafeMode::class)->enabled()) {
+ if ($State->getOrDefault(SafeMode::class)->isEnabled()) {
$attributes['href'] = Element::filterUnsafeUrl($attributes['href']);
}
diff --git a/src/Components/Inlines/Markup.php b/src/Components/Inlines/Markup.php
index e94c07e..ab65ed4 100644
--- a/src/Components/Inlines/Markup.php
+++ b/src/Components/Inlines/Markup.php
@@ -66,7 +66,7 @@ final class Markup implements Inline
function (State $State) {
$SafeMode = $State->getOrDefault(SafeMode::class);
- if ($SafeMode->enabled()) {
+ if ($SafeMode->isEnabled()) {
return new Text($this->html);
} else {
return new RawHtml($this->html);
diff --git a/src/Configurables/SafeMode.php b/src/Configurables/SafeMode.php
index 9bb3715..0b022b1 100644
--- a/src/Configurables/SafeMode.php
+++ b/src/Configurables/SafeMode.php
@@ -18,11 +18,17 @@ final class SafeMode implements Configurable
}
/** @return bool */
- public function enabled()
+ public function isEnabled()
{
return $this->enabled;
}
+ /** @return self */
+ public static function enabled()
+ {
+ return new self(true);
+ }
+
/** @return self */
public static function initial()
{
diff --git a/src/Configurables/StrictMode.php b/src/Configurables/StrictMode.php
index b693ee5..8e4d0de 100644
--- a/src/Configurables/StrictMode.php
+++ b/src/Configurables/StrictMode.php
@@ -18,11 +18,17 @@ final class StrictMode implements Configurable
}
/** @return bool */
- public function enabled()
+ public function isEnabled()
{
return $this->enabled;
}
+ /** @return self */
+ public static function enabled()
+ {
+ return new self(true);
+ }
+
/** @return self */
public static function initial()
{