phpstan fixes

This commit is contained in:
Dennis Eichhorn 2022-09-27 21:23:30 +02:00
parent de0d70679b
commit c77874873c
17 changed files with 125 additions and 55 deletions

View File

@ -62,7 +62,8 @@ final class Continuous
*/ */
public static function solve(array $items, BackpackInterface $backpack) : BackpackInterface public static function solve(array $items, BackpackInterface $backpack) : BackpackInterface
{ {
\usort($items, ['self', 'continuousComparator']); /* @phpstan-ignore-next-line */
\usort($items, ['self', '\phpOMS\Algorithm\Knapsack\continuousComparator']);
$availableSpace = $backpack->getMaxCost(); $availableSpace = $backpack->getMaxCost();

View File

@ -99,7 +99,7 @@ abstract class UninstallerAbstract
$builder = new SchemaBuilder($dbPool->get('schema')); $builder = new SchemaBuilder($dbPool->get('schema'));
foreach ($definitions as $name => $definition) { foreach ($definitions as $name => $definition) {
$builder->dropTable($name ?? ''); $builder->dropTable($name);
} }
$builder->execute(); $builder->execute();

View File

@ -273,7 +273,7 @@ class Builder extends BuilderAbstract
/** /**
* Select. * Select.
* *
* @param array ...$columns Columns * @param mixed ...$columns Columns
* *
* @return Builder * @return Builder
* *

View File

@ -126,7 +126,7 @@ final class HttpSession implements SessionInterface
$this->set('CSRF', $csrf, false); $this->set('CSRF', $csrf, false);
} }
UriFactory::setQuery('$CSRF', $csrf); UriFactory::setQuery('$CSRF', $csrf); /* @phpstan-ignore-line */
} }
/** /**

View File

@ -172,6 +172,8 @@ final class EigenvalueDecomposition
if ($scale == 0) { if ($scale == 0) {
$this->E[$i] = $this->D[$i - 1]; $this->E[$i] = $this->D[$i - 1];
/* @phpstan-ignore-next-line */
for ($j = 0; $j > $i; ++$j) { for ($j = 0; $j > $i; ++$j) {
$this->D[$j] = $this->V[$i - 1][$j]; $this->D[$j] = $this->V[$i - 1][$j];
$this->V[$i][$j] = 0.0; $this->V[$i][$j] = 0.0;
@ -522,6 +524,7 @@ final class EigenvalueDecomposition
$norm = 0.0; $norm = 0.0;
for ($i = 0; $i < $nn; ++$i) { for ($i = 0; $i < $nn; ++$i) {
/* @phpstan-ignore-next-line */
if ($i < $low || $i > $high) { if ($i < $low || $i > $high) {
$this->D[$i] = $this->H[$i][$i]; $this->D[$i] = $this->H[$i][$i];
$this->E[$i] = 0.0; $this->E[$i] = 0.0;
@ -873,6 +876,7 @@ final class EigenvalueDecomposition
} }
for ($i = 0; $i < $nn; ++$i) { for ($i = 0; $i < $nn; ++$i) {
/* @phpstan-ignore-next-line */
if ($i < $low || $i > $high) { if ($i < $low || $i > $high) {
for ($j = $i; $j < $nn; ++$j) { for ($j = $i; $j < $nn; ++$j) {
$this->V[$i][$j] = $this->H[$i][$j]; $this->V[$i][$j] = $this->H[$i][$j];

View File

@ -548,7 +548,7 @@ class Matrix implements \ArrayAccess, \Iterator
} }
} }
$newMatrix->setMatrix($newMatrixArr); $newMatrix->setMatrix($newMatrixArr); /* @phpstan-ignore-line */
return $newMatrix; return $newMatrix;
} }
@ -725,7 +725,7 @@ class Matrix implements \ArrayAccess, \Iterator
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function key() public function key() : mixed
{ {
return $this->position; return $this->position;
} }
@ -772,7 +772,7 @@ class Matrix implements \ArrayAccess, \Iterator
$offset = (int) $offset; $offset = (int) $offset;
$row = (int) ($offset / $this->m); $row = (int) ($offset / $this->m);
$this->matrix[$row][$offset - $row * $this->n] = $value; $this->matrix[$row][$offset - $row * $this->n] = $value; /* @phpstan-ignore-line */
} }
/** /**

View File

@ -94,20 +94,25 @@ final class ConsoleRequest extends RequestAbstract
$key = '-' . \mb_strtolower($key); $key = '-' . \mb_strtolower($key);
if ($type === null) { if ($type === null) {
/** @var string[] $this->data */ /* @phpstan-ignore-next-line */
return ArrayUtils::getArg($key, $this->data); return ArrayUtils::getArg($key, $this->data);
} }
switch ($type) { switch ($type) {
case 'int': case 'int':
/* @phpstan-ignore-next-line */
return (int) ArrayUtils::getArg($key, $this->data); return (int) ArrayUtils::getArg($key, $this->data);
case 'string': case 'string':
/* @phpstan-ignore-next-line */
return (string) ArrayUtils::getArg($key, $this->data); return (string) ArrayUtils::getArg($key, $this->data);
case 'float': case 'float':
/* @phpstan-ignore-next-line */
return (float) ArrayUtils::getArg($key, $this->data); return (float) ArrayUtils::getArg($key, $this->data);
case 'bool': case 'bool':
/* @phpstan-ignore-next-line */
return (bool) ArrayUtils::getArg($key, $this->data); return (bool) ArrayUtils::getArg($key, $this->data);
default: default:
/* @phpstan-ignore-next-line */
return ArrayUtils::getArg($key, $this->data); return ArrayUtils::getArg($key, $this->data);
} }
} }
@ -119,6 +124,7 @@ final class ConsoleRequest extends RequestAbstract
{ {
$key = '-' . \mb_strtolower($key); $key = '-' . \mb_strtolower($key);
/* @phpstan-ignore-next-line */
return ArrayUtils::hasArg($key, $this->data) > -1; return ArrayUtils::hasArg($key, $this->data) > -1;
} }
@ -136,8 +142,9 @@ final class ConsoleRequest extends RequestAbstract
public function setData(string $key, mixed $value, bool $overwrite = false) : bool public function setData(string $key, mixed $value, bool $overwrite = false) : bool
{ {
$key = '-' . \mb_strtolower($key); $key = '-' . \mb_strtolower($key);
$pos = -1; $pos = -1;
/* @phpstan-ignore-next-line */
if ($overwrite || ($pos = ArrayUtils::hasArg($key, $this->data)) !== -1) { if ($overwrite || ($pos = ArrayUtils::hasArg($key, $this->data)) !== -1) {
if ($pos === -1) { if ($pos === -1) {
$this->data[] = $key; $this->data[] = $key;

View File

@ -82,12 +82,15 @@ final class Rest
// handle different content types // handle different content types
$contentType = $requestHeaders['content-type'] ?? []; $contentType = $requestHeaders['content-type'] ?? [];
if ($request->getData() !== null && (empty($contentType) || \in_array(MimeType::M_POST, $contentType))) { if ($request->getData() !== null && (empty($contentType) || \in_array(MimeType::M_POST, $contentType))) {
/* @phpstan-ignore-next-line */
\curl_setopt($curl, \CURLOPT_POSTFIELDS, \http_build_query($request->getData())); \curl_setopt($curl, \CURLOPT_POSTFIELDS, \http_build_query($request->getData()));
} elseif ($request->getData() !== null && \in_array(MimeType::M_JSON, $contentType)) { } elseif ($request->getData() !== null && \in_array(MimeType::M_JSON, $contentType)) {
\curl_setopt($curl, \CURLOPT_POSTFIELDS, \json_encode($request->getData())); \curl_setopt($curl, \CURLOPT_POSTFIELDS, \json_encode($request->getData()));
} elseif ($request->getData() !== null && \in_array(MimeType::M_MULT, $contentType)) { } elseif ($request->getData() !== null && \in_array(MimeType::M_MULT, $contentType)) {
$boundary = '----' . \uniqid(); $boundary = '----' . \uniqid();
$data = self::createMultipartData($boundary, $request->getData());
/* @phpstan-ignore-next-line */
$data = self::createMultipartData($boundary, $request->getData());
// @todo: replace boundary/ with the correct boundary= in the future. // @todo: replace boundary/ with the correct boundary= in the future.
// Currently this cannot be done due to a bug. If we do it now the server cannot correclty populate php://input // Currently this cannot be done due to a bug. If we do it now the server cannot correclty populate php://input

View File

@ -131,7 +131,7 @@ abstract class RequestAbstract implements MessageInterface
return []; return [];
} }
$json = \json_decode($this->data[$key], true); $json = \json_decode($this->data[$key], true); /** @phpstan-ignore-line */
return !\is_array($json) ? [] : $json; return !\is_array($json) ? [] : $json;
} }
@ -154,6 +154,7 @@ abstract class RequestAbstract implements MessageInterface
return []; return [];
} }
/* @phpstan-ignore-next-line */
$list = \explode($delim, $this->data[$key]); $list = \explode($delim, $this->data[$key]);
if ($list === false) { if ($list === false) {

View File

@ -676,6 +676,7 @@ final class ModuleManager
$this->initModule($module, $appName); $this->initModule($module, $appName);
} }
/* @phpstan-ignore-next-line */
return $this->running[$name] ?? new NullModule(); return $this->running[$name] ?? new NullModule();
} }

