Skip to content

Commit 8a0c41d

Browse files
committed
Address static analysis issues
1 parent fb2d297 commit 8a0c41d

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ cache:
1414

1515
before_install:
1616
- if [[ $TRAVIS_PHP_VERSION =~ ^7 ]]; then phpenv config-rm xdebug.ini; fi
17-
- composer self-update
1817

1918
install:
20-
- composer require --no-update --no-interaction "phpunit/phpunit:*" "squizlabs/php_codesniffer:*" "friendsofphp/php-cs-fixer:*"
21-
- travis_retry composer update --no-interaction --prefer-source
19+
- travis_retry composer update --no-interaction
2220
- travis_retry wget https://scrutinizer-ci.com/ocular.phar
2321

2422
before_script:

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
"php": ">=5.6.0",
2020
"psr/http-message": "^1.0"
2121
},
22+
"require-dev": {
23+
"phpunit/phpunit": "^6.0",
24+
"squizlabs/php_codesniffer": "^2.8",
25+
"friendsofphp/php-cs-fixer": "^2.1"
26+
},
2227
"autoload": {
2328
"psr-4": {
2429
"Violet\\StreamingJsonEncoder\\": "src/"

src/AbstractJsonEncoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private function initialize()
108108

109109
/**
110110
* Returns the current number of step in the encoder.
111-
* @return int|null The current step number or null if the current state is not valid
111+
* @return mixed The current step number as integer or null if the current state is not valid
112112
*/
113113
public function key()
114114
{

src/JsonStream.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
*/
1414
class JsonStream implements StreamInterface
1515
{
16-
/** @var BufferJsonEncoder The encoder used to produce the JSON stream */
16+
/** @var BufferJsonEncoder|null The encoder used to produce the JSON stream or null once closed */
1717
private $encoder;
1818

1919
/** @var int The current position of the cursor in the JSON stream */
2020
private $cursor;
2121

22-
/** @var string Buffered output from encoding the value as JSON */
22+
/** @var string|null Buffered output from encoding the value as JSON or null when at EOF */
2323
private $buffer;
2424

2525
/**

tests/classes/SerializableData.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@
1111
*/
1212
class SerializableData implements \JsonSerializable
1313
{
14+
/** @var mixed */
1415
private $data;
1516

17+
/**
18+
* SerializableData constructor.
19+
* @param mixed $data
20+
*/
1621
public function __construct($data)
1722
{
1823
$this->data = $data;

tests/tests/JsonStreamTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function testInvalidSeekWhence()
128128
$stream = new JsonStream('value');
129129

130130
$this->expectException(\InvalidArgumentException::class);
131-
$stream->seek(2, 'invalid');
131+
$stream->seek(2, -1);
132132
}
133133

134134
public function testPrettyPrintStream()

0 commit comments

Comments
 (0)