Skip to content

Commit 4f46da1

Browse files
committed
Update formatting
1 parent a47165f commit 4f46da1

File tree

8 files changed

+46
-46
lines changed

8 files changed

+46
-46
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
coverage: none
2828

2929
- name: Install PrettyPHP
30-
run: composer create-project --no-interaction --no-progress --no-dev lkrms/pretty-php=0.4.22 build/pretty-php
30+
run: composer create-project --no-interaction --no-progress --no-dev lkrms/pretty-php=0.4.25 build/pretty-php
3131

3232
- name: Run PrettyPHP
3333
run: build/pretty-php/bin/pretty-php --diff

src/Cli/CliCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ final public function getSynopsis(bool $withMarkup = true, ?int $width = 80): st
370370
$n = "\n{$pre} ";
371371
} else {
372372
$b = '__';
373-
$n = " \\\n\\ \\ \\ \\ ";
373+
$n = " \\\n\ \ \ \ ";
374374
}
375375
}
376376

src/Support/Catalog/TtyControlSequence.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,70 +11,70 @@
1111
*/
1212
final class TtyControlSequence extends Dictionary
1313
{
14-
public const BLACK = "\x1b[30m";
15-
public const RED = "\x1b[31m";
16-
public const GREEN = "\x1b[32m";
17-
public const YELLOW = "\x1b[33m";
18-
public const BLUE = "\x1b[34m";
19-
public const MAGENTA = "\x1b[35m";
20-
public const CYAN = "\x1b[36m";
21-
public const WHITE = "\x1b[37m";
22-
public const DEFAULT = "\x1b[39m";
23-
public const BLACK_BG = "\x1b[40m";
24-
public const RED_BG = "\x1b[41m";
25-
public const GREEN_BG = "\x1b[42m";
26-
public const YELLOW_BG = "\x1b[43m";
27-
public const BLUE_BG = "\x1b[44m";
28-
public const MAGENTA_BG = "\x1b[45m";
29-
public const CYAN_BG = "\x1b[46m";
30-
public const WHITE_BG = "\x1b[47m";
31-
public const DEFAULT_BG = "\x1b[49m";
32-
public const BOLD = "\x1b[1m";
33-
public const DIM = "\x1b[2m";
34-
public const UNDERLINE = "\x1b[4m";
35-
public const NO_UNDERLINE = "\x1b[24m";
14+
public const BLACK = "\e[30m";
15+
public const RED = "\e[31m";
16+
public const GREEN = "\e[32m";
17+
public const YELLOW = "\e[33m";
18+
public const BLUE = "\e[34m";
19+
public const MAGENTA = "\e[35m";
20+
public const CYAN = "\e[36m";
21+
public const WHITE = "\e[37m";
22+
public const DEFAULT = "\e[39m";
23+
public const BLACK_BG = "\e[40m";
24+
public const RED_BG = "\e[41m";
25+
public const GREEN_BG = "\e[42m";
26+
public const YELLOW_BG = "\e[43m";
27+
public const BLUE_BG = "\e[44m";
28+
public const MAGENTA_BG = "\e[45m";
29+
public const CYAN_BG = "\e[46m";
30+
public const WHITE_BG = "\e[47m";
31+
public const DEFAULT_BG = "\e[49m";
32+
public const BOLD = "\e[1m";
33+
public const DIM = "\e[2m";
34+
public const UNDERLINE = "\e[4m";
35+
public const NO_UNDERLINE = "\e[24m";
3636

3737
/**
3838
* Reset BOLD and DIM
3939
*
4040
* @see TtyControlSequence::UNBOLD_DIM
4141
* @see TtyControlSequence::UNDIM_BOLD
4242
*/
43-
public const UNBOLD_UNDIM = "\x1b[22m";
43+
public const UNBOLD_UNDIM = "\e[22m";
4444

4545
/**
4646
* Reset BOLD, set DIM
4747
*
4848
*/
49-
public const UNBOLD_DIM = "\x1b[22;2m";
49+
public const UNBOLD_DIM = "\e[22;2m";
5050

5151
/**
5252
* Reset DIM, set BOLD
5353
*
5454
*/
55-
public const UNDIM_BOLD = "\x1b[22;1m";
55+
public const UNDIM_BOLD = "\e[22;1m";
5656

5757
/**
5858
* Reset all colours and styles
5959
*
6060
*/
61-
public const RESET = "\x1b[m";
61+
public const RESET = "\e[m";
6262

6363
/**
6464
* Clear to end of line
6565
*
6666
*/
67-
public const CLEAR_LINE = "\x1b[K";
67+
public const CLEAR_LINE = "\e[K";
6868

6969
/**
7070
* Turn off automatic margins
7171
*
7272
*/
73-
public const WRAP_OFF = "\x1b[?7l";
73+
public const WRAP_OFF = "\e[?7l";
7474

7575
/**
7676
* Turn on automatic margins
7777
*
7878
*/
79-
public const WRAP_ON = "\x1b[?7h";
79+
public const WRAP_ON = "\e[?7h";
8080
}

src/Utility/Convert.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ public static function pathToBasename(string $path, int $extLimit = 0): string
627627
$path = basename($path);
628628
if ($extLimit) {
629629
$range = $extLimit > 1 ? "{1,$extLimit}" : ($extLimit < 0 ? '+' : '');
630-
$path = Pcre::replace("/(?<=.)(?<!^\\.|^\\.\\.)(\\.[^.\\s]+){$range}\$/", '', $path);
630+
$path = Pcre::replace("/(?<=.)(?<!^\.|^\.\.)(\.[^.\s]+){$range}\$/", '', $path);
631631
}
632632

