From c77874873ccbaa3d5139e38726f2912b3e7924da Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 27 Sep 2022 21:23:30 +0200 Subject: [PATCH] phpstan fixes --- Algorithm/Knapsack/Continuous.php | 3 +- Application/UninstallerAbstract.php | 2 +- DataStorage/Database/Query/Builder.php | 2 +- DataStorage/Session/HttpSession.php | 2 +- Math/Matrix/EigenvalueDecomposition.php | 4 ++ Math/Matrix/Matrix.php | 6 +-- Message/Console/ConsoleRequest.php | 11 +++++- Message/Http/Rest.php | 5 ++- Message/RequestAbstract.php | 3 +- Module/ModuleManager.php | 1 + Stdlib/Base/Address.php | 2 +- Stdlib/Queue/PriorityQueue.php | 2 +- System/File/Ftp/Directory.php | 37 +++++++++++++----- System/File/Ftp/File.php | 38 ++++++++++++++++-- System/File/Ftp/FileAbstract.php | 8 +++- tests/System/File/Ftp/DirectoryTest.php | 52 ++++++++++++------------- tests/phpunit_no_coverage.xml | 2 +- 17 files changed, 125 insertions(+), 55 deletions(-) diff --git a/Algorithm/Knapsack/Continuous.php b/Algorithm/Knapsack/Continuous.php index 98b274107..7147c632c 100644 --- a/Algorithm/Knapsack/Continuous.php +++ b/Algorithm/Knapsack/Continuous.php @@ -62,7 +62,8 @@ final class Continuous */ 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(); diff --git a/Application/UninstallerAbstract.php b/Application/UninstallerAbstract.php index f6bf790d6..25c3919d6 100644 --- a/Application/UninstallerAbstract.php +++ b/Application/UninstallerAbstract.php @@ -99,7 +99,7 @@ abstract class UninstallerAbstract $builder = new SchemaBuilder($dbPool->get('schema')); foreach ($definitions as $name => $definition) { - $builder->dropTable($name ?? ''); + $builder->dropTable($name); } $builder->execute(); diff --git a/DataStorage/Database/Query/Builder.php b/DataStorage/Database/Query/Builder.php index 21c00905c..1e851e306 100644 --- a/DataStorage/Database/Query/Builder.php +++ b/DataStorage/Database/Query/Builder.php @@ -273,7 +273,7 @@ class Builder extends BuilderAbstract /** * Select. * - * @param array ...$columns Columns + * @param mixed ...$columns Columns * * @return Builder * diff --git a/DataStorage/Session/HttpSession.php b/DataStorage/Session/HttpSession.php index f8ba9973f..513e91e94 100644 --- a/DataStorage/Session/HttpSession.php +++ b/DataStorage/Session/HttpSession.php @@ -126,7 +126,7 @@ final class HttpSession implements SessionInterface $this->set('CSRF', $csrf, false); } - UriFactory::setQuery('$CSRF', $csrf); + UriFactory::setQuery('$CSRF', $csrf); /* @phpstan-ignore-line */ } /** diff --git a/Math/Matrix/EigenvalueDecomposition.php b/Math/Matrix/EigenvalueDecomposition.php index b4de39247..89c0224ff 100644 --- a/Math/Matrix/EigenvalueDecomposition.php +++ b/Math/Matrix/EigenvalueDecomposition.php @@ -172,6 +172,8 @@ final class EigenvalueDecomposition if ($scale == 0) { $this->E[$i] = $this->D[$i - 1]; + + /* @phpstan-ignore-next-line */ for ($j = 0; $j > $i; ++$j) { $this->D[$j] = $this->V[$i - 1][$j]; $this->V[$i][$j] = 0.0; @@ -522,6 +524,7 @@ final class EigenvalueDecomposition $norm = 0.0; for ($i = 0; $i < $nn; ++$i) { + /* @phpstan-ignore-next-line */ if ($i < $low || $i > $high) { $this->D[$i] = $this->H[$i][$i]; $this->E[$i] = 0.0; @@ -873,6 +876,7 @@ final class EigenvalueDecomposition } for ($i = 0; $i < $nn; ++$i) { + /* @phpstan-ignore-next-line */ if ($i < $low || $i > $high) { for ($j = $i; $j < $nn; ++$j) { $this->V[$i][$j] = $this->H[$i][$j]; diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php index ac945aa04..e7423dc3c 100644 --- a/Math/Matrix/Matrix.php +++ b/Math/Matrix/Matrix.php @@ -548,7 +548,7 @@ class Matrix implements \ArrayAccess, \Iterator } } - $newMatrix->setMatrix($newMatrixArr); + $newMatrix->setMatrix($newMatrixArr); /* @phpstan-ignore-line */ return $newMatrix; } @@ -725,7 +725,7 @@ class Matrix implements \ArrayAccess, \Iterator /** * {@inheritdoc} */ - public function key() + public function key() : mixed { return $this->position; } @@ -772,7 +772,7 @@ class Matrix implements \ArrayAccess, \Iterator $offset = (int) $offset; $row = (int) ($offset / $this->m); - $this->matrix[$row][$offset - $row * $this->n] = $value; + $this->matrix[$row][$offset - $row * $this->n] = $value; /* @phpstan-ignore-line */ } /** diff --git a/Message/Console/ConsoleRequest.php b/Message/Console/ConsoleRequest.php index f5f057e74..fb512797d 100644 --- a/Message/Console/ConsoleRequest.php +++ b/Message/Console/ConsoleRequest.php @@ -94,20 +94,25 @@ final class ConsoleRequest extends RequestAbstract $key = '-' . \mb_strtolower($key); if ($type === null) { - /** @var string[] $this->data */ + /* @phpstan-ignore-next-line */ return ArrayUtils::getArg($key, $this->data); } switch ($type) { case 'int': + /* @phpstan-ignore-next-line */ return (int) ArrayUtils::getArg($key, $this->data); case 'string': + /* @phpstan-ignore-next-line */ return (string) ArrayUtils::getArg($key, $this->data); case 'float': + /* @phpstan-ignore-next-line */ return (float) ArrayUtils::getArg($key, $this->data); case 'bool': + /* @phpstan-ignore-next-line */ return (bool) ArrayUtils::getArg($key, $this->data); default: + /* @phpstan-ignore-next-line */ return ArrayUtils::getArg($key, $this->data); } } @@ -119,6 +124,7 @@ final class ConsoleRequest extends RequestAbstract { $key = '-' . \mb_strtolower($key); + /* @phpstan-ignore-next-line */ 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 { $key = '-' . \mb_strtolower($key); - $pos = -1; + + /* @phpstan-ignore-next-line */ if ($overwrite || ($pos = ArrayUtils::hasArg($key, $this->data)) !== -1) { if ($pos === -1) { $this->data[] = $key; diff --git a/Message/Http/Rest.php b/Message/Http/Rest.php index 144f70903..062384d60 100644 --- a/Message/Http/Rest.php +++ b/Message/Http/Rest.php @@ -82,12 +82,15 @@ final class Rest // handle different content types $contentType = $requestHeaders['content-type'] ?? []; 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())); } elseif ($request->getData() !== null && \in_array(MimeType::M_JSON, $contentType)) { \curl_setopt($curl, \CURLOPT_POSTFIELDS, \json_encode($request->getData())); } elseif ($request->getData() !== null && \in_array(MimeType::M_MULT, $contentType)) { $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. // Currently this cannot be done due to a bug. If we do it now the server cannot correclty populate php://input diff --git a/Message/RequestAbstract.php b/Message/RequestAbstract.php index e5de9ad95..cb942f273 100644 --- a/Message/RequestAbstract.php +++ b/Message/RequestAbstract.php @@ -131,7 +131,7 @@ abstract class RequestAbstract implements MessageInterface return []; } - $json = \json_decode($this->data[$key], true); + $json = \json_decode($this->data[$key], true); /** @phpstan-ignore-line */ return !\is_array($json) ? [] : $json; } @@ -154,6 +154,7 @@ abstract class RequestAbstract implements MessageInterface return []; } + /* @phpstan-ignore-next-line */ $list = \explode($delim, $this->data[$key]); if ($list === false) { diff --git a/Module/ModuleManager.php b/Module/ModuleManager.php index 42e50cf95..8c7d4ab31 100644 --- a/Module/ModuleManager.php +++ b/Module/ModuleManager.php @@ -676,6 +676,7 @@ final class ModuleManager $this->initModule($module, $appName); } + /* @phpstan-ignore-next-line */ return $this->running[$name] ?? new NullModule(); } diff --git a/Stdlib/Base/Address.php b/Stdlib/Base/Address.php index df86c7e62..2e67294be 100755 --- a/Stdlib/Base/Address.php +++ b/Stdlib/Base/Address.php @@ -61,7 +61,7 @@ class Address implements \JsonSerializable /** * {@inheritdoc} */ - public function jsonSerialize(int $option = 0) + public function jsonSerialize() : mixed { return $this->toArray(); } diff --git a/Stdlib/Queue/PriorityQueue.php b/Stdlib/Queue/PriorityQueue.php index 88a5b3a54..084f92e44 100644 --- a/Stdlib/Queue/PriorityQueue.php +++ b/Stdlib/Queue/PriorityQueue.php @@ -330,6 +330,6 @@ class PriorityQueue implements \Countable, SerializableInterface */ public function unserialize(mixed $data) : void { - $this->queue = \json_decode($data, true); + $this->queue = \json_decode($data, true); /* @phpstan-ignore-line */ } } diff --git a/System/File/Ftp/Directory.php b/System/File/Ftp/Directory.php index 098ae5f9b..0ba343a4c 100644 --- a/System/File/Ftp/Directory.php +++ b/System/File/Ftp/Directory.php @@ -40,7 +40,7 @@ class Directory extends FileAbstract implements DirectoryInterface * @var string * @since 1.0.0 */ - private string $filter = '*'; + //private string $filter = '*'; /** * Directory nodes (files and directories). @@ -79,21 +79,20 @@ class Directory extends FileAbstract implements DirectoryInterface * Constructor. * * @param HttpUri $uri Uri - * @param string $filter Filter * @param bool $initialize Should get initialized during construction * @param \FTP\Connection $con Connection * * @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->con = $con ?? self::ftpConnect($uri); - $this->filter = \ltrim($filter, '\\/'); + //$this->filter = \ltrim($filter, '\\/'); 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(); } } @@ -110,6 +109,10 @@ class Directory extends FileAbstract implements DirectoryInterface $this->isInitialized = true; parent::index(); + if ($this->con === null) { + return; + } + $list = self::list($this->con, $this->path); foreach ($list as $filename) { @@ -117,7 +120,7 @@ class Directory extends FileAbstract implements DirectoryInterface $uri = clone $this->uri; $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); } @@ -604,6 +607,10 @@ class Directory extends FileAbstract implements DirectoryInterface */ public function createNode() : bool { + if ($this->con === null) { + return false; + } + 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->setPath(self::parent($this->path)); - return new self( - $uri, - '*', true, $this->con - ); + return new self($uri, true, $this->con); } /** @@ -640,6 +644,10 @@ class Directory extends FileAbstract implements DirectoryInterface */ public function copyNode(string $to, bool $overwrite = false) : bool { + if ($this->con === null) { + return false; + } + 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 { + if ($this->con === null) { + return false; + } + return self::move($this->con, $this->path, $to, $overwrite); } @@ -656,6 +668,10 @@ class Directory extends FileAbstract implements DirectoryInterface */ public function deleteNode() : bool { + if ($this->con === null) { + return false; + } + // @todo: update parent 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 { + /** @var \phpOMS\System\File\ContainerInterface $value */ if ($offset === null || !isset($this->nodes[$offset])) { $this->addNode($value); } else { diff --git a/System/File/Ftp/File.php b/System/File/Ftp/File.php index c9dd1e39c..bca801917 100644 --- a/System/File/Ftp/File.php +++ b/System/File/Ftp/File.php @@ -51,7 +51,7 @@ class File extends FileAbstract implements FileInterface parent::__construct($uri->getPath()); - if (self::exists($this->con, $this->path)) { + if ($this->con !== null && self::exists($this->con, $this->path)) { $this->index(); } } @@ -63,6 +63,10 @@ class File extends FileAbstract implements FileInterface { parent::index(); + if ($this->con === null) { + return; + } + $this->size = (int) \ftp_size($this->con, $this->path); } @@ -408,6 +412,10 @@ class File extends FileAbstract implements FileInterface */ public function isExisting() : bool { + if ($this->con === null) { + return false; + } + return self::exists($this->con, $this->path); } @@ -425,7 +433,7 @@ class File extends FileAbstract implements FileInterface $uri = clone $this->uri; $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 { + if ($this->con === null) { + return false; + } + 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 { + if ($this->con === null) { + return false; + } + 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 { + if ($this->con === null) { + return false; + } + return self::move($this->con, $this->path, $to, $overwrite); } @@ -479,6 +499,10 @@ class File extends FileAbstract implements FileInterface */ public function deleteNode() : bool { + if ($this->con === null) { + return false; + } + 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 { + if ($this->con === null) { + return false; + } + return self::put($this->con, $this->path, $content, $mode); } @@ -554,6 +582,10 @@ class File extends FileAbstract implements FileInterface */ public function getContent() : string { + if ($this->con === null) { + return ''; + } + return self::get($this->con, $this->path); } @@ -611,6 +643,6 @@ class File extends FileAbstract implements FileInterface $uri = clone $this->uri; $uri->setPath(self::dirpath($this->path)); - return new Directory($uri, '*', true, $this->con); + return new Directory($uri, true, $this->con); } } diff --git a/System/File/Ftp/FileAbstract.php b/System/File/Ftp/FileAbstract.php index 3bed5139c..442700c91 100644 --- a/System/File/Ftp/FileAbstract.php +++ b/System/File/Ftp/FileAbstract.php @@ -31,10 +31,10 @@ abstract class FileAbstract implements FtpContainerInterface /** * Ftp connection * - * @var \FTP\Connection + * @var null|\FTP\Connection * @since 1.0.0 */ - protected \FTP\Connection $con; + protected ?\FTP\Connection $con = null; /** * Ftp uri @@ -209,6 +209,10 @@ abstract class FileAbstract implements FtpContainerInterface */ public function index() : void { + if ($this->con === null) { + return; + } + $mtime = \ftp_mdtm($this->con, $this->path); $ctime = \ftp_mdtm($this->con, $this->path); diff --git a/tests/System/File/Ftp/DirectoryTest.php b/tests/System/File/Ftp/DirectoryTest.php index 23b6f57e2..50002faa4 100644 --- a/tests/System/File/Ftp/DirectoryTest.php +++ b/tests/System/File/Ftp/DirectoryTest.php @@ -576,7 +576,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase public function testList() : void { $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([ 'sub', @@ -591,7 +591,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase public function testNodeOutput() : void { $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')); } @@ -602,13 +602,13 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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'))); self::assertTrue(\is_dir(__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(); self::assertTrue(\is_dir(__DIR__ . '/nodedir2')); @@ -621,7 +621,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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'))); self::assertTrue(\is_dir(__DIR__ . '/nodedir')); @@ -637,7 +637,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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->getNode('nodedir')->copyNode(__DIR__ . '/nodedir2'); @@ -653,7 +653,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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->getNode('nodedir')->moveNode(__DIR__ . '/nodedir2'); @@ -669,7 +669,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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('dirtest')); @@ -682,7 +682,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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()); } @@ -693,7 +693,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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(); self::assertEquals(__DIR__ . '/dirtest/test.txt', $dir->current()->getPath()); @@ -705,7 +705,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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()); } @@ -716,7 +716,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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()); @@ -730,7 +730,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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()); } @@ -741,7 +741,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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')); self::assertTrue(\is_dir(__DIR__ . '/nodedir')); @@ -759,7 +759,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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'))); self::assertTrue(\is_dir(__DIR__ . '/nodedir')); @@ -775,7 +775,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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::assertFalse(isset($dir['invalid'])); @@ -788,7 +788,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase public function testNodeCreatedAt() : void { $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()); @@ -805,7 +805,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase public function testNodeChangedAt() : void { $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()); @@ -821,7 +821,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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()); } @@ -832,7 +832,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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()); } @@ -843,7 +843,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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(); self::assertEquals('dirtest', $dir->current()->getDirname()); @@ -855,7 +855,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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(); self::assertEquals('test', $dir->current()->getName()); @@ -867,7 +867,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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(); self::assertEquals('test.txt', $dir->current()->getBasename()); @@ -879,7 +879,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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(); self::assertEquals(__DIR__ . '/dirtest', $dir->current()->getDirPath()); @@ -891,7 +891,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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(); self::assertTrue($dir->valid()); @@ -903,7 +903,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase */ 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()) { $dir->next(); diff --git a/tests/phpunit_no_coverage.xml b/tests/phpunit_no_coverage.xml index 97b4b0f7b..7d26b9823 100755 --- a/tests/phpunit_no_coverage.xml +++ b/tests/phpunit_no_coverage.xml @@ -25,7 +25,7 @@ ./vendor ./Build ./Resources - ./Application/Testapp* + *Testapp*