View File

@ -61,7 +61,7 @@ class Address implements \JsonSerializable
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function jsonSerialize(int $option = 0) public function jsonSerialize() : mixed
{ {
return $this->toArray(); return $this->toArray();
} }

View File

@ -330,6 +330,6 @@ class PriorityQueue implements \Countable, SerializableInterface
*/ */
public function unserialize(mixed $data) : void public function unserialize(mixed $data) : void
{ {
$this->queue = \json_decode($data, true); $this->queue = \json_decode($data, true); /* @phpstan-ignore-line */
} }
} }

View File

@ -40,7 +40,7 @@ class Directory extends FileAbstract implements DirectoryInterface
* @var string * @var string
* @since 1.0.0 * @since 1.0.0
*/ */
private string $filter = '*'; //private string $filter = '*';
/** /**
* Directory nodes (files and directories). * Directory nodes (files and directories).
@ -79,21 +79,20 @@ class Directory extends FileAbstract implements DirectoryInterface
* Constructor. * Constructor.
* *
* @param HttpUri $uri Uri * @param HttpUri $uri Uri
* @param string $filter Filter
* @param bool $initialize Should get initialized during construction * @param bool $initialize Should get initialized during construction
* @param \FTP\Connection $con Connection * @param \FTP\Connection $con Connection
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function __construct(HttpUri $uri, string $filter = '*', bool $initialize = true, \FTP\Connection $con = null) public function __construct(HttpUri $uri, bool $initialize = true, \FTP\Connection $con = null)
{ {
$this->uri = $uri; $this->uri = $uri;
$this->con = $con ?? self::ftpConnect($uri); $this->con = $con ?? self::ftpConnect($uri);
$this->filter = \ltrim($filter, '\\/'); //$this->filter = \ltrim($filter, '\\/');
parent::__construct($uri->getPath()); parent::__construct($uri->getPath());
if ($initialize && self::exists($this->con, $this->path)) { if ($initialize && $this->con !== null && self::exists($this->con, $this->path)) {
$this->index(); $this->index();
} }
} }
@ -110,6 +109,10 @@ class Directory extends FileAbstract implements DirectoryInterface
$this->isInitialized = true; $this->isInitialized = true;
parent::index(); parent::index();
if ($this->con === null) {
return;
}
$list = self::list($this->con, $this->path); $list = self::list($this->con, $this->path);
foreach ($list as $filename) { foreach ($list as $filename) {
@ -117,7 +120,7 @@ class Directory extends FileAbstract implements DirectoryInterface
$uri = clone $this->uri; $uri = clone $this->uri;
$uri->setPath($filename); $uri->setPath($filename);
$file = \ftp_size($this->con, $filename) === -1 ? new self($uri, '*', false, $this->con) : new File($uri, $this->con); $file = \ftp_size($this->con, $filename) === -1 ? new self($uri, false, $this->con) : new File($uri, $this->con);
$this->addNode($file); $this->addNode($file);
} }
@ -604,6 +607,10 @@ class Directory extends FileAbstract implements DirectoryInterface
*/ */
public function createNode() : bool public function createNode() : bool
{ {
if ($this->con === null) {
return false;
}
return self::create($this->con, $this->path, $this->permission, true); return self::create($this->con, $this->path, $this->permission, true);
} }
@ -629,10 +636,7 @@ class Directory extends FileAbstract implements DirectoryInterface
$uri = clone $this->uri; $uri = clone $this->uri;
$uri->setPath(self::parent($this->path)); $uri->setPath(self::parent($this->path));
return new self( return new self($uri, true, $this->con);
$uri,
'*', true, $this->con
);
} }
/** /**
@ -640,6 +644,10 @@ class Directory extends FileAbstract implements DirectoryInterface
*/ */
public function copyNode(string $to, bool $overwrite = false) : bool public function copyNode(string $to, bool $overwrite = false) : bool
{ {
if ($this->con === null) {
return false;
}
return self::copy($this->con, $this->path, $to, $overwrite); return self::copy($this->con, $this->path, $to, $overwrite);
} }
@ -648,6 +656,10 @@ class Directory extends FileAbstract implements DirectoryInterface
*/ */
public function moveNode(string $to, bool $overwrite = false) : bool public function moveNode(string $to, bool $overwrite = false) : bool
{ {
if ($this->con === null) {
return false;
}
return self::move($this->con, $this->path, $to, $overwrite); return self::move($this->con, $this->path, $to, $overwrite);
} }
@ -656,6 +668,10 @@ class Directory extends FileAbstract implements DirectoryInterface
*/ */
public function deleteNode() : bool public function deleteNode() : bool
{ {
if ($this->con === null) {
return false;
}
// @todo: update parent // @todo: update parent
return self::delete($this->con, $this->path); return self::delete($this->con, $this->path);
@ -716,6 +732,7 @@ class Directory extends FileAbstract implements DirectoryInterface
*/ */
public function offsetSet(mixed $offset, mixed $value) : void public function offsetSet(mixed $offset, mixed $value) : void
{ {
/** @var \phpOMS\System\File\ContainerInterface $value */
if ($offset === null || !isset($this->nodes[$offset])) { if ($offset === null || !isset($this->nodes[$offset])) {
$this->addNode($value); $this->addNode($value);
} else { } else {

View File

@ -51,7 +51,7 @@ class File extends FileAbstract implements FileInterface
parent::__construct($uri->getPath()); parent::__construct($uri->getPath());
if (self::exists($this->con, $this->path)) { if ($this->con !== null && self::exists($this->con, $this->path)) {
$this->index(); $this->index();
} }
} }
@ -63,6 +63,10 @@ class File extends FileAbstract implements FileInterface
{ {
parent::index(); parent::index();
if ($this->con === null) {
return;
}
$this->size = (int) \ftp_size($this->con, $this->path); $this->size = (int) \ftp_size($this->con, $this->path);
} }
@ -408,6 +412,10 @@ class File extends FileAbstract implements FileInterface
*/ */
public function isExisting() : bool public function isExisting() : bool
{ {
if ($this->con === null) {
return false;
}
return self::exists($this->con, $this->path); return self::exists($this->con, $this->path);
} }
@ -425,7 +433,7 @@ class File extends FileAbstract implements FileInterface
$uri = clone $this->uri; $uri = clone $this->uri;
$uri->setPath(self::parent($this->path)); $uri->setPath(self::parent($this->path));
return new Directory($uri, '*', true, $this->con); return new Directory($uri, true, $this->con);
} }
/** /**
@ -437,6 +445,10 @@ class File extends FileAbstract implements FileInterface
*/ */
public function createNode() : bool public function createNode() : bool
{ {
if ($this->con === null) {
return false;
}
return self::create($this->con, $this->uri->getPath()); return self::create($this->con, $this->uri->getPath());
} }
@ -452,6 +464,10 @@ class File extends FileAbstract implements FileInterface
*/ */
public function copyNode(string $to, bool $overwrite = false) : bool public function copyNode(string $to, bool $overwrite = false) : bool
{ {
if ($this->con === null) {
return false;
}
return self::copy($this->con, $this->path, $to, $overwrite); return self::copy($this->con, $this->path, $to, $overwrite);
} }
@ -467,6 +483,10 @@ class File extends FileAbstract implements FileInterface
*/ */
public function moveNode(string $to, bool $overwrite = false) : bool public function moveNode(string $to, bool $overwrite = false) : bool
{ {
if ($this->con === null) {
return false;
}
return self::move($this->con, $this->path, $to, $overwrite); return self::move($this->con, $this->path, $to, $overwrite);
} }
@ -479,6 +499,10 @@ class File extends FileAbstract implements FileInterface
*/ */
public function deleteNode() : bool public function deleteNode() : bool
{ {
if ($this->con === null) {
return false;
}
return self::delete($this->con, $this->path); return self::delete($this->con, $this->path);
} }
@ -494,6 +518,10 @@ class File extends FileAbstract implements FileInterface
*/ */
public function putContent(string $content, int $mode = ContentPutMode::APPEND | ContentPutMode::CREATE) : bool public function putContent(string $content, int $mode = ContentPutMode::APPEND | ContentPutMode::CREATE) : bool
{ {
if ($this->con === null) {
return false;
}
return self::put($this->con, $this->path, $content, $mode); return self::put($this->con, $this->path, $content, $mode);
} }
@ -554,6 +582,10 @@ class File extends FileAbstract implements FileInterface
*/ */
public function getContent() : string public function getContent() : string
{ {
if ($this->con === null) {
return '';
}
return self::get($this->con, $this->path); return self::get($this->con, $this->path);
} }
@ -611,6 +643,6 @@ class File extends FileAbstract implements FileInterface
$uri = clone $this->uri; $uri = clone $this->uri;
$uri->setPath(self::dirpath($this->path)); $uri->setPath(self::dirpath($this->path));
return new Directory($uri, '*', true, $this->con); return new Directory($uri, true, $this->con);
} }
} }

