From: Roland Häder Date: Thu, 21 Aug 2025 22:22:20 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b8cae20b349dee78d98a18697b585a9a6266ea80;p=core.git Continued: - yet even more type-hints ... --- diff --git a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php index dfcce1b7..f38b417d 100644 --- a/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php +++ b/framework/main/classes/file_directories/binary/class_BaseBinaryFile.php @@ -664,7 +664,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile { * @return $status Status of file seek: 0 = success, -1 = failed * @throws OutOfBoundsException If the position is not seekable */ - 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-BINARY-FILE: offset=%d,whence=%d - CALLED!', $offset, $whence)); if ($offset < 0) { @@ -687,7 +687,7 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile { * @return $data Data read from file * @throws OutOfBoundsException If the position is not seekable */ - public function read (int $bytes = 0) { + public function read (int $bytes = 0): string { // Validate parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: bytes=%d - CALLED!', $bytes)); if ($bytes < 0) { @@ -921,7 +921,8 @@ abstract class BaseBinaryFile extends BaseAbstractFile implements BinaryFile { // Now simply write a NUL there. This will pre-allocate the file. //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-BINARY-FILE: Invoking this->writeAtPosition(%d,NUL) ...', $seekPosition)); - $this->writeAtPosition($seekPosition, chr(0)); + $status = $this->writeAtPosition($seekPosition, chr(0)); + // @TODO Handle $status properly // Is the seek position zero? //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-BINARY-FILE: fileSize=%d', $fileSize)); diff --git a/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php b/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php index 734b97b7..edbf2ffc 100644 --- a/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php +++ b/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php @@ -141,7 +141,7 @@ class FrameworkRawFileInputPointer extends BaseFileIo implements InputPointer { * @throws InvalidArgumentException If a parameter is not valid * @throws UnexpectedValueException If fread() returns a non-string value */ - public function read (int $bytes = 0) { + public function read (int $bytes = 0): string { // Trace message /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('RAW-FILE-INPUT-POINTER: bytes=%d - CALLED!', $bytes)); if ($bytes < 0) { diff --git a/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php b/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php index 31182978..acfd75ad 100644 --- a/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php +++ b/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php @@ -126,7 +126,7 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer { * @throws NullPointerException If the file pointer instance is not set by setFileObject() * @throws LogicException If $fileObject is not an object */ - public function read (int $bytes = 0) { + public function read (int $bytes = 0): string { // Some sanity checks /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('RAW-FILE-INPUT-POINTER: bytes=%d - CALLED!', $bytes)); if ($bytes < 0) { diff --git a/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php b/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php index b3b4e56e..02fa81a0 100644 --- a/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php +++ b/framework/main/classes/file_directories/io/class_FrameworkFileInputOutputPointer.php @@ -239,7 +239,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP * @return $data Data read from file * @throws OutOfBoundsException If the position is not seekable */ - public function read (int $bytes = 0) { + public function read (int $bytes = 0): string { // Validatre parameter /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-INPUT-OUTPUT-POINTER: bytes=%d - CALLED!', $bytes)); if ($bytes < 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 b47eb023..34d16faf 100644 --- a/framework/main/classes/file_directories/io_stream/class_FileIoStream.php +++ b/framework/main/classes/file_directories/io_stream/class_FileIoStream.php @@ -317,7 +317,7 @@ class FileIoStream extends BaseFrameworkSystem implements FileInputStreamer, Fil * @return $data The data (string mostly) to "stream" * @throws UnsupportedOperationException If this method is called */ - public function streamData (string $data) { + public function streamData (string $data): string { // Not supported /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-IO-STREAM: data=()=%d - CALLED!', strlen($data))); throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); diff --git a/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php b/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php index 25634755..6517c55c 100644 --- a/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php +++ b/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php @@ -137,7 +137,7 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer * @return mixed Number of writes bytes or false on error * @throws UnsupportedOperationException If this method is called */ - public function writeAtPosition (int $seedPosition, string $data): void { + public function writeAtPosition (int $seedPosition, string $data): mixed { throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php b/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php index fa968671..754b5ed2 100644 --- a/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php +++ b/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php @@ -133,7 +133,7 @@ class FrameworkTextFileOutputPointer extends BaseFileIo implements OutputPointer * @return mixed Number of writes bytes or false on error * @throws UnsupportedOperationException If this method is called */ - public function writeAtPosition (int $seedPosition, string $data) { + public function writeAtPosition (int $seedPosition, string $data): mixed { throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/framework/main/classes/handler/class_BaseHandler.php b/framework/main/classes/handler/class_BaseHandler.php index ef63de38..3dd8a67d 100644 --- a/framework/main/classes/handler/class_BaseHandler.php +++ b/framework/main/classes/handler/class_BaseHandler.php @@ -59,7 +59,7 @@ abstract class BaseHandler extends BaseFrameworkSystem implements HandleableData * * @return $handlerName Name of this handler */ - public final function getHandlerName () { + public final function getHandlerName (): string { return $this->handlerName; } @@ -69,7 +69,7 @@ abstract class BaseHandler extends BaseFrameworkSystem implements HandleableData * @param $handlerName Name of this handler * @return void */ - protected final function setHandlerName (string $handlerName) { + protected final function setHandlerName (string $handlerName): void { $this->handlerName = $handlerName; } @@ -81,7 +81,7 @@ abstract class BaseHandler extends BaseFrameworkSystem implements HandleableData * @return void * @todo Rewrite this to use DHT */ - public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData) { + public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-HANDLER: dataSetInstance=%s,messageData()=%d - CALLED!', $dataSetInstance->__toString(), count($messageData))); if (count($messageData) == 0) { diff --git a/framework/main/classes/index/file/class_BaseFileIndex.php b/framework/main/classes/index/file/class_BaseFileIndex.php index 126a93f3..f332c3bf 100644 --- a/framework/main/classes/index/file/class_BaseFileIndex.php +++ b/framework/main/classes/index/file/class_BaseFileIndex.php @@ -287,7 +287,7 @@ abstract class BaseFileIndex extends BaseIndex implements FileIndexer { * @throws InvalidArgumentException If the parameter is not valid * @todo Unfinished work */ - public function searchNextGap (int $length) { + public function searchNextGap (int $length): int { // Validate parameter /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FILE-INDEX: length=%d - CALLED!', $length)); if ($length <= 0) { @@ -308,7 +308,7 @@ abstract class BaseFileIndex extends BaseIndex implements FileIndexer { * @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-FILE-INDEX: seekPosition=%d,dataStream(%d)=%s - CALLED!', $seekPosition, strlen($dataStream), $dataStream)); if ($seekPosition < 0) { @@ -333,7 +333,7 @@ abstract class BaseFileIndex extends BaseIndex implements FileIndexer { * * @return $isLoaded Whether this index has been loaded */ - public function isIndexLoaded () { + public function isIndexLoaded (): bool { // Is the file gaps-only? /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-INDEX: CALLED!'); if ($this->getIteratorInstance()->getBinaryFileInstance()->isFileGapsOnly()) { diff --git a/framework/main/classes/index/file/stack/class_FileStackIndex.php b/framework/main/classes/index/file/stack/class_FileStackIndex.php index ea8ef7ca..7e538626 100644 --- a/framework/main/classes/index/file/stack/class_FileStackIndex.php +++ b/framework/main/classes/index/file/stack/class_FileStackIndex.php @@ -54,7 +54,7 @@ class FileStackIndex extends BaseFileIndex implements IndexableStack, Registerab * @param $fileInfoInstance An instance of a SplFileInfo class * @return $indexInstance An instance of this Index class */ - public final static function createFileStackIndex (SplFileInfo $fileInfoInstance) { + public final static function createFileStackIndex (SplFileInfo $fileInfoInstance): IndexableStack { // Get a new instance /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: fileInfoInstance[%s]=%s - CALLED!', get_class($fileInfoInstance), $fileInfoInstance)); $indexInstance = new FileStackIndex(); @@ -76,7 +76,7 @@ class FileStackIndex extends BaseFileIndex implements IndexableStack, Registerab * @throws InvalidArgumentException If a parameter is not valid * @throws UnexpectedValueException If an invalid gap position is being returned */ - public function addHashedDataToIndex (string $stackName, array $data) { + public function addHashedDataToIndex (string $stackName, array $data): void { // Validate parameter /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('FILE-STACK-INDEX: stackName=%s,data()=%d - CALLED!', $stackName, count($data))); if (empty($stackName)) { diff --git a/framework/main/classes/iterator/file/class_FileIterator.php b/framework/main/classes/iterator/file/class_FileIterator.php index 759e6ed1..5915427c 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): seek { + public function seek (int $seekPosition): int { // Validate parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('FILE-ITERATOR: seekPosition=%d,whence=%d - CALLED!', $seekPosition, $whence)); if ($seekPosition < 0) { diff --git a/framework/main/classes/output/class_ b/framework/main/classes/output/class_ index 9d6a07e2..1dfe1085 100644 --- a/framework/main/classes/output/class_ +++ b/framework/main/classes/output/class_ @@ -51,11 +51,11 @@ class ???Output extends BaseOutput implements OutputStreamer, Registerable { * @param $applicationInstance An instance of a ManageableApplication class * @return $debugInstance An instance of this middleware class */ - public static final function createWebOutput (ManageableApplication $applicationInstance) { + public static final function create???Output (ManageableApplication $applicationInstance): OutputStreamer { // Is the self-instance already set? if (is_null(self::$!!!Instance)) { // Get a new instance and set it - self::$!!!Instance = new WebOutput(); + self::$!!!Instance = new ???Output(); // Get the content type $contentType = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('!!!_content_type'); @@ -79,7 +79,7 @@ class ???Output extends BaseOutput implements OutputStreamer, Registerable { * @return void * @todo 0% done */ - public final function output ($outStream = false, $stripTags = false) { + public final function output ($outStream = false, $stripTags = false): void { DebugMiddleware::getSelfInstance()->partialStub('Please implement this method. outStream()=' . strlen($outStream) . ',stripTags=' . intval($stripTags)); } @@ -89,7 +89,7 @@ class ???Output extends BaseOutput implements OutputStreamer, Registerable { * @return $seekPosition Current seek position * @throws UnsupportedOperationException If this method is called */ - public function determineSeekPosition () { + public function determineSeekPosition (): int { throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } @@ -112,7 +112,7 @@ class ???Output extends BaseOutput implements OutputStreamer, Registerable { * @return $size Size (in bytes) of file * @throws UnsupportedOperationException If this method is called */ - public function size () { + public function size (): int { throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/framework/main/classes/request/class_BaseRequest.php b/framework/main/classes/request/class_BaseRequest.php index 26b18d89..5c126958 100644 --- a/framework/main/classes/request/class_BaseRequest.php +++ b/framework/main/classes/request/class_BaseRequest.php @@ -56,7 +56,7 @@ abstract class BaseRequest extends BaseFrameworkSystem { * @param $element Name of the request element we want to check * @return $isSet Whether the request element is set */ - public function isRequestElementSet (string $element) { + public function isRequestElementSet (string $element): bool { // Is this element found? $isSet = isset($this->requestData[$element]); @@ -71,7 +71,7 @@ abstract class BaseRequest extends BaseFrameworkSystem { * @return $value Value of the found request element or 'null' if the * element was not found */ - public function getRequestElement (string $element) { + public function getRequestElement (string $element): mixed { // Initialize value $value = NULL; @@ -95,7 +95,7 @@ abstract class BaseRequest extends BaseFrameworkSystem { * @param $value Value to set * @return void */ - public function setRequestElement (string $element, $value) { + public function setRequestElement (string $element, mixed $value): void { $this->requestData[$element] = $value; } @@ -105,7 +105,7 @@ abstract class BaseRequest extends BaseFrameworkSystem { * @param $requestData Request element to se * @return void */ - public function setRequestData (array $requestData) { + public function setRequestData (array $requestData): void { $this->requestData = $requestData; } @@ -114,7 +114,7 @@ abstract class BaseRequest extends BaseFrameworkSystem { * * @return $array An array containing all array keys to return */ - public function getParameterNames () { + public function getParameterNames (): array { return array_keys($this->requestData); } @@ -124,7 +124,7 @@ abstract class BaseRequest extends BaseFrameworkSystem { * @param $isValid Whether the request is valid * @return void */ - public final function setIsRequestValid (bool $isValid) { + public final function setIsRequestValid (bool $isValid): void { $this->isRequestValid = $isValid; } @@ -133,7 +133,7 @@ abstract class BaseRequest extends BaseFrameworkSystem { * * @return $isRequestValid Whether this request is valid */ - public final function isRequestValid () { + public final function isRequestValid (): bool { return $this->isRequestValid; } diff --git a/framework/main/classes/stacker/file/class_BaseFileStack.php b/framework/main/classes/stacker/file/class_BaseFileStack.php index 17af2c39..1a34a2c6 100644 --- a/framework/main/classes/stacker/file/class_BaseFileStack.php +++ b/framework/main/classes/stacker/file/class_BaseFileStack.php @@ -208,7 +208,8 @@ abstract class BaseFileStack extends BaseStacker { // Write it to disk (header is always at seek position 0) /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Invoking this->iteratorInstance->writeAtPosition(0, header=%s) ...', $header)); - $this->getIteratorInstance()->getBinaryFileInstance()->writeAtPosition(0, $header); + $status = $this->getIteratorInstance()->getBinaryFileInstance()->writeAtPosition(0, $header); + // @TODO Handle $status // Trace message /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FILE-STACK: EXIT!'); diff --git a/framework/main/interfaces/handler/class_HandleableDataSet.php b/framework/main/interfaces/handler/class_HandleableDataSet.php index 42be03fb..237b2337 100644 --- a/framework/main/interfaces/handler/class_HandleableDataSet.php +++ b/framework/main/interfaces/handler/class_HandleableDataSet.php @@ -36,6 +36,13 @@ interface HandleableDataSet extends Handleable { * @param $messageData An array with all message data * @return void */ - function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData); + function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData): void; + + /** + * Getter for handler name + * + * @return<>$handlerNameName of this handler + */ + function getHandlerName (): string; } diff --git a/framework/main/interfaces/handler/task/class_HandleableTask.php b/framework/main/interfaces/handler/task/class_HandleableTask.php index c7ace208..1e7fa600 100644 --- a/framework/main/interfaces/handler/task/class_HandleableTask.php +++ b/framework/main/interfaces/handler/task/class_HandleableTask.php @@ -37,7 +37,7 @@ interface HandleableTask extends HandleableDataSet { * @param $taskInstanc An instanceof a Taskable class * @return $taskName Name of the task as used while registration */ - function searchTask (Taskable $taskInstance); + function searchTask (Taskable $taskInstance): string; /** * Registers a task with a task handler. @@ -46,7 +46,7 @@ interface HandleableTask extends HandleableDataSet { * @param $taskInstance An instance of a Taskable class * @return void */ - function registerTask (string $taskName, Taskable $taskInstance); + function registerTask (string $taskName, Taskable $taskInstance): void; /** * Checks whether tasks are left including idle task @@ -63,7 +63,7 @@ interface HandleableTask extends HandleableDataSet { * * @return void */ - function handleTasks (); + function handleTasks (): void; /** * Shuts down all tasks and the task handler itself. This method should be @@ -71,6 +71,6 @@ interface HandleableTask extends HandleableDataSet { * * @return void */ - function doShutdown (); + function doShutdown (): void; } diff --git a/framework/main/interfaces/index/class_Indexable.php b/framework/main/interfaces/index/class_Indexable.php index f5da8e4f..9e1724e5 100644 --- a/framework/main/interfaces/index/class_Indexable.php +++ b/framework/main/interfaces/index/class_Indexable.php @@ -53,6 +53,6 @@ interface Indexable extends FrameworkInterface { * * @return $isLoaded Whether the index has been loaded */ - function isIndexLoaded (); + function isIndexLoaded (): bool; } diff --git a/framework/main/interfaces/index/file/class_FileIndexer.php b/framework/main/interfaces/index/file/class_FileIndexer.php index e2d85910..1eae3bf7 100644 --- a/framework/main/interfaces/index/file/class_FileIndexer.php +++ b/framework/main/interfaces/index/file/class_FileIndexer.php @@ -36,7 +36,7 @@ interface FileIndexer extends Indexable { * @return void * @throws InvalidArgumentException If a parameter is not valid */ - function addHashedDataToIndex (string $stackName, array $data); + function addHashedDataToIndex (string $stackName, array $data): void; /** * Searches for next suitable gap the given length of data can fit in @@ -46,7 +46,7 @@ interface FileIndexer extends Indexable { * @return $seekPosition Found next gap's seek position * @throws InvalidArgumentException If the parameter is not valid */ - function searchNextGap (int $length); + function searchNextGap (int $length): int; /** * Writes at given position by seeking to it. @@ -56,6 +56,6 @@ interface FileIndexer extends Indexable { * @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_CloseableFile.php b/framework/main/interfaces/io/class_CloseableFile.php index dc98cb21..0732fd93 100644 --- a/framework/main/interfaces/io/class_CloseableFile.php +++ b/framework/main/interfaces/io/class_CloseableFile.php @@ -37,6 +37,6 @@ interface CloseableFile extends FrameworkInterface { * @throws NullPointerException If the file pointer instance is not set by setFileObject() * @throws InvalidResourceException If there is being set */ - function closeFile (); + function closeFile (): void; } diff --git a/framework/main/interfaces/io/class_StreamableInput.php b/framework/main/interfaces/io/class_StreamableInput.php index b3723351..7066ad3e 100644 --- a/framework/main/interfaces/io/class_StreamableInput.php +++ b/framework/main/interfaces/io/class_StreamableInput.php @@ -33,14 +33,14 @@ interface StreamableInput extends Streamable { * * @return $seekPosition Current seek position */ - function determineSeekPosition (); + function determineSeekPosition (): int; /** * Seek to given offset (default) or other possibilities as fseek() gives. * * @param $offset Offset to seek to (or used as "base" for other seeks) * @param $whence Added to offset (default: only use offset to seek to) - * @return void + * @return $position Position after seeking (?) * @throws OutOfBoundsException If the position is not seekable */ function seek (int $offset, int $whence = SEEK_SET): int; @@ -50,6 +50,6 @@ interface StreamableInput extends Streamable { * * @return $size Size (in bytes) of file */ - function size (); + function size (): int; } diff --git a/framework/main/interfaces/io/pointer/class_InputPointer.php b/framework/main/interfaces/io/pointer/class_InputPointer.php index d0e355d0..7b2f1514 100644 --- a/framework/main/interfaces/io/pointer/class_InputPointer.php +++ b/framework/main/interfaces/io/pointer/class_InputPointer.php @@ -52,6 +52,6 @@ interface InputPointer extends StreamableInput, FilePointer { * is not set by setFileObject() * @throws InvalidResourceException If there is being set */ - function read (int $bytes = 0); + function read (int $bytes = 0): string; } diff --git a/framework/main/interfaces/io/pointer/class_OutputPointer.php b/framework/main/interfaces/io/pointer/class_OutputPointer.php index 039d1757..5306c0e1 100644 --- a/framework/main/interfaces/io/pointer/class_OutputPointer.php +++ b/framework/main/interfaces/io/pointer/class_OutputPointer.php @@ -48,6 +48,6 @@ interface OutputPointer extends StreamableOutput, FilePointer { * @param $data Data to be written * @return mixed Number of writes bytes or false on error */ - function writeAtPosition (int $seedPosition, string $data); + function writeAtPosition (int $seedPosition, string $data): mixed; } diff --git a/framework/main/interfaces/reader/class_ReadableNews.php b/framework/main/interfaces/reader/class_ReadableNews.php index a0ec486c..27417838 100644 --- a/framework/main/interfaces/reader/class_ReadableNews.php +++ b/framework/main/interfaces/reader/class_ReadableNews.php @@ -33,6 +33,6 @@ interface ReadableNews extends FrameworkInterface { * * @return void */ - function initializeReader(); + function initializeReader(): void; } diff --git a/framework/main/interfaces/request/class_Requestable.php b/framework/main/interfaces/request/class_Requestable.php index 13b8c364..c3ae75fb 100644 --- a/framework/main/interfaces/request/class_Requestable.php +++ b/framework/main/interfaces/request/class_Requestable.php @@ -34,7 +34,7 @@ interface Requestable extends FrameworkInterface { * @param $element Name of the request element we want to check * @return $isSet Whether the request element is set */ - function isRequestElementSet (string $element); + function isRequestElementSet (string $element): bool; /** * Getter for request element or 'null' if element was not found @@ -43,7 +43,7 @@ interface Requestable extends FrameworkInterface { * @return $value Value of the found request element or 'null' if the * element was not found */ - function getRequestElement (string $element); + function getRequestElement (string $element): mixed; /** * Setter for request elements @@ -52,7 +52,7 @@ interface Requestable extends FrameworkInterface { * @param $value Value to set * @return void */ - function setRequestElement (string $element, $value); + function setRequestElement (string $element, mixed $value): void; /** * Setter for request data array @@ -60,14 +60,14 @@ interface Requestable extends FrameworkInterface { * @param $requestData Request element to se * @return void */ - function setRequestData (array $requestData); + function setRequestData (array $requestData): void; /** * Wrapper method for array_key() function for the request data array * * @return $array An array containing all array keys to return */ - function getParameterNames (); + function getParameterNames (): array; /** * Sets whether the request was valid @@ -75,13 +75,13 @@ interface Requestable extends FrameworkInterface { * @param $isValid Whether the request is valid * @return void */ - function setIsRequestValid (bool $isValid); + function setIsRequestValid (bool $isValid): void; /** * Returns whether this request is valid * * @return $isRequestValid Whether this request is valid */ - function isRequestValid (); + function isRequestValid (): bool; } diff --git a/framework/main/middleware/io/class_FileIoHandler.php b/framework/main/middleware/io/class_FileIoHandler.php index 2c62adda..24506c26 100644 --- a/framework/main/middleware/io/class_FileIoHandler.php +++ b/framework/main/middleware/io/class_FileIoHandler.php @@ -106,7 +106,7 @@ class FileIoHandler extends BaseMiddleware implements IoHandler { * @return void * @throws UnsupportedOperationException If this method is called */ - public function saveFile (SplFileInfo $infoInstance, array $dataArray) { + public function saveFile (SplFileInfo $infoInstance, array $dataArray): void { // Trace message for logging parameters /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-IO-HANDLER: infoInstance.pathname=%s,dataArray()=%d - CALLED!', $infoInstance->getPathname(), count($dataArray))); throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); @@ -155,7 +155,7 @@ class FileIoHandler extends BaseMiddleware implements IoHandler { * @param $infoInstance An instance of a SplFileInfo class * @return $array Array with the file contents */ - public function loadFileContents (SplFileInfo $infoInstance) { + public function loadFileContents (SplFileInfo $infoInstance): array { // Read from the input handler /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('FILE-IO-HANDLER: infoInstance=%s - CALLED!', $infoInstance->__toString())); return $this->getInputStreamerInstance()->loadFileContents($infoInstance); @@ -167,7 +167,7 @@ class FileIoHandler extends BaseMiddleware implements IoHandler { * @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-HANDLER: CALLED!'); DebugMiddleware::getSelfInstance()->partialStub(); @@ -205,7 +205,7 @@ class FileIoHandler extends BaseMiddleware implements IoHandler { * @return $size Size (in bytes) of file * @todo 0% done */ - public function size () { + public function size (): int { // @TODO: Unfinished method: /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-HANDLER: CALLED!'); DebugMiddleware::getSelfInstance()->partialStub(); @@ -220,7 +220,7 @@ class FileIoHandler extends BaseMiddleware implements IoHandler { * @return $seekPosition Current seek position * @todo 0% done */ - public function getPosition () { + public function getPosition (): int { // @TODO: Unfinished method: /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('FILE-IO-HANDLER: CALLED!'); DebugMiddleware::getSelfInstance()->partialStub();