Skip to content

Commit be252ff

Browse files
committed
Initial commit
0 parents  commit be252ff

40 files changed

+1731
-0
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
indent_style = space
11+
indent_size = 4
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
15+
# JSON-Files
16+
[*.json]
17+
indent_style = tab

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# The Crowdin access token
2+
CROWDIN_ACCESS_TOKEN=""
3+
4+
# The relative path to store the configuration file (recommended: "var/configuration.json")
5+
CONFIGURATION_FILE=""

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/tests/ export-ignore
2+
/.editorconfig export-ignore
3+
/.env.example export-ignore
4+
/.gitattributes export-ignore
5+
/.github export-ignore
6+
/.gitignore export-ignore
7+
/.php-cs-fixer.php export-ignore
8+
/phpstan.dist.neon export-ignore
9+
/phpunit.xml.dist export-ignore
10+
/rector.php export-ignore

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v5
12+
with:
13+
fetch-depth: 1
14+
15+
- name: Setup PHP with composer v2
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: '8.4'
19+
20+
- name: Install dependencies
21+
run: |
22+
composer install --no-progress
23+
24+
- name: Run PHP linter
25+
run: |
26+
find . -type f -name '*.php' ! -path "./vendor/*" ! -path "./var/*" -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" )
27+
28+
- name: Verify PSR-4 namespace correctness
29+
run: |
30+
composer dumpautoload --optimize --strict-psr
31+
32+
- name: Normalize composer.json
33+
run: |
34+
composer normalize --dry-run
35+
36+
- name: Check coding standards
37+
run: |
38+
composer cs
39+
40+
- name: Run tests
41+
run: |
42+
composer tests
43+
44+
- name: Run static analysis
45+
run: |
46+
composer stan
47+
48+
- name: Run rector
49+
run: |
50+
composer rector-check

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/composer.lock
2+
/var
3+
/vendor
4+
/.env
5+
/.php-cs-fixer.cache.php

.php-cs-fixer.php

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Config;
6+
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
7+
use PhpCsFixer\Finder;
8+
9+
if (PHP_SAPI !== 'cli') {
10+
die('This script supports command line usage only. Please check your command.');
11+
}
12+
13+
return new Config()
14+
->setParallelConfig(ParallelConfigFactory::detect())
15+
->setCacheFile(__DIR__ . '/.php-cs-fixer.cache.php')
16+
->setFinder(
17+
new Finder()
18+
->ignoreVCSIgnored(true)
19+
->in(realpath(__DIR__ . '/src'))
20+
)
21+
->setRiskyAllowed(true)
22+
->setRules([
23+
'@DoctrineAnnotation' => true,
24+
// @todo: Switch to @PER-CS2x0 once php-cs-fixer's todo list is done: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7247
25+
'@PER-CS1x0' => true,
26+
'array_indentation' => true,
27+
'array_syntax' => ['syntax' => 'short'],
28+
'cast_spaces' => ['space' => 'none'],
29+
// @todo: Can be dropped once we enable @PER-CS2x0
30+
'concat_space' => ['spacing' => 'one'],
31+
'declare_equal_normalize' => ['space' => 'none'],
32+
'declare_parentheses' => true,
33+
'dir_constant' => true,
34+
// @todo: Can be dropped once we enable @PER-CS2x0
35+
'function_declaration' => [
36+
'closure_fn_spacing' => 'none',
37+
],
38+
'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']],
39+
'type_declaration_spaces' => true,
40+
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
41+
'list_syntax' => ['syntax' => 'short'],
42+
// @todo: Can be dropped once we enable @PER-CS2x0
43+
'method_argument_space' => true,
44+
'modernize_strpos' => true,
45+
'modernize_types_casting' => true,
46+
'native_function_casing' => true,
47+
'no_alias_functions' => true,
48+
'no_blank_lines_after_phpdoc' => true,
49+
'no_empty_phpdoc' => true,
50+
'no_empty_statement' => true,
51+
'no_extra_blank_lines' => true,
52+
'no_leading_namespace_whitespace' => true,
53+
'no_null_property_initialization' => true,
54+
'no_short_bool_cast' => true,
55+
'no_singleline_whitespace_before_semicolons' => true,
56+
'no_superfluous_elseif' => true,
57+
'no_trailing_comma_in_singleline' => true,
58+
'no_unneeded_control_parentheses' => true,
59+
'no_unused_imports' => true,
60+
'no_useless_else' => true,
61+
'no_useless_nullsafe_operator' => true,
62+
'nullable_type_declaration' => [
63+
'syntax' => 'question_mark',
64+
],
65+
'nullable_type_declaration_for_default_null_value' => true,
66+
'ordered_class_elements' => ['order' => ['use_trait', 'case', 'constant', 'property']],
67+
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
68+
'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']],
69+
'php_unit_mock_short_will_return' => true,
70+
'php_unit_test_case_static_method_calls' => ['call_type' => 'self',
71+
'methods' => [
72+
'any' => 'this',
73+
'atLeast' => 'this',
74+
'atLeastOnce' => 'this',
75+
'atMost' => 'this',
76+
'exactly' => 'this',
77+
'never' => 'this',
78+
'onConsecutiveCalls' => 'this',
79+
'once' => 'this',
80+
'returnArgument' => 'this',
81+
'returnCallback' => 'this',
82+
'returnSelf' => 'this',
83+
'returnValue' => 'this',
84+
'returnValueMap' => 'this',
85+
'throwException' => 'this',
86+
],
87+
],
88+
'phpdoc_no_access' => true,
89+
'phpdoc_no_empty_return' => true,
90+
'phpdoc_no_package' => true,
91+
'phpdoc_scalar' => true,
92+
'phpdoc_trim' => true,
93+
'phpdoc_types' => true,
94+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
95+
'return_type_declaration' => ['space_before' => 'none'],
96+
'single_quote' => true,
97+
'single_space_around_construct' => true,
98+
'single_line_comment_style' => ['comment_types' => ['hash']],
99+
// @todo: Can be dropped once we enable @PER-CS2x0
100+
'single_line_empty_body' => true,
101+
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
102+
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
103+
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
104+
]);

0 commit comments

Comments
 (0)