From: Roland Häder Date: Thu, 21 Aug 2025 21:04:12 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ab7e3911daa771001b093bb2881d154e1d7b50c6;p=core.git Continued: - added more type-hints --- diff --git a/framework/main/classes/database/result/class_CachedDatabaseResult.php b/framework/main/classes/database/result/class_CachedDatabaseResult.php index 4296044a..cbf5b515 100644 --- a/framework/main/classes/database/result/class_CachedDatabaseResult.php +++ b/framework/main/classes/database/result/class_CachedDatabaseResult.php @@ -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; } diff --git a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php index d7aa398b..dfcce1b7 100644 --- a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php +++ b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php @@ -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) { diff --git a/framework/main/classes/file_directories/binary/index/class_IndexFile.php b/framework/main/classes/file_directories/binary/index/class_IndexFile.php index 28ca8b1b..753521b6 100644 --- a/framework/main/classes/file_directories/binary/index/class_IndexFile.php +++ b/framework/main/classes/file_directories/binary/index/class_IndexFile.php @@ -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); } diff --git a/framework/main/classes/file_directories/binary/stack/class_StackFile.php b/framework/main/classes/file_directories/binary/stack/class_StackFile.php index 4f3c5b5e..b2824927 100644 --- a/framework/main/classes/file_directories/binary/stack/class_StackFile.php +++ b/framework/main/classes/file_directories/binary/stack/class_StackFile.php @@ -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); } diff --git a/framework/main/classes/file_directories/class_BaseAbstractFile.php b/framework/main/classes/file_directories/class_BaseAbstractFile.php index 2e0aefe4..51aeaaec 100644 --- a/framework/main/classes/file_directories/class_BaseAbstractFile.php +++ b/framework/main/classes/file_directories/class_BaseAbstractFile.php @@ -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(); diff --git a/framework/main/classes/file_directories/class_BaseFileIo.php b/framework/main/classes/file_directories/class_BaseFileIo.php index d093dda0..35ad9405 100644 --- a/framework/main/classes/file_directories/class_BaseFileIo.php +++ b/framework/main/classes/file_directories/class_BaseFileIo.php @@ -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(); diff --git a/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php b/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php index 88972151..b3b4e56e 100644 --- a/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php +++ b/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php @@ -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) { diff --git a/framework/main/classes/file_directories/io_stream/class_FileIoStream.php b/framework/main/classes/file_directories/io_stream/class_FileIoStream.php index 9a82005c..b47eb023 100644 --- a/framework/main/classes/file_directories/io_stream/class_FileIoStream.php +++ b/framework/main/classes/file_directories/io_stream/class_FileIoStream.php @@ -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(); diff --git a/framework/main/classes/file_directories/text/class_BaseTextFile.php b/framework/main/classes/file_directories/text/class_BaseTextFile.php index 341f453d..bfb00fb0 100644 --- a/framework/main/classes/file_directories/text/class_BaseTextFile.php +++ b/framework/main/classes/file_directories/text/class_BaseTextFile.php @@ -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. diff --git a/framework/main/classes/iterator/file/class_FileIterator.php b/framework/main/classes/iterator/file/class_FileIterator.php index 305f7c59..759e6ed1 100644 --- a/framework/main/classes/iterator/file/class_FileIterator.php +++ b/framework/main/classes/iterator/file/class_FileIterator.php @@ -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); } } diff --git a/framework/main/classes/output/class_ b/framework/main/classes/output/class_ index 84b7d53d..9d6a07e2 100644 --- a/framework/main/classes/output/class_ +++ b/framework/main/classes/output/class_ @@ -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); } diff --git a/framework/main/classes/output/debug/console/class_DebugConsoleOutput.php b/framework/main/classes/output/debug/console/class_DebugConsoleOutput.php index 140365da..5e033047 100644 --- a/framework/main/classes/output/debug/console/class_DebugConsoleOutput.php +++ b/framework/main/classes/output/debug/console/class_DebugConsoleOutput.php @@ -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); diff --git a/framework/main/classes/output/debug/error/class_DebugErrorLogOutput.php b/framework/main/classes/output/debug/error/class_DebugErrorLogOutput.php index 29982412..01e1372b 100644 --- a/framework/main/classes/output/debug/error/class_DebugErrorLogOutput.php +++ b/framework/main/classes/output/debug/error/class_DebugErrorLogOutput.php @@ -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); diff --git a/framework/main/classes/output/debug/web/class_DebugWebOutput.php b/framework/main/classes/output/debug/web/class_DebugWebOutput.php index 4617d45f..b1caa5b3 100644 --- a/framework/main/classes/output/debug/web/class_DebugWebOutput.php +++ b/framework/main/classes/output/debug/web/class_DebugWebOutput.php @@ -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
$output = str_replace('
', '', $output); printf('' . 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); diff --git a/framework/main/classes/points/class_UserPoints.php b/framework/main/classes/points/class_UserPoints.php index 8f451ce3..d11ae223 100644 --- a/framework/main/classes/points/class_UserPoints.php +++ b/framework/main/classes/points/class_UserPoints.php @@ -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()); diff --git a/framework/main/classes/reader/class_ConsoleNewsReader.php b/framework/main/classes/reader/class_ConsoleNewsReader.php index 8c395272..4d28de44 100644 --- a/framework/main/classes/reader/class_ConsoleNewsReader.php +++ b/framework/main/classes/reader/class_ConsoleNewsReader.php @@ -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'); diff --git a/framework/main/classes/reader/class_DefaultNewsReader.php b/framework/main/classes/reader/class_DefaultNewsReader.php index 2ef04379..f73ea020 100644 --- a/framework/main/classes/reader/class_DefaultNewsReader.php +++ b/framework/main/classes/reader/class_DefaultNewsReader.php @@ -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'); diff --git a/framework/main/classes/registry/class_ b/framework/main/classes/registry/class_ index a4ffbcbc..32a74c1a 100644 --- a/framework/main/classes/registry/class_ +++ b/framework/main/classes/registry/class_ @@ -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 diff --git a/framework/main/classes/registry/class_BaseRegistry.php b/framework/main/classes/registry/class_BaseRegistry.php index 3757c282..b09f2e4e 100644 --- a/framework/main/classes/registry/class_BaseRegistry.php +++ b/framework/main/classes/registry/class_BaseRegistry.php @@ -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)) { diff --git a/framework/main/classes/registry/format_upgrade/database/class_ b/framework/main/classes/registry/format_upgrade/database/class_ index d5f96b20..11b62f88 100644 --- a/framework/main/classes/registry/format_upgrade/database/class_ +++ b/framework/main/classes/registry/format_upgrade/database/class_ @@ -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 diff --git a/framework/main/classes/registry/format_upgrade/database/class_LocalFileDatabaseFormatUpgradeRegistry.php b/framework/main/classes/registry/format_upgrade/database/class_LocalFileDatabaseFormatUpgradeRegistry.php index c40b19a8..f8b9e1ea 100644 --- a/framework/main/classes/registry/format_upgrade/database/class_LocalFileDatabaseFormatUpgradeRegistry.php +++ b/framework/main/classes/registry/format_upgrade/database/class_LocalFileDatabaseFormatUpgradeRegistry.php @@ -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 diff --git a/framework/main/classes/registry/generic/class_GenericRegistry.php b/framework/main/classes/registry/generic/class_GenericRegistry.php index f5ce8237..7016bd9c 100644 --- a/framework/main/classes/registry/generic/class_GenericRegistry.php +++ b/framework/main/classes/registry/generic/class_GenericRegistry.php @@ -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)) { diff --git a/framework/main/classes/registry/object/class_ObjectRegistry.php b/framework/main/classes/registry/object/class_ObjectRegistry.php index 0d01db6d..3b90ee42 100644 --- a/framework/main/classes/registry/object/class_ObjectRegistry.php +++ b/framework/main/classes/registry/object/class_ObjectRegistry.php @@ -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)) { diff --git a/framework/main/classes/registry/sub/class_SubRegistry.php b/framework/main/classes/registry/sub/class_SubRegistry.php index fbdd82ef..d88af242 100644 --- a/framework/main/classes/registry/sub/class_SubRegistry.php +++ b/framework/main/classes/registry/sub/class_SubRegistry.php @@ -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(); diff --git a/framework/main/classes/stacker/file/class_ b/framework/main/classes/stacker/file/class_ index 091d7526..8dfe6ab9 100644 --- a/framework/main/classes/stacker/file/class_ +++ b/framework/main/classes/stacker/file/class_ @@ -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); } diff --git a/framework/main/classes/stacker/file/class_BaseFileStack.php b/framework/main/classes/stacker/file/class_BaseFileStack.php index 303caca7..17af2c39 100644 --- a/framework/main/classes/stacker/file/class_BaseFileStack.php +++ b/framework/main/classes/stacker/file/class_BaseFileStack.php @@ -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)) { diff --git a/framework/main/classes/stacker/file/fifo/class_FiFoFileStack.php b/framework/main/classes/stacker/file/fifo/class_FiFoFileStack.php index 3c291361..48127452 100644 --- a/framework/main/classes/stacker/file/fifo/class_FiFoFileStack.php +++ b/framework/main/classes/stacker/file/fifo/class_FiFoFileStack.php @@ -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) { diff --git a/framework/main/interfaces/block/calculatable/class_CalculatableBlock.php b/framework/main/interfaces/block/calculatable/class_CalculatableBlock.php index 026b8d24..eb829dff 100644 --- a/framework/main/interfaces/block/calculatable/class_CalculatableBlock.php +++ b/framework/main/interfaces/block/calculatable/class_CalculatableBlock.php @@ -33,6 +33,6 @@ interface CalculatableBlock extends Block { * * @return $length Minimum length for one entry/block */ - function calculateMinimumBlockLength (); + function calculateMinimumBlockLength (): int; } diff --git a/framework/main/interfaces/debug/class_Debugger.php b/framework/main/interfaces/debug/class_Debugger.php index d9525855..e0b7c0de 100644 --- a/framework/main/interfaces/debug/class_Debugger.php +++ b/framework/main/interfaces/debug/class_Debugger.php @@ -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; } diff --git a/framework/main/interfaces/executor/class_Executor.php b/framework/main/interfaces/executor/class_Executor.php index 50f9f932..cb16ef60 100644 --- a/framework/main/interfaces/executor/class_Executor.php +++ b/framework/main/interfaces/executor/class_Executor.php @@ -34,5 +34,5 @@ interface Executor extends FrameworkInterface { * * @return void */ - function initExecutor (Stateable $stateInstance); + function initExecutor (Stateable $stateInstance): void; } diff --git a/framework/main/interfaces/filesystem/binary/class_BinaryFile.php b/framework/main/interfaces/filesystem/binary/class_BinaryFile.php index e84bd183..dbdf2713 100644 --- a/framework/main/interfaces/filesystem/binary/class_BinaryFile.php +++ b/framework/main/interfaces/filesystem/binary/class_BinaryFile.php @@ -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; } diff --git a/framework/main/interfaces/io/class_FilePointer.php b/framework/main/interfaces/io/class_FilePointer.php index 5d2f2e79..b4993714 100644 --- a/framework/main/interfaces/io/class_FilePointer.php +++ b/framework/main/interfaces/io/class_FilePointer.php @@ -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; } diff --git a/framework/main/interfaces/io/class_StreamableInput.php b/framework/main/interfaces/io/class_StreamableInput.php index f38f6400..b3723351 100644 --- a/framework/main/interfaces/io/class_StreamableInput.php +++ b/framework/main/interfaces/io/class_StreamableInput.php @@ -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 diff --git a/framework/main/interfaces/stacker/file/class_StackableFile.php b/framework/main/interfaces/stacker/file/class_StackableFile.php index 2a08b75e..d9fd994b 100644 --- a/framework/main/interfaces/stacker/file/class_StackableFile.php +++ b/framework/main/interfaces/stacker/file/class_StackableFile.php @@ -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; } diff --git a/framework/main/middleware/io/class_FileIoHandler.php b/framework/main/middleware/io/class_FileIoHandler.php index 723308a5..2c62adda 100644 --- a/framework/main/middleware/io/class_FileIoHandler.php +++ b/framework/main/middleware/io/class_FileIoHandler.php @@ -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) { diff --git a/framework/main/traits/crypto/rng/class_RandomNumberGeneratorTrait.php b/framework/main/traits/crypto/rng/class_RandomNumberGeneratorTrait.php index b411484a..d41b0f83 100644 --- a/framework/main/traits/crypto/rng/class_RandomNumberGeneratorTrait.php +++ b/framework/main/traits/crypto/rng/class_RandomNumberGeneratorTrait.php @@ -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; } diff --git a/framework/main/traits/template/class_CompileableTemplateTrait.php b/framework/main/traits/template/class_CompileableTemplateTrait.php index 7afeec83..9d1318a0 100644 --- a/framework/main/traits/template/class_CompileableTemplateTrait.php +++ b/framework/main/traits/template/class_CompileableTemplateTrait.php @@ -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; } diff --git a/framework/main/traits/visitor/class_VisitorTrait.php b/framework/main/traits/visitor/class_VisitorTrait.php index f38d5850..339579fe 100644 --- a/framework/main/traits/visitor/class_VisitorTrait.php +++ b/framework/main/traits/visitor/class_VisitorTrait.php @@ -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; }