Skip to content

Commit 0f815bf

Browse files
committed
Migrate to revoltphp organization
The package has previously been available at https://github.com/amphp/react-adapter.
1 parent 55d0c30 commit 0f815bf

25 files changed

+158
-161
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

.php-cs-fixer.dist.php

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,89 @@
11
<?php
22

3-
$config = new Amp\CodeStyle\Config();
3+
namespace Revolt;
4+
5+
use PhpCsFixer\Config as PhpCsFixerConfig;
6+
7+
final class Config extends PhpCsFixerConfig
8+
{
9+
private string $src;
10+
11+
public function __construct()
12+
{
13+
parent::__construct('Revolt');
14+
15+
$this->setRiskyAllowed(true);
16+
$this->setLineEnding("\n");
17+
18+
$this->src = __DIR__ . '/src';
19+
}
20+
21+
public function getRules(): array
22+
{
23+
return [
24+
"@PSR1" => true,
25+
"@PSR2" => true,
26+
"@PSR12" => true,
27+
"braces" => [
28+
"allow_single_line_closure" => true,
29+
],
30+
"array_syntax" => ["syntax" => "short"],
31+
"cast_spaces" => true,
32+
"combine_consecutive_unsets" => true,
33+
"function_to_constant" => true,
34+
"native_function_invocation" => [
35+
'include' => [
36+
'@internal',
37+
'pcntl_async_signals',
38+
'pcntl_signal_dispatch',
39+
'pcntl_signal',
40+
'posix_kill',
41+
'uv_loop_new',
42+
'uv_poll_start',
43+
'uv_poll_stop',
44+
'uv_now',
45+
'uv_run',
46+
'uv_poll_init_socket',
47+
'uv_timer_init',
48+
'uv_timer_start',
49+
'uv_timer_stop',
50+
'uv_signal_init',
51+
'uv_signal_start',
52+
'uv_signal_stop',
53+
'uv_update_time',
54+
'uv_is_active',
55+
],
56+
],
57+
"multiline_whitespace_before_semicolons" => true,
58+
"no_unused_imports" => true,
59+
"no_useless_else" => true,
60+
"no_useless_return" => true,
61+
"no_whitespace_before_comma_in_array" => true,
62+
"no_whitespace_in_blank_line" => true,
63+
"non_printable_character" => true,
64+
"normalize_index_brace" => true,
65+
"ordered_imports" => ['imports_order' => ['class', 'const', 'function']],
66+
"php_unit_construct" => true,
67+
"php_unit_dedicate_assert" => true,
68+
"php_unit_fqcn_annotation" => true,
69+
"phpdoc_scalar" => ["types" => ['boolean', 'double', 'integer', 'real', 'str']],
70+
"phpdoc_summary" => true,
71+
"phpdoc_types" => ["groups" => ["simple", "meta"]],
72+
"psr_autoloading" => ['dir' => $this->src],
73+
"return_type_declaration" => ["space_before" => "none"],
74+
"short_scalar_cast" => true,
75+
"single_blank_line_before_namespace" => true,
76+
"line_ending" => true,
77+
];
78+
}
79+
}
80+
81+
$config = new Config;
482
$config->getFinder()
83+
->in(__DIR__ . '/examples')
584
->in(__DIR__ . '/src')
685
->in(__DIR__ . '/test');
786

8-
$config->setCacheFile(__DIR__ . '/.php_cs.cache');
87+
$config->setCacheFile(__DIR__ . '/.php-cs-fixer.cache');
988

1089
return $config;

