Skip to content

Commit 58dc2b5

Browse files
committed
first commit
0 parents  commit 58dc2b5

18 files changed

Lines changed: 570 additions & 0 deletions

.DS_Store

6 KB
Binary file not shown.

.github/php-syntax.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "php -l",
5+
"pattern": [
6+
{
7+
"regexp": "^\\s*(PHP\\s+)?([a-zA-Z\\s]+):\\s+(.*)\\s+in\\s+(\\S+)\\s+on\\s+line\\s+(\\d+)$",
8+
"file": 4,
9+
"line": 5,
10+
"message": 3
11+
}
12+
]
13+
}
14+
]
15+
}

.github/workflows/codestyle.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Code Style
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
php:
9+
name: PHP
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Setup PHP with tools
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: '8.1'
17+
extensions: ctype, dom, exif, gd, gmp, hash, intl, json, libxml, mbstring, opcache, pcre, pdo, pdo_mysql, zlib
18+
tools: cs2pr, phpcs, php-cs-fixer
19+
- name: phpcs
20+
run: phpcs -n -q --report=checkstyle | cs2pr
21+
- name: php-cs-fixer
22+
run: php-cs-fixer fix --dry-run --diff

.github/workflows/php.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: PHP
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
syntax:
9+
name: "Check Syntax (${{ matrix.php }})"
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php:
15+
- '8.1'
16+
- '8.2'
17+
- '8.3'
18+
- '8.4'
19+
steps:
20+
- name: Set up PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php }}
24+
- uses: actions/checkout@v4
25+
- run: echo "::add-matcher::.github/php-syntax.json"
26+
- run: |
27+
! find . -type f -name '*.php' -exec php -l '{}' \; 2>&1 |grep -v '^No syntax errors detected'

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['*']
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 20
20+
21+
- name: Create package
22+
run: |
23+
rm -rf *.tar.gz
24+
npx --yes wspackager@latest
25+
26+
- name: Check file existence
27+
id: check_files
28+
uses: andstor/file-existence-action@v2.0.0
29+
with:
30+
files: "*.tar.gz"
31+
32+
- name: On Build Failure
33+
if: steps.check_files.outputs.files_exists == 'false'
34+
run: |
35+
echo "Packaging FAILED" && exit 1
36+
37+
- name: Release
38+
uses: softprops/action-gh-release@v0.1.15
39+
if: startsWith(github.ref, 'refs/tags/') && steps.check_files.outputs.files_exists == 'true'
40+
with:
41+
files: "*.tar.gz"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/*.tar
2+
.phpcs-cache
3+
node_modules/
4+
*.cache

.php-cs-fixer.dist.php

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<?php
2+
$finder = PhpCsFixer\Finder::create()
3+
->in(__DIR__.'/files/');
4+
5+
return (new PhpCsFixer\Config())
6+
->setRiskyAllowed(true)
7+
->setRules([
8+
'@PSR1' => true,
9+
'@PSR2' => true,
10+
11+
'array_push' => true,
12+
'backtick_to_shell_exec' => true,
13+
'no_alias_language_construct_call' => true,
14+
'no_mixed_echo_print' => true,
15+
'pow_to_exponentiation' => true,
16+
'random_api_migration' => true,
17+
18+
'array_syntax' => ['syntax' => 'short'],
19+
'no_multiline_whitespace_around_double_arrow' => true,
20+
'no_trailing_comma_in_singleline_array' => true,
21+
'no_whitespace_before_comma_in_array' => true,
22+
'normalize_index_brace' => true,
23+
'whitespace_after_comma_in_array' => true,
24+
25+
'non_printable_character' => ['use_escape_sequences_in_strings' => true],
26+
27+
'lowercase_static_reference' => true,
28+
'magic_constant_casing' => true,
29+
'magic_method_casing' => true,
30+
'native_function_casing' => true,
31+
'native_function_type_declaration_casing' => true,
32+
33+
'cast_spaces' => ['space' => 'none'],
34+
'lowercase_cast' => true,
35+
'no_unset_cast' => true,
36+
'short_scalar_cast' => true,
37+
38+
'class_attributes_separation' => true,
39+
'no_blank_lines_after_class_opening' => true,
40+
'no_null_property_initialization' => true,
41+
'self_accessor' => true,
42+
'single_class_element_per_statement' => true,
43+
'single_trait_insert_per_statement' => true,
44+
45+
'no_empty_comment' => true,
46+
'single_line_comment_style' => ['comment_types' => ['hash']],
47+
48+
'native_constant_invocation' => ['strict' => false],
49+
50+
'no_alternative_syntax' => true,
51+
'no_trailing_comma_in_list_call' => true,
52+
'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield', 'yield_from']],
53+
'no_unneeded_curly_braces' => ['namespaces' => true],
54+
'switch_continue_to_break' => true,
55+
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
56+
57+
'function_typehint_space' => true,
58+
'lambda_not_used_import' => true,
59+
'native_function_invocation' => ['include' => ['@internal']],
60+
'no_unreachable_default_argument_value' => true,
61+
'nullable_type_declaration_for_default_null_value' => true,
62+
'return_type_declaration' => true,
63+
'static_lambda' => true,
64+
65+
'fully_qualified_strict_types' => ['leading_backslash_in_global_namespace' => true],
66+
'no_leading_import_slash' => true,
67+
'no_unused_imports' => true,
68+
'ordered_imports' => true,
69+
70+
'declare_equal_normalize' => true,
71+
'dir_constant' => true,
72+
'explicit_indirect_variable' => true,
73+
'function_to_constant' => true,
74+
'is_null' => true,
75+
'no_unset_on_property' => true,
76+
77+
'list_syntax' => ['syntax' => 'short'],
78+
79+
'clean_namespace' => true,
80+
'no_leading_namespace_whitespace' => true,
81+
'single_blank_line_before_namespace' => true,
82+
83+
'no_homoglyph_names' => true,
84+
85+
'binary_operator_spaces' => true,
86+
'concat_space' => ['spacing' => 'one'],
87+
'increment_style' => ['style' => 'post'],
88+
'logical_operators' => true,
89+
'object_operator_without_whitespace' => true,
90+
'operator_linebreak' => true,
91+
'standardize_increment' => true,
92+
'standardize_not_equals' => true,
93+
'ternary_operator_spaces' => true,
94+
'ternary_to_elvis_operator' => true,
95+
'ternary_to_null_coalescing' => true,
96+
'unary_operator_spaces' => true,
97+
98+
'no_useless_return' => true,
99+
'return_assignment' => true,
100+
101+
'multiline_whitespace_before_semicolons' => true,
102+
'no_empty_statement' => true,
103+
'no_singleline_whitespace_before_semicolons' => true,
104+
'space_after_semicolon' => ['remove_in_empty_for_expressions' => true],
105+
106+
'escape_implicit_backslashes' => true,
107+
'explicit_string_variable' => true,
108+
'heredoc_to_nowdoc' => true,
109+
'no_binary_string' => true,
110+
'simple_to_complex_string_variable' => true,
111+
112+
'array_indentation' => true,
113+
'blank_line_before_statement' => ['statements' => ['return', 'exit']],
114+
'compact_nullable_typehint' => true,
115+
'method_chaining_indentation' => true,
116+
'no_extra_blank_lines' => ['tokens' => ['case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'switch', 'throw', 'use']],
117+
'no_spaces_around_offset' => true,
118+
])
119+
->setFinder($finder);

.phpcs.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0"?>
2+
<ruleset
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd"
5+
>
6+
<file>files/</file>
7+
<arg name="extensions" value="php" />
8+
<arg value="p"/>
9+
<arg name="basepath" value="."/>
10+
11+
<rule ref="PSR12">
12+
<!-- https://github.com/squizlabs/PHP_CodeSniffer/issues/3200 -->
13+
<exclude name="PSR12.Classes.AnonClassDeclaration.SpaceAfterKeyword"/>
14+
15+
<!-- We have a large number of comments between the closing brace of an `if` and the `else`. -->
16+
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace"/>
17+
</rule>
18+
</ruleset>

files/.DS_Store

6 KB
Binary file not shown.

files/lib/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)