Skip to content

Commit bb817d3

Browse files
committed
Init repo
0 parents  commit bb817d3

17 files changed

+346
-0
lines changed

.gitattributes

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/.github export-ignore
2+
/docs export-ignore
3+
/tests export-ignore
4+
.gitattributes export-ignore
5+
.gitignore export-ignore
6+
.php-cs-fixer.php export-ignore
7+
CHANGELOG.md export-ignore
8+
phpstan.neon export-ignore
9+
phpstan-baseline.neon export-ignore
10+
phpunit.xml.dist export-ignore
11+
README.md export-ignore

.github/FUNDING.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: mbabker

.github/workflows/run-tests.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 'Run Tests'
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
continue-on-error: ${{ matrix.can-fail }}
9+
strategy:
10+
fail-fast: true
11+
matrix:
12+
php: ['8.1']
13+
symfony: ['5.4.*', '6.0.*', '6.1.*']
14+
composer-flags: ['--prefer-stable']
15+
can-fail: [false]
16+
include:
17+
- php: '8.1'
18+
symfony: '5.4.*'
19+
composer-flags: '--prefer-stable --prefer-lowest'
20+
can-fail: false
21+
22+
name: "PHP ${{ matrix.php }} - Symfony ${{ matrix.symfony }}${{ matrix.composer-flags != '' && format(' - Composer {0}', matrix.composer-flags) || '' }}"
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v3
27+
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php }}
32+
tools: composer:v2,flex
33+
extensions: curl, iconv, mbstring, zip
34+
coverage: none
35+
36+
- name: Install dependencies
37+
run: |
38+
composer update ${{ matrix.composer-flags }} --prefer-dist --no-suggest
39+
env:
40+
SYMFONY_REQUIRE: ${{ matrix.symfony }}
41+
42+
- name: Execute tests
43+
run: vendor/bin/phpunit

.github/workflows/static-analysis.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: 'Static Analysis'
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
sa-phpstan:
7+
runs-on: ubuntu-latest
8+
9+
name: PHPStan
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
15+
- name: Setup PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: '8.1'
19+
tools: composer:v2,flex
20+
extensions: curl, iconv, mbstring, zip
21+
coverage: none
22+
23+
- name: Install dependencies
24+
run: composer update --prefer-stable --prefer-dist
25+
env:
26+
SYMFONY_REQUIRE: '6.1.*'
27+
28+
- name: Run PHPStan
29+
run: vendor/bin/phpstan analyze --error-format=github

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/vendor/
2+
composer.lock
3+
.phpunit.result.cache
4+
/phpunit.xml
5+
.php-cs-fixer.cache

