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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
### Changed

- Requires PHP `8.5`
- Requires `innmind/url:~5.4`
- Requires `innmind/black-box:~7.0`

### Fixed

- All paths are declared as file paths to allow otherwise restricted `?` and `#`

## 4.1.1 - 2026-04-09

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use Innmind\Immutable\Str;

$chunks = IO::fromAmbienAuthority()
->files()
->read(Path::of('/some/file.ext'))
->read(Path::file('/some/file.ext'))
->toEncoding(Str\Encoding::ascii)
->chunks(8192); // max length of each chunk
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"php": "~8.5",
"innmind/immutable": "~6.0",
"innmind/mutable": "~1.0",
"innmind/url": "~5.0",
"innmind/url": "~5.4",
"innmind/time": "~1.0",
"innmind/ip": "~4.0",
"innmind/validation": "~3.0"
Expand Down
6 changes: 3 additions & 3 deletions documentation/files/read.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use Innmind\Url\Path;

$chunks = IO::fromAmbientAuthority()
->files()
->read(Path::of('/path/to/file.ext'))
->read(Path::file('/path/to/file.ext'))
->chunks(8192);
```

Expand All @@ -23,7 +23,7 @@ use Innmind\Url\Path;

$chunks = IO::fromAmbientAuthority()
->files()
->read(Path::of('/path/to/file.ext'))
->read(Path::file('/path/to/file.ext'))
->lines();
```

Expand All @@ -40,7 +40,7 @@ use Innmind\Immutable\Str;

$chunks = IO::fromAmbientAuthority()
->files()
->read(Path::of('/path/to/file.ext'))
->read(Path::file('/path/to/file.ext'))
->toEncoding(Str\Encoding::ascii)
->lines();
```
2 changes: 1 addition & 1 deletion documentation/files/write.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use Innmind\Immutable\{

$successful = IO::fromAmbientAuthority()
->files()
->write(Path::of('/path/to/file.ext'))
->write(Path::file('/path/to/file.ext'))
->sink(Sequence::of(
Str::of('chunk 1'),
Str::of("new line \n"),
Expand Down
6 changes: 3 additions & 3 deletions documentation/sockets.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ $server = IO::fromAmbientAuthority()
->sockets()
->servers()
->unix(Address::of(
Path::of('/path/to/socket'),
Path::file('/path/to/socket'),
))
->unwrap();
```
Expand All @@ -63,7 +63,7 @@ $server = IO::fromAmbientAuthority()
->sockets()
->servers()
->takeOver(Address::of(
Path::of('/path/to/socket'),
Path::file('/path/to/socket'),
))
->unwrap();
```
Expand Down Expand Up @@ -144,7 +144,7 @@ $client = IO::fromAmbientAuthority()
->sockets()
->clients()
->unix(Address::of(
Path::of('/path/to/socket'),
Path::file('/path/to/socket'),
))
->unwrap();
```
Expand Down
2 changes: 1 addition & 1 deletion documentation/use-cases/files/chunks.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use Innmind\Immutable\Str;

$chunks = IO::fromAmbienAuthority()
->files()
->read(Path::of('/some/file.ext'))
->read(Path::file('/some/file.ext'))
->toEncoding(Str\Encoding::ascii)
->chunks(8192); // max length of each chunk
```
Expand Down
2 changes: 1 addition & 1 deletion documentation/use-cases/files/lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use Innmind\Immutable\Str;

$lines = IO::fromAmbienAuthority()
->files()
->read(Path::of('/some/file.ext'))
->read(Path::file('/some/file.ext'))
->toEncoding(Str\Encoding::ascii)
->lines();
```
Expand Down
19 changes: 19 additions & 0 deletions proofs/files.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Files\Read,
Files\Temporary,
Files\Temporary\Pull,
Files\Directory,
};
use Innmind\Url\Path;
use Innmind\Immutable\{
Expand Down Expand Up @@ -447,4 +448,22 @@ static function($assert) {
);
},
);

yield $prove->test(
'IO::files() can read a directory containing a #',
static function($assert) {
$tmp = \sys_get_temp_dir();
@\rmdir($tmp.'/innmind/#/');
@\mkdir($tmp.'/innmind/#/', recursive: true);

$assert
->object(
IO::fromAmbientAuthority()
->files()
->access(Path::file($tmp.'/innmind/#'))
->unwrap(),
)
->instance(Directory::class);
},
);
};
2 changes: 1 addition & 1 deletion src/Files/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function of(
Path $path,
): self {
if (!$path->directory()) {
$path = Path::of($path->toString().'/');
$path = Path::file($path->toString().'/');
}

return new self($capabilities, $path);
Expand Down
4 changes: 2 additions & 2 deletions src/Internal/Capabilities/Files/AmbientAuthority.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private function touch(Path $path): Attempt
private function rmdir(string $path): Attempt
{
return $this
->list(Path::of($path))
->list(Path::file($path))
->map(static fn($name) => \sprintf(
'%s%s%s',
$path,
Expand All @@ -244,7 +244,7 @@ private function rmdir(string $path): Attempt
default => '',
},
))
->map(Path::of(...))
->map(Path::file(...))
->sink(SideEffect::identity)
->attempt(fn($_, $file) => $this->remove($file))
->map(static fn() => @\rmdir($path))
Expand Down
2 changes: 1 addition & 1 deletion src/Sockets/Unix/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function of(Path $path): self
#[\NoDiscard]
public function asPath(): Path
{
return Path::of($this->toString());
return Path::file($this->toString());
}

#[\NoDiscard]
Expand Down
Loading