Skip to content

Commit bf92de4

Browse files
Swich from PHP CS Fixer to PHP CS and PSR-12
1 parent 81d1c10 commit bf92de4

File tree

10 files changed

+28
-37
lines changed

10 files changed

+28
-37
lines changed

.php_cs.dist

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

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ before_script:
2323
- composer install --no-interaction --no-progress --no-suggest --no-ansi
2424

2525
script:
26-
- composer phpcsfix-test
27-
- composer phpstan
28-
- composer psalm
29-
- composer phpunit
30-
- composer infection
26+
- composer test:lint
27+
- composer test:phpstan
28+
- composer test:psalm
29+
- composer test:unit
30+
- composer test:mutation

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
}
2121
},
2222
"scripts": {
23-
"phpcsfix-test": "./tools/php-cs-fixer fix --config .php_cs.dist --dry-run",
24-
"phpcsfix": "./tools/php-cs-fixer fix --config .php_cs.dist",
25-
"phpstan": "./tools/phpstan analyse --level max examples/ src/",
26-
"psalm": "./tools/psalm src/ examples/",
27-
"phpunit": "./tools/phpunit",
28-
"infection": "./tools/infection --min-msi=40 --no-interaction --no-ansi --no-progress",
23+
"fix": "./tools/phpcbf --standard=PSR12 --extensions=php -p src/ tests/ examples/",
24+
"test:lint": "./tools/phpcs --standard=PSR12 --extensions=php -p src/ tests/ examples/",
25+
"test:phpstan": "./tools/phpstan analyse --level max examples/ src/",
26+
"test:psalm": "./tools/psalm src/ examples/",
27+
"test:unit": "./tools/phpunit",
28+
"test:mutation": "./tools/infection --min-msi=60 --no-interaction --no-ansi --no-progress",
2929
"test": [
30-
"@phpcsfix",
31-
"@phpstan",
32-
"@psalm",
33-
"@phpunit",
34-
"@infection"
30+
"@test:lint",
31+
"@test:phpstan",
32+
"@test:psalm",
33+
"@test:unit",
34+
"@test:mutation"
3535
]
3636
}
3737
}

examples/01-watcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
print_r($data);
2323
});
2424

25-
touch(__DIR__.'/testfile');
26-
unlink(__DIR__.'/testfile');
25+
touch(__DIR__ . '/testfile');
26+
unlink(__DIR__ . '/testfile');
2727

2828
$loop->run();

phive.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<phar name="phpunit" version="^8.4.3" installed="8.4.3" location="./tools/phpunit" copy="true"/>
44
<phar name="phpstan" version="^0.11.19" installed="0.11.19" location="./tools/phpstan" copy="true"/>
55
<phar name="psalm" version="^3.6.4" installed="3.6.4" location="./tools/psalm" copy="true"/>
6-
<phar name="php-cs-fixer" version="^2.16.0" installed="2.16.0" location="./tools/php-cs-fixer" copy="true"/>
76
<phar name="infection" version="^0.14.2" installed="0.14.2" location="./tools/infection" copy="true"/>
7+
<phar name="phpcs" version="^3.4.2" installed="3.4.2" location="./tools/phpcs" copy="true"/>
8+
<phar name="phpcbf" version="^3.5.2" installed="3.5.2" location="./tools/phpcbf" copy="true"/>
89
</phive>

src/InotifyStream.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ final class InotifyStream extends EventEmitter
3636
public function __construct($stream, LoopInterface $loop)
3737
{
3838
if (!\is_resource($stream) ||
39-
\get_resource_type($stream) !== "stream") {
39+
\get_resource_type($stream) !== "stream"
40+
) {
4041
throw new \InvalidArgumentException(
4142
'First parameter must be a valid stream resource'
4243
);
@@ -46,7 +47,8 @@ public function __construct($stream, LoopInterface $loop)
4647
$meta = \stream_get_meta_data($stream);
4748
if (isset($meta['mode']) &&
4849
$meta['mode'] !== '' &&
49-
\strpos($meta['mode'], 'r') === \strpos($meta['mode'], '+')) {
50+
\strpos($meta['mode'], 'r') === \strpos($meta['mode'], '+')
51+
) {
5052
throw new \InvalidArgumentException(
5153
'Given stream resource is not opened in read mode'
5254
);
@@ -93,7 +95,8 @@ public function pause(): void
9395
public function resume(): void
9496
{
9597
if (!$this->listening &&
96-
!$this->closed) {
98+
!$this->closed
99+
) {
97100
$this->loop->addReadStream($this->stream, [$this, 'handleData']);
98101
$this->listening = true;
99102
}

tests/InotifyStreamTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public function testValidStreamWithEvent(): void
6161
inotify_add_watch($fd, __DIR__, IN_CLOSE_WRITE);
6262
$watcher = new InotifyStream($fd, $loop);
6363
$watcher->on('event', $this->expectCallableOnce());
64-
touch(__DIR__.'/testfile');
65-
unlink(__DIR__.'/testfile');
64+
touch(__DIR__ . '/testfile');
65+
unlink(__DIR__ . '/testfile');
6666
$watcher->handleData();
6767
fclose($fd);
6868
}

tools/php-cs-fixer

-1.73 MB
Binary file not shown.

tools/phpcbf

1.2 MB
Binary file not shown.

tools/phpcs

1.13 MB
Binary file not shown.

0 commit comments

Comments
 (0)