mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2025-01-05 20:28:26 +01:00
34 lines
677 B
PHP
34 lines
677 B
PHP
|
<?php
|
||
|
|
||
|
namespace Psalm\LaravelPlugin;
|
||
|
|
||
|
class FakeFilesystem extends \Illuminate\Filesystem\Filesystem
|
||
|
{
|
||
|
/** @var ?string */
|
||
|
private $destination = '';
|
||
|
|
||
|
/**
|
||
|
* Write the contents of a file.
|
||
|
*
|
||
|
* @param string $path
|
||
|
* @param string $contents
|
||
|
* @param bool $lock
|
||
|
* @return int
|
||
|
*/
|
||
|
public function put($path, $contents, $lock = false)
|
||
|
{
|
||
|
$destination = $this->destination ?: $path;
|
||
|
|
||
|
$this->destination = null;
|
||
|
|
||
|
return parent::put($destination, $contents, $lock);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return void
|
||
|
*/
|
||
|
public function setDestination(string $destination)
|
||
|
{
|
||
|
$this->destination = $destination;
|
||
|
}
|
||
|
}
|