Skip to content

Commit 8f38808

Browse files
kelunikbwoebi
authored andcommitted
Fix line lengths, resolves #76 (#81)
1 parent e089d8e commit 8f38808

File tree

3 files changed

+37
-34
lines changed

3 files changed

+37
-34
lines changed

src/Loop.php

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ final class Loop
2727
/**
2828
* Set the factory to be used to create a default drivers.
2929
*
30-
* Setting a factory is only allowed as long as no loop is currently running.
31-
* Passing null will reset the default driver and remove the factory.
30+
* Setting a factory is only allowed as long as no loop is currently running. Passing null will reset the default
31+
* driver and remove the factory.
3232
*
3333
* The factory will be invoked if none is passed to Loop::execute. A default driver will be created to support
3434
* synchronous waits in traditional applications.
3535
*
36-
* @param DriverFactory|null $factory
36+
* @param DriverFactory|null $factory New factory to replace the previous one.
3737
*/
3838
public static function setFactory(DriverFactory $factory = null)
3939
{
@@ -42,13 +42,15 @@ public static function setFactory(DriverFactory $factory = null)
4242
}
4343

4444
self::$factory = $factory;
45-
self::$driver = null; // reset it here, it will be actually instantiated inside execute() or get()
45+
46+
// reset it here, it will be actually instantiated inside execute() or get()
47+
self::$driver = null;
4648
}
4749

4850
/**
4951
* Execute a callback within the scope of an event loop driver.
5052
*
51-
* @param callable $callback The callback to execute
53+
* @param callable $callback The callback to execute.
5254
* @param Driver $driver The event loop driver. If null a new one is created from the set factory.
5355
*
5456
* @return void
@@ -72,7 +74,7 @@ public static function execute(callable $callback, Driver $driver = null)
7274
/**
7375
* Create a new driver if a factory is present, otherwise throw.
7476
*
75-
* @throws \LogicException if no factory is set or no driver returned from factory
77+
* @throws \LogicException If no factory is set or no driver returned from factory.
7678
*/
7779
private static function createDriver()
7880
{
@@ -100,6 +102,7 @@ public static function get()
100102
if (self::$driver) {
101103
return self::$driver;
102104
}
105+
103106
return self::$driver = self::createDriver();
104107
}
105108

@@ -232,7 +235,7 @@ public static function enable($watcherId)
232235
*
233236
* @return void
234237
*
235-
* @throws InvalidWatcherException Thrown if the watcher identifier is invalid.
238+
* @throws InvalidWatcherException If the watcher identifier is invalid.
236239
*/
237240
public static function disable($watcherId)
238241
{
@@ -241,8 +244,8 @@ public static function disable($watcherId)
241244
}
242245

