Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"description" : "Reads and writes JSON to and from various input sources",
"keywords": ["module", "xp"],
"require" : {
"xp-framework/core": "^12.0 | ^11.0 | ^10.0",
"xp-framework/core": "^12.11 | ^11.11",
"php" : ">=7.4.0"
},
"require-dev" : {
Expand Down
4 changes: 2 additions & 2 deletions src/main/php/text/json/MultiByteSource.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace text\json;

use io\IOException;
use io\NotSupported;
use io\streams\{InputStream, Seekable, Streams};

class MultiByteSource implements InputStream, Seekable {
Expand Down Expand Up @@ -39,7 +39,7 @@ public function seek($offset, $whence= SEEK_SET) {
if ($this->in instanceof Seekable) {
$this->in->seek($offset, $whence);
} else {
throw new IOException('Cannot seek '.$this->in->toString());
throw new NotSupported('Cannot seek '.$this->in->toString());
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/php/text/json/StreamInput.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace text\json;

use io\IOException;
use io\NotSupported;
use io\streams\{InputStream, Seekable};
use lang\FormatException;

Expand Down Expand Up @@ -79,7 +79,7 @@ public function __construct(InputStream $in, $encoding= \xp::ENCODING, $maximumN
* Resets input
*
* @return void
* @throws io.IOException If this input cannot be reset
* @throws io.NotSupported If this input cannot be reset
*/
public function reset() {
if ($this->in instanceof Seekable) {
Expand All @@ -89,7 +89,7 @@ public function reset() {
$this->pos= 0;
$this->firstToken= null;
} else {
throw new IOException('Cannot seek streams of type '.typeof($this->in)->getName());
throw new NotSupported('Cannot seek streams of type '.typeof($this->in)->getName());
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/php/text/json/unittest/StreamInputTest.class.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace text\json\unittest;

use io\IOException;
use io\NotSupported;
use io\streams\{InputStream, MemoryInputStream};
use test\{Assert, Test, Values};
use text\json\StreamInput;
Expand Down Expand Up @@ -76,7 +76,7 @@ public function available() { return true; }
public function close() { }
});
Assert::equals([1], iterator_to_array($input->elements()), '#1');
Assert::throws(IOException::class, function() use($input) {
Assert::throws(NotSupported::class, function() use($input) {
$input->reset();
iterator_to_array($input->elements());
});
Expand Down
Loading