Skip to content

Commit a35858f

Browse files
committed
curly braces is deprecated
1 parent 9445abe commit a35858f

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

Michelf/Markdown.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ protected function _doHeaders_callback_setext($matches) {
951951
return $matches[0];
952952
}
953953

954-
$level = $matches[2]{0} == '=' ? 1 : 2;
954+
$level = $matches[2][0] == '=' ? 1 : 2;
955955

956956
// ID attribute generation
957957
$idAtt = $this->_generateIdFromHeaderValue($matches[1]);
@@ -1357,7 +1357,7 @@ protected function doItalicsAndBold($text) {
13571357
} else {
13581358
// Other closing marker: close one em or strong and
13591359
// change current token state to match the other
1360-
$token_stack[0] = str_repeat($token{0}, 3-$token_len);
1360+
$token_stack[0] = str_repeat($token[0], 3-$token_len);
13611361
$tag = $token_len == 2 ? "strong" : "em";
13621362
$span = $text_stack[0];
13631363
$span = $this->runSpanGamut($span);
@@ -1382,7 +1382,7 @@ protected function doItalicsAndBold($text) {
13821382
} else {
13831383
// Reached opening three-char emphasis marker. Push on token
13841384
// stack; will be handled by the special condition above.
1385-
$em = $token{0};
1385+
$em = $token[0];
13861386
$strong = "$em$em";
13871387
array_unshift($token_stack, $token);
13881388
array_unshift($text_stack, '');
@@ -1795,9 +1795,9 @@ protected function parseSpan($str) {
17951795
* @return string
17961796
*/
17971797
protected function handleSpanToken($token, &$str) {
1798-
switch ($token{0}) {
1798+
switch ($token[0]) {
17991799
case "\\":
1800-
return $this->hashPart("&#". ord($token{1}). ";");
1800+
return $this->hashPart("&#". ord($token[1]). ";");
18011801
case "`":
18021802
// Search for end marker in remaining text.
18031803
if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm',

Michelf/MarkdownExtra.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ protected function doExtraAttributes($tag_name, $attr, $defaultIdValue = null, $
256256
$attributes = array();
257257
$id = false;
258258
foreach ($elements as $element) {
259-
if ($element{0} === '.') {
259+
if ($element[0] === '.') {
260260
$classes[] = substr($element, 1);
261-
} else if ($element{0} === '#') {
261+
} else if ($element[0] === '#') {
262262
if ($id === false) $id = substr($element, 1);
263263
} else if (strpos($element, '=') > 0) {
264264
$parts = explode('=', $element, 2);
@@ -553,14 +553,14 @@ protected function _hashHTMLBlocks_inMarkdown($text, $indent = 0,
553553
}
554554
}
555555
// Check for: Indented code block.
556-
else if ($tag{0} === "\n" || $tag{0} === " ") {
556+
else if ($tag[0] === "\n" || $tag[0] === " ") {
557557
// Indented code block: pass it unchanged, will be handled
558558
// later.
559559
$parsed .= $tag;
560560
}
561561
// Check for: Code span marker
562562
// Note: need to check this after backtick fenced code blocks
563-
else if ($tag{0} === "`") {
563+
else if ($tag[0] === "`") {
564564
// Find corresponding end marker.
565565
$tag_re = preg_quote($tag);
566566
if (preg_match('{^(?>.+?|\n(?!\n))*?(?<!`)' . $tag_re . '(?!`)}',
@@ -594,7 +594,7 @@ protected function _hashHTMLBlocks_inMarkdown($text, $indent = 0,
594594
// Check for: Clean tag (like script, math)
595595
// HTML Comments, processing instructions.
596596
else if (preg_match('{^<(?:' . $this->clean_tags_re . ')\b}', $tag) ||
597-
$tag{1} === '!' || $tag{1} === '?')
597+
$tag[1] === '!' || $tag[1] === '?')
598598
{
599599
// Need to parse tag and following text using the HTML parser.
600600
// (don't check for markdown attribute)
@@ -609,7 +609,7 @@ protected function _hashHTMLBlocks_inMarkdown($text, $indent = 0,
609609
preg_match('{^</?(?:' . $enclosing_tag_re . ')\b}', $tag))
610610
{
611611
// Increase/decrease nested tag count.
612-
if ($tag{1} === '/') {
612+
if ($tag[1] === '/') {
613613
$depth--;
614614
} else if ($tag{strlen($tag)-2} !== '/') {
615615
$depth++;
@@ -713,7 +713,7 @@ protected function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) {
713713
// In that case, we return original text unchanged and pass the
714714
// first character as filtered to prevent an infinite loop in the
715715
// parent function.
716-
return array($original_text{0}, substr($original_text, 1));
716+
return array($original_text[0], substr($original_text, 1));
717717
}
718718

719719
$block_text .= $parts[0]; // Text before current tag.
@@ -723,7 +723,7 @@ protected function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) {
723723
// Check for: Auto-close tag (like <hr/>)
724724
// Comments and Processing Instructions.
725725
if (preg_match('{^</?(?:' . $this->auto_close_tags_re . ')\b}', $tag) ||
726-
$tag{1} === '!' || $tag{1} === '?')
726+
$tag[1] === '!' || $tag[1] === '?')
727727
{
728728
// Just add the tag to the block as if it was text.
729729
$block_text .= $tag;
@@ -732,7 +732,7 @@ protected function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) {
732732
// Increase/decrease nested tag count. Only do so if
733733
// the tag's name match base tag's.
734734
if (preg_match('{^</?' . $base_tag_name_re . '\b}', $tag)) {
735-
if ($tag{1} === '/') {
735+
if ($tag[1] === '/') {
736736
$depth--;
737737
} else if ($tag{strlen($tag)-2} !== '/') {
738738
$depth++;
@@ -1125,7 +1125,7 @@ protected function _doHeaders_callback_setext($matches) {
11251125
return $matches[0];
11261126
}
11271127

1128-
$level = $matches[3]{0} === '=' ? 1 : 2;
1128+
$level = $matches[3][0] === '=' ? 1 : 2;
11291129

11301130
$defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[1]) : null;
11311131

@@ -1519,7 +1519,7 @@ protected function _doFencedCodeBlocks_callback($matches) {
15191519

15201520
$classes = array();
15211521
if ($classname !== "") {
1522-
if ($classname{0} === '.') {
1522+
if ($classname[0] === '.') {
15231523
$classname = substr($classname, 1);
15241524
}
15251525
$classes[] = $this->code_class_prefix . $classname;

0 commit comments

Comments
 (0)