243246
/**
244-
* Cancel a watcher. This will detatch the event loop from all resources that are associated to the watcher. After this
245-
* operation the watcher is permanently invalid.
247+
* Cancel a watcher. This will detatch the event loop from all resources that are associated to the watcher. After
248+
* this operation the watcher is permanently invalid.
246249
*
247250
* @param string $watcherId The watcher identifier.
248251
*
@@ -264,7 +267,7 @@ public static function cancel($watcherId)
264267
*
265268
* @return void
266269
*
267-
* @throws InvalidWatcherException Thrown if the watcher identifier is invalid.
270+
* @throws InvalidWatcherException If the watcher identifier is invalid.
268271
*/
269272
public static function reference($watcherId)
270273
{
@@ -282,7 +285,7 @@ public static function reference($watcherId)
282285
*
283286
* @return void
284287
*
285-
* @throws InvalidWatcherException Thrown if the watcher identifier is invalid.
288+
* @throws InvalidWatcherException If the watcher identifier is invalid.
286289
*/
287290
public static function unreference($watcherId)
288291
{
@@ -328,7 +331,8 @@ public static function fetchState($key)
328331
*
329332
* Subsequent calls to this method will overwrite the previous handler.
330333
*
331-
* @param callable(\Throwable|\Exception $error)|null $callback The callback to execute; null will clear the current handler.
334+
* @param callable(\Throwable|\Exception $error)|null $callback The callback to execute; null will clear the current
335+
* handler.
332336
*
333337
* @return void
334338
*/
@@ -341,8 +345,7 @@ public static function setErrorHandler(callable $callback = null)
341345
/**
342346
* Retrieve an associative array of information about the event loop driver.
343347
*
344-
* The returned array MUST contain the following data describing the driver's
345-
* currently registered watchers:
348+
* The returned array MUST contain the following data describing the driver's currently registered watchers:
346349
*
347350
* [
348351
* "defer" => ["enabled" => int, "disabled" => int],
@@ -354,8 +357,8 @@ public static function setErrorHandler(callable $callback = null)
354357
* "watchers" => ["referenced" => int, "unreferenced" => int],
355358
* ];
356359
*
357-
* Implementations MAY optionally add more information in the array but
358-
* at minimum the above key => value format MUST always be provided.
360+
* Implementations MAY optionally add more information in the array but at minimum the above key => value format
361+
* MUST always be provided.
359362
*
360363
* @return array
361364
*/

src/Loop/Driver.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ public function onWritable($stream, callable $callback, $data = null);
106106
*
107107
* @return string An unique identifier that can be used to cancel, enable or disable the watcher.
108108
*
109-
* @throws UnsupportedFeatureException Thrown if signal handling is not supported.
109+
* @throws UnsupportedFeatureException If signal handling is not supported.
110110
*/
111111
public function onSignal($signo, callable $callback, $data = null);
112112

113113
/**
114114
* Enable a watcher.
115-
*
115+
*
116116
* Watchers (enabling or new watchers) MUST immediately be marked as enabled, but only be activated (i.e. callbacks
117117
* can be called) right before the next tick. Callbacks of watchers MUST not be called in the tick they were enabled.
118118
*
119119
* @param string $watcherId The watcher identifier.
120120
*
121121
* @return void
122122
*
123-
* @throws InvalidWatcherException Thrown if the watcher identifier is invalid.
123+
* @throws InvalidWatcherException If the watcher identifier is invalid.
124124
*/
125125
public function enable($watcherId);
126126

@@ -131,14 +131,14 @@ public function enable($watcherId);
131131
*
132132
* @return void
133133
*
134-
* @throws InvalidWatcherException Thrown if the watcher identifier is invalid.
134+
* @throws InvalidWatcherException If the watcher identifier is invalid.
135135
*/
136136
public function disable($watcherId);
137137

138138
/**
139-
* Cancel a watcher. This will detatch the event loop from all resources that are associated to the watcher. After this
140-
* operation the watcher is permanently invalid. Calling this function MUST never fail, even when passed an invalid
141-
* watcher.
139+
* Cancel a watcher. This will detatch the event loop from all resources that are associated to the watcher. After
140+
* this operation the watcher is permanently invalid. Calling this function MUST never fail, even when passed an
141+
* invalid watcher.
142142
*
143143
* @param string $watcherId The watcher identifier.
144144
*
@@ -156,7 +156,7 @@ public function cancel($watcherId);
156156
*
157157
* @return void
158158
*
159-
* @throws InvalidWatcherException Thrown if the watcher identifier is invalid.
159+
* @throws InvalidWatcherException If the watcher identifier is invalid.
160160
*/
161161
public function reference($watcherId);
162162

@@ -170,10 +170,10 @@ public function reference($watcherId);
170170
*
171171
* @return void
172172
*
173-
* @throws InvalidWatcherException Thrown if the watcher identifier is invalid.
173+
* @throws InvalidWatcherException If the watcher identifier is invalid.
174174
*/
175175
public function unreference($watcherId);
176-
176+
177177
/**
178178
* Stores information in the loop bound registry. This can be used to store loop bound information. Stored
179179
* information is package private. Packages MUST NOT retrieve the stored state of other packages.
@@ -193,7 +193,7 @@ public function storeState($key, $value);
193193
*
194194
* Therefore packages SHOULD use the following prefix to keys: `vendor.package.`
195195
*
196-
* @param string $key namespaced storage key
196+
* @param string $key Namespaced storage key.
197197
*
198198
* @return mixed previously stored value or null if it doesn't exist
199199
*/
@@ -214,8 +214,7 @@ public function setErrorHandler(callable $callback = null);
214214
/**
215215
* Retrieve an associative array of information about the event loop driver.
216216
*
217-
* The returned array MUST contain the following data describing the driver's
218-
* currently registered watchers:
217+
* The returned array MUST contain the following data describing the driver's currently registered watchers:
219218
*
220219
* [
221220
* "defer" => ["enabled" => int, "disabled" => int],
@@ -227,8 +226,8 @@ public function setErrorHandler(callable $callback = null);
227226
* "watchers" => ["referenced" => int, "unreferenced" => int],
228227
* ];
229228
*
230-
* Implementations MAY optionally add more information in the array but
231-
* at minimum the above key => value format MUST always be provided.
229+
* Implementations MAY optionally add more information in the array but at minimum the above key => value format
230+
* MUST always be provided.
232231
*
233232
* @return array
234233
*/
@@ -239,7 +238,8 @@ public function info();
239238
*
240239
* Example: the uv_loop resource for libuv or the EvLoop object for libev or null for a native driver
241240
*
242-
* Note: This function is *not* exposed in the Loop class; users shall access it directly on the respective loop instance.
241+
* Note: This function is *not* exposed in the Loop class; users shall access it directly on the respective loop
242+
* instance.
243243
*
244244
* @return null|object|resource The loop handle the event loop operates on. Null if there is none.
245245
*/

src/Loop/InvalidWatcherException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Interop\Async\Loop;
44

55
/**
6-
* MUST be thrown if any operation (except cancel()) is attempted with an invalid watcher identifier.
7-
* [Invalid watcher identifier: any identifier not yet emitted by the driver or cancelled by the user]
6+
* MUST be thrown if any operation (except cancel()) is attempted with an invalid watcher identifier. An invalid watcher
7+
* identifier is any identifier that is not yet emitted by the driver or cancelled by the user.
88
*/
99
class InvalidWatcherException extends \LogicException
1010
{

0 commit comments

Comments
 (0)