.php-cs-fixer.php

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php declare(strict_types=1);
2+
3+
return (new PhpCsFixer\Config())
4+
->setRules([
5+
'@Symfony' => true,
6+
'@Symfony:risky' => true,
7+
'@PHP81Migration' => true,
8+
'@PHP80Migration:risky' => true,
9+
'@PHPUnit84Migration:risky' => true,
10+
'array_syntax' => ['syntax' => 'short'],
11+
'blank_line_after_opening_tag' => false,
12+
'fopen_flags' => false,
13+
'linebreak_after_opening_tag' => false,
14+
'no_superfluous_phpdoc_tags' => ['remove_inheritdoc' => true],
15+
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
16+
])
17+
->setRiskyAllowed(true)
18+
->setFinder(
19+
(new PhpCsFixer\Finder())
20+
->in(__DIR__.'/src')
21+
->in(__DIR__.'/tests')
22+
)
23+
;

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2022 Michael Babker
4+
https://www.babdev.com/
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# WebSocketBundle
2+
3+
[![Latest Stable Version](https://poser.pugx.org/babdev/websocket-bundle/v/stable)](https://packagist.org/packages/babdev/websocket-bundle) [![Latest Unstable Version](https://poser.pugx.org/babdev/websocket-bundle/v/unstable)](https://packagist.org/packages/babdev/websocket-bundle) [![Total Downloads](https://poser.pugx.org/babdev/websocket-bundle/downloads)](https://packagist.org/packages/babdev/websocket-bundle) [![License](https://poser.pugx.org/babdev/websocket-bundle/license)](https://packagist.org/packages/babdev/websocket-bundle) ![Run Tests](https://github.com/BabDev/WebSocketBundle/workflows/Run%20Tests/badge.svg?branch=0.1)
4+
5+
Bundle integrating the WebSocket Server library with [Symfony](https://github.com/symfony/symfony).
6+
7+
## Documentation
8+
9+
Please see the [BabDev website](https://www.babdev.com/open-source/packages/websocketbundle/docs/1.x) for detailed information on how to use this bundle.
10+
11+
## Security
12+
13+
If you believe you have discovered a security issue with this bundle, please email [email protected] with information about the issue. Do **NOT** use the public issue tracker for security issues.
14+
15+
## Acknowledgements
16+
17+
This bundle is an enhancement of [GosWebSocketBundle](https://github.com/GeniusesOfSymfony/WebSocketBundle).
18+
19+
## License
20+
21+
The WebSocketBundle is licensed under the MIT License. See the [LICENSE file](/LICENSE) for full details.

composer.json

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "babdev/websocket-bundle",
3+
"type": "symfony-bundle",
4+
"description": "Bundle integrating the WebSocket Server library with Symfony",
5+
"keywords": [
6+
"symfony",
7+
"WAMP",
8+
"websocket",
9+
"websocket server"
10+
],
11+
"license": "MIT",
12+
"repositories": [
13+
{
14+
"type": "path",
15+
"url": "../websocket-server"
16+
}
17+
],
18+
"require": {
19+
"php": "8.1.*",
20+
"babdev/websocket-server": "*",
21+
"symfony/config": "^5.4 || ^6.0",
22+
"symfony/dependency-injection": "^5.4 || ^6.0",
23+
"symfony/deprecation-contracts": "^2.1 || ^3.0",
24+
"symfony/http-kernel": "^5.4 || ^6.0"
25+
},
26+
"require-dev": {
27+
"matthiasnoback/symfony-config-test": "^4.3",
28+
"matthiasnoback/symfony-dependency-injection-test": "^4.3",
29+
"phpstan/extension-installer": "^1.1",
30+
"phpstan/phpstan": "1.7.14",
31+
"phpstan/phpstan-phpunit": "1.1.1",
32+
"phpstan/phpstan-symfony": "1.2.5",
33+
"phpunit/phpunit": "9.5.21",
34+
"symfony/phpunit-bridge": "^5.4 || ^6.0"
35+
},
36+
"autoload": {
37+
"psr-4": {
38+
"BabDev\\WebSocketBundle\\": "src/"
39+
}
40+
},
41+
"autoload-dev": {
42+
"psr-4": {
43+
"BabDev\\WebSocketBundle\\Tests\\": "tests/"
44+
}
45+
},
46+
"config": {
47+
"allow-plugins": {
48+
"composer/package-versions-deprecated": true,
49+
"phpstan/extension-installer": true
50+
}
51+
},
52+
"minimum-stability": "dev"
53+
}

phpstan-baseline.neon

Whitespace-only changes.

phpstan.neon

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
level: max
6+
paths:
7+
- %currentWorkingDirectory%/src
8+
- %currentWorkingDirectory%/tests
9+
checkMissingIterableValueType: false
10+
treatPhpDocTypesAsCertain: false

phpunit.xml.dist

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
colors="true"
5+
bootstrap="vendor/autoload.php"
6+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
7+
>
8+
<testsuites>
9+
<testsuite name="BabDevMoneyBundle Test Suite">
10+
<directory>./tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
14+
<coverage processUncoveredFiles="true">
15+
<include>
16+
<directory suffix=".php">./src</directory>
17+
</include>
18+
</coverage>
19+
20+
<listeners>
21+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
22+
</listeners>
23+
24+
<php>
25+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=2"/>
26+
</php>
27+
</phpunit>

src/BabDevWebSocketBundle.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace BabDev\WebSocketBundle;
4+
5+
use BabDev\WebSocketBundle\DependencyInjection\BabDevWebSocketExtension;
6+
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
7+
use Symfony\Component\HttpKernel\Bundle\Bundle;
8+
9+
final class BabDevWebSocketBundle extends Bundle
10+
{
11+
public function getContainerExtension(): ?ExtensionInterface
12+
{
13+
if (null === $this->extension) {
14+
$this->extension = new BabDevWebSocketExtension();
15+
}
16+
17+
return $this->extension ?: null;
18+
}
19+
20+
public function getPath(): string
21+
{
22+
return \dirname(__DIR__);
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace BabDev\WebSocketBundle\DependencyInjection;
4+
5+
use Symfony\Component\DependencyInjection\ContainerBuilder;
6+
use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
7+
8+
final class BabDevWebSocketExtension extends ConfigurableExtension
9+
{
10+
public function getAlias(): string
11+
{
12+
return 'babdev_websocket';
13+
}
14+
15+
protected function loadInternal(array $mergedConfig, ContainerBuilder $container): void
16+
{
17+
}
18+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace BabDev\WebSocketBundle\DependencyInjection;
4+
5+
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
6+
use Symfony\Component\Config\Definition\ConfigurationInterface;
7+
8+
final class Configuration implements ConfigurationInterface
9+
{
10+
public function getConfigTreeBuilder(): TreeBuilder
11+
{
12+
return new TreeBuilder('babdev_websocket');
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace BabDev\WebSocketBundle\Tests\DependencyInjection;
4+
5+
use BabDev\WebSocketBundle\DependencyInjection\BabDevWebSocketExtension;
6+
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
7+
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
8+
9+
final class BabDevWebSocketExtensionTest extends AbstractExtensionTestCase
10+
{
11+
/**
12+
* @return ExtensionInterface[]
13+
*/
14+
protected function getContainerExtensions(): array
15+
{
16+
return [
17+
new BabDevWebSocketExtension(),
18+
];
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace BabDev\WebSocketBundle\Tests\DependencyInjection;
4+
5+
use BabDev\WebSocketBundle\DependencyInjection\Configuration;
6+
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
7+
use PHPUnit\Framework\TestCase;
8+
use Symfony\Component\Config\Definition\ConfigurationInterface;
9+
10+
final class ConfigurationTest extends TestCase
11+
{
12+
use ConfigurationTestCaseTrait;
13+
14+
protected function getConfiguration(): ConfigurationInterface
15+
{
16+
return new Configuration();
17+
}
18+
19+
public function testConfigurationIsValidWithNoUserConfiguration(): void
20+
{
21+
$this->assertConfigurationIsValid([[]]);
22+
}
23+
}

0 commit comments

Comments
 (0)