diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..719467a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +[*.php] +charset = utf-8 +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..682936e --- /dev/null +++ b/.prettierrc @@ -0,0 +1,9 @@ +{ + "printWidth": 120, + "phpVersion": "7.2", + "trailingCommaPHP": false, + "trailingComma": "none", + "semi": false, + "singleQuote": true, + "endOfLine": "lf" +} diff --git a/src/N.php b/src/N.php index 01d7ae9..dec3fae 100644 --- a/src/N.php +++ b/src/N.php @@ -2,7 +2,8 @@ namespace Shovel; -class N { +class N +{ public static function toInt($n): ?int { return $n === null ? null : intval($n); diff --git a/src/S.php b/src/S.php index 6fd5b2e..b5a2038 100644 --- a/src/S.php +++ b/src/S.php @@ -123,12 +123,14 @@ public static function trim(string $data): string } // S::replace("a", "b", "appletini") -> "bppletini" - public static function replace(string $old, string $new, string $data): string { + public static function replace(string $old, string $new, string $data): string + { return str_replace($old, $new, $data); } // S::splitAt(3, "abcdef") -> ["abc", "def"] - public static function splitAt(int $index, string $data): array { + public static function splitAt(int $index, string $data): array + { $first = self::slice(0, $index, $data); $second = self::slice($index, PHP_INT_MAX, $data); return [$first, $second];