diff --git a/src/DirectoryAttributes.php b/src/DirectoryAttributes.php index 3fe44c1b4..02533c610 100644 --- a/src/DirectoryAttributes.php +++ b/src/DirectoryAttributes.php @@ -4,7 +4,7 @@ namespace League\Flysystem; -class DirectoryAttributes implements StorageAttributes +class DirectoryAttributes implements StorageAttributes, \Stringable { use ProxyArrayAccessToProperties; private string $type = StorageAttributes::TYPE_DIRECTORY; @@ -84,4 +84,9 @@ public function jsonSerialize(): array StorageAttributes::ATTRIBUTE_EXTRA_METADATA => $this->extraMetadata, ]; } + + public function __toString(): string + { + return sprintf('%s(%s)', $this->type, $this->path); + } } diff --git a/src/FileAttributes.php b/src/FileAttributes.php index 42172f8c4..a2be0429a 100644 --- a/src/FileAttributes.php +++ b/src/FileAttributes.php @@ -4,7 +4,7 @@ namespace League\Flysystem; -class FileAttributes implements StorageAttributes +class FileAttributes implements StorageAttributes, \Stringable { use ProxyArrayAccessToProperties; private string $type = StorageAttributes::TYPE_FILE; @@ -97,4 +97,9 @@ public function jsonSerialize(): array StorageAttributes::ATTRIBUTE_EXTRA_METADATA => $this->extraMetadata, ]; } + + public function __toString(): string + { + return sprintf('%s(%s)', $this->type, $this->path); + } }