633633
return $path;
@@ -1128,11 +1128,11 @@ public static function unwrap(
11281128
$escapes = $ignoreEscapes ? '' : Regex::NOT_ESCAPED . '\K';
11291129

11301130
if ($trimTrailingWhitespace) {
1131-
$search[] = "/{$escapes}\\h+{$newline}/";
1131+
$search[] = "/{$escapes}\h+{$newline}/";
11321132
$replace[] = $break;
11331133
}
11341134

1135-
$search[] = "/{$escapes}(?<!{$newline}){$newline}(?!{$newline}| |\\t|(?:[-+*]|[0-9]+[).])\\h)/";
1135+
$search[] = "/{$escapes}(?<!{$newline}){$newline}(?!{$newline}| |\\t|(?:[-+*]|[0-9]+[).])\h)/";
11361136
$replace[] = ' ';
11371137

11381138
if ($collapseBlankLines) {
@@ -1196,7 +1196,7 @@ public static function toStrings(...$value): array
11961196
public static function toShellArg(string $arg): string
11971197
{
11981198
if ($arg === '' || Pcre::match('/[^a-z0-9+.\/@_-]/i', $arg)) {
1199-
return "'" . str_replace("'", "'\\''", $arg) . "'";
1199+
return "'" . str_replace("'", "'\''", $arg) . "'";
12001200
}
12011201

12021202
return $arg;
@@ -1436,7 +1436,7 @@ public static function valueToCode(
14361436
if (is_string($value) &&
14371437
(($escapeCharacters && strpbrk($value, $escapeCharacters) !== false) ||
14381438
Pcre::match('/\v/', $value))) {
1439-
$escaped = addcslashes($value, "\n\r\t\v\x1b\f\\\$\"" . $escapeCharacters);
1439+
$escaped = addcslashes($value, "\n\r\t\v\e\f\\\$\"" . $escapeCharacters);
14401440
if ($escapeCharacters) {
14411441
foreach (str_split($escapeCharacters) as $character) {
14421442
$oct = sprintf('\%03o', ord($character));

src/Utility/Env.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private static function parse(array $lines, array &$queue, array &$errors, ?stri
102102
continue;
103103
}
104104
if (($single = $match['single']) !== null) {
105-
$queue[$name] = str_replace("'\\''", "'", $single);
105+
$queue[$name] = str_replace("'\''", "'", $single);
106106
continue;
107107
}
108108
$queue[$name] = preg_replace('/\\\\(.)/', '\1', $match['none']);
@@ -373,7 +373,7 @@ public static function getIntList(string $name, ?array $default = null, string $
373373
return [];
374374
}
375375
$sep = preg_quote($delimiter, '/');
376-
if (!preg_match("/^[0-9]++(?:{$sep}[0-9]++)*+$/", $value)) {
376+
if (!preg_match("/^[0-9]++(?:{$sep}[0-9]++)*+\$/", $value)) {
377377
throw new InvalidEnvironmentException(sprintf('Value is not an integer list: %s', $name));
378378
}
379379
$list = [];

src/Utility/System.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public static function getProgramBasename(string ...$suffixes): string
230230
}
231231
$regex = implode('|', array_map(fn(string $s) => preg_quote($s, '/'), $suffixes));
232232

233-
return preg_replace("/(?<=.)({$regex})+$/", '', $basename);
233+
return preg_replace("/(?<=.)({$regex})+\$/", '', $basename);
234234
}
235235

236236
/**

tests/console

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,19 @@ Console::log('```
6767
This is a __preformatted block__, with nothing else in the string
6868
```');
6969

70-
Console::info('A \`preformatted\` __block__ starts after the next line.
70+
Console::info("A \`preformatted\` __block__ starts after the next line.
7171
___There should be no blank lines.___
7272
```
73-
~~Here\'s some \\\\```__preformatted__\`\`\` text.~~
73+
~~Here's some \\\\```__preformatted__\`\`\` text.~~
7474
```
75-
And ... _done_. ~~Did two backslashes survive on the left? Three on the right?~~');
75+
And ... _done_. ~~Did two backslashes survive on the left? Three on the right?~~");
7676

77-
Console::log('A similar block, enclosed between __inline__ delimiters, starts after the next line.
77+
Console::log("A similar block, enclosed between __inline__ delimiters, starts after the next line.
7878
___There should be blank lines.___
7979
`
80-
~~Here\'s some \\\\\\`\`\`__preformatted__\`\`\` text.~~
80+
~~Here's some \\\\\\`\`\`__preformatted__\`\`\` text.~~
8181
`
82-
~~So let it be written. Hopefully with only one backslash. On the left.~~');
82+
~~So let it be written. Hopefully with only one backslash. On the left.~~");
8383

8484
class TestClass
8585
{

tests/unit/Utility/ConvertTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ public function testToShellArg()
830830
$this->assertSame('abc', Convert::toShellArg('abc'));
831831
$this->assertSame('/some/path', Convert::toShellArg('/some/path'));
832832
$this->assertSame("'/some/path with spaces'", Convert::toShellArg('/some/path with spaces'));
833-
$this->assertSame("''\\''quotable'\\'' \"quotes\"'", Convert::toShellArg('\'quotable\' "quotes"'));
833+
$this->assertSame("''\''quotable'\'' \"quotes\"'", Convert::toShellArg('\'quotable\' "quotes"'));
834834
}
835835

836836
/**

0 commit comments

Comments
 (0)