for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* BsbFlystem
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* @see https://bushbaby.nl/
* @copyright Copyright (c) 2014-2021 bushbaby multimedia. (https://bushbaby.nl)
* @author Bas Kamer <[email protected]>
* @license MIT
* @package bushbaby/flysystem
*/
declare(strict_types=1);
namespace BsbFlysystem\Adapter\Factory;
use BsbFlysystem\Exception\UnexpectedValueException;
use League\Flysystem\Adapter\Local as Adapter;
use League\Flysystem\AdapterInterface;
use Psr\Container\ContainerInterface;
class LocalAdapterFactory extends AbstractAdapterFactory
{
public function doCreateService(ContainerInterface $container): AdapterInterface
$options = [];
$options[] = $this->options['root'];
$options[] = $this->options['writeFlags'] ?? null;
if (isset($this->options['linkHandling'])) { // since 1.0.8
$options[] = $this->options['linkHandling'];
if (isset($this->options['permissions'])) { // since 1.0.14
$options[] = $this->options['permissions'];
}
return new Adapter(...$options);
$options
array<integer,?>
string
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
protected function validateConfig(): void
if (! isset($this->options['root'])) {
throw new UnexpectedValueException("Missing 'root' as option");
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: