Skip to content

Commit b5cbe9a

Browse files
authored
Code: upgrade deps, codesniffer fixes (#39)
1 parent a792c11 commit b5cbe9a

File tree

9 files changed

+27
-13
lines changed

9 files changed

+27
-13
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ csf: vendor
1818
vendor/bin/codefixer src tests
1919

2020
phpstan: vendor
21-
vendor/bin/phpstan analyse -l max -c phpstan.neon src
21+
vendor/bin/phpstan analyse -l 8 -c phpstan.neon src
2222

2323
tests: vendor
2424
vendor/bin/tester -s -p php --colors 1 -C tests/cases

composer.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@
2222
"nette/application": "^3.0.0"
2323
},
2424
"require-dev": {
25-
"nette/http": "~2.4.8 || ~3.0.0",
25+
"nette/http": "~2.4.8 || ^3.0.0",
2626
"ninjify/nunjuck": "^0.3.0",
27-
"ninjify/qa": "^0.9.0",
28-
"phpstan/extension-installer": "^1.0",
29-
"phpstan/phpstan-deprecation-rules": "^0.11.0",
30-
"phpstan/phpstan-nette": "^0.11.1",
31-
"phpstan/phpstan-shim": "^0.11.2",
32-
"phpstan/phpstan-strict-rules": "^0.11.0",
27+
"ninjify/qa": "^0.13.0",
28+
"phpstan/phpstan": "^1.0",
29+
"phpstan/phpstan-deprecation-rules": "^1.0",
30+
"phpstan/phpstan-nette": "^1.0",
31+
"phpstan/phpstan-strict-rules": "^1.0",
3332
"psr/http-message": "~1.0.1",
34-
"tracy/tracy": "~2.6.1"
33+
"tracy/tracy": "~2.9.1"
3534
},
3635
"autoload": {
3736
"psr-4": {
@@ -46,7 +45,10 @@
4645
"minimum-stability": "dev",
4746
"prefer-stable": true,
4847
"config": {
49-
"sort-packages": true
48+
"sort-packages": true,
49+
"allow-plugins": {
50+
"dealerdirect/phpcodesniffer-composer-installer": true
51+
}
5052
},
5153
"extra": {
5254
"branch-alias": {

phpstan.neon

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
includes:
2+
#- vendor/phpstan/phpstan-deprecation-rules/rules.neon
3+
- vendor/phpstan/phpstan-nette/extension.neon
4+
- vendor/phpstan/phpstan-nette/rules.neon
5+
- vendor/phpstan/phpstan-strict-rules/rules.neon
6+
17
parameters:
28
ignoreErrors:
39
- '#^Property Contributte\\Application\\Response\\Fly\\Buffer\\(FileBuffer|ProcessBuffer)\:\:\$pointer \(resource\) does not accept resource\|false\.$#'
10+
- '#^Property Contributte\\Application\\Response\\Fly\\Buffer\\(.*)Buffer\:\:\$pointer \(resource\) in isset\(\) is not nullable\.$#'

ruleset.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<rule ref="./vendor/ninjify/coding-standard/contributte.xml">
55
<exclude name="SlevomatCodingStandard.ControlStructures.RequireTernaryOperator.TernaryOperatorNotUsed" />
66
<exclude name="SlevomatCodingStandard.PHP.TypeCast" />
7+
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable" />
78
</rule>
89

910
<!-- Specific rules -->

src/Response/CSVResponse.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ private function getBom(): string
110110
switch (strtolower($this->outputEncoding)) {
111111
case 'utf-8':
112112
return b"\xEF\xBB\xBF";
113+
113114
case 'utf-16':
114115
return b"\xFF\xFE";
116+
115117
default:
116118
return '';
117119
}

src/Response/Fly/Buffer/FileBuffer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public function write($data): void
3636
*/
3737
public function read(int $size)
3838
{
39+
/** @var positive-int $size */
3940
return fread($this->pointer, $size);
4041
}
4142

src/Response/Fly/Buffer/ProcessBuffer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public function write($data): void
3636
*/
3737
public function read(int $size)
3838
{
39+
/** @var positive-int $size */
3940
return fread($this->pointer, $size);
4041
}
4142

src/Response/JsonPrettyResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class JsonPrettyResponse implements IResponse
2828
public function __construct($payload, ?string $contentType = null)
2929
{
3030
$this->payload = $payload;
31-
$this->contentType = $contentType ?: 'application/json';
31+
$this->contentType = $contentType ?? 'application/json';
3232
}
3333

3434
public function setCode(int $code): void

src/Response/PSR7StreamResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ final class PSR7StreamResponse implements IResponse
2525
/**
2626
* @param StreamInterface $stream PSR7 Stream instance
2727
* @param string $name Imposed file name
28-
* @param string $contentType MIME content type
28+
* @param ?string $contentType MIME content type
2929
*/
3030
public function __construct(StreamInterface $stream, string $name, ?string $contentType = null)
3131
{
3232
$this->stream = $stream;
3333
$this->name = $name;
34-
$this->contentType = $contentType ?: 'application/octet-stream';
34+
$this->contentType = $contentType ?? 'application/octet-stream';
3535
}
3636

3737
/**

0 commit comments

Comments
 (0)