]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 21 Aug 2025 21:04:12 +0000 (23:04 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 21 Aug 2025 21:14:36 +0000 (23:14 +0200)
- added more type-hints

38 files changed:
framework/main/classes/database/result/class_CachedDatabaseResult.php
framework/main/classes/file_directories/binary/class_BaseBinaryFile.php
framework/main/classes/file_directories/binary/index/class_IndexFile.php
framework/main/classes/file_directories/binary/stack/class_StackFile.php
framework/main/classes/file_directories/class_BaseAbstractFile.php
framework/main/classes/file_directories/class_BaseFileIo.php
framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php
framework/main/classes/file_directories/io_stream/class_FileIoStream.php
framework/main/classes/file_directories/text/class_BaseTextFile.php
framework/main/classes/iterator/file/class_FileIterator.php
framework/main/classes/output/class_
framework/main/classes/output/debug/console/class_DebugConsoleOutput.php
framework/main/classes/output/debug/error/class_DebugErrorLogOutput.php
framework/main/classes/output/debug/web/class_DebugWebOutput.php
framework/main/classes/points/class_UserPoints.php
framework/main/classes/reader/class_ConsoleNewsReader.php
framework/main/classes/reader/class_DefaultNewsReader.php
framework/main/classes/registry/class_
framework/main/classes/registry/class_BaseRegistry.php
framework/main/classes/registry/format_upgrade/database/class_
framework/main/classes/registry/format_upgrade/database/class_LocalFileDatabaseFormatUpgradeRegistry.php
framework/main/classes/registry/generic/class_GenericRegistry.php
framework/main/classes/registry/object/class_ObjectRegistry.php
framework/main/classes/registry/sub/class_SubRegistry.php
framework/main/classes/stacker/file/class_
framework/main/classes/stacker/file/class_BaseFileStack.php
framework/main/classes/stacker/file/fifo/class_FiFoFileStack.php
framework/main/interfaces/block/calculatable/class_CalculatableBlock.php
framework/main/interfaces/debug/class_Debugger.php
framework/main/interfaces/executor/class_Executor.php
framework/main/interfaces/filesystem/binary/class_BinaryFile.php
framework/main/interfaces/io/class_FilePointer.php
framework/main/interfaces/io/class_StreamableInput.php
framework/main/interfaces/stacker/file/class_StackableFile.php
framework/main/middleware/io/class_FileIoHandler.php
framework/main/traits/crypto/rng/class_RandomNumberGeneratorTrait.php
framework/main/traits/template/class_CompileableTemplateTrait.php
framework/main/traits/visitor/class_VisitorTrait.php

index 4296044a90a286c938d4b0f2c3a328e43932e64b..cbf5b515aa62639ba0e8375c51fd56ca7f790c43 100644 (file)
@@ -420,7 +420,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul
         *
         * @return      $foundValue             Found value of previous found() call
         */
-       public final function getFoundValue () {
+       public final function getFoundValue (): mixed {
                return $this->foundValue;
        }
 
index d7aa398bbfcd133f1a1af7d3bfc9810426407268..dfcce1b7a3d20454a1d4343dfb02fe62e00ce6dd 100644 (file)
@@ -109,7 +109,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @param       $backBuffer             Characters to "store" in back-buffer
         * @return      void
         */
-       private function setBackBuffer (string $backBuffer) {
+       private function setBackBuffer (string $backBuffer): void {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: Setting backBuffer(%d)=%s - CALLED!', strlen($backBuffer), $backBuffer));
                $this->backBuffer = $backBuffer;
        }
@@ -119,7 +119,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      $backBuffer             Characters "stored" in back-buffer
         */
-       private function getBackBuffer () {
+       private function getBackBuffer (): string {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: Getting this->backBuffer(%d)=%s - CALLED!', strlen($this->backBuffer), $this->backBuffer));
                return $this->backBuffer;
        }
@@ -130,7 +130,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @param       $current        Characters to set a currently loaded block
         * @return      void
         */
-       private function setCurrentBlock (string $currentBlock) {
+       private function setCurrentBlock (string $currentBlock): void {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: Setting currentBlock(%d)=%s - CALLED!', strlen($currentBlock), $currentBlock));
                $this->currentBlock = $currentBlock;
        }
@@ -140,7 +140,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      $current        Currently read data
         */
-       public function getCurrentBlock () {
+       public function getCurrentBlock (): string {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: Getting this->currentBlock(%d)=%s - CALLED!', strlen($this->currentBlock), $this->currentBlock));
                return $this->currentBlock;
        }
@@ -150,7 +150,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      $totalEntries   Size of file header
         */
-       public final function getHeaderSize () {
+       public final function getHeaderSize (): int {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: Getting this->headerSize=%d - CALLED!', $this->headerSize));
                return $this->headerSize;
        }
@@ -161,7 +161,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @param       $headerSize             Size of file header
         * @return      void
         */
-       public final function setHeaderSize (int $headerSize) {
+       public final function setHeaderSize (int $headerSize): void {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: Setting headerSize=%d - CALLED!', $headerSize));
                $this->headerSize = $headerSize;
        }
@@ -171,7 +171,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      $totalEntries   Size of file header
         */
-       public final function getHeader () {
+       public final function getHeader (): array {
                // Get it
                return $this->header;
        }
@@ -182,7 +182,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @param       $header         Array for a file header
         * @return      void
         */
-       public final function setHeader (array $header) {
+       public final function setHeader (array $header): void {
                // Set it
                $this->header = $header;
        }
@@ -192,7 +192,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      $seekPosition   Current seek position (stored here in object)
         */
-       public final function getSeekPosition () {
+       public final function getSeekPosition (): int {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: Getting this->seekPosition=%d - CALLED!', $this->seekPosition));
                return $this->seekPosition;
        }
@@ -203,7 +203,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @param       $seekPosition   Current seek position (stored here in object)
         * @return      void
         */
-       protected final function setSeekPosition (int $seekPosition) {
+       protected final function setSeekPosition (int $seekPosition): void {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: Setting seekPosition=%d - CALLED!', $seekPosition));
                $this->seekPosition = $seekPosition;
        }
@@ -215,7 +215,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @return      $isGapsOnly             Whether the abstracted file only contains gaps
         * @throws      OutOfBoundsException    If calculated file size is larger than actual
         */
-       public function isFileGapsOnly () {
+       public function isFileGapsOnly (): bool {
                // Count every gap
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-BINARY-FILE: CALLED!');
                $gapsSize = 0;
@@ -255,7 +255,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @param       $minimumBlockLength             Minimum block length
         * @return      void
         */
-       private function markFileGapsOnly (string $type, int $minimumBlockLength) {
+       private function markFileGapsOnly (string $type, int $minimumBlockLength): void {
                // Is config cache there?
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: type=%s,minimumBlockLength=%d - CALLED!', $type, $minimumBlockLength));
                if (!isset(self::$configCache[$type . '_pre_allocate_count'])) {
@@ -286,7 +286,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @param       $endPosition    End seek position
         * @return      void
         */
-       private function addGap(int $startPosition, int $endPosition) {
+       private function addGap(int $startPosition, int $endPosition): void {
                // Push to gaps array
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: startPosition=%d,endPosition=%d - CALLED!', $startPosition, $endPosition));
                array_push($this->gaps, [
@@ -303,7 +303,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      void
         */
-       private function initBackBuffer () {
+       private function initBackBuffer (): void {
                // Simply call the setter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-BINARY-FILE: CALLED!');
                $this->setBackBuffer('');
@@ -319,7 +319,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @param       $flushHeader    Wether the file's header should be flushed (default: false)
         * @return      void
         */
-       protected function rewindUpdateSeekPosition (bool $flushHeader = false) {
+       protected function rewindUpdateSeekPosition (bool $flushHeader = false): void {
                // Seek to beginning of file
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: flushHeader=%d - CALLED!', intval($flushHeader)));
                $this->rewind();
@@ -344,7 +344,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      void
         */
-       protected function seekToOldPosition () {
+       protected function seekToOldPosition (): void {
                // Seek to currently ("old") saved position
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-BINARY-FILE: CALLED!');
                $this->seek($this->determineSeekPosition());
@@ -359,7 +359,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @param       $fileInfoInstance       An instance of a SplFileInfo class
         * @return      void
         */
-       protected function initFile (SplFileInfo $fileInfoInstance) {
+       protected function initFile (SplFileInfo $fileInfoInstance): void {
                // Get a file i/o pointer instance
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: fileInfoInstance[%s]=%s - CALLED!', get_class($fileInfoInstance), $fileInfoInstance));
                $pointerInstance = ObjectFactory::createObjectByConfiguredName('file_raw_input_output_class', array($fileInfoInstance));
@@ -379,7 +379,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @return      void
         * @throws      InvalidArgumentException        If a parameter is invalid
         */
-       protected function markCurrentBlockAsEmpty (int $length) {
+       protected function markCurrentBlockAsEmpty (int $length): void {
                // Validate parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: length=%d - CALLED!', $length));
                if ($length < 1) {
@@ -406,7 +406,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      void
         */
-       public function initCountersGapsArray () {
+       public function initCountersGapsArray (): void {
                // Init counter and seek position to header size
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-BINARY-FILE: Invoking this->determineSeekPosition() - CALLED!');
                $seekPosition = $this->getSeekPosition();
@@ -439,7 +439,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      void
         */
-       public function updateSeekPosition () {
+       public function updateSeekPosition (): void {
                // Get key (= seek position)
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-BINARY-FILE: CALLED!');
                $seekPosition = $this->determineSeekPosition();
@@ -459,7 +459,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @return      $isFound        Whether the block separator has been found
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       public static function isBlockSeparatorFound (string $str) {
+       public static function isBlockSeparatorFound (string $str): bool {
                // Validate parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: str=%s - CALLED!', $str));
                if (empty($str)) {
@@ -485,7 +485,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @throws      OutOfBoundsException    If the position is not seekable
         * @throws      InvalidArgumentException        If a parameter is invalid
         */
-       public function writeData (int $seekPosition, string $data, bool $flushHeader = true) {
+       public function writeData (int $seekPosition, string $data, bool $flushHeader = true): void {
                // Validate parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: seekPosition=%s,data()=%d,flushHeader=%d - CALLED!', $seekPosition, strlen($data), intval($flushHeader)));
                if ($seekPosition < 0) {
@@ -533,7 +533,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @throws      OutOfBoundsException    If the position is not seekable
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       public function writeAtPosition (int $seekPosition, string $dataStream) {
+       public function writeAtPosition (int $seekPosition, string $dataStream): mixed {
                // Validate parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: seekPosition=%d,dataStream(%d)=%s - CALLED!', $seekPosition, strlen($dataStream), $dataStream));
                if ($seekPosition < 0) {
@@ -558,7 +558,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      $isInitialized  Whether the file header is initialized
         */
-       public function isFileHeaderInitialized () {
+       public function isFileHeaderInitialized (): bool {
                // Default is not initialized
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-BINARY-FILE: CALLED!');
                $isInitialized = false;
@@ -591,7 +591,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @return      $isInitialized          Whether the file's size is zero
         * @throws      UnexpectedValueException        If an unexpected value was returned
         */
-       public function isFileInitialized () {
+       public function isFileInitialized (): bool {
                // Get it from iterator which holds the pointer instance. If false is returned
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-BINARY-FILE: CALLED!');
                $fileSize = $this->size();
@@ -620,7 +620,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @return      void
         * @throws      BadMethodCallException  If this file's header is already initialized
         */
-       public function createFileHeader () {
+       public function createFileHeader (): void {
                // The file's header should not be initialized here
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-BINARY-FILE: CALLED!');
                if ($this->isFileHeaderInitialized()) {
@@ -646,7 +646,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      $seekPosition   Current seek position
         */
-       public function determineSeekPosition () {
+       public function determineSeekPosition (): int {
                // Call pointer instance
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-BINARY-FILE: CALLED!');
                $seekPosition = $this->getPointerInstance()->determineSeekPosition();
@@ -713,7 +713,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      void
         */
-       public function rewind () {
+       public function rewind (): void {
                // Call pointer instance
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-BINARY-FILE: CALLED!');
                $this->getPointerInstance()->rewind();
@@ -730,7 +730,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @return      void
         * @throws      BadMethodCallException  If this method is called but file is not initialized
         */
-       public function analyzeFileStructure () {
+       public function analyzeFileStructure (): void {
                // Make sure the file is initialized
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-BINARY-FILE: CALLED!');
                if (!$this->isFileInitialized()) {
@@ -814,7 +814,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @return      void
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       protected function readNextBlockByLength (int $length) {
+       protected function readNextBlockByLength (int $length): void {
                // Validate parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: this->seekPosition=%d,length=%d - CALLED!', $this->getSeekPosition(), $length));
                if ($length < 1) {
@@ -897,7 +897,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @return      void
         * @throws      InvalidArgumentException        If a parameter is empty
         */
-       protected function preAllocateFileByTypeLength (string $type, int $minimumBlockLength) {
+       protected function preAllocateFileByTypeLength (string $type, int $minimumBlockLength): void {
                // Is it enabled?
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: type=%s,minimumBlockLength=%d - CALLED!', $type, $minimumBlockLength));
                if (empty($type)) {
@@ -950,7 +950,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @return      $isValid        Whether the next entry is valid
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       protected function isValidByLength (int $length) {
+       protected function isValidByLength (int $length): bool {
                // Validate parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: length=%d - CALLED!', $length));
                if ($length < 1) {
@@ -995,7 +995,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         *
         * @return      void
         */
-       protected abstract function readNextBlock ();
+       protected abstract function readNextBlock (): void;
 
        /**
         * Reads the file header
@@ -1003,7 +1003,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @return      void
         * @throws      LogicException  If both instances are not set
         */
-       public abstract function readFileHeader ();
+       public abstract function readFileHeader (): void;
 
        /**
         * Searches for next suitable gap the given length of data can fit in
@@ -1013,7 +1013,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile {
         * @return      $seekPosition   Found next gap's seek position
         * @throws      InvalidArgumentException        If the parameter is not valid
         */
-       public function searchNextGap (int $length) {
+       public function searchNextGap (int $length): int {
                // If the file is only gaps, no need to seek
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: length=%d - CALLED!', $length));
                if ($length <= 0) {
index 28ca8b1b4883f4385604f0f57da213e238f36d5b..753521b6b6406fa748c58f90dfd73f33006645e8 100644 (file)
@@ -56,7 +56,7 @@ class IndexFile extends BaseBinaryFile implements IndexableFile {
         * @param       $indexInstance  An instance of a Indexable class
         * @return      $indexFileInstance      An instance of an IndexableFile class
         */
-       public final static function createIndexFile (SplFileInfo $fileInfoInstance, Indexable $indexInstance) {
+       public final static function createIndexFile (SplFileInfo $fileInfoInstance, Indexable $indexInstance): IndexableFile {
                // Get a new instance
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('INDEX-FILE: fileInfoInstance[%s]=%s,indexInstance=%s - CALLED!', get_class($fileInfoInstance), $fileInfoInstance, $indexInstance->__toString()));
                $indexFileInstance = new IndexFile();
@@ -84,7 +84,7 @@ class IndexFile extends BaseBinaryFile implements IndexableFile {
         * @return      void
         * @throws      BadMethodCallException  If this->indexInstance is not properly set
         */
-       public function flushFileHeader () {
+       public function flushFileHeader (): void {
                // Validate call
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('INDEX-FILE: CALLED!');
                if (!($this->getIndexInstance() instanceof Indexable)) {
@@ -108,7 +108,7 @@ class IndexFile extends BaseBinaryFile implements IndexableFile {
         * @throws      InvalidArgumentException        If a parameter is empty
         * @throws      BadMethodCallException  If this->indexInstance is not properly set
         */
-       public function preAllocateFile (string $type) {
+       public function preAllocateFile (string $type): void {
                // Is it enabled?
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('INDEX-FILE: type=%s - CALLED!', $type));
                if (empty($type)) {
@@ -140,7 +140,7 @@ class IndexFile extends BaseBinaryFile implements IndexableFile {
         * @return      $isValid        Whether the next entry is valid
         * @throws      BadMethodCallException  If this->indexInstance is not properly set
         */
-       public function isValid () {
+       public function isValid (): bool {
                // Validate call
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('INDEX-FILE: CALLED!');
                if (!($this->getIndexInstance() instanceof Indexable)) {
@@ -168,7 +168,7 @@ class IndexFile extends BaseBinaryFile implements IndexableFile {
         *
         * @return      void
         */
-       protected function readNextBlock () {
+       protected function readNextBlock (): void {
                // First calculate minimum block length
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('INDEX-FILE: this->seekPosition=%d - CALLED!', $this->getSeekPosition()));
                $length = $this->getIndexInstance()->calculateMinimumBlockLength();
@@ -186,7 +186,7 @@ class IndexFile extends BaseBinaryFile implements IndexableFile {
         *
         * @return      void
         */
-       public function readFileHeader () {
+       public function readFileHeader (): void {
                // Call index class' method
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('INDEX-FILE: Invoking this->indexInstance->readIndexHeader() - CALLED!');
                $this->getIndexInstance()->readIndexHeader();
@@ -204,7 +204,7 @@ class IndexFile extends BaseBinaryFile implements IndexableFile {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      BadMethodCallException  If this->indexInstance is not properly set
         */
-       public function writeValueToFile (string $stackName, $value) {
+       public function writeValueToFile (string $stackName, mixed $value): array {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('INDEX-FILE: stackName=%s,value[]=%s - CALLED!', $stackName, gettype($value)));
                if (empty($stackName)) {
@@ -244,7 +244,7 @@ class IndexFile extends BaseBinaryFile implements IndexableFile {
         * @return      $data           Gap position and length of the raw data
         * @throws      UnsupportedOperationException   If this method is called
         */
-       public function writeDataToFreeGap (string $stackName, string $hash, string $encoded) {
+       public function writeDataToFreeGap (string $stackName, string $hash, string $encoded): array {
                self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('INDEX-FILE: stackName=' . $stackName . ',hash=' . $hash . ',encoded()=' . strlen($encoded));
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
index 4f3c5b5ebd2cc85f097dcf7f059a15c09310518b..b2824927c9b1a07c41de4edd22947574fd158c6a 100644 (file)
@@ -57,7 +57,7 @@ class StackFile extends BaseBinaryFile implements FileStacker {
         * @param       $stackInstance  An instance of a StackableFile class
         * @return      $stackFileInstance      An instance of this File class
         */
-       public final static function createStackFile (SplFileInfo $infoInstance, StackableFile $stackInstance) {
+       public final static function createStackFile (SplFileInfo $infoInstance, StackableFile $stackInstance): FileStacker {
                // Get a new instance
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STACK-FILE: infoInstance[%s]=%s,stackInstance=%s - CALLED!', get_class($infoInstance), $infoInstance, $stackInstance->__toString()));
                $stackFileInstance = new StackFile();
@@ -82,7 +82,7 @@ class StackFile extends BaseBinaryFile implements FileStacker {
         * @return      void
         * @throws      BadMethodCallException  If this->stackInstance is not properly set
         */
-       public function flushFileHeader () {
+       public function flushFileHeader (): void {
                // Validate call
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('STACK-FILE: CALLED!');
                if (!($this->getStackInstance() instanceof StackableFIle)) {
@@ -106,7 +106,7 @@ class StackFile extends BaseBinaryFile implements FileStacker {
         * @throws      InvalidArgumentException        If a parameter is empty
         * @throws      BadMethodCallException  If this->stackInstance is not properly set
         */
-       public function preAllocateFile (string $type) {
+       public function preAllocateFile (string $type): void {
                // Is it enabled?
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STACK-FILE: type=%s - CALLED!', $type));
                if (empty($type)) {
@@ -137,7 +137,7 @@ class StackFile extends BaseBinaryFile implements FileStacker {
         * @return      $isValid        Whether the next entry is valid
         * @throws      BadMethodCallException  If this->stackInstance is not properly set
         */
-       public function isValid () {
+       public function isValid (): bool {
                // Validate call
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('STACK-FILE: CALLED!');
                if (!($this->getStackInstance() instanceof StackableFile)) {
@@ -164,7 +164,7 @@ class StackFile extends BaseBinaryFile implements FileStacker {
         * @return      void
         * @throws      LogicException  If both instances are not set
         */
-       public function readFileHeader () {
+       public function readFileHeader (): void {
                // Call stacke instance
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('STACK-FILE: Invoking this->stackInstance->readStackHeader() - CALLED!');
                $this->getStackInstance()->readStackHeader();
@@ -180,7 +180,7 @@ class StackFile extends BaseBinaryFile implements FileStacker {
         *
         * @return      void
         */
-       protected function readNextBlock () {
+       protected function readNextBlock (): void {
                // First calculate minimum block length
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STACK-FILE: this->seekPosition=%d - CALLED!', $this->getSeekPosition()));
                $length = $this->getStackInstance()->calculateMinimumBlockLength();
@@ -201,7 +201,7 @@ class StackFile extends BaseBinaryFile implements FileStacker {
         * @return      $data           Hash and gap position
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       public function writeValueToFile (string $stackName, $value) {
+       public function writeValueToFile (string $stackName, mixed $value): array {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STACK-FILE: stackName=%s,value[]=%s - CALLED!', $stackName, gettype($value)));
                if (empty($stackName)) {
@@ -238,7 +238,7 @@ class StackFile extends BaseBinaryFile implements FileStacker {
         * @return      $data           Gap position and length of the raw data
         * @throws      UnsupportedOperationException   If this method is called
         */
-       public function writeDataToFreeGap (string $stackName, string $hash, string $encoded) {
+       public function writeDataToFreeGap (string $stackName, string $hash, string $encoded): array {
                self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('STACK-FILE: stackName=' . $stackName . ',hash=' . $hash . ',encoded()=' . strlen($encoded));
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
index 2e0aefe49594de36f6adc9b54e80881d87d368b2..51aeaaec51cbc45862336fd7b7e81df56b4589c1 100644 (file)
@@ -11,6 +11,7 @@ use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
 
 // Import SPL stuff
 use \InvalidArgumentException;
+use \SplFileObject;
 
 /**
  * An abstract file class
@@ -60,13 +61,30 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: EXIT!');
        }
 
+       /**
+        * Destructor for cleaning purposes, etc
+        *
+        * @return      void
+        */
+       public final function __destruct() {
+               // Try to close a file
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: DESTRUCTED!');
+               $this->closeFile();
+
+               // Call the parent destructor
+               parent::__destruct();
+
+               // Trace message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: EXIT!');
+       }
+
        /**
         * Setter for FilePointer instance
         *
         * @param       $pointerInstance        An instance of an FilePointer class
         * @return      void
         */
-       protected final function setPointerInstance (FilePointer $pointerInstance = NULL) {
+       protected final function setPointerInstance (FilePointer $pointerInstance = NULL): void {
                $this->pointerInstance = $pointerInstance;
        }
 
@@ -75,7 +93,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         *
         * @return      $pointerInstance        An instance of an FilePointer class
         */
-       public final function getPointerInstance () {
+       public final function getPointerInstance (): FilePointer {
                return $this->pointerInstance;
        }
 
@@ -90,7 +108,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         *
         * @return      void
         */
-       protected final function unsetPointerInstance () {
+       protected final function unsetPointerInstance (): void {
                // Simply invoke setter with no parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: CALLED!');
                $this->setPointerInstance();
@@ -99,29 +117,12 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: EXIT!');
        }
 
-       /**
-        * Destructor for cleaning purposes, etc
-        *
-        * @return      void
-        */
-       public final function __destruct() {
-               // Try to close a file
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: DESTRUCTED!');
-               $this->closeFile();
-
-               // Call the parent destructor
-               parent::__destruct();
-
-               // Trace message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: EXIT!');
-       }
-
        /**
         * "Getter" for abstracted file size
         *
         * @return      $fileSize       Size of abstracted file
         */
-       public function getFileSize () {
+       public function getFileSize (): int {
                // Call pointer instanze
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: CALLED!');
                return $this->getPointerInstance()->getFileSize();
@@ -132,7 +133,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         *
         * @return      $totalEntries   Total entries in this file
         */
-       public final function getCounter () {
+       public final function getCounter (): int {
                // Get it
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-ABSTRACT-FILE: Getting this->totalEntries=%d ... - CALLED!', $this->totalEntries));
                return $this->totalEntries;
@@ -144,7 +145,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         * @param       $totalEntries   Total entries in this file
         * @return      void
         */
-       protected final function setCounter (int $counter) {
+       protected final function setCounter (int $counter): void {
                // Set it
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-ABSTRACT-FILE: Setting this->totalEntries=%d ... - CALLED!', $counter));
                $this->totalEntries = $counter;
@@ -155,7 +156,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         *
         * @return      void
         */
-       protected final function incrementCounter () {
+       protected final function incrementCounter (): void {
                // Count up
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: CALLED!');
                $this->totalEntries++;
@@ -169,7 +170,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         *
         * @return      $fileObject             An instance of a SplFileObject
         */
-       public final function getFileObject () {
+       public final function getFileObject (): SplFileObject {
                // Call pointer instanze
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: CALLED!');
                return $this->getPointerInstance()->getFileObject();
@@ -177,8 +178,10 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
 
        /**
         * Getter for file's name
+        *
+        * @return      $fileName       Name of file
         */
-       public final function getFilename () {
+       public final function getFilename (): string {
                // Invole file object's method
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: CALLED!');
                return $this->getFileObject()->getFilename();
@@ -190,7 +193,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         *
         * @return      void
         */
-       public function closeFile () {
+       public function closeFile (): void {
                // Close down pointer instance as well by unsetting it
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: CALLED!');
                $this->unsetPointerInstance();
@@ -205,7 +208,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         * @return      $size   Size (in bytes) of file
         * @todo        Handle seekStatus
         */
-       public function size () {
+       public function size (): int {
                // Call pointer instance
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: CALLED!');
                return $this->getPointerInstance()->size();
@@ -219,7 +222,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         *                                                                      is not set by setFileObject()
         * @throws      InvalidResourceException        If there is being set
         */
-       public function readFromFile () {
+       public function readFromFile (): mixed {
                // Call pointer instance
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: CALLED!');
                return $this->getPointerInstance()->readFromFile();
@@ -235,7 +238,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         * @throws      InvalidResourceException        If there is being set
         *                                                                                      an invalid file resource
         */
-       public function writeToFile (string $dataStream) {
+       public function writeToFile (string $dataStream): mixed {
                // Check parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-ABSTRACT-FILE: dataStream()=%d - CALLED!', strlen($dataStream)));
                if (empty($dataStream)) {
@@ -252,7 +255,7 @@ abstract class BaseAbstractFile extends BaseFrameworkSystem implements FilePoint
         *
         * @return      $isEndOfFileReached             Whether the EOF has been reached
         */
-       public final function isEndOfFileReached () {
+       public final function isEndOfFileReached (): bool {
                // Call pointer instance
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-ABSTRACT-FILE: CALLED!');
                return $this->getPointerInstance()->isEndOfFileReached();
index d093dda0f2913b8fee0f0534136f10b0a0bacf50..35ad9405bb905a759ec380073abd8d70a2c3c47c 100644 (file)
@@ -85,7 +85,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         * @throws      NullPointerException    If the file pointer instance is not set by setFileObject()
         * @throws      LogicException  If there is no object being set
         */
-       public function closeFile () {
+       public function closeFile (): void {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: fileName=%s - CALLED!', $this->getFileObject()->getPathname()));
                if (is_null($this->getFileObject())) {
@@ -109,7 +109,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         *
         * @return      void
         */
-       protected final function resetFileObject () {
+       protected final function resetFileObject (): void {
                // Set it to NULL
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: Setting this->fileObject=NULL - CALLED!');
                $this->fileObject = NULL;
@@ -124,7 +124,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         * @param       $fileObject             An instance of a SplFileObject class
         * @return      void
         */
-       protected final function setFileObject (SplFileObject $fileObject) {
+       protected final function setFileObject (SplFileObject $fileObject): void {
                $this->fileObject = $fileObject;
        }
 
@@ -133,7 +133,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         *
         * @return      $fileObject             An instance of a SplFileObject class
         */
-       public final function getFileObject () {
+       public final function getFileObject (): SplFileObject {
                return $this->fileObject;
        }
 
@@ -142,7 +142,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         *
         * @return      $seekPosition   Current seek position
         */
-       public final function determineSeekPosition () {
+       public final function determineSeekPosition (): int {
                return $this->getFileObject()->ftell();
        }
 
@@ -151,7 +151,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         *
         * @return      $isEndOfFileReached             Whether the EOF has been reached
         */
-       public final function isEndOfFileReached () {
+       public final function isEndOfFileReached (): bool {
                return $this->getFileObject()->eof();
        }
 
@@ -162,7 +162,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         * @param       $whence         Added to offset (default: only use offset to seek to)
         * @return      $status         Status of file seek: 0 = success, -1 = failed
         */
-       public function seek (int $offset, int $whence = SEEK_SET) {
+       public function seek (int $offset, int $whence = SEEK_SET): int {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-IO: offset=%d,whence=%d - CALLED!', $offset, $whence));
                if ($offset < 0) {
@@ -184,7 +184,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl
         * @return      $size   Size (in bytes) of file
         * @todo        Handle seekStatus
         */
-       public function size () {
+       public function size (): int {
                // Get current seek position
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FILE-IO: CALLED!');
                $seekPosition = $this->determineSeekPosition();
index 8897215130a277014b7c697c5269e713e5618195..b3b4e56eb2f3f246925c7e6978b8a11333e8026e 100644 (file)
@@ -108,7 +108,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP
         *
         * @return      mixed   The result of fread()
         */
-       public function readFromFile () {
+       public function readFromFile (): mixed {
                // Read data from the file pointer and return it
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-INPUT-OUTPUT-POINTER: CALLED!');
                $data = $this->read(1024);
@@ -124,7 +124,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP
         * @param       $dataStream             The data stream we shall write to the file
         * @return      mixed                   Number of writes bytes or false on error
         */
-       public function writeToFile (string $dataStream) {
+       public function writeToFile (string $dataStream): mixed {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-INPUT-OUTPUT-POINTER: dataStream(%d)=%s - CALLED!', strlen($dataStream), $dataStream));
                if (empty($dataStream)) {
@@ -153,7 +153,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP
         * @throws      OutOfBoundsException    If the position is not seekable
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       public function writeAtPosition (int $seekPosition, string $dataStream) {
+       public function writeAtPosition (int $seekPosition, string $dataStream): mixed {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-INPUT-OUTPUT-POINTER: seekPosition=%d,dataStream(%d)=%s - CALLED!', $seekPosition, strlen($dataStream), $dataStream));
                if ($seekPosition < 0) {
@@ -198,7 +198,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP
         * @return      $status                 Status of this operation
         * @throws      OutOfBoundsException    If the position is not seekable
         */
-       public function seek (int $seekPosition, int $whence = SEEK_SET) {
+       public function seek (int $seekPosition, int $whence = SEEK_SET): int {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-INPUT-OUTPUT-POINTER: seekPosition=%d,whence=%d - CALLED!', $seekPosition, $whence));
                if ($seekPosition < 0) {
index 9a82005ca9669aa738187231a6b1e0066054162e..b47eb023e4a34af1c496157fcdce8b244ac8b25a 100644 (file)
@@ -75,7 +75,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
         *
         * @return      $ioInstance     An instance of a FileIoStream class
         */
-       public static final function createFileIoStream () {
+       public static final function createFileIoStream (): FileIoStream {
                // Create new instance
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-STREAM: CALLED!');
                $ioInstance = new FileIoStream();
@@ -95,7 +95,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
         * @throws      InvalidArgumentException        If an invalid parameter was given
         * @throws      OutOfBoundsException    If an expected array element wasn't found
         */
-       public final function saveFile (SplFileInfo $fileInfoInstance, array $dataArray) {
+       public final function saveFile (SplFileInfo $fileInfoInstance, array $dataArray): void {
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-IO-STREAM: fileInfoInstance=%s,dataArray()=%d - CALLED!', $fileInfoInstance, count($dataArray)));
                if (count($dataArray) < 2) {
@@ -170,7 +170,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
         * @return      $array  An array with the element 'header' and 'data'
         * @see         FileInputStreamer
         */
-       public final function loadFileContents (SplFileInfo $infoInstance) {
+       public final function loadFileContents (SplFileInfo $infoInstance): array {
                // Initialize some variables and arrays
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-IO-STREAM: infoInstance=%s - CALLED!', $infoInstance));
                $inputBuffer = '';
@@ -329,7 +329,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
         * @return      $seekPosition   Current seek position
         * @todo        0% done
         */
-       public function determineSeekPosition () {
+       public function determineSeekPosition (): int {
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-STREAM: CALLED!');
                DebugMiddleware::getSelfInstance()->partialStub();
@@ -342,7 +342,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
         * @param       $whence         Added to offset (default: only use offset to seek to)
         * @return      $status         Status of file seek: 0 = success, -1 = failed
         */
-       public function seek (int $offset, int $whence = SEEK_SET) {
+       public function seek (int $offset, int $whence = SEEK_SET): int {
                // Check parameters
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-IO-STREAM: offset=%d,whence=%d - CALLED!', $offset, $whence));
                if ($offset < 0) {
@@ -353,6 +353,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
                        throw new InvalidArgumentException(sprintf('whence=%d is below zero', $whence), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
                }
 
+               // @TODO Partial stub
                DebugMiddleware::getSelfInstance()->partialStub('offset=' . $offset . ',whence=' . $whence);
        }
 
@@ -361,7 +362,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil
         *
         * @return      $size   Size (in bytes) of file
         */
-       public function size () {
+       public function size (): int {
                // Trace message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-STREAM: CALLED!');
                DebugMiddleware::getSelfInstance()->partialStub();
index 341f453d9fa204b72b1a86be96942672deef4131..bfb00fb026cd8e091a26d2e992ebaf92c1dccb34 100644 (file)
@@ -49,7 +49,7 @@ abstract class BaseTextFile extends BaseAbstractFile {
         *
         * @return      $seekPosition   Current seek position
         */
-       public function determineSeekPosition () {
+       public function determineSeekPosition (): int {
                // Not possible in text files
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
@@ -61,7 +61,7 @@ abstract class BaseTextFile extends BaseAbstractFile {
         * @param       $whence         Added to offset (default: only use offset to seek to)
         * @return      $status         Status of file seek: 0 = success, -1 = failed
         */
-       public function seek (int $offset, int $whence = SEEK_SET) {
+       public function seek (int $offset, int $whence = SEEK_SET): int {
                // Not possible in text files
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-TEXT-FILE: offset=' . $offset . ',whence=' . $whence);
                throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
@@ -75,7 +75,7 @@ abstract class BaseTextFile extends BaseAbstractFile {
         * @throws      InvalidArrayCountException      If an array has not the expected size
         * @throws      InvalidMD5ChecksumException     If two MD5 hashes did not match
         */
-       public function loadFileContents (SplFileInfo $infoInstance) {
+       public function loadFileContents (SplFileInfo $infoInstance): array {
                /*
                 * This class (or its implementations) are special file readers/writers.
                 * There is no need to read/write the whole file.
index 305f7c59b9ca5ec54fae0216ade2eff5bb82d7dd..759e6ed110e131bcf42d1009d354bd8a907ec9da 100644 (file)
@@ -164,7 +164,7 @@ class FileIterator extends BaseIterator implements SeekableIterator {
         * @return      void
         * @throws      OutOfBoundsException    If the position is not seekable
         */
-       public function seek (int $seekPosition): void {
+       public function seek (int $seekPosition): seek {
                // Validate parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('FILE-ITERATOR: seekPosition=%d,whence=%d - CALLED!', $seekPosition, $whence));
                if ($seekPosition < 0) {
@@ -173,10 +173,8 @@ class FileIterator extends BaseIterator implements SeekableIterator {
                }
 
                // Call file instance
-               $this->getBinaryFileInstance()->seek($seekPosition);
-
-               // Trace message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILE-ITERATOR: EXIT!');
+               return $this->getBinaryFileInstance()->seek($seekPosition);
        }
 
 }
index 84b7d53dd215256e589d80f4b5f3ee955b900b3a..9d6a07e25953dbff2946e4615a07ef1ef7cbaf30 100644 (file)
@@ -101,7 +101,7 @@ class ???Output extends BaseOutput implements OutputStreamer, Registerable {
         * @return      $status         Status of file seek: 0 = success, -1 = failed
         * @throws      UnsupportedOperationException   If this method is called
         */
-       public function seek ($offset, $whence = SEEK_SET) {
+       public function seek ($offset, $whence = SEEK_SET): int {
                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('OUTPUT: offset=' . $offset . ',whence=' . $whence);
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
index 140365da8eaf583512d146aff1fdf5a7e27b443f..5e033047f9861ab3b71394f1f7c7c15499307c81 100644 (file)
@@ -57,7 +57,7 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre
         *
         * @return      $debugInstance  The prepared debug instance
         */
-       public static final function createDebugConsoleOutput () {
+       public static final function createDebugConsoleOutput (): OutputStreamer {
                // Get a new instance
                $debugInstance = new DebugConsoleOutput();
 
@@ -72,7 +72,7 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre
         * @param       $stripTags      Whether HTML tags shall be stripped out
         * @return      void
         */
-       public final function outputStream (string $output, bool $stripTags = false) {
+       public final function outputStream (string $output, bool $stripTags = false): void {
                // Strip HTML tags out?
                if ($stripTags === true) {
                        // Prepare the output without HTML tags
@@ -96,7 +96,7 @@ class DebugConsoleOutput extends BaseDebugOutput implements Debugger, OutputStre
         * @param       $stripTags      Whether HTML tags shall be stripped out
         * @return      void
         */
-       public final function output (string $outStream = '', bool $stripTags = false) {
+       public final function output (string $outStream = '', bool $stripTags = false): void {
                // Empty output will be silently ignored
                if (!empty($outStream)) {
                        $this->outputStream($outStream, $stripTags);
index 299824128bd2d4e172eac78ede3c78f345887963..01e1372be9010c32817b6e1b3a15c8d3a65d2323 100644 (file)
@@ -47,7 +47,7 @@ class DebugErrorLogOutput extends BaseDebugOutput implements Debugger, OutputStr
         *
         * @return      $debugInstance  The prepared debug instance
         */
-       public static final function createDebugErrorLogOutput () {
+       public static final function createDebugErrorLogOutput (): OutputStreamer {
                // Get a new instance
                $debugInstance = new DebugErrorLogOutput();
 
@@ -62,7 +62,7 @@ class DebugErrorLogOutput extends BaseDebugOutput implements Debugger, OutputStr
         * @param       $stripTags      Whether HTML tags shall be stripped out
         * @return      void
         */
-       public final function outputStream (string $output, bool $stripTags = false) {
+       public final function outputStream (string $output, bool $stripTags = false): void {
                // Split multiple lines into and array to put them out line-by-line
                $errorLines = explode(chr(10), $output);
 
@@ -86,7 +86,7 @@ class DebugErrorLogOutput extends BaseDebugOutput implements Debugger, OutputStr
         * @param       $stripTags      Whether HTML tags shall be stripped out
         * @return      void
         */
-       public final function output (string $outStream = '', bool $stripTags = false) {
+       public final function output (string $outStream = '', bool $stripTags = false): void {
                // Empty output will be silently ignored
                if (!empty($outStream)) {
                        $this->outputStream($outStream);
index 4617d45f7fe76c88ea3271513d67102250a10418..b1caa5b3e8a3fb535c3bceb3618c13de10a38391 100644 (file)
@@ -47,7 +47,7 @@ class DebugWebOutput extends BaseDebugOutput implements Debugger, OutputStreamer
         *
         * @return      $debugInstance  The prepared debug instance
         */
-       public static final function createDebugWebOutput () {
+       public static final function createDebugWebOutput (): OutputStreamer {
                // Get a new instance
                $debugInstance = new DebugWebOutput();
 
@@ -62,7 +62,7 @@ class DebugWebOutput extends BaseDebugOutput implements Debugger, OutputStreamer
         * @param       $stripTags      Whether HTML tags shall be stripped out
         * @return      void
         */
-       public final function outputStream (string $output, bool $stripTags = false) {
+       public final function outputStream (string $output, bool $stripTags = false): void {
                // Strip out any <br />
                $output = str_replace('<br />', '', $output);
                printf('<!-- %s -->' . PHP_EOL, stripslashes($output));
@@ -75,7 +75,7 @@ class DebugWebOutput extends BaseDebugOutput implements Debugger, OutputStreamer
         * @param       $stripTags      Whether HTML tags shall be stripped out
         * @return      void
         */
-       public final function output (string $outStream = '', bool $stripTags = false) {
+       public final function output (string $outStream = '', bool $stripTags = false): void {
                // Empty output will be silently ignored
                if (!empty($outStream)) {
                        $this->outputStream($outStream, $stripTags);
index 8f451ce343f531d1cabd27aaddb720150085ea30..d11ae22376afbe21242bb85440fb8f7df5ba57e1 100644 (file)
@@ -61,7 +61,7 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
         * @param       $userInstance           An instance of a user class
         * @return      $pointsInstance         An instance of this class
         */
-       public static final function createUserPoints (ManageableAccount $userInstance) {
+       public static final function createUserPoints (ManageableAccount $userInstance): BookablePoints {
                // Get a new instance
                $pointsInstance = new UserPoints();
 
@@ -97,8 +97,8 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
         * @param       $amount         Amount of points to store
         * @return      void
         */
-       public final function setAmount (float $amount) {
-               $this->amount = (float) $amount;
+       public final function setAmount (float $amount): void {
+               $this->amount = $amount;
        }
 
        /**
@@ -106,7 +106,7 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
         *
         * @return      $amount         Amount of points to store
         */
-       public final function getAmount () {
+       public final function getAmount (): float {
                return $this->amount;
        }
 
@@ -117,7 +117,7 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
         * @return      $hasRequired    Whether the user has the required points
         * @todo        Finish loading part of points
         */
-       public function ifUserHasRequiredPoints (string $action) {
+       public function ifUserHasRequiredPoints (string $action): bool {
                // Default is that everyone is poor... ;-)
                $hasRequired = false;
 
@@ -146,7 +146,7 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
         * @param       $amount         Amount of points we shall book
         * @return      void
         */
-       public function bookPointsDirectly (float $amount) {
+       public function bookPointsDirectly (float $amount): void {
                // Rewind always
                $this->getResultInstance()->rewind();
 
@@ -188,7 +188,7 @@ class UserPoints extends BaseFrameworkSystem implements Registerable, BookablePo
         * @return      void
         * @todo        $requestInstance is currently unused
         */
-       public function addElementsToDataSet (StoreableCriteria $criteriaInstance) {
+       public function addElementsToDataSet (StoreableCriteria $criteriaInstance): void {
                // Add user id
                $criteriaInstance->addCriteria(UserPointsDatabaseFrontend::DB_COLUMN_POINTS_UID, $this->getUserInstance()->getUserId());
 
index 8c395272af686b5c58afaf9809f6660396004fa1..4d28de447b34b2c2b0b4655f9b6db12d1eda7eee 100644 (file)
@@ -54,7 +54,7 @@ class ConsoleNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg
         * @param       $requestInstance        An instance of a Requestable class
         * @return      $readerInstance         An instance of this reader class
         */
-       public static final function createConsoleNewsReader (Requestable $requestInstance) {
+       public static final function createConsoleNewsReader (Requestable $requestInstance): ReadableNews {
                // Get a new instance
                $readerInstance = new ConsoleNewsReader();
 
@@ -68,7 +68,7 @@ class ConsoleNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg
         *
         * @return      void
         */
-       public function initializeReader () {
+       public function initializeReader (): void {
                // Get 'command' for saving some calls
                $command = FrameworkBootstrap::getRequestInstance()->getRequestElement('command');
 
index 2ef04379f33a3f8758175d92d06ae098e26dc61b..f73ea0207ee46edb056f7aa92a40cd32eb60ea3a 100644 (file)
@@ -53,7 +53,7 @@ class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg
         * @param       $requestInstance        An instance of a Requestable class
         * @return      $readerInstance         An instance of this reader class
         */
-       public static final function createDefaultNewsReader (Requestable $requestInstance) {
+       public static final function createDefaultNewsReader (Requestable $requestInstance): ReadableNews {
                // Get a new instance
                $readerInstance = new DefaultNewsReader();
 
@@ -67,7 +67,7 @@ class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg
         *
         * @return      void
         */
-       public function initializeReader () {
+       public function initializeReader (): void {
                // Get 'command' for saving some calls
                $command = FrameworkBootstrap::getRequestInstance()->getRequestElement('command');
 
index a4ffbcbceda27072f255889a086b5e82b44e5f63..32a74c1ac6cc95c777c0ca8799f490c86944dd9f 100644 (file)
@@ -50,7 +50,7 @@ class ???Registry extends BaseRegistry implements Register {
         *
         * @return      $registryInstance       Instance of this class
         */
-       public final static function getRegistry (string $key) {
+       public final static function getRegistry (string $key): Register {
                // Is an instance there?
                if (is_null(self::$registryInstances[$key])) {
                        // Not yet, so create one
index 3757c2825b2aa50355edec64c9c39f6d99784207..b09f2e4e98bb9434dde80c0154aaf3a96cfab5b6 100644 (file)
@@ -98,7 +98,7 @@ abstract class BaseRegistry extends BaseFrameworkSystem implements Register, Reg
         *
         * @return      $instanceRegistry       The whole generic registry array
         */
-       public final function getGenericRegistry () {
+       public final function getGenericRegistry (): array {
                return $this->getGenericSubArray('registry', 'generic');
        }
 
@@ -111,7 +111,7 @@ abstract class BaseRegistry extends BaseFrameworkSystem implements Register, Reg
         * @return      void
         * @throws      InvalidArgumentException        If a paramter has an invalid value
         */
-       public final function addEntry (string $key, $value) {
+       public final function addEntry (string $key, mixed $value): void {
                // Check parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: key=%s,value[]=%s - CALLED!', $key, gettype($value)));
                if (empty($key)) {
@@ -134,7 +134,7 @@ abstract class BaseRegistry extends BaseFrameworkSystem implements Register, Reg
         * @return      $entries        An array with entries from this registry
         * @throws      InvalidArgumentException        If a paramter has an invalid value
         */
-       public final function getEntries (string $key = NULL) {
+       public final function getEntries (string $key = NULL): array {
                // Check parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: key[%s]=%s - CALLED!', gettype($key), $key));
                if (!is_null($key) && empty($key)) {
@@ -168,7 +168,7 @@ abstract class BaseRegistry extends BaseFrameworkSystem implements Register, Reg
         * @throws      InvalidArgumentException        If a paramter has an invalid value
         * @throws      UnexpectedValueException        If $value3 is not an array
         */
-       public function getArrayFromKey (string $arrayKey, string $lookFor) {
+       public function getArrayFromKey (string $arrayKey, string $lookFor): array {
                // Check parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: arrayKey=%s,lookFor=%s - CALLED!', $arrayKey, $lookFor));
                if (empty($arrayKey)) {
@@ -233,7 +233,7 @@ abstract class BaseRegistry extends BaseFrameworkSystem implements Register, Reg
         * @param       $data                   An array with data
         * @return      $registryKey    A registry key
         */
-       public static function getRegistryKeyFromArray (string $prefix, array $data) {
+       public static function getRegistryKeyFromArray (string $prefix, array $data): string {
                // Check parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-REGISTRY: prefix=%s,data()=%d - CALLED!', $prefix, count($data)));
                if (empty($prefix)) {
index d5f96b20fe978fb337e890aa60b6c1526ac7dfc0..11b62f88dd0bea25f109d7b48e626822925278d7 100644 (file)
@@ -43,7 +43,7 @@ class ???FormatUpgradeRegistry extends BaseRegistry implements RegisterableForma
         *
         * @return      $registryInstance       Instance of this class
         */
-       public final static function getRegistry () {
+       public final static function getRegistry (): RegisterableFormatUpgrade {
                // Is an instance there?
                if (is_null(self::$registryInstance)) {
                        // Not yet, so create one
index c40b19a893df221e645ba2856bc8041a173e312b..f8b9e1ea3284f93d8fa7e7c0b81bd7017f68b43c 100644 (file)
@@ -52,7 +52,7 @@ class LocalFileDatabaseFormatUpgradeRegistry extends BaseRegistry implements Reg
         *
         * @return      $registryInstance       Instance of this class
         */
-       public final static function getRegistry () {
+       public final static function getRegistry (): RegisterableFormatUpgrade {
                // Is an instance there?
                if (is_null(self::$registryInstance)) {
                        // Not yet, so create one
index f5ce8237c4882baaedd9248257f02d551b2382c1..7016bd9c5b19636565a8a753cc5e73f733229002 100644 (file)
@@ -52,7 +52,7 @@ class GenericRegistry extends BaseRegistry implements Register {
         * @return      $registryInstance       Instance of this class
         * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
-       public static final function getRegistry (string $key) {
+       public static final function getRegistry (string $key): Register {
                // Check parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: key=%s - CALLED!', $key));
                if (empty($key)) {
index 0d01db6d945b1ada1a3b1149415faef9cbd5ee4d..3b90ee427e87ca94429599fdc7f1eb255563e2d1 100644 (file)
@@ -66,7 +66,7 @@ class ObjectRegistry extends BaseRegistry implements ObjectRegister {
         * @return      $registryInstance       Instance of this class
         * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
-       public static final function getRegistry (string $key) {
+       public static final function getRegistry (string $key): ObjectRegister {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: key=%s - CALLED!', $key));
                if (empty($key)) {
@@ -93,7 +93,7 @@ class ObjectRegistry extends BaseRegistry implements ObjectRegister {
         * @return      $exists                 Whether the key exists in registry
         * @throws      InvalidArgumentException        If a paramter has an invalid value
         */
-       public function instanceExists (string $instanceKey) {
+       public function instanceExists (string $instanceKey): bool {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: instanceKey=%s - CALLED!', $instanceKey));
                if (empty($instanceKey)) {
@@ -115,7 +115,7 @@ class ObjectRegistry extends BaseRegistry implements ObjectRegister {
         *
         * @return      $instanceRegistry       The whole instance registry array
         */
-       public final function getInstanceRegistry () {
+       public final function getInstanceRegistry (): array {
                return $this->getGenericSubArray('registry', 'instance');
        }
 
@@ -127,7 +127,7 @@ class ObjectRegistry extends BaseRegistry implements ObjectRegister {
         * @return      void
         * @throws      InvalidArgumentException        If a paramter has an invalid value
         */
-       public function addInstance (string $instanceKey, Registerable $objectInstance) {
+       public function addInstance (string $instanceKey, Registerable $objectInstance): void {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: instanceKey=%s,objectInstance=%s - CALLED!', $instanceKey, $objectInstance->__toString()));
                if (empty($instanceKey)) {
@@ -151,7 +151,7 @@ class ObjectRegistry extends BaseRegistry implements ObjectRegister {
         * @throws      InvalidArgumentException        If a paramter has an invalid value
         * @throws      NullPointerException    If the requested key is not found
         */
-       public function getInstance (string $instanceKey) {
+       public function getInstance (string $instanceKey): Registerable {
                // Check parameter
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('OBJECT-REGISTRY: instanceKey=%s - CALLED!', $instanceKey));
                if (empty($instanceKey)) {
index fbdd82ef6b5f1fc706cc4926ed9f84a58ede9944..d88af242e66ef99eb56acf7572c394cda712bbeb 100644 (file)
@@ -44,7 +44,7 @@ class SubRegistry extends BaseRegistry implements Register {
         *
         * @return      $registryInstance       An instance of this registry class
         */
-       public static final function createSubRegistry () {
+       public static final function createSubRegistry (): Register {
                // Just get a new instance ...
                $registryInstance = new SubRegistry();
 
index 091d752601158452d3ce2a9ef31aa9ecb085917a..8dfe6ab9749134117ef78fcedd984ab03d98d44a 100644 (file)
@@ -94,7 +94,7 @@ class ???FileStack extends BaseFileStack implements StackableFile, Registerable
         * @param       $seekPosition   Seek position in file
         * @return      void
         */
-       public function seek ($seekPosition) {
+       public function seek ($seekPosition): int {
                DebugMiddleware::getSelfInstance()->partialStub('seekPosition=' . $seekPosition);
        }
 
index 303caca77c7666d0f91e05b18640b50d3c199cc7..17af2c39bf2902ceb1d2375b5d78468b8f7676d3 100644 (file)
@@ -75,7 +75,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @throws      UnexpectedValueException        If header is not proper length
         * @throws      InvalidMagicException   If a bad magic was found
         */
-       public function readStackHeader () {
+       public function readStackHeader (): void {
                // First rewind to beginning as the header sits at the beginning ...
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: CALLED!');
                $this->getIteratorInstance()->rewind();
@@ -183,7 +183,7 @@ abstract class BaseFileStack extends BaseStacker {
         *
         * @return      void
         */
-       public function flushFileHeader () {
+       public function flushFileHeader (): void {
                // Put all informations together
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: CALLED!');
                $header = sprintf('%s%s%s%s%s%s',
@@ -223,7 +223,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @throws      InvalidArgumentException        If a parameter is invalid
         * @todo        Currently the stack file is not cached, please implement a memory-handling class and if enough RAM is found, cache the whole stack file.
         */
-       protected function initFileStack (SplFileInfo $fileInfoInstance, string $type) {
+       protected function initFileStack (SplFileInfo $fileInfoInstance, string $type): void {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: fileInfoInstance[%s]=%s,type=%s - CALLED!', get_class($fileInfoInstance), $fileInfoInstance, $type));
                if (empty($type)) {
@@ -314,7 +314,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      InvalidArgumentException        Not all variable types are wanted here
         */
-       protected function addValueToStack (string $stackerName, $value) {
+       protected function addValueToStack (string $stackerName, mixed $value): void {
                // Validate parameter
                /* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s,value[]=%s - CALLED!', $stackerName, gettype($value)));
                //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s,value[%s]=%s', $stackerName, gettype($value), print_r($value, true)));
@@ -353,7 +353,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      BadMethodCallException  If the stack is empty
         */
-       protected function getLastValue (string $stackerName) {
+       protected function getLastValue (string $stackerName): mixed {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName));
                if (empty($stackerName)) {
@@ -381,7 +381,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      BadMethodCallException  If the stack is empty
         */
-       protected function getFirstValue (string $stackerName) {
+       protected function getFirstValue (string $stackerName): mixed {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName));
                if (empty($stackerName)) {
@@ -409,7 +409,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      BadMethodCallException  If the stack is empty
         */
-       protected function popLast (string $stackerName) {
+       protected function popLast (string $stackerName): mixed {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName));
                if (empty($stackerName)) {
@@ -433,7 +433,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      BadMethodCallException  If the named stacker is empty
         */
-       protected function popFirst (string $stackerName) {
+       protected function popFirst (string $stackerName): mixed {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName));
                if (empty($stackerName)) {
@@ -456,7 +456,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      $isFull                 Whether the stack is full
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       protected function isStackFull (string $stackerName) {
+       protected function isStackFull (string $stackerName): bool {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName));
                if (empty($stackerName)) {
@@ -481,7 +481,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @throws      InvalidArgumentException        If a parameter is not valid
         * @throws      BadMethodCallException  If given stack is missing
         */
-       public function isStackEmpty (string $stackerName) {
+       public function isStackEmpty (string $stackerName): bool {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName));
                if (empty($stackerName)) {
@@ -504,7 +504,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      $isInitialized  Whether the stack is initialized
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public function isStackInitialized (string $stackerName) {
+       public function isStackInitialized (string $stackerName): bool {
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
@@ -514,7 +514,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      $isEndOfFileReached             Whether the EOF has been reached
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public function isEndOfFileReached () {
+       public function isEndOfFileReached (): bool {
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
@@ -524,7 +524,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @param       $stackerName    Name of the stack
         * @return      $count                  Size of stack (array count)
         */
-       public function getStackCount (string $stackerName) {
+       public function getStackCount (string $stackerName): int {
                // Now, simply return the found count value, this must be up-to-date then!
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackerName=%s - CALLED!', $stackerName));
                $count = $this->getIteratorInstance()->getBinaryFileInstance()->getCounter();
@@ -539,7 +539,7 @@ abstract class BaseFileStack extends BaseStacker {
         *
         * @return      $length         Minimum length for one entry/block
         */
-       public function calculateMinimumBlockLength () {
+       public function calculateMinimumBlockLength (): int {
                // Is the value "cached"?
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: CALLED!');
                if (self::$minimumBlockLength == 0) {
@@ -568,7 +568,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      void
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public function initCountersGapsArray () {
+       public function initCountersGapsArray (): void {
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
@@ -578,7 +578,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      $totalEntries   Size of file header
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public final function getHeaderSize () {
+       public final function getHeaderSize (): int {
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
@@ -589,7 +589,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      void
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public final function setHeaderSize (int $headerSize) {
+       public final function setHeaderSize (int $headerSize): void {
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
@@ -599,7 +599,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      $totalEntries   Size of file header
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public final function getHeader () {
+       public final function getHeader (): array {
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
@@ -610,7 +610,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      void
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public final function setHeader (array $header) {
+       public final function setHeader (array $header): void {
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
@@ -620,7 +620,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      void
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public function updateSeekPosition () {
+       public function updateSeekPosition (): void {
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
@@ -630,7 +630,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      $totalEntries   Total entries in this file
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public final function getCounter () {
+       public final function getCounter (): int {
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
@@ -643,7 +643,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      void
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public function writeData (int $seekPosition, string $data, bool $flushHeader = true) {
+       public function writeData (int $seekPosition, string $data, bool $flushHeader = true): void {
                // Not supported
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
@@ -656,7 +656,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      mixed                   Number of writes bytes or false on error
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public function writeAtPosition (int $seekPosition, string $dataStream) {
+       public function writeAtPosition (int $seekPosition, string $dataStream): mixed {
                // Not supported
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
@@ -669,7 +669,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      $data           Hash and gap position
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public function writeValueToFile (string $stackName, $value) {
+       public function writeValueToFile (string $stackName, value $value): array {
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
@@ -681,7 +681,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      $seekPosition   Found next gap's seek position
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       public function searchNextGap (int $length) {
+       public function searchNextGap (int $length): int {
                // Not supported here
                throw new UnsupportedOperationException(array($this, __FUNCTION__, $this->getIteratorInstance()->getBinaryFileInstance()), FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION);
        }
@@ -691,7 +691,7 @@ abstract class BaseFileStack extends BaseStacker {
         *
         * @return      $fileSize       Size of currently loaded file
         */
-       public function getFileSize () {
+       public function getFileSize (): int {
                // Call iterator's method
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: CALLED!');
                $size = $this->getIteratorInstance()->getBinaryFileInstance()->getFileSize();
@@ -710,7 +710,7 @@ abstract class BaseFileStack extends BaseStacker {
         * @return      $data           Gap position and length of the raw data
         * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
-       public function writeDataToFreeGap (string $stackName, string $hash, string $encoded) {
+       public function writeDataToFreeGap (string $stackName, string $hash, string $encoded): array {
                // Check parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: stackName=%s,hash{}=0x%s,encoded()=%d - CALLED!', $stackName, bin2hex($hash), strlen($encoded)));
                if (empty($stackName)) {
index 3c291361d5ee1e1052c54bd75676bd8f10395c72..481274525fc6de68d432aaa26276971b57940f12 100644 (file)
@@ -167,7 +167,7 @@ class FiFoFileStack extends BaseFileStack implements StackableFile, Calculatable
         * @return      $status                 Status of this operation
         * @throws      OutOfBoundsException    If the position is not seekable
         */
-       public function seek (int $seekPosition, int $whence = SEEK_SET) {
+       public function seek (int $seekPosition, int $whence = SEEK_SET): int {
                // Validate parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FIFO-FILE-STACK: seekPosition=%d,whence=%d - CALLED!', $seekPosition, $whence));
                if ($seekPosition < 0) {
index 026b8d24f93831a56c4094d5905334a8ad465ac1..eb829dff8810d1cc1c4ac31a4b8b9486bd504de7 100644 (file)
@@ -33,6 +33,6 @@ interface CalculatableBlock extends Block {
         *
         * @return      $length         Minimum length for one entry/block
         */
-       function calculateMinimumBlockLength ();
+       function calculateMinimumBlockLength (): int;
 
 }
index d9525855bda57eeaa68ae52bd7dd2f91f021a3a7..e0b7c0de871dd4c7b3606110ee6aae18b07e344a 100644 (file)
@@ -35,6 +35,6 @@ interface Debugger extends FrameworkInterface {
         * @param       $stripTags      Whether HTML tags shall be stripped out
         * @return      void
         */
-       function outputStream (string $output, bool $stripTags = false);
+       function outputStream (string $output, bool $stripTags = false): void;
 
 }
index 50f9f932af408682a43aa0cf9166237070475b51..cb16ef60742eaee6b0097cfc01eec9398319b5fa 100644 (file)
@@ -34,5 +34,5 @@ interface Executor extends FrameworkInterface {
         *
         * @return      void
         */
-       function initExecutor (Stateable $stateInstance);
+       function initExecutor (Stateable $stateInstance): void;
 }
index e84bd183eb0edff4c926bff60491244b272de81f..dbdf2713e758d5e8c2929688d3be7fa63fe83112 100644 (file)
@@ -104,28 +104,28 @@ interface BinaryFile extends Filesystem {
         *
         * @return      void
         */
-       function readFileHeader ();
+       function readFileHeader (): void;
 
        /**
         * Flushes the file header
         *
         * @return      void
         */
-       function flushFileHeader ();
+       function flushFileHeader (): void;
 
        /**
         * Determines whether the EOF has been reached
         *
         * @return      $isEndOfFileReached             Whether the EOF has been reached
         */
-       function isEndOfFileReached ();
+       function isEndOfFileReached (): bool;
 
        /**
         * Getter for header size
         *
         * @return      $totalEntries   Size of file header
         */
-       function getHeaderSize ();
+       function getHeaderSize (): int;
 
        /**
         * Setter for header size
@@ -133,14 +133,14 @@ interface BinaryFile extends Filesystem {
         * @param       $headerSize             Size of file header
         * @return      void
         */
-       function setHeaderSize (int $headerSize);
+       function setHeaderSize (int $headerSize): void;
 
        /**
         * Getter for header array
         *
-        * @return      $totalEntries   Size of file header
+        * @return      $header         An array with all headers
         */
-       function getHeader ();
+       function getHeader (): array;
 
        /**
         * Setter for header
@@ -148,7 +148,7 @@ interface BinaryFile extends Filesystem {
         * @param       $header         Array for a file header
         * @return      void
         */
-       function setHeader (array $header);
+       function setHeader (array $header): void;
 
        /**
         * Initializes counter for valid entries, arrays for damaged entries and
@@ -158,28 +158,28 @@ interface BinaryFile extends Filesystem {
         *
         * @return      void
         */
-       function initCountersGapsArray ();
+       function initCountersGapsArray (): void;
 
        /**
         * Updates seekPosition attribute from file to avoid to much access on file.
         *
         * @return      void
         */
-       function updateSeekPosition ();
+       function updateSeekPosition (): void;
 
        /**
         * Getter for total entries
         *
         * @return      $totalEntries   Total entries in this file
         */
-       function getCounter ();
+       function getCounter (): int;
 
        /**
         * "Getter" for file size
         *
         * @return      $fileSize       Size of currently loaded file
         */
-       function getFileSize ();
+       function getFileSize (): int;
 
        /**
         * Checks whether the abstracted file only contains gaps by counting all
@@ -187,7 +187,7 @@ interface BinaryFile extends Filesystem {
         *
         * @return      $isGapsOnly             Whether the abstracted file only contains gaps
         */
-       function isFileGapsOnly();
+       function isFileGapsOnly(): bool;
 
        /**
         * Searches for next suitable gap the given length of data can fit in
@@ -196,7 +196,7 @@ interface BinaryFile extends Filesystem {
         * @param       $length                 Length of raw data
         * @return      $seekPosition   Found next gap's seek position
         */
-       function searchNextGap (int $length);
+       function searchNextGap (int $length): int;
 
        /**
         * Writes given value to the file and returns a hash and gap position for it
@@ -205,7 +205,7 @@ interface BinaryFile extends Filesystem {
         * @param       $value          Value to be added to the stack
         * @return      $data           Hash and gap position
         */
-       function writeValueToFile (string $groupId, string $rawData);
+       function writeValueToFile (string $groupId, string $rawData): array;
 
        /**
         * Writes given raw data to the file and returns a gap position and length
@@ -215,7 +215,7 @@ interface BinaryFile extends Filesystem {
         * @param       $encoded        Encoded value to be written to the file
         * @return      $data           Gap position and length of the raw data
         */
-       function writeDataToFreeGap (string $groupId, string $hash, string $encoded);
+       function writeDataToFreeGap (string $groupId, string $hash, string $encoded): array;
 
        /**
         * Writes data at given position
@@ -225,7 +225,7 @@ interface BinaryFile extends Filesystem {
         * @param       $flushHeader    Whether to flush the header (default: flush)
         * @return      void
         */
-       function writeData (int $seekPosition, string $data, bool $flushHeader = true);
+       function writeData (int $seekPosition, string $data, bool $flushHeader = true): void;
 
        /**
         * Writes at given position by seeking to it.
@@ -235,6 +235,6 @@ interface BinaryFile extends Filesystem {
         * @return      mixed                   Number of writes bytes or false on error
         * @throws      InvalidArgumentException        If a parameter is not valid
         */
-       function writeAtPosition (int $seekPosition, string $dataStream);
+       function writeAtPosition (int $seekPosition, string $dataStream): mixed;
 
 }
index 5d2f2e7923cfcfb03fb2ad17d63306fba2e3e3b2..b499371482ea03e4af328709082e17e7216dc9f7 100644 (file)
@@ -5,6 +5,9 @@ namespace Org\Mxchange\CoreFramework\Filesystem;
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
 
+// Import SPL stuff
+use \SplFileObject;
+
 /**
  * An interface for file pointers
  *
@@ -33,13 +36,13 @@ interface FilePointer extends FrameworkInterface {
         *
         * @return      $fileObject             An instance of a SplFileObject class
         */
-       function getFileObject ();
+       function getFileObject (): SplFileObject;
 
        /**
         * Determines whether the EOF has been reached
         *
         * @return      $isEndOfFileReached             Whether the EOF has been reached
         */
-       function isEndOfFileReached ();
+       function isEndOfFileReached (): bool;
 
 }
index f38f6400515f0265db5158a16dfe1e07642caa08..b372335141245c041a37e910ae6b95eabd83752c 100644 (file)
@@ -43,7 +43,7 @@ interface StreamableInput extends Streamable {
         * @return      void
         * @throws      OutOfBoundsException    If the position is not seekable
         */
-       function seek (int $offset, int $whence = SEEK_SET);
+       function seek (int $offset, int $whence = SEEK_SET): int;
 
        /**
         * Size of file stack
index 2a08b75efca8db06042b913eaf488103916ab640..d9fd994b50bf0f8c3b2c4a044e2e712c918182ee 100644 (file)
@@ -54,14 +54,14 @@ interface StackableFile extends Stackable {
         * @param       $seekPosition   Seek position in file
         * @return      $status                 Status of this operation
         */
-       function seek (int $seekPosition);
+       function seek (int $seekPosition): int;
 
        /**
         * Size of file stack
         *
         * @return      $size   Size (in bytes) of file
         */
-       function size ();
+       function size (): int;
 
        /**
         * Reads the stack's file header
@@ -71,14 +71,14 @@ interface StackableFile extends Stackable {
         * @throws      UnexpectedValueException        If header is not proper length
         * @throws      InvalidMagicException   If a bad magic was found
         */
-       function readStackHeader ();
+       function readStackHeader (): void;
 
        /**
         * Flushes the file header
         *
         * @return      void
         */
-       function flushFileHeader ();
+       function flushFileHeader (): void;
 
        /**
         * Determines whether the EOF has been reached
@@ -86,14 +86,14 @@ interface StackableFile extends Stackable {
         * @return      $isEndOfFileReached             Whether the EOF has been reached
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       function isEndOfFileReached ();
+       function isEndOfFileReached (): bool;
 
        /**
         * Calculates minimum length for one entry/block
         *
         * @return      $length         Minimum length for one entry/block
         */
-       function calculateMinimumBlockLength ();
+       function calculateMinimumBlockLength (): int;
 
        /**
         * Initializes counter for valid entries, arrays for damaged entries and
@@ -104,7 +104,7 @@ interface StackableFile extends Stackable {
         * @return      void
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       function initCountersGapsArray ();
+       function initCountersGapsArray (): void;
 
        /**
         * Getter for header size
@@ -112,7 +112,7 @@ interface StackableFile extends Stackable {
         * @return      $totalEntries   Size of file header
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       function getHeaderSize ();
+       function getHeaderSize (): int;
 
        /**
         * Setter for header size
@@ -121,15 +121,15 @@ interface StackableFile extends Stackable {
         * @return      void
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       function setHeaderSize (int $headerSize);
+       function setHeaderSize (int $headerSize): void;
 
        /**
         * Getter for header array
         *
-        * @return      $totalEntries   Size of file header
+        * @return      $header         Array with header lines
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       function getHeader ();
+       function getHeader (): array;
 
        /**
         * Setter for header
@@ -138,7 +138,7 @@ interface StackableFile extends Stackable {
         * @return      void
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       function setHeader (array $header);
+       function setHeader (array $header): void;
 
        /**
         * Updates seekPosition attribute from file to avoid to much access on file.
@@ -146,7 +146,7 @@ interface StackableFile extends Stackable {
         * @return      void
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       function updateSeekPosition ();
+       function updateSeekPosition (): void;
 
        /**
         * Getter for total entries
@@ -154,7 +154,7 @@ interface StackableFile extends Stackable {
         * @return      $totalEntries   Total entries in this file
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       function getCounter ();
+       function getCounter (): int;
 
        /**
         * Writes data at given position
@@ -165,7 +165,7 @@ interface StackableFile extends Stackable {
         * @return      void
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       function writeData (int $seekPosition, string $data, bool $flushHeader = true);
+       function writeData (int $seekPosition, string $data, bool $flushHeader = true): void;
 
        /**
         * Writes at given position by seeking to it.
@@ -175,7 +175,7 @@ interface StackableFile extends Stackable {
         * @return      mixed                   Number of writes bytes or false on error
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       function writeAtPosition (int $seekPosition, string $dataStream);
+       function writeAtPosition (int $seekPosition, string $dataStream): mixed;
 
        /**
         * Writes given value to the file and returns a hash and gap position for it
@@ -185,7 +185,7 @@ interface StackableFile extends Stackable {
         * @return      $data           Hash and gap position
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       function writeValueToFile (string $groupId, $value);
+       function writeValueToFile (string $groupId, mixed $value): array;
 
        /**
         * Searches for next suitable gap the given length of data can fit in
@@ -195,14 +195,14 @@ interface StackableFile extends Stackable {
         * @return      $seekPosition   Found next gap's seek position
         * @throws      UnsupportedOperationException   This method is not (and maybe never will be) supported
         */
-       function searchNextGap (int $length);
+       function searchNextGap (int $length): int;
 
        /**
         * "Getter" for file size
         *
         * @return      $fileSize       Size of currently loaded file
         */
-       function getFileSize ();
+       function getFileSize (): int;
 
        /**
         * Writes given raw data to the file and returns a gap position and length
@@ -212,6 +212,6 @@ interface StackableFile extends Stackable {
         * @param       $encoded        Encoded value to be written to the file
         * @return      $data           Gap position and length of the raw data
         */
-       function writeDataToFreeGap (string $groupId, string $hash, string $encoded);
+       function writeDataToFreeGap (string $groupId, string $hash, string $encoded): array;
 
 }
index 723308a5d03e7de60420d6914e700f7279e91cf0..2c62addadb00c618e055b52016bc7dcd81fabf9c 100644 (file)
@@ -184,7 +184,7 @@ class FileIoHandler extends BaseMiddleware implements IoHandler {
         * @return      void
         * @throws      InvalidArgumentException        If a parameter has an invalid value
         */
-       public function seek (int $offset, int $whence = SEEK_SET) {
+       public function seek (int $offset, int $whence = SEEK_SET): int {
                // Check parameter
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-IO-HANDLER: offset=%d,whence=%d - CALLED!', $offset, $whence));
                if ($offset < 0) {
index b411484ad082015c42f0eb118e0c2a68dd4abb4e..d41b0f83005f3ce4b426d133a19872343f180dc9 100644 (file)
@@ -49,7 +49,7 @@ trait RandomNumberGeneratorTrait {
         *
         * @return      $rngInstance    An instance of a random number generator (RNG)
         */
-       public final function getRngInstance () {
+       public final function getRngInstance (): RandomNumberGenerator {
                return $this->rngInstance;
        }
 
index 7afeec83de0e8bf117d26d4a451e52fb40dcce89..9d1318a0e9bc5cea0f6e082dd52f1c5f398e99a6 100644 (file)
@@ -39,7 +39,7 @@ trait CompileableTemplateTrait {
         * @param       $templateInstance       An instance of a CompileableTemplate class
         * @return      void
         */
-       public final function setTemplateInstance (CompileableTemplate $templateInstance) {
+       public final function setTemplateInstance (CompileableTemplate $templateInstance): void {
                $this->templateInstance = $templateInstance;
        }
 
index f38d58503f9ca79230eebfbedd791e2ea858fa2e..339579fe392a59b98683c8fcc0b51618e90a225b 100644 (file)
@@ -39,7 +39,7 @@ trait VisitorTrait {
         * @param       $visitorInstance        An instance of a Visitor class
         * @return      void
         */
-       protected final function setVisitorInstance (Visitor $visitorInstance) {
+       protected final function setVisitorInstance (Visitor $visitorInstance): void {
                $this->visitorInstance = $visitorInstance;
        }