mirror of
https://github.com/shufflingpixels/php-io.git
synced 2026-08-19 21:58:14 +02:00
Adopt Go-style minimal interfaces for streams
Replace PSR-7 StreamInterface with a set of small, composable interfaces (ReaderInterface, WriterInterface, SeekerInterface and their combinations). BinaryReader now depends only on ReaderInterface, BinaryWriter on WriterInterface, making both easy to satisfy with any byte source or sink. Buffer and Resource are simplified — no capability flags, no detach/close lifecycle, no PSR-7 metadata methods. LimitedResource is replaced by LimitedReader, a lightweight reader that enforces a byte count limit. BinaryReader::read() is renamed to readExact() for clarity. Tests updated throughout to match the new APIs.
This commit is contained in:
parent
a27c0a87ea
commit
07ec405512
25 changed files with 451 additions and 1168 deletions
10
src/WriteSeekerInterface.php
Normal file
10
src/WriteSeekerInterface.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shufflingpixels\IO;
|
||||
|
||||
/** A writable, seekable byte stream. */
|
||||
interface WriteSeekerInterface extends WriterInterface, SeekerInterface
|
||||
{
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue