1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-11-30 04:19:23 +01:00

Update and fix php-cs-fixer and code style

This commit is contained in:
Niklas Keller 2017-04-26 08:27:52 +02:00
parent 9f22953566
commit 16fc80ae3b
13 changed files with 88 additions and 34 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.php_cs.cache
build
composer.lock
phpunit.xml

39
.php_cs.dist Normal file
View File

@ -0,0 +1,39 @@
<?php
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
"@PSR1" => true,
"@PSR2" => true,
"braces" => [
"allow_single_line_closure" => true,
"position_after_functions_and_oop_constructs" => "same",
],
"array_syntax" => ["syntax" => "short"],
"cast_spaces" => true,
"combine_consecutive_unsets" => true,
"function_to_constant" => true,
"no_multiline_whitespace_before_semicolons" => true,
"no_unused_imports" => true,
"no_useless_else" => true,
"no_useless_return" => true,
"no_whitespace_before_comma_in_array" => true,
"no_whitespace_in_blank_line" => true,
"non_printable_character" => true,
"normalize_index_brace" => true,
"ordered_imports" => true,
"php_unit_construct" => true,
"php_unit_dedicate_assert" => true,
"php_unit_fqcn_annotation" => true,
"phpdoc_summary" => true,
"phpdoc_types" => true,
"psr4" => true,
"return_type_declaration" => ["space_before" => "none"],
"short_scalar_cast" => true,
"single_blank_line_before_namespace" => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__ . "/lib")
->in(__DIR__ . "/test")
);

View File

@ -26,7 +26,7 @@
"require-dev": {
"amphp/phpunit-util": "dev-master",
"phpunit/phpunit": "^6",
"friendsofphp/php-cs-fixer": "~1.9"
"friendsofphp/php-cs-fixer": "^2.3"
},
"autoload": {
"psr-4": {

View File

@ -55,8 +55,7 @@ class BufferIterator implements \SeekableIterator {
/**
* Moves to the next character in the buffer.
*/
public function next()
{
public function next() {
++$this->current;
}

View File

@ -2,4 +2,5 @@
namespace Amp\ByteStream;
class ClosedException extends StreamException {}
class ClosedException extends StreamException {
}

View File

@ -2,4 +2,5 @@
namespace Amp\ByteStream;
interface DuplexStream extends ReadableStream, WritableStream {}
interface DuplexStream extends ReadableStream, WritableStream {
}

View File

@ -2,7 +2,8 @@
namespace Amp\ByteStream\Internal;
use Amp\ByteStream\{ ReadableStream, WritableStream };
use Amp\ByteStream\ReadableStream;
use Amp\ByteStream\WritableStream;
/**
* @internal

View File

@ -2,7 +2,11 @@
namespace Amp\ByteStream;
use Amp\{ Deferred, Promise, Stream, StreamIterator, Success };
use Amp\Deferred;
use Amp\Promise;
use Amp\Stream;
use Amp\StreamIterator;
use Amp\Success;
/**
* Creates a buffered message from a Stream. The message can be consumed in chunks using the advance() and getChunk()

View File

@ -2,7 +2,11 @@
namespace Amp\ByteStream;
use Amp\{ Failure, InvalidYieldError, Loop, Promise, Success };
use Amp\Failure;
use Amp\InvalidYieldError;
use Amp\Loop;
use Amp\Promise;
use Amp\Success;
class Parser implements WritableStream {
const CHUNK_SIZE = 8192;

View File

@ -2,4 +2,5 @@
namespace Amp\ByteStream;
class StreamException extends \Exception {}
class StreamException extends \Exception {
}

View File

@ -2,7 +2,8 @@
namespace Amp\ByteStream;
use Amp\{ Coroutine, Promise };
use Amp\Coroutine;
use Amp\Promise;
// @codeCoverageIgnoreStart
if (\strlen('…') !== 3) {

View File

@ -2,9 +2,11 @@
namespace Amp\ByteStream\Test;
use Amp\{ Emitter, Loop, Success };
use Amp\ByteStream\Message;
use Amp\Emitter;
use Amp\Loop;
use Amp\PHPUnit\TestCase;
use Amp\Success;
class MessageTest extends TestCase {
public function testBufferingAll() {