Skip to content

Commit 06b776d

Browse files
authored
Merge pull request #3 from roadrunner-php/feature/refactoring
Code refactoring
2 parents 6b11b36 + 4e2d85b commit 06b776d

File tree

15 files changed

+478
-158
lines changed

15 files changed

+478
-158
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
indent_style = space
10+
indent_size = 4
11+
trim_trailing_whitespace = true

.gitattributes

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
/tests export-ignore
1+
/.github export-ignore
2+
/.gitattributes export-ignore
3+
/.gitignore export-ignore
4+
/phpunit.xml.dist export-ignore
5+
/tests export-ignore
6+
/.editorconfig export-ignore
7+
/.php_cs.dist.php export-ignore
8+
/psalm.xml export-ignore
9+
/psalm.xml.dist export-ignore
10+
/UPGRADING.md export-ignore

.github/workflows/phpunit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on:
22
push:
33
branches:
4-
- master
4+
- 1.*
55

66
name: phpunit
77

.github/workflows/psalm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on:
22
push:
33
branches:
4-
- master
4+
- 1.*
55

66
name: static analysis
77

.gitignore

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
# IDEA
2-
.idea/
3-
*.iml
4-
5-
# Composer
6-
composer.phar
7-
vendor
8-
composer.lock
9-
10-
# OS
11-
.DS_Store
12-
Thumbs.db
13-
*.exe
14-
15-
# Other
16-
.phpunit.result.cache
1+
.idea
2+
.php_cs
173
.php_cs.cache
18-
clover.xml
19-
.env
20-
builds
21-
4+
.phpunit.result.cache
5+
build
6+
composer.lock
7+
coverage
8+
docs
9+
vendor
10+
node_modules
11+
.php-cs-fixer.cache

.styleci.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
preset: psr12
2+
risky: true
3+
4+
version: 8
5+
6+
enabled:
7+
- alpha_ordered_traits
8+
- array_indentation
9+
- array_push
10+
- combine_consecutive_issets
11+
- combine_consecutive_unsets
12+
- combine_nested_dirname
13+
- declare_strict_types
14+
- dir_constant
15+
- fully_qualified_strict_types
16+
- function_to_constant
17+
- is_null
18+
- magic_constant_casing
19+
- magic_method_casing
20+
- method_separation
21+
- modernize_types_casting
22+
- native_function_casing
23+
- native_function_type_declaration_casing
24+
- no_alias_functions
25+
- no_empty_comment
26+
- no_empty_phpdoc
27+
- no_empty_statement
28+
- no_extra_block_blank_lines
29+
- no_short_bool_cast
30+
- no_superfluous_elseif
31+
- no_unneeded_control_parentheses
32+
- no_unneeded_curly_braces
33+
- no_unneeded_final_method
34+
- no_unset_cast
35+
- no_unused_imports
36+
- no_unused_lambda_imports
37+
- no_useless_else
38+
- no_useless_return
39+
- normalize_index_brace
40+
- php_unit_dedicate_assert
41+
- php_unit_dedicate_assert_internal_type
42+
- php_unit_expectation
43+
- php_unit_mock
44+
- php_unit_mock_short_will_return
45+
- php_unit_namespaced
46+
- php_unit_no_expectation_annotation
47+
- phpdoc_no_empty_return
48+
- phpdoc_no_useless_inheritdoc
49+
- phpdoc_order
50+
- phpdoc_property
51+
- phpdoc_scalar
52+
- phpdoc_separation
53+
- phpdoc_singular_inheritdoc
54+
- phpdoc_trim
55+
- phpdoc_trim_consecutive_blank_line_separation
56+
- phpdoc_type_to_var
57+
- phpdoc_types
58+
- phpdoc_types_order
59+
- print_to_echo
60+
- regular_callable_call
61+
- return_assignment
62+
- self_accessor
63+
- self_static_accessor
64+
- set_type_to_cast
65+
- short_array_syntax
66+
- short_list_syntax
67+
- simplified_if_return
68+
- single_quote
69+
- standardize_not_equals
70+
- ternary_to_null_coalescing
71+
- trailing_comma_in_multiline_array
72+
- unalign_double_arrow
73+
- unalign_equals

