From fc23ca5ef58f8bf18124fa832073c83c18686e8d Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Sun, 10 Feb 2019 23:07:21 +0000 Subject: [PATCH] Remove more redundant checks --- src/Components/Inlines/Emphasis.php | 4 ---- src/Components/Inlines/SpecialCharacter.php | 4 +--- src/Components/Inlines/Strikethrough.php | 4 ---- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Components/Inlines/Emphasis.php b/src/Components/Inlines/Emphasis.php index 69f3ba2..4ed1c8c 100644 --- a/src/Components/Inlines/Emphasis.php +++ b/src/Components/Inlines/Emphasis.php @@ -52,10 +52,6 @@ final class Emphasis implements Inline */ public static function build(Excerpt $Excerpt, State $State) { - if (\strlen($Excerpt->text()) < 3) { - return null; - } - $marker = \substr($Excerpt->text(), 0, 1); if ($marker !== '*' && $marker !== '_') { diff --git a/src/Components/Inlines/SpecialCharacter.php b/src/Components/Inlines/SpecialCharacter.php index d9a920b..be75a64 100644 --- a/src/Components/Inlines/SpecialCharacter.php +++ b/src/Components/Inlines/SpecialCharacter.php @@ -32,9 +32,7 @@ final class SpecialCharacter implements Inline */ public static function build(Excerpt $Excerpt, State $State) { - if (\substr($Excerpt->text(), 1, 1) !== ' ' && \strpos($Excerpt->text(), ';') !== false - && \preg_match('/^&(#?+[0-9a-zA-Z]++);/', $Excerpt->text(), $matches) - ) { + if (\preg_match('/^&(#?+[0-9a-zA-Z]++);/', $Excerpt->text(), $matches)) { return new self($matches[1]); } diff --git a/src/Components/Inlines/Strikethrough.php b/src/Components/Inlines/Strikethrough.php index a66b5f8..3f8dab6 100644 --- a/src/Components/Inlines/Strikethrough.php +++ b/src/Components/Inlines/Strikethrough.php @@ -37,10 +37,6 @@ final class Strikethrough implements Inline { $text = $Excerpt->text(); - if (\strlen($text) < 2) { - return null; - } - if (\preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $text, $matches)) { return new self($matches[1], \strlen($matches[0])); }