Skip to content

Commit 601a0a2

Browse files
committed
feat: Add dependabot config, CI workflow, UDP client, chat server docs, PHPUnit config, StreamChannel, TcpChannel, UdpChannel, CryptoMethod, Domain, Transport enums, socket exceptions, interfaces refactoring, RuntimeException, AbstractStreamServer, SSL, ServerConnection, TCP, TLS, UDP classes, unit tests
1 parent 067f4fe commit 601a0a2

70 files changed

Lines changed: 4119 additions & 1427 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5
8+
labels:
9+
- dependencies
10+
commit-message:
11+
prefix: chore
12+
include: scope
13+
14+
- package-ecosystem: github-actions
15+
directory: /
16+
schedule:
17+
interval: weekly
18+
open-pull-requests-limit: 5
19+
labels:
20+
- dependencies
21+
- ci
22+
commit-message:
23+
prefix: chore
24+
include: scope

.github/workflows/ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 2.x
8+
pull_request:
9+
branches:
10+
- main
11+
- 2.x
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: ci-${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
static-analysis:
22+
name: Static analysis & code style
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Set up PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: '8.1'
32+
extensions: sockets, openssl
33+
coverage: none
34+
tools: composer:v2
35+
36+
- name: Get composer cache directory
37+
id: composer-cache
38+
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
39+
40+
- name: Cache composer dependencies
41+
uses: actions/cache@v4
42+
with:
43+
path: ${{ steps.composer-cache.outputs.dir }}
44+
key: composer-${{ runner.os }}-${{ hashFiles('composer.json') }}
45+
restore-keys: composer-${{ runner.os }}-
46+
47+
- name: Install dependencies
48+
run: composer install --no-interaction --no-progress --prefer-dist
49+
50+
- name: PHPStan
51+
run: composer stan -- --no-progress
52+
53+
- name: PHP-CS-Fixer (dry-run)
54+
run: composer cs-check
55+
56+
tests:
57+
name: Tests (PHP ${{ matrix.php }})
58+
runs-on: ubuntu-latest
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
php: ['8.1', '8.2', '8.3']
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
66+
67+
- name: Set up PHP
68+
uses: shivammathur/setup-php@v2
69+
with:
70+
php-version: ${{ matrix.php }}
71+
extensions: sockets, openssl, pcntl, posix
72+
coverage: pcov
73+
tools: composer:v2
74+
75+
- name: Get composer cache directory
76+
id: composer-cache
77+
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
78+
79+
- name: Cache composer dependencies
80+
uses: actions/cache@v4
81+
with:
82+
path: ${{ steps.composer-cache.outputs.dir }}
83+
key: composer-${{ runner.os }}-php${{ matrix.php }}-${{ hashFiles('composer.json') }}
84+
restore-keys: composer-${{ runner.os }}-php${{ matrix.php }}-
85+
86+
- name: Install dependencies
87+
run: composer install --no-interaction --no-progress --prefer-dist
88+
89+
- name: Run test suite
90+
run: composer test-coverage
91+
92+
- name: Upload coverage to Codecov
93+
if: matrix.php == '8.3'
94+
uses: codecov/codecov-action@v4
95+
with:
96+
files: build/coverage.xml
97+
fail_ci_if_error: false
98+
env:
99+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
/.vs/
33
/.vscode/
44
/vendor/
5-
/composer.lock
5+
/composer.lock
6+
/build/
7+
/coverage/
8+
/.phpunit.cache/
9+
/.phpstan-cache/
10+
/.php-cs-fixer.cache

.php-cs-fixer.dist.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$finder = PhpCsFixer\Finder::create()
6+
->in([__DIR__ . '/src', __DIR__ . '/tests'])
7+
->name('*.php')
8+
->ignoreDotFiles(true)
9+
->ignoreVCS(true);
10+
11+
return (new PhpCsFixer\Config())
12+
->setRiskyAllowed(true)
13+
->setRules([
14+
'@PSR12' => true,
15+
'@PSR12:risky' => true,
16+
'@PHP81Migration' => true,
17+
'declare_strict_types' => true,
18+
'native_function_invocation' => [
19+
'include' => ['@compiler_optimized'],
20+
'scope' => 'namespaced',
21+
'strict' => true,
22+
],
23+
'no_unused_imports' => true,
24+
'ordered_imports' => [
25+
'sort_algorithm' => 'alpha',
26+
'imports_order' => ['class', 'function', 'const'],
27+
],
28+
'single_quote' => true,
29+
'array_syntax' => ['syntax' => 'short'],
30+
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments', 'parameters']],
31+
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
32+
'phpdoc_align' => ['align' => 'left'],
33+
'phpdoc_order' => true,
34+
'phpdoc_separation' => true,
35+
])
36+
->setFinder($finder)
37+
->setCacheFile(__DIR__ . '/.php-cs-fixer.cache');

0 commit comments

Comments
 (0)