View File

@ -31,10 +31,10 @@ abstract class FileAbstract implements FtpContainerInterface
/** /**
* Ftp connection * Ftp connection
* *
* @var \FTP\Connection * @var null|\FTP\Connection
* @since 1.0.0 * @since 1.0.0
*/ */
protected \FTP\Connection $con; protected ?\FTP\Connection $con = null;
/** /**
* Ftp uri * Ftp uri
@ -209,6 +209,10 @@ abstract class FileAbstract implements FtpContainerInterface
*/ */
public function index() : void public function index() : void
{ {
if ($this->con === null) {
return;
}
$mtime = \ftp_mdtm($this->con, $this->path); $mtime = \ftp_mdtm($this->con, $this->path);
$ctime = \ftp_mdtm($this->con, $this->path); $ctime = \ftp_mdtm($this->con, $this->path);

View File

@ -576,7 +576,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
public function testList() : void public function testList() : void
{ {
$dirTestPath = __DIR__ . '/dirtest'; $dirTestPath = __DIR__ . '/dirtest';
$dir = new Directory(new HttpUri(self::BASE . $dirTestPath), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . $dirTestPath), true, self::$con);
self::assertEquals([ self::assertEquals([
'sub', 'sub',
@ -591,7 +591,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
public function testNodeOutput() : void public function testNodeOutput() : void
{ {
$dirTestPath = __DIR__ . '/dirtest'; $dirTestPath = __DIR__ . '/dirtest';
$dir = new Directory(new HttpUri(self::BASE . $dirTestPath), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . $dirTestPath), true, self::$con);
self::assertInstanceOf(Directory::class, $dir->getNode('sub')); self::assertInstanceOf(Directory::class, $dir->getNode('sub'));
} }
@ -602,13 +602,13 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeCreate() : void public function testNodeCreate() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
$dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir'))); $dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir')));
self::assertTrue(\is_dir(__DIR__ . '/nodedir')); self::assertTrue(\is_dir(__DIR__ . '/nodedir'));
\rmdir(__DIR__ . '/nodedir'); \rmdir(__DIR__ . '/nodedir');
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir2'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir2'), true, self::$con);
$dir->createNode(); $dir->createNode();
self::assertTrue(\is_dir(__DIR__ . '/nodedir2')); self::assertTrue(\is_dir(__DIR__ . '/nodedir2'));
@ -621,7 +621,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeDelete() : void public function testNodeDelete() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
$dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir'))); $dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir')));
self::assertTrue(\is_dir(__DIR__ . '/nodedir')); self::assertTrue(\is_dir(__DIR__ . '/nodedir'));
@ -637,7 +637,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeCopy() : void public function testNodeCopy() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
$dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir'))); $dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir')));
$dir->getNode('nodedir')->copyNode(__DIR__ . '/nodedir2'); $dir->getNode('nodedir')->copyNode(__DIR__ . '/nodedir2');
@ -653,7 +653,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeMove() : void public function testNodeMove() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
$dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir'))); $dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir')));
$dir->getNode('nodedir')->moveNode(__DIR__ . '/nodedir2'); $dir->getNode('nodedir')->moveNode(__DIR__ . '/nodedir2');
@ -669,7 +669,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeExists() : void public function testNodeExists() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
self::assertTrue($dir->isExisting()); self::assertTrue($dir->isExisting());
self::assertTrue($dir->isExisting('dirtest')); self::assertTrue($dir->isExisting('dirtest'));
@ -682,7 +682,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testParentOutput() : void public function testParentOutput() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
self::assertEquals(__DIR__, $dir->getParent()->getPath()); self::assertEquals(__DIR__, $dir->getParent()->getPath());
} }
@ -693,7 +693,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeNext() : void public function testNodeNext() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
$dir->next(); $dir->next();
self::assertEquals(__DIR__ . '/dirtest/test.txt', $dir->current()->getPath()); self::assertEquals(__DIR__ . '/dirtest/test.txt', $dir->current()->getPath());
@ -705,7 +705,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeCurrent() : void public function testNodeCurrent() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
self::assertEquals(__DIR__ . '/dirtest/sub', $dir->current()->getPath()); self::assertEquals(__DIR__ . '/dirtest/sub', $dir->current()->getPath());
} }
@ -716,7 +716,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeKey() : void public function testNodeKey() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
self::assertEquals('sub', $dir->key()); self::assertEquals('sub', $dir->key());
@ -730,7 +730,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeArrayRead() : void public function testNodeArrayRead() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
self::assertEquals('test', $dir['test.txt']->getName()); self::assertEquals('test', $dir['test.txt']->getName());
} }
@ -741,7 +741,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeArraySet() : void public function testNodeArraySet() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
$dir[] = new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir')); $dir[] = new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir'));
self::assertTrue(\is_dir(__DIR__ . '/nodedir')); self::assertTrue(\is_dir(__DIR__ . '/nodedir'));
@ -759,7 +759,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeArrayRemove() : void public function testNodeArrayRemove() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
$dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir'))); $dir->addNode(new Directory(new HttpUri(self::BASE . __DIR__ . '/nodedir')));
self::assertTrue(\is_dir(__DIR__ . '/nodedir')); self::assertTrue(\is_dir(__DIR__ . '/nodedir'));
@ -775,7 +775,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeArrayExists() : void public function testNodeArrayExists() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__), true, self::$con);
self::assertTrue(isset($dir['dirtest'])); self::assertTrue(isset($dir['dirtest']));
self::assertFalse(isset($dir['invalid'])); self::assertFalse(isset($dir['invalid']));
@ -788,7 +788,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
public function testNodeCreatedAt() : void public function testNodeCreatedAt() : void
{ {
$dirPath = __DIR__ . '/test'; $dirPath = __DIR__ . '/test';
$dir = new Directory(new HttpUri(self::BASE . $dirPath), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . $dirPath), true, self::$con);
self::assertTrue($dir->createNode()); self::assertTrue($dir->createNode());
@ -805,7 +805,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
public function testNodeChangedAt() : void public function testNodeChangedAt() : void
{ {
$dirPath = __DIR__ . '/test'; $dirPath = __DIR__ . '/test';
$dir = new Directory(new HttpUri(self::BASE . $dirPath), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . $dirPath), true, self::$con);
self::assertTrue($dir->createNode()); self::assertTrue($dir->createNode());
@ -821,7 +821,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeOwner() : void public function testNodeOwner() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
self::assertNotEmpty($dir->getOwner()); self::assertNotEmpty($dir->getOwner());
} }
@ -832,7 +832,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodePermission() : void public function testNodePermission() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
self::assertGreaterThan(0, $dir->getPermission()); self::assertGreaterThan(0, $dir->getPermission());
} }
@ -843,7 +843,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testDirname() : void public function testDirname() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
$dir->next(); $dir->next();
self::assertEquals('dirtest', $dir->current()->getDirname()); self::assertEquals('dirtest', $dir->current()->getDirname());
@ -855,7 +855,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testName() : void public function testName() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
$dir->next(); $dir->next();
self::assertEquals('test', $dir->current()->getName()); self::assertEquals('test', $dir->current()->getName());
@ -867,7 +867,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testBaseame() : void public function testBaseame() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
$dir->next(); $dir->next();
self::assertEquals('test.txt', $dir->current()->getBasename()); self::assertEquals('test.txt', $dir->current()->getBasename());
@ -879,7 +879,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testDirpath() : void public function testDirpath() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
$dir->next(); $dir->next();
self::assertEquals(__DIR__ . '/dirtest', $dir->current()->getDirPath()); self::assertEquals(__DIR__ . '/dirtest', $dir->current()->getDirPath());
@ -891,7 +891,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeValid() : void public function testNodeValid() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
$dir->next(); $dir->next();
self::assertTrue($dir->valid()); self::assertTrue($dir->valid());
@ -903,7 +903,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
*/ */
public function testNodeInvalid() : void public function testNodeInvalid() : void
{ {
$dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), '*', true, self::$con); $dir = new Directory(new HttpUri(self::BASE . __DIR__ . '/dirtest'), true, self::$con);
while ($dir->valid()) { while ($dir->valid()) {
$dir->next(); $dir->next();

View File

@ -25,7 +25,7 @@
<exclude>./vendor</exclude> <exclude>./vendor</exclude>
<exclude>./Build</exclude> <exclude>./Build</exclude>
<exclude>./Resources</exclude> <exclude>./Resources</exclude>
<exclude>./Application/Testapp*</exclude> <exclude>*Testapp*</exclude>
</testsuite> </testsuite>
</testsuites> </testsuites>
<groups> <groups>