Skip to content

Commit 2bf41b4

Browse files
committed
Merge branch 'update'
2 parents c45c892 + 54eeb65 commit 2bf41b4

File tree

12 files changed

+186
-65
lines changed

12 files changed

+186
-65
lines changed

.phive/phars.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="php-cs-fixer" version="^3.0" installed="3.74.0" location="./tools/php-cs-fixer" copy="true"/>
3+
<phar name="php-cs-fixer" version="^3.0" installed="3.75.0" location="./tools/php-cs-fixer" copy="true"/>
44
<phar name="box" version="^4.0" installed="4.6.6" location="./tools/box" copy="true"/>
55
</phive>

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
"ext-mbstring": "*",
1919
"ext-tokenizer": "*",
2020
"composer-runtime-api": "^2.2",
21-
"salient/cli": "^0.99",
22-
"salient/collections": "^0.99",
23-
"salient/console": "^0.99",
24-
"salient/contracts": "^0.99",
25-
"salient/core": "^0.99",
26-
"salient/phpdoc": "^0.99",
27-
"salient/polyfills": "^0.99",
28-
"salient/utils": "^0.99",
21+
"salient/cli": "0.99.79",
22+
"salient/collections": "0.99.79",
23+
"salient/console": "0.99.79",
24+
"salient/contracts": "0.99.79",
25+
"salient/core": "0.99.79",
26+
"salient/phpdoc": "0.99.79",
27+
"salient/polyfills": "0.99.79",
28+
"salient/utils": "0.99.79",
2929
"sebastian/diff": "^4 || ^5"
3030
},
3131
"require-dev": {
@@ -36,9 +36,9 @@
3636
"phpstan/phpstan-deprecation-rules": "^2",
3737
"phpstan/phpstan-phpunit": "^2",
3838
"phpunit/phpunit": "^9",
39-
"salient/phpstan": "^0.99",
40-
"salient/sli": "^0.99",
41-
"salient/testing": "^0.99"
39+
"salient/phpstan": "0.99.79",
40+
"salient/sli": "0.99.79",
41+
"salient/testing": "0.99.79"
4242
},
4343
"autoload": {
4444
"psr-4": {

composer.lock

Lines changed: 58 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Rules.md

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Rule/NormaliseComments.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ public static function needsSortedTokens(): bool
5454
* from both delimiters, the remaining content is trimmed, and a space is
5555
* added between delimiters and adjacent content.
5656
*
57+
* Region markers recognised by VS Code, including C++-style comments like
58+
* `//region`, are converted to shell-style `#region` or `#endregion`
59+
* comments if necessary, otherwise they are not modified.
60+
*
5761
* Shell-style comments (`#`) are converted to C++-style comments (`//`).
5862
*
5963
* In C++-style comments (`//`), a space is added between the delimiter and
@@ -106,10 +110,20 @@ public function processTokens(array $tokens): void
106110
}
107111

108112
if ($token->Flags & Flag::ONELINE_COMMENT) {
109-
if ($type === Flag::SHELL_COMMENT) {
110-
$text = '//' . substr($text, 1);
113+
if (
114+
$token->wasFirstOnLine()
115+
&& Regex::match('`^(?:#|//)(?:end)?region\b`', $text)
116+
) {
117+
if ($type === Flag::CPP_COMMENT) {
118+
$text = '#' . substr($text, 2);
119+
$token->setText($text);
120+
}
121+
} else {
122+
if ($type === Flag::SHELL_COMMENT) {
123+
$text = '//' . substr($text, 1);
124+
}
125+
$token->setText(Regex::replace('#^//(?=\S)#', '// ', $text));
111126
}
112-
$token->setText(Regex::replace('#^//(?=\S)#', '// ', $text));
113127
continue;
114128
}
115129

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
return function (App $app) {
3+
$app->add(SessionMiddleware::class);
4+
5+
#region Twig
6+
7+
// Create Twig
8+
$twig = Twig::create(__DIR__ . '/../templates', ['cache' => false]);
9+
// Add Twig-View Middleware
10+
$app->add(TwigMiddleware::create($app, $twig));
11+
12+
#endregion Twig
13+
};

0 commit comments

Comments
 (0)