From: Roland Häder Date: Sat, 1 Feb 2025 22:35:33 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5326549b9635ffbf369c29abbe7e3df31495beb2;p=core.git Continued: - added more returned scalar and object type-hints --- diff --git a/framework/main/classes/class_BaseFrameworkSystem.php b/framework/main/classes/class_BaseFrameworkSystem.php index 2200b370..3c826e9d 100644 --- a/framework/main/classes/class_BaseFrameworkSystem.php +++ b/framework/main/classes/class_BaseFrameworkSystem.php @@ -306,7 +306,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * * @return $realClass The name of the real class (not BaseFrameworkSystem) */ - public function __toString () { + public function __toString (): string { return $this->realClass; } @@ -317,7 +317,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $value Value to store * @return void */ - public final function __set (string $name, $value) { + public final function __set (string $name, mixed $value): void { $this->debugBackTrace(sprintf('Tried to set a missing field. name=%s, value[%s]=%s', $name, gettype($value), @@ -331,7 +331,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $name Name of the field/attribute * @return void */ - public final function __get (string $name) { + public final function __get (string $name): void { $this->debugBackTrace(sprintf('Tried to get a missing field. name=%s', $name )); @@ -343,7 +343,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $name Name of the field/attribute * @return void */ - public final function __unset (string $name) { + public final function __unset (string $name): void { $this->debugBackTrace(sprintf('Tried to unset a missing field. name=%s', $name )); @@ -385,7 +385,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $realClass Class name (string) * @return void */ - public final function setRealClass (string $realClass) { + public final function setRealClass (string $realClass): void { // Set real class $this->realClass = $realClass; } @@ -396,7 +396,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $debugInstance The instance for debug output class * @return void */ - public final function setDebugInstance (DebugMiddleware $debugInstance) { + public final function setDebugInstance (DebugMiddleware $debugInstance): void { self::$debugInstance = $debugInstance; } @@ -405,7 +405,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * * @return $debugInstance Instance to class DebugConsoleOutput or DebugWebOutput */ - public final function getDebugInstance () { + public final function getDebugInstance (): DebugMiddleware { return self::$debugInstance; } @@ -415,7 +415,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $webInstance The instance for web output class * @return void */ - public final function setWebOutputInstance (OutputStreamer $webInstance) { + public final function setWebOutputInstance (OutputStreamer $webInstance): void { ObjectRegistry::getRegistry('generic')->addInstance('web_output', $webInstance); } @@ -424,7 +424,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * * @return $webOutputInstance - Instance to class WebOutput */ - public final function getWebOutputInstance () { + public final function getWebOutputInstance (): OutputStreamer { return ObjectRegistry::getRegistry('generic')->getInstance('web_output'); } @@ -434,7 +434,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $callbackInstance An instance of a FrameworkInterface class * @return void */ - public final function setCallbackInstance (FrameworkInterface $callbackInstance) { + public final function setCallbackInstance (FrameworkInterface $callbackInstance): void { $this->callbackInstance = $callbackInstance; } @@ -443,7 +443,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * * @return $callbackInstance An instance of a FrameworkInterface class */ - protected final function getCallbackInstance () { + protected final function getCallbackInstance (): FrameworkInterface { return $this->callbackInstance; } @@ -454,7 +454,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @param $objectInstance An instance of a FrameworkInterface object * @return $equals Whether both objects equals */ - public function equals (FrameworkInterface $objectInstance) { + public function equals (FrameworkInterface $objectInstance): bool { // Now test it $equals = (( $this->__toString() == $objectInstance->__toString() @@ -472,7 +472,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * * @return $hashCode A generic hash code respresenting this whole class */ - public function hashCode () { + public function hashCode (): int { // Simple hash code return crc32($this->__toString()); } @@ -484,7 +484,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @return $str A string with an auto-appended trailing slash * @throws InvalidArgumentException If a paramter has an invalid value */ - public final function addMissingTrailingSlash (string $str) { + public final function addMissingTrailingSlash (string $str): string { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FRAMEWORK-SYSTEM: str=%s - CALLED!', $str)); if (empty($str)) { @@ -509,7 +509,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @return void * @throws InvalidArgumentException If a paramter has an invalid value */ - public final function debugInstance (string $message = '') { + public final function debugInstance (string $message = ''): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FRAMEWORK-SYSTEM: message=%s - CALLED!', $message)); if (empty($message)) { @@ -565,7 +565,7 @@ Loaded includes: * @return void * @throws InvalidArgumentException If a paramter has an invalid value */ - public function debugBackTrace (string $message = '', bool $doExit = true) { + public function debugBackTrace (string $message = '', bool $doExit = true): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FRAMEWORK-SYSTEM: message=%s,doExit=%d - CALLED!', $message, intval($doExit))); if (empty($message)) { @@ -599,7 +599,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter has an invalid value * @deprecated Not fully, as the new Logger facilities are not finished yet. */ - public final static function createDebugInstance (string $className, int $lineNumber = NULL) { + public final static function createDebugInstance (string $className, int $lineNumber = 0): DebugMiddleware { // Validate parameter //* NOISY-DEBUG: */ printf('[%s:%d]: className=%s,lineNumber[%s]=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $className, gettype($lineNumber), $lineNumber); if (empty($className)) { @@ -636,7 +636,7 @@ Loaded includes: * @return void * @throws InvalidArgumentException If a paramter has an invalid value */ - public function outputLine (string $message) { + public function outputLine (string $message): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FRAMEWORK-SYSTEM: message=%s - CALLED!', $message)); if (empty($message)) { @@ -655,7 +655,7 @@ Loaded includes: * @return $markedCode Marked PHP code * @throws InvalidArgumentException If a paramter has an invalid value */ - public function markupCode (string $phpCode) { + public function markupCode (string $phpCode): string { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugMessage(sprintf('BASE-FRAMEWORK-SYSTEM: phpCode=%s - CALLED!', $phpCode)); if (empty($phpCode)) { @@ -701,7 +701,7 @@ Loaded includes: * @throws InvalidDatabaseResultException If the database result is invalid * @deprecated Monolithic method, should be moved to proper classes */ - protected final function getDatabaseEntry () { + protected final function getDatabaseEntry (): array { // This method is deprecated /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FRAMEWORK-SYSTEM: CALLED!'); $this->deprecationWarning('Monolithic method, should be moved to proper classes'); @@ -745,7 +745,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @deprecated Monolithic method, should be moved to proper classes */ - public final function getField (string $fieldName) { + public final function getField (string $fieldName): mixed { // Check parameter /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: fieldName=%s - CALLED!', $fieldName)); if (empty($fieldName)) { @@ -801,8 +801,9 @@ Loaded includes: * @return $isSet Whether the given field name is set * @throws NullPointerException If the result instance is null * @throws InvalidArgumentException If a parameter is not valid + * @deprecated Monolithic method, should be moved to proper classes */ - public function isFieldSet (string $fieldName) { + public function isFieldSet (string $fieldName): bool { // Check parameter /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: fieldName=%s - CALLED!', $fieldName)); if (empty($fieldName)) { @@ -810,6 +811,9 @@ Loaded includes: throw new InvalidArgumentException('Parameter "fieldName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } + // This method is deprecated + $this->deprecationWarning('Monolithic method, should be moved to proper classes'); + // Get result instance $resultInstance = $this->getResultInstance(); @@ -844,7 +848,7 @@ Loaded includes: * @throws InvalidArgumentException If a paramter has an invalid value * @todo Write a logging mechanism for productive mode */ - public function deprecationWarning (string $message) { + public function deprecationWarning (string $message): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: message=%s - CALLED!', $message)); if (empty($message)) { @@ -879,7 +883,7 @@ Loaded includes: * @return $isLoaded Whether the PHP extension is loaded * @throws InvalidArgumentException If a parameter is not valid */ - public final function isPhpExtensionLoaded (string $phpExtension) { + public final function isPhpExtensionLoaded (string $phpExtension): bool { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: phpExtension=%s - CALLED!', $phpExtension)); if (empty($phpExtension)) { @@ -901,7 +905,7 @@ Loaded includes: * * @return $milliTime Timestamp with milliseconds */ - public function getMilliTime () { + public function getMilliTime (): float { // Get the time of day as float //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FRAMEWORK-SYSTEM: CALLED!'); $milliTime = gettimeofday(true); @@ -917,7 +921,7 @@ Loaded includes: * @return $hasSlept Whether it goes fine * @throws InvalidArgumentException If a parameter is not valid */ - public function idle (int $milliSeconds) { + public function idle (int $milliSeconds): bool { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: milliSeconds=%s - CALLED!', $milliSeconds)); if ($milliSeconds < 1) { @@ -955,7 +959,7 @@ Loaded includes: * @return $isBase64 Whether the encoded data is Base64 * @throws InvalidArgumentException If a parameter is not valid */ - protected function isBase64Encoded (string $encodedData) { + protected function isBase64Encoded (string $encodedData): bool { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: encodedData=%s - CALLED!', $encodedData)); if (empty($encodedData)) { @@ -976,7 +980,7 @@ Loaded includes: * * @return $startupTime Startup time in miliseconds */ - protected function getStartupTime () { + protected function getStartupTime (): float { return self::$startupTime; } @@ -985,7 +989,7 @@ Loaded includes: * * @return $executionTime Current execution time in nice braces */ - protected function getPrintableExecutionTime () { + protected function getPrintableExecutionTime (): string { // Calculate execution time and pack it in nice braces $executionTime = sprintf('[ %01.5f ] ', (microtime(true) - $this->getStartupTime())); @@ -1003,7 +1007,7 @@ Loaded includes: * @return $isset Whether the given key is set * @throws InvalidArgumentException If a parameter is not valid */ - protected final function isGenericArrayElementSet (string $keyGroup, string $subGroup, string $key, string $element) { + protected final function isGenericArrayElementSet (string $keyGroup, string $subGroup, string $key, string $element): bool { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s,element=%s - CALLED!', $keyGroup, $subGroup, $key, $element)); if (empty($keyGroup)) { @@ -1036,7 +1040,7 @@ Loaded includes: * @return $isset Whether the given key is set * @throws InvalidArgumentException If a parameter is not valid */ - protected final function isGenericArrayKeySet (string $keyGroup, string $subGroup, string $key) { + protected final function isGenericArrayKeySet (string $keyGroup, string $subGroup, string $key): bool { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s - CALLED!', $keyGroup, $subGroup, $key)); if (empty($keyGroup)) { @@ -1066,7 +1070,7 @@ Loaded includes: * @return $isset Whether the given group is set * @throws InvalidArgumentException If a parameter is not valid */ - protected final function isGenericArrayGroupSet (string $keyGroup, string $subGroup) { + protected final function isGenericArrayGroupSet (string $keyGroup, string $subGroup): bool { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s - CALLED!', $keyGroup, $subGroup)); if (empty($keyGroup)) { @@ -1094,7 +1098,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key/sub group isn't there but this method is invoked */ - protected final function getGenericSubArray (string $keyGroup, string $subGroup) { + protected final function getGenericSubArray (string $keyGroup, string $subGroup): array { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s - CALLED!', $keyGroup, $subGroup)); if (empty($keyGroup)) { @@ -1122,7 +1126,7 @@ Loaded includes: * @return void * @throws InvalidArgumentException If a parameter is not valid */ - protected final function unsetGenericArrayKey (string $keyGroup, string $subGroup, string $key) { + protected final function unsetGenericArrayKey (string $keyGroup, string $subGroup, string $key): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s - CALLED!', $keyGroup, $subGroup, $key)); if (empty($keyGroup)) { @@ -1153,7 +1157,7 @@ Loaded includes: * @return void * @throws InvalidArgumentException If a parameter is not valid */ - protected final function unsetGenericArrayElement (string $keyGroup, string $subGroup, string $key, string $element) { + protected final function unsetGenericArrayElement (string $keyGroup, string $subGroup, string $key, string $element): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s,element=%s - CALLED!', $keyGroup, $subGroup, $key, $element)); if (empty($keyGroup)) { @@ -1187,7 +1191,7 @@ Loaded includes: * @return void * @throws InvalidArgumentException If a parameter is not valid */ - protected final function appendStringToGenericArrayKey (string $keyGroup, string $subGroup, string $key, string $value, string $appendGlue = '') { + protected final function appendStringToGenericArrayKey (string $keyGroup, string $subGroup, string $key, string $value, string $appendGlue = ''): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s,value=%s,appendGlue=%s - CALLED!', $keyGroup, $subGroup, $key, $value, $appendGlue)); if (empty($keyGroup)) { @@ -1225,7 +1229,7 @@ Loaded includes: * @return void * @throws InvalidArgumentException If a parameter is not valid */ - protected final function appendStringToGenericArrayElement (string $keyGroup, string $subGroup, string $key, string $element, string $value, string $appendGlue = '') { + protected final function appendStringToGenericArrayElement (string $keyGroup, string $subGroup, string $key, string $element, string $value, string $appendGlue = ''): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s,element=%s,value=%s,appendGlue=%s - CALLED!', $keyGroup, $subGroup, $key, $element, $value, $appendGlue)); if (empty($keyGroup)) { @@ -1266,7 +1270,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key/sub group has already been initialized */ - protected final function initGenericArrayGroup (string $keyGroup, string $subGroup, bool $forceInit = false) { + protected final function initGenericArrayGroup (string $keyGroup, string $subGroup, bool $forceInit = false): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,forceInit=%d - CALLED!', $keyGroup, $subGroup, intval($forceInit))); if (empty($keyGroup)) { @@ -1298,7 +1302,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key/sub group has already been initialized */ - protected final function initGenericArrayKey (string $keyGroup, string $subGroup, string $key, bool $forceInit = false) { + protected final function initGenericArrayKey (string $keyGroup, string $subGroup, string $key, bool $forceInit = false): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s,forceInit=%d - CALLED!', $keyGroup, $subGroup, $key, intval($forceInit))); if (empty($keyGroup)) { @@ -1334,7 +1338,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key/sub group isn't there but this method is invoked */ - protected final function initGenericArrayElement (string $keyGroup, string $subGroup, string $key, string $element, bool $forceInit = false) { + protected final function initGenericArrayElement (string $keyGroup, string $subGroup, string $key, string $element, bool $forceInit = false): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s,element=%s,forceInit=%d - CALLED!', $keyGroup, $subGroup, $key, $element, intval($forceInit))); if (empty($keyGroup)) { @@ -1371,7 +1375,7 @@ Loaded includes: * @return $count Number of array elements * @throws InvalidArgumentException If a parameter is not valid */ - protected final function pushValueToGenericArrayKey (string $keyGroup, string $subGroup, string $key, $value) { + protected final function pushValueToGenericArrayKey (string $keyGroup, string $subGroup, string $key, mixed $value): int { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s,value[]=%s - CALLED!', $keyGroup, $subGroup, $key, gettype($value))); if (empty($keyGroup)) { @@ -1408,7 +1412,7 @@ Loaded includes: * @return $count Number of array elements * @throws InvalidArgumentException If a parameter is not valid */ - protected final function pushValueToGenericArrayElement (string $keyGroup, string $subGroup, string $key, string $element, $value) { + protected final function pushValueToGenericArrayElement (string $keyGroup, string $subGroup, string $key, string $element, mixed $value): int { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s,element=%s,value[]=%s - CALLED!', $keyGroup, $subGroup, $key, $element, gettype($value))); if (empty($keyGroup)) { @@ -1448,7 +1452,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key/sub group isn't there but this method is invoked */ - protected final function popGenericArrayElement (string $keyGroup, string $subGroup, string $key) { + protected final function popGenericArrayElement (string $keyGroup, string $subGroup, string $key): mixed { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s - CALLED!', $keyGroup, $subGroup, $key)); if (empty($keyGroup)) { @@ -1484,7 +1488,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key/sub group isn't there but this method is invoked */ - protected final function shiftGenericArrayElement (string $keyGroup, string $subGroup, string $key) { + protected final function shiftGenericArrayElement (string $keyGroup, string $subGroup, string $key): mixed { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s - CALLED!', $keyGroup, $subGroup, $key)); if (empty($keyGroup)) { @@ -1518,7 +1522,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key group isn't there but this method is invoked */ - protected final function countGenericArray (string $keyGroup) { + protected final function countGenericArray (string $keyGroup): int { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s - CALLED!', $keyGroup)); if (empty($keyGroup)) { @@ -1546,7 +1550,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key/sub group isn't there but this method is invoked */ - protected final function countGenericArrayGroup (string $keyGroup, string $subGroup) { + protected final function countGenericArrayGroup (string $keyGroup, string $subGroup): int { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s - CALLED!', $keyGroup, $subGroup)); if (empty($keyGroup)) { @@ -1578,7 +1582,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key/sub group isn't there but this method is invoked */ - protected final function countGenericArrayElements (string $keyGroup, string $subGroup, string $key) { + protected final function countGenericArrayElements (string $keyGroup, string $subGroup, string $key): int { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s - CALLED!', $keyGroup, $subGroup, $key)); if (empty($keyGroup)) { @@ -1614,7 +1618,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key/sub group isn't there but this method is invoked */ - protected final function getGenericArray (string $keyGroup) { + protected final function getGenericArray (string $keyGroup): array { // Check parameters //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s - CALLED!', $keyGroup)); if (empty($keyGroup)) { @@ -1641,7 +1645,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key/sub group isn't there but this method is invoked */ - protected final function setGenericArrayKey (string $keyGroup, string $subGroup, string $key, $value) { + protected final function setGenericArrayKey (string $keyGroup, string $subGroup, string $key, mixed $value): void { // Check parameters //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s,value[]=%s - CALLED!', $keyGroup, $subGroup, $key, gettype($value))); if (empty($keyGroup)) { @@ -1675,7 +1679,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key/sub group isn't there but this method is invoked */ - protected final function getGenericArrayKey (string $keyGroup, string $subGroup, string $key) { + protected final function getGenericArrayKey (string $keyGroup, string $subGroup, string $key): mixed { // Check parameters //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s - CALLED!', $keyGroup, $subGroup, $key)); if (empty($keyGroup)) { @@ -1708,7 +1712,7 @@ Loaded includes: * @return void * @throws InvalidArgumentException If a parameter is not valid */ - protected final function setGenericArrayElement (string $keyGroup, string $subGroup, string $key, string $element, $value) { + protected final function setGenericArrayElement (string $keyGroup, string $subGroup, string $key, string $element, mixed $value): void { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s,element=%s,value[]=%s - CALLED!', $keyGroup, $subGroup, $key, $element, gettype($value))); if (empty($keyGroup)) { @@ -1746,7 +1750,7 @@ Loaded includes: * @throws InvalidArgumentException If a parameter is not valid * @throws BadMethodCallException If key/sub group isn't there but this method is invoked */ - protected final function getGenericArrayElement (string $keyGroup, string $subGroup, string $key, string $element) { + protected final function getGenericArrayElement (string $keyGroup, string $subGroup, string $key, string $element): mixed { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s,element=%s - CALLED!', $keyGroup, $subGroup, $key, $element)); if (empty($keyGroup)) { @@ -1779,7 +1783,7 @@ Loaded includes: * @return $isValid Whether given sub group is valid * @throws InvalidArgumentException If a parameter is not valid */ - protected final function isValidGenericArrayGroup (string $keyGroup, string $subGroup) { + protected final function isValidGenericArrayGroup (string $keyGroup, string $subGroup): bool { // Check parameter //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s - CALLED!', $keyGroup, $subGroup)); if (empty($keyGroup)) { @@ -1806,7 +1810,7 @@ Loaded includes: * @param $key Key to check * @return $isValid Whether given sub group is valid */ - protected final function isValidGenericArrayKey (string $keyGroup, string $subGroup, string $key) { + protected final function isValidGenericArrayKey (string $keyGroup, string $subGroup, string $key): bool { // Check parameters //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: keyGroup=%s,subGroup=%s,key=%s - CALLED!', $keyGroup, $subGroup, $key)); if (empty($keyGroup)) { @@ -1833,7 +1837,7 @@ Loaded includes: * * @return void */ - protected function initWebOutputInstance () { + protected function initWebOutputInstance (): void { // Init web output instance //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FRAMEWORK-SYSTEM: CALLED!'); $outputInstance = ObjectFactory::createObjectByConfiguredName('output_class'); @@ -1851,7 +1855,7 @@ Loaded includes: * @param $boolean Boolean value * @return $translated Translated boolean value */ - public static final function translateBooleanToYesNo (bool $boolean) { + public static final function translateBooleanToYesNo (bool $boolean): string { // "Translate" it //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: boolean=%d - CALLED!', intval($boolean))); $translated = ($boolean === true) ? 'Y' : 'N'; @@ -1870,7 +1874,7 @@ Loaded includes: * @throw PathWriteProtectedException If the path in 'temp_file_path' is write-protected * @throws FileIoException If the file cannot be written */ - protected static function createTempPathForFile (SplFileInfo $infoInstance) { + protected static function createTempPathForFile (SplFileInfo $infoInstance): SplFileInfo { // Get config entry //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('BASE-FRAMEWORK-SYSTEM: infoInstance=%s - CALLED!', $infoInstance->__toString())); $basePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('temp_file_path'); @@ -1901,9 +1905,9 @@ Loaded includes: * * @return $stateName Name of the node's state in a printable format * @throws BadMethodCallException If this instance doesn't have a callable getter for stateInstance - * @todo Move this class away from this monolithic place (not whole class is monolithic) + * @deprecated Monolithic method, should be moved to proper classes */ - public final function getPrintableState () { + public final function getPrintableState (): string { // Check if getter is there //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage('BASE-FRAMEWORK-SYSTEM: CALLED!'); if (!is_callable($this, 'getStateInstance')) { @@ -1911,6 +1915,9 @@ Loaded includes: throw new BadMethodCallException(sprintf('this=%s has no callable getter for stateInstance', $this->__toString()), FrameworkInterface::EXCEPTION_BAD_METHOD_CALL); } + // This method is deprecated + $this->deprecationWarning('Monolithic method, should be moved to proper classes'); + // Default is 'null' $stateName = 'null'; diff --git a/framework/main/classes/class_FrameworkArrayObject.php b/framework/main/classes/class_FrameworkArrayObject.php index d1860fc2..320f6e62 100644 --- a/framework/main/classes/class_FrameworkArrayObject.php +++ b/framework/main/classes/class_FrameworkArrayObject.php @@ -49,7 +49,7 @@ class FrameworkArrayObject extends ArrayObject { * * @return $realClass The class' real name */ - public function __toString () { + public function __toString (): string { return $this->realClass; }