Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Stringable on storage attributes #1810

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion src/DirectoryAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace League\Flysystem;

class DirectoryAttributes implements StorageAttributes
class DirectoryAttributes implements StorageAttributes, \Stringable
{
use ProxyArrayAccessToProperties;
private string $type = StorageAttributes::TYPE_DIRECTORY;
Expand Down Expand Up @@ -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);
}
}
7 changes: 6 additions & 1 deletion src/FileAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace League\Flysystem;

class FileAttributes implements StorageAttributes
class FileAttributes implements StorageAttributes, \Stringable
{
use ProxyArrayAccessToProperties;
private string $type = StorageAttributes::TYPE_FILE;
Expand Down Expand Up @@ -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);
}
}
Loading