Skip to content

Commit

Permalink
fix: correct parent scope is title
Browse files Browse the repository at this point in the history
- also add `title.function.invoke` to the official list
  (Rust was already using)
  • Loading branch information
joshgoebel committed Dec 15, 2021
1 parent ceb070f commit 248b109
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docs/css-classes-reference.rst
Expand Up @@ -70,6 +70,8 @@ in mind so a better choice (for best theme support) might possibly be ``string``
+--------------------------+-------------------------------------------------------------+
| title.function | name of a function |
+--------------------------+-------------------------------------------------------------+
| title.function.invoke | name of a function (when being invoked) |
+--------------------------+-------------------------------------------------------------+
| params | block of function arguments (parameters) at the |
| | place of declaration |
+--------------------------+-------------------------------------------------------------+
Expand Down
2 changes: 1 addition & 1 deletion src/languages/php.js
Expand Up @@ -330,7 +330,7 @@ export default function(hljs) {
regex.lookahead(/(?=\()/)
],
scope: {
3: "function.title.invoke",
3: "title.function.invoke",
}
};

Expand Down
8 changes: 4 additions & 4 deletions test/markup/php/functions.expect.txt
Expand Up @@ -11,11 +11,11 @@
* Function invoke
*/</span>
<span class="hljs-variable">$date</span> = <span class="hljs-keyword">new</span> <span class="hljs-title class_">DateTimeImmutable</span> ();
<span class="hljs-variable">$date</span>-&gt;<span class="hljs-function title_ invoke__">format</span>(<span class="hljs-string">&#x27;Y-m-d&#x27;</span>);
<span class="hljs-variable">$date</span>-&gt;<span class="hljs-title function_ invoke__">format</span>(<span class="hljs-string">&#x27;Y-m-d&#x27;</span>);

DateTimeImmutable::<span class="hljs-function title_ invoke__">createFromMutable</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">\DateTime</span>(<span class="hljs-string">&#x27;now&#x27;</span>));
DateTimeImmutable::<span class="hljs-title function_ invoke__">createFromMutable</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">\DateTime</span>(<span class="hljs-string">&#x27;now&#x27;</span>));

<span class="hljs-function title_ invoke__">str_contains</span> (\<span class="hljs-function title_ invoke__">strtoupper</span>(<span class="hljs-function title_ invoke__">substr</span>(<span class="hljs-string">&#x27;abcdef&#x27;</span>, -<span class="hljs-number">2</span>), <span class="hljs-string">&#x27;f&#x27;</span>));
<span class="hljs-title function_ invoke__">str_contains</span> (\<span class="hljs-title function_ invoke__">strtoupper</span>(<span class="hljs-title function_ invoke__">substr</span>(<span class="hljs-string">&#x27;abcdef&#x27;</span>, -<span class="hljs-number">2</span>), <span class="hljs-string">&#x27;f&#x27;</span>));

<span class="hljs-comment">/**
* Function declaration
Expand All @@ -39,5 +39,5 @@ DateTimeImmutable::<span class="hljs-function title_ invoke__">createFromMutable
<span class="hljs-comment">/**
* First-class Callable Syntax
*/</span>
<span class="hljs-variable">$fun</span> = <span class="hljs-function title_ invoke__">mb_strlen</span>();
<span class="hljs-variable">$fun</span> = <span class="hljs-title function_ invoke__">mb_strlen</span>();
<span class="hljs-variable">$fun</span>();
4 changes: 2 additions & 2 deletions test/markup/php/strings.expect.txt
Expand Up @@ -12,12 +12,12 @@ MSG</span>);

<span class="hljs-comment">// heredoc syntax</span>

<span class="hljs-function title_ invoke__">var_dump</span>(<span class="hljs-string">&lt;&lt;&lt;SQL
<span class="hljs-title function_ invoke__">var_dump</span>(<span class="hljs-string">&lt;&lt;&lt;SQL
SELECT *
FROM table
SQL</span>);

<span class="hljs-function title_ invoke__">var_dump</span>(<span class="hljs-string">&lt;&lt;&lt;SQL
<span class="hljs-title function_ invoke__">var_dump</span>(<span class="hljs-string">&lt;&lt;&lt;SQL
SELECT *
FROM table
SQL</span>);

0 comments on commit 248b109

Please sign in to comment.