mirror of
https://github.com/adlawson/php-vfs.git
synced 2024-11-25 06:07:40 +00:00
Remove file __toString
behaviour
Casting a file to a string to get the content is a bit of a dirty pattern.
This commit is contained in:
parent
407af5ef5b
commit
30e428df47
@ -103,12 +103,4 @@ class File implements FileInterface
|
|||||||
{
|
{
|
||||||
return strlen($this->content);
|
return strlen($this->content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function __toString()
|
|
||||||
{
|
|
||||||
return $this->content;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,4 @@ interface FileInterface extends NodeInterface
|
|||||||
* @param string $content
|
* @param string $content
|
||||||
*/
|
*/
|
||||||
public function setContent($content);
|
public function setContent($content);
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string The file content
|
|
||||||
*/
|
|
||||||
public function __toString();
|
|
||||||
}
|
}
|
||||||
|
@ -29,13 +29,6 @@ class FileTest extends UnitTestCase
|
|||||||
$this->assertEquals('foo', $file->getContent());
|
$this->assertEquals('foo', $file->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testToString()
|
|
||||||
{
|
|
||||||
$file = new File('foo');
|
|
||||||
|
|
||||||
$this->assertEquals('foo', (string) $file);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGetDateAccessed()
|
public function testGetDateAccessed()
|
||||||
{
|
{
|
||||||
$file = new File();
|
$file = new File();
|
||||||
|
Loading…
Reference in New Issue
Block a user