CONTRIBUTING.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,32 @@ submission. Please adhere to [sound bug reporting principles](http://www.chiark.
1010
Truths which we believe to be self-evident:
1111

1212
- **It's an asynchronous world.** Be wary of anything that undermines
13-
async principles.
13+
async principles.
1414

1515
- **The answer is not more options.** If you feel compelled to expose
16-
new preferences to the user it's very possible you've made a wrong
17-
turn somewhere.
16+
new preferences to the user it's very possible you've made a wrong
17+
turn somewhere.
1818

1919
- **There are no power users.** The idea that some users "understand"
20-
concepts better than others has proven to be, for the most part, false.
21-
If anything, "power users" are more dangerous than the rest, and we
22-
should avoid exposing dangerous functionality to them.
20+
concepts better than others has proven to be, for the most part, false.
21+
If anything, "power users" are more dangerous than the rest, and we
22+
should avoid exposing dangerous functionality to them.
2323

2424
## Code style
2525

26-
The amphp project adheres to the PSR-2 style guide with the exception that
27-
opening braces for classes and methods must appear on the same line as
28-
the declaration:
26+
The project adheres to the [PSR-2 style guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
27+
).
2928

30-
https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md
29+
To apply code standards you can run `php-cs-fixer` with following composer command:
30+
31+
```bash
32+
composer code-style
33+
```
34+
35+
## Running the tests
36+
37+
Run the test suite from root directory:
38+
39+
```bash
40+
composer test
41+
```

LICENSE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2017-2022 amphp
3+
Copyright (c) 2022 Revolt (Aaron Piotrowski, Cees-Jan Kiewiet, Niklas Keller, and contributors)
4+
Copyright (c) 2017-2022 amphp (Aaron Piotrowski, Niklas Keller, and contributors)
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
67
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
# react-adapter
1+
# event-loop-adapter-react
22

3-
[![Build Status](https://img.shields.io/travis/amphp/react-adapter/master.svg?style=flat-square)](https://travis-ci.org/amphp/react-adapter)
4-
[![Coverage Status](https://img.shields.io/coveralls/amphp/react-adapter/master.svg?style=flat-square)](https://coveralls.io/github/amphp/react-adapter?branch=master)
53
![Stable](https://img.shields.io/badge/stability-stable-green.svg?style=flat-square)
64
![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)
75

8-
`amphp/react-adapter` makes any [ReactPHP](https://reactphp.org/) library compatible with [Revolt's event loop](https://revolt.run) and v3 of [Amp](https://github.com/amphp/amp).
6+
`revolt/event-loop-adapter-react` makes any [ReactPHP](https://reactphp.org/) library run on top of
7+
the [Revolt event loop](https://revolt.run).
98

109
## Installation
1110

1211
```bash
13-
composer require amphp/react-adapter
12+
composer require revolt/event-loop-adapter-react
1413
```
1514

1615
## Usage
1716

18-
Everywhere where a ReactPHP library requires an instance of `LoopInterface`, you just pass `ReactAdapter::get()` to run the ReactPHP library on [Revolt](https://revolt.run/) event loop.
17+
Everywhere where a ReactPHP library requires an instance of `LoopInterface`, you just pass `ReactAdapter::get()` to run
18+
the ReactPHP library on the [Revolt event loop](https://revolt.run/).
1919

2020
```php
2121
<?php
2222

2323
require 'vendor/autoload.php';
2424

2525
use Revolt\EventLoop;
26-
use Amp\ReactAdapter\ReactAdapter;
26+
use Revolt\EventLoop\Adapter\React\RevoltLoop;
2727

2828
EventLoop::defer(function () {
2929
$app = function ($request, $response) {
3030
$response->writeHead(200, array('Content-Type' => 'text/plain'));
3131
$response->end("Hello World\n");
3232
};
3333

34-
$socket = new React\Socket\Server(ReactAdapter::get());
35-
$http = new React\Http\Server($socket, ReactAdapter::get());
34+
$socket = new React\Socket\Server(RevoltLoop::get());
35+
$http = new React\Http\Server($socket, RevoltLoop::get());
3636

3737
$http->on('request', $app);
3838
echo "Server running at http://127.0.0.1:1337\n";
@@ -41,12 +41,9 @@ EventLoop::defer(function () {
4141
});
4242
```
4343

44-
You can also use the adapter to run ReactPHP apps on an [Revolt](https://revolt.run/) event loop implementation without relying on Revolt's global event loop.
44+
You can also use the adapter to run ReactPHP apps on a specific [Revolt event loop](https://revolt.run/) implementation
45+
without relying on Revolt's global event loop.
4546

4647
```php
47-
$loop = new Amp\ReactAdapter\ReactAdapter((new Revolt\EventLoop\DriverFactory)->create());
48+
$loop = new Revolt\EventLoop\Adapter\React\RevoltLoop((new Revolt\EventLoop\DriverFactory)->create());
4849
```
49-
50-
## Documentation
51-
52-
Documentation is available on [amphp.org/react-adapter](https://amphp.org/react-adapter/).

composer.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "amphp/react-adapter",
3-
"description": "Adapter to make any ReactPHP library compatible with Amp.",
2+
"name": "revolt/event-loop-adapter-react",
3+
"description": "Makes any ReactPHP based library run on top of the Revolt event loop.",
44
"license": "MIT",
55
"authors": [
66
{
@@ -9,36 +9,38 @@
99
}
1010
],
1111
"support": {
12-
"issues": "https://github.com/amphp/react-adapter/issues",
13-
"irc": "irc://irc.freenode.org/amphp"
12+
"issues": "https://github.com/revoltphp/event-loop-adapter-react/issues"
1413
},
1514
"require": {
1615
"php": ">=8.1",
1716
"react/event-loop": "^0.5 || ^1",
18-
"revolt/event-loop": "^0.2.1"
17+
"revolt/event-loop": "^0.2.4"
1918
},
2019
"require-dev": {
21-
"phpunit/phpunit": "^9",
22-
"amphp/php-cs-fixer-config": "^2-dev",
20+
"phpunit/phpunit": "^9.5.21",
2321
"psalm/phar": "^4.24"
2422
},
2523
"autoload": {
2624
"psr-4": {
27-
"Amp\\ReactAdapter\\": "src"
25+
"Revolt\\EventLoop\\Adapter\\React\\": "src"
2826
},
2927
"files": [
3028
"etc/Factory.php"
3129
]
3230
},
3331
"autoload-dev": {
3432
"psr-4": {
35-
"Amp\\ReactAdapter\\Test\\": "test",
33+
"Revolt\\EventLoop\\Adapter\\React\\": "test",
3634
"React\\Tests\\EventLoop\\": "vendor/react/event-loop/tests"
3735
}
3836
},
3937
"config": {
4038
"preferred-install": {
4139
"react/event-loop": "source"
4240
}
41+
},
42+
"scripts": {
43+
"test": "@php -dzend.assertions=1 -dassert.exception=1 vendor/bin/phpunit",
44+
"code-style": "@php vendor/bin/php-cs-fixer fix"
4345
}
4446
}

docs/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/.shared

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/Gemfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/_config.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)