LICENSE

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

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# RoadRunner Lock Integration for Symfony
2+
3+
[![PHP Version Require](https://poser.pugx.org/roadrunner-php/symfony-lock-driver/require/php)](https://packagist.org/packages/roadrunner-php/symfony-lock-driver)
4+
[![Latest Stable Version](https://poser.pugx.org/roadrunner-php/symfony-lock-driver/v/stable)](https://packagist.org/packages/roadrunner-php/symfony-lock-driver)
5+
[![phpunit](https://github.com/roadrunner-php/symfony-lock-driver/actions/workflows/phpunit.yml/badge.svg)](https://github.com/roadrunner-php/symfony-lock-driver/actions)
6+
[![psalm](https://github.com/roadrunner-php/symfony-lock-driver/actions/workflows/psalm.yml/badge.svg)](https://github.com/roadrunner-php/symfony-lock-driver/actions)
7+
[![Codecov](https://codecov.io/gh/roadrunner-php/symfony-lock-driver/branch/master/graph/badge.svg)](https://codecov.io/gh/roadrunner-php/symfony-lock-driver/)
8+
[![Total Downloads](https://poser.pugx.org/roadrunner-php/symfony-lock-driver/downloads)](https://packagist.org/roadrunner-php/symfony-lock-driver/phpunit)
9+
<a href="https://discord.gg/8bZsjYhVVk"><img src="https://img.shields.io/badge/discord-chat-magenta.svg"></a>
10+
11+
This package is a bridge that connects the powerful RoadRunner Lock plugin with the Symfony Lock component. It's
12+
designed to help you easily manage distributed locks in your PHP applications, particularly when you're working with
13+
high-traffic web applications and microservices.
14+
15+
## Requirements
16+
17+
Make sure that your server is configured with following PHP version and extensions:
18+
19+
- PHP 8.1+
20+
21+
## Installation
22+
23+
You can install the package via composer:
24+
25+
```bash
26+
composer require roadrunner-php/symfony-lock-driver
27+
28+
```
29+
30+
## Usage
31+
32+
Using the RoadRunner Lock with Symfony is straightforward. Here's a simple example:
33+
34+
```php
35+
use RoadRunner\Lock\Lock;
36+
use Spiral\Goridge\RPC\RPC;
37+
use Spiral\RoadRunner\Symfony\Lock\RoadRunnerStore;
38+
use Symfony\Component\Lock\LockFactory;
39+
40+
require __DIR__ . '/vendor/autoload.php';
41+
42+
$lock = new Lock(RPC::create('tcp://127.0.0.1:6001'));
43+
$factory = new LockFactory(
44+
new RoadRunnerStore($lock)
45+
);
46+
```
47+
48+
Read more about using Symfony Lock component [here](https://symfony.com/doc/current/components/lock.html).
49+
50+
## Contributing
51+
52+
Contributions are welcome! If you find an issue or have a feature request, please open
53+
an [issue](https://github.com/roadrunner-php/issues) or submit a pull request.
54+
55+
## Credits
56+
57+
- [gam6itko](https://github.com/gam6itko)
58+
- [butschster](https://github.com/butschster)
59+
60+
## License
61+
62+
The MIT License (MIT). Please see [License File](LICENSE) for more information.

composer.json

Lines changed: 64 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,68 @@
11
{
2-
"name": "roadrunner-php/symfony-lock-driver",
3-
"type": "library",
4-
"description": "RoadRunner: symfony/lock bridge",
5-
"license": "MIT",
6-
"authors": [
7-
{
8-
"name": "Pavel Buchnev (butschster)",
9-
"email": "pavel.buchnev@spiralscout.com"
2+
"name": "roadrunner-php/symfony-lock-driver",
3+
"type": "library",
4+
"description": "RoadRunner: symfony/lock bridge",
5+
"keywords": [
6+
"roadrunner-php",
7+
"symfony",
8+
"roadrunner",
9+
"spiral",
10+
"lock"
11+
],
12+
"license": "MIT",
13+
"authors": [
14+
{
15+
"name": "Pavel Buchnev (butschster)",
16+
"email": "pavel.buchnev@spiralscout.com"
17+
},
18+
{
19+
"name": "Alexander Strizhak",
20+
"email": "gam6itko@gmail.com"
21+
}
22+
],
23+
"homepage": "https://spiral.dev/",
24+
"support": {
25+
"docs": "https://roadrunner.dev/docs",
26+
"issues": "https://github.com/roadrunner-server/roadrunner/issues",
27+
"forum": "https://forum.roadrunner.dev/",
28+
"chat": "https://discord.gg/V6EK4he"
1029
},
11-
{
12-
"name": "Alexander Strizhak",
13-
"email": "gam6itko@gmail.com"
14-
}
15-
],
16-
"homepage": "https://spiral.dev/",
17-
"support": {
18-
"docs": "https://roadrunner.dev/docs",
19-
"issues": "https://github.com/roadrunner-server/roadrunner/issues",
20-
"forum": "https://forum.roadrunner.dev/",
21-
"chat": "https://discord.gg/V6EK4he"
22-
},
23-
"require": {
24-
"php": ">=8.1",
25-
"roadrunner-php/lock": "^1.0",
26-
"symfony/lock": "^6.0"
27-
},
28-
"require-dev": {
29-
"phpunit/phpunit": "^10.0",
30-
"vimeo/psalm": "^5.9"
31-
},
32-
"autoload": {
33-
"psr-4": {
34-
"Spiral\\RoadRunner\\Symfony\\Lock\\": "src"
35-
}
36-
},
37-
"autoload-dev": {
38-
"psr-4": {
39-
"Spiral\\RoadRunner\\Symfony\\Lock\\Tests\\": "tests"
40-
}
41-
},
42-
"funding": [
43-
{
44-
"type": "github",
45-
"url": "https://github.com/sponsors/roadrunner-server"
46-
}
47-
],
48-
"scripts": {
49-
"analyze": "psalm"
50-
},
51-
"config": {
52-
"sort-packages": true
53-
},
54-
"minimum-stability": "dev",
55-
"prefer-stable": true,
56-
"extra": {
57-
"branch-alias": {
58-
"dev-main": "1.0-dev"
30+
"require": {
31+
"php": ">=8.1",
32+
"roadrunner-php/lock": "^1.0",
33+
"symfony/lock": "^6.0"
34+
},
35+
"require-dev": {
36+
"phpunit/phpunit": "^10.0",
37+
"vimeo/psalm": "^5.9"
38+
},
39+
"autoload": {
40+
"psr-4": {
41+
"Spiral\\RoadRunner\\Symfony\\Lock\\": "src"
42+
}
43+
},
44+
"autoload-dev": {
45+
"psr-4": {
46+
"Spiral\\RoadRunner\\Symfony\\Lock\\Tests\\": "tests"
47+
}
48+
},
49+
"funding": [
50+
{
51+
"type": "github",
52+
"url": "https://github.com/sponsors/roadrunner-server"
53+
}
54+
],
55+
"scripts": {
56+
"analyze": "psalm"
57+
},
58+
"config": {
59+
"sort-packages": true
60+
},
61+
"minimum-stability": "dev",
62+
"prefer-stable": true,
63+
"extra": {
64+
"branch-alias": {
65+
"dev-main": "1.0-dev"
66+
}
5967
}
60-
}
6168
}

0 commit comments

Comments
 (0)