From ecf5fe9a8d7c2f7f6ab41ebaa6d129af42f77d9e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 18 Aug 2025 20:47:18 +0200 Subject: [PATCH] Continued: - added more type-hints - __sleep() returns array --- application/tests/class_ApplicationHelper.php | 14 ++--- .../bootstrap/class_FrameworkBootstrap.php | 58 +++++++++---------- framework/loader/class_ClassLoader.php | 20 +++---- framework/main/classes/actions/class_ | 8 +-- .../application/class_BaseApplication.php | 20 +++---- .../classes/class_BaseFrameworkSystem.php | 18 +++--- framework/main/classes/client/class_ | 2 +- .../classes/client/http/class_HttpClient.php | 10 ++-- .../class_ManageableApplication.php | 24 ++++---- 9 files changed, 87 insertions(+), 87 deletions(-) diff --git a/application/tests/class_ApplicationHelper.php b/application/tests/class_ApplicationHelper.php index 161f9fc2..2a4a1353 100644 --- a/application/tests/class_ApplicationHelper.php +++ b/application/tests/class_ApplicationHelper.php @@ -68,7 +68,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication * * @return $selfInstance An instance of this class */ - public static final function getSelfInstance () { + public static final function getSelfInstance (): ManageableApplication { // Is the instance there? if (is_null(self::getApplicationInstance())) { // Then set it @@ -84,7 +84,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication * * @return void */ - public function setupApplicationData () { + public function setupApplicationData (): void { // Set all application data $this->setAppName('Unit tests and more'); $this->setAppVersion('0.0.0'); @@ -96,7 +96,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication * * @return void */ - public function initApplication () { + public function initApplication (): void { // Initialize output system self::createDebugInstance('ApplicationHelper'); @@ -112,7 +112,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication * * @return void */ - public function launchApplication () { + public function launchApplication (): void { // Get request/response instances $requestInstance = FrameworkBootstrap::getRequestInstance(); $responseInstance = FrameworkBootstrap::getResponseInstance(); @@ -160,7 +160,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication * @param $messageList An array of fatal messages * @return void */ - public function handleFatalMessages (array $messageList) { + public function handleFatalMessages (array $messageList): void { // Walk through all messages foreach ($messageList as $message) { exit(__METHOD__ . ':MSG:' . $message); @@ -172,7 +172,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication * * @return $masterTemplateName Name of the master template */ - public function buildMasterTemplateName () { + public function buildMasterTemplateName (): string { return 'tests_main'; } @@ -183,7 +183,7 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication * @return void * @todo Nothing to add? */ - public function assignExtraTemplateData (CompileableTemplate $templateInstance) { + public function assignExtraTemplateData (CompileableTemplate $templateInstance): void { DebugMiddleware::getSelfInstance()->partialStub('Unfinished method. templateInstance=' . $templateInstance->__toString()); } diff --git a/framework/bootstrap/class_FrameworkBootstrap.php b/framework/bootstrap/class_FrameworkBootstrap.php index 004b4c6f..35169d4e 100644 --- a/framework/bootstrap/class_FrameworkBootstrap.php +++ b/framework/bootstrap/class_FrameworkBootstrap.php @@ -128,7 +128,7 @@ final class FrameworkBootstrap { * * @return $configurationInstance An instance of a FrameworkConfiguration class */ - public static function getConfigurationInstance () { + public static function getConfigurationInstance (): FrameworkConfiguration { // Is the instance there? if (is_null(self::$configurationInstance)) { // Init new instance @@ -144,7 +144,7 @@ final class FrameworkBootstrap { * * @return $detectedApplicationName Detected name of application */ - public static function getDetectedApplicationName () { + public static function getDetectedApplicationName (): string { return self::$detectedApplicationName; } @@ -153,7 +153,7 @@ final class FrameworkBootstrap { * * @return $detectedApplicationPath Detected full path of application */ - public static function getDetectedApplicationPath () { + public static function getDetectedApplicationPath (): string { return self::$detectedApplicationPath; } @@ -162,7 +162,7 @@ final class FrameworkBootstrap { * * @return $requestType Analyzed request type */ - public static function getRequestTypeFromSystem () { + public static function getRequestTypeFromSystem (): string { // Default is console $requestType = 'console'; @@ -184,7 +184,7 @@ final class FrameworkBootstrap { * @param $fileInstance An instance of a SplFileInfo class * @return $isReachable Whether it is within open_basedir() */ - public static function isReachableFilePath (SplFileInfo $fileInstance) { + public static function isReachableFilePath (SplFileInfo $fileInstance): bool { // Is not reachable by default //* NOISY-DEBUG: */ printf('[%s:%d]: fileInstance=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, get_class($fileInstance)); $isReachable = false; @@ -226,7 +226,7 @@ final class FrameworkBootstrap { * @param $fileInstance An instance of a SplFileInfo class * @return $isReadable Whether the file is readable (and therefor exists) */ - public static function isReadableFile (SplFileInfo $fileInstance) { + public static function isReadableFile (SplFileInfo $fileInstance): bool { // Check if it is a file and readable //* NOISY-DEBUG: */ printf('[%s:%d]: fileInstance=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, get_class($fileInstance)); $isReadable = ( @@ -251,7 +251,7 @@ final class FrameworkBootstrap { * @return void * @throws InvalidArgumentException If file was not found or not readable or deprecated */ - public static function loadInclude (SplFileInfo $fileInstance) { + public static function loadInclude (SplFileInfo $fileInstance): void { // Should be there ... //* NOISY-DEBUG: */ printf('[%s:%d]: fileInstance=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $fileInstance->__toString()); if (!self::isReadableFile($fileInstance)) { @@ -281,7 +281,7 @@ final class FrameworkBootstrap { * * @return void */ - public static function doBootstrap () { + public static function doBootstrap (): void { // Load basic include files to continue bootstrapping //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); self::loadInclude(new SplFileInfo(sprintf('%smain%sinterfaces%sclass_FrameworkInterface.php', ApplicationEntryPoint::detectFrameworkPath(), DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR))); @@ -306,7 +306,7 @@ final class FrameworkBootstrap { * * @return void */ - public static function initFramework () { + public static function initFramework (): void { /** * 1) Load class loader and scan framework classes, interfaces and * exceptions. @@ -340,7 +340,7 @@ final class FrameworkBootstrap { * * @return void */ - public static function prepareApplication () { + public static function prepareApplication (): void { /* * Now check and load all files, found deprecated files will throw a * warning at the user. @@ -394,7 +394,7 @@ final class FrameworkBootstrap { * * @return void */ - public static function startApplication () { + public static function startApplication (): void { // Is there an application helper instance? //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); $applicationInstance = call_user_func_array( @@ -442,7 +442,7 @@ final class FrameworkBootstrap { * @return void * @throws BadMethodCallException If this method was invoked twice */ - public static function initDatabaseInstance () { + public static function initDatabaseInstance (): void { // Get application instance //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); $applicationInstance = ApplicationHelper::getSelfInstance(); @@ -475,7 +475,7 @@ final class FrameworkBootstrap { * @throws UnknownHostnameException If SERVER_NAME cannot be resolved to an IP address * @todo Have to check some more entries from $_SERVER here */ - public static function detectServerAddress () { + public static function detectServerAddress (): string { // Is the entry set? //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); if (!isset(self::$serverAddress)) { @@ -521,7 +521,7 @@ final class FrameworkBootstrap { * @return $success If timezone was accepted * @throws InvalidArgumentException If $timezone is empty */ - public static function setDefaultTimezone (string $timezone) { + public static function setDefaultTimezone (string $timezone): bool { // Is it set? //* NOISY-DEBUG: */ printf('[%s:%d]: timezone=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $timezone); if (empty($timezone)) { @@ -549,7 +549,7 @@ final class FrameworkBootstrap { * @return $isset Whether HTTPS is set * @todo Test more fields */ - public static function isHttpSecured () { + public static function isHttpSecured (): bool { //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); return ( ( @@ -573,7 +573,7 @@ final class FrameworkBootstrap { * * @return $baseUrl Detected base URL */ - public static function detectBaseUrl () { + public static function detectBaseUrl (): string { // Initialize the URL //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); $protocol = 'http'; @@ -597,7 +597,7 @@ final class FrameworkBootstrap { * * @return $fullDomain The detected full domain */ - public static function detectDomain () { + public static function detectDomain (): string { // Full domain is localnet.invalid by default //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); $fullDomain = 'localnet.invalid'; @@ -619,7 +619,7 @@ final class FrameworkBootstrap { * * @return $scriptPath The script path extracted from $_SERVER['SCRIPT_NAME'] */ - public static function detectScriptPath () { + public static function detectScriptPath (): string { // Default is empty //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); $scriptPath = ''; @@ -647,7 +647,7 @@ final class FrameworkBootstrap { * * @return void */ - private static function scanFrameworkClasses () { + private static function scanFrameworkClasses (): void { // Include class loader //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); require self::getConfigurationInstance()->getConfigEntry('framework_base_path') . 'loader/class_ClassLoader.php'; @@ -668,7 +668,7 @@ final class FrameworkBootstrap { * * @return void */ - private static function determineRequestType () { + private static function determineRequestType (): void { // Determine request type //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); $request = self::getRequestTypeFromSystem(); @@ -706,7 +706,7 @@ final class FrameworkBootstrap { * * @return void */ - private static function validateApplicationParameter () { + private static function validateApplicationParameter (): void { // Is the parameter set? //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); if (!self::getRequestInstance()->isRequestElementSet('app')) { @@ -760,7 +760,7 @@ final class FrameworkBootstrap { * * @return $requestInstance An instance of a Requestable class */ - public static function getRequestInstance () { + public static function getRequestInstance (): Requestable { return self::$requestInstance; } @@ -769,7 +769,7 @@ final class FrameworkBootstrap { * * @return $responseInstance An instance of a Responseable class */ - public static function getResponseInstance () { + public static function getResponseInstance (): Responseable { return self::$responseInstance; } @@ -779,7 +779,7 @@ final class FrameworkBootstrap { * @param $requestInstance An instance of a Requestable class * @return void */ - private static function setRequestInstance (Requestable $requestInstance) { + private static function setRequestInstance (Requestable $requestInstance): void { self::$requestInstance = $requestInstance; } @@ -789,7 +789,7 @@ final class FrameworkBootstrap { * @param $responseInstance An instance of a Responseable class * @return void */ - private static function setResponseInstance (Responseable $responseInstance) { + private static function setResponseInstance (Responseable $responseInstance): void { self::$responseInstance = $responseInstance; } @@ -799,7 +799,7 @@ final class FrameworkBootstrap { * @param $databaseInstance An instance of a DatabaseConnection class * @return void */ - public static function setDatabaseInstance (DatabaseConnection $databaseInstance) { + public static function setDatabaseInstance (DatabaseConnection $databaseInstance): void { self::$databaseInstance = $databaseInstance; } @@ -808,7 +808,7 @@ final class FrameworkBootstrap { * * @return $databaseInstance An instance of a DatabaseConnection class */ - public static function getDatabaseInstance () { + public static function getDatabaseInstance (): ?DatabaseConnection { // Return instance return self::$databaseInstance; } @@ -818,7 +818,7 @@ final class FrameworkBootstrap { * * @return $languageInstance An instance of a ManageableLanguage class */ - public static function getLanguageInstance () { + public static function getLanguageInstance (): ManageableLanguage { return self::$languageInstance; } @@ -828,7 +828,7 @@ final class FrameworkBootstrap { * @param $languageInstance An instance of a ManageableLanguage class * @return void */ - public static function setLanguageInstance (ManageableLanguage $languageInstance) { + public static function setLanguageInstance (ManageableLanguage $languageInstance): void { self::$languageInstance = $languageInstance; } diff --git a/framework/loader/class_ClassLoader.php b/framework/loader/class_ClassLoader.php index 3f4422cd..60e78895 100644 --- a/framework/loader/class_ClassLoader.php +++ b/framework/loader/class_ClassLoader.php @@ -262,7 +262,7 @@ final class ClassLoader { * * @return void */ - public static function scanFrameworkClasses () { + public static function scanFrameworkClasses (): void { // Get loader instance //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); $loaderInstance = self::getSelfInstance(); @@ -307,7 +307,7 @@ final class ClassLoader { * @return void * @throws UnexpectedValueException If a given path isn't one or not readable */ - public static function scanApplicationClasses () { + public static function scanApplicationClasses (): void { // Get loader instance //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); $loaderInstance = self::getSelfInstance(); @@ -358,7 +358,7 @@ final class ClassLoader { * @param $strictNamingConvention Whether to strictly check naming-convention * @return void */ - public static function enableStrictNamingConventionCheck (bool $strictNamingConvention = true) { + public static function enableStrictNamingConventionCheck (bool $strictNamingConvention = true): void { self::$strictNamingConvention = $strictNamingConvention; } @@ -369,7 +369,7 @@ final class ClassLoader { * @return void * @throws InvalidArgumentException If the class' name does not contain a namespace: Tld\Domain\Project is AT LEAST recommended! */ - public static function autoLoad (string $className) { + public static function autoLoad (string $className): void { // Validate parameter //* NOISY-DEBUG: */ printf('[%s:%d] className=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $className); if (empty($className)) { @@ -400,7 +400,7 @@ final class ClassLoader { * * @return $selfInstance A singleton instance of this class */ - public static final function getSelfInstance () { + public static final function getSelfInstance (): ClassLoader { // Is the instance there? //* NOISY-DEBUG: */ printf('[%s:%d]: self::selfInstance[]=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, gettype(self::$selfInstance)); if (is_null(self::$selfInstance)) { @@ -420,7 +420,7 @@ final class ClassLoader { * * @return $total Total loaded include files */ - public final function getTotal () { + public final function getTotal (): int { return $this->total; } @@ -429,7 +429,7 @@ final class ClassLoader { * * @param $includeList A printable include list */ - public function getPrintableIncludeList () { + public function getPrintableIncludeList (): string { // Prepare the list $includeList = ''; foreach (array_keys($this->loadedClasses) as $classFile) { @@ -448,7 +448,7 @@ final class ClassLoader { * @return void * @throws InvalidArgumentException If a parameter is invalid */ - protected function scanClassPath (string $basePath, array $ignoreList = [] ) { + protected function scanClassPath (string $basePath, array $ignoreList = [] ): void { // Is a list has been restored from cache, don't read it again //* NOISY-DEBUG: */ printf('[%s:%d] basePath=%s,ignoreList()=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $basePath, count($ignoreList)); if (empty($basePath)) { @@ -526,7 +526,7 @@ final class ClassLoader { * * @return void */ - private function initClassLoader () { + private function initClassLoader (): void { // Set suffix and prefix from configuration //* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__); $this->suffix = self::$configInstance->getConfigEntry('class_suffix'); @@ -584,7 +584,7 @@ final class ClassLoader { * @param $className The class that shall be loaded * @return void */ - private function loadClassFile (string $className) { + private function loadClassFile (string $className): void { // The class name should contain at least 2 back-slashes, so split at them //* NOISY-DEBUG: */ printf('[%s:%d]: className=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $className); $classNameParts = explode("\\", $className); diff --git a/framework/main/classes/actions/class_ b/framework/main/classes/actions/class_ index 80eefba5..a6a55be3 100644 --- a/framework/main/classes/actions/class_ +++ b/framework/main/classes/actions/class_ @@ -28,7 +28,7 @@ use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware; * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class ???Action extends BaseAction implements Commandable { +class ???Action extends BaseAction implements PerformableAction { /** * Protected constructor * @@ -42,9 +42,9 @@ class ???Action extends BaseAction implements Commandable { /** * Creates an instance of this action * - * @return $actionInstance An instance of this action class + * @return $actionInstance An instance of a PerformableAction class */ - public final static function create???Action () { + public final static function create???Action (): PerformableAction { // Get a new instance $actionInstance = new ???Action(); @@ -60,7 +60,7 @@ class ???Action extends BaseAction implements Commandable { * @return void * @todo 0% done */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { + public function execute (Requestable $requestInstance, Responseable $responseInstance): void { DebugMiddleware::getSelfInstance()->partialStub("You have to implement me."); } diff --git a/framework/main/classes/application/class_BaseApplication.php b/framework/main/classes/application/class_BaseApplication.php index 59c2c662..bd3fbf12 100644 --- a/framework/main/classes/application/class_BaseApplication.php +++ b/framework/main/classes/application/class_BaseApplication.php @@ -72,7 +72,7 @@ abstract class BaseApplication extends BaseFrameworkSystem { * * @return $applicationInstance An instance of a ManageableApplication class */ - public static final function getApplicationInstance () { + public static final function getApplicationInstance (): ?ManageableApplication { return self::$applicationInstance; } @@ -81,7 +81,7 @@ abstract class BaseApplication extends BaseFrameworkSystem { * * @param $applicationInstance An instance of a ManageableApplication class */ - public static final function setApplicationInstance (ManageableApplication $applicationInstance) { + public static final function setApplicationInstance (ManageableApplication $applicationInstance): void { self::$applicationInstance = $applicationInstance; } @@ -91,7 +91,7 @@ abstract class BaseApplication extends BaseFrameworkSystem { * @param $controllerInstance An instance of the controller * @return void */ - public final function setControllerInstance (Controller $controllerInstance) { + public final function setControllerInstance (Controller $controllerInstance): void { $this->controllerInstance = $controllerInstance; } @@ -100,7 +100,7 @@ abstract class BaseApplication extends BaseFrameworkSystem { * * @return $controllerInstance An instance of the controller */ - public final function getControllerInstance () { + public final function getControllerInstance (): Controller { return $this->controllerInstance; } @@ -109,7 +109,7 @@ abstract class BaseApplication extends BaseFrameworkSystem { * * @return $appVersion The application's version number */ - public final function getAppVersion () { + public final function getAppVersion (): string { return $this->appVersion; } @@ -119,7 +119,7 @@ abstract class BaseApplication extends BaseFrameworkSystem { * @param $appVersion The application's version number * @return void */ - public final function setAppVersion (string $appVersion) { + public final function setAppVersion (string $appVersion): void { // Cast and set it $this->appVersion = $appVersion; } @@ -129,7 +129,7 @@ abstract class BaseApplication extends BaseFrameworkSystem { * * @return $appName The application's human-readable name */ - public final function getAppName () { + public final function getAppName (): string { return $this->appName; } @@ -139,7 +139,7 @@ abstract class BaseApplication extends BaseFrameworkSystem { * @param $appName The application's human-readable name * @return void */ - public final function setAppName (string $appName) { + public final function setAppName (string $appName): void { // Cast and set it $this->appName = $appName;; } @@ -149,7 +149,7 @@ abstract class BaseApplication extends BaseFrameworkSystem { * * @return $shortName The application's short uni*-like name */ - public final function getAppShortName () { + public final function getAppShortName (): string { return $this->shortName; } @@ -159,7 +159,7 @@ abstract class BaseApplication extends BaseFrameworkSystem { * @param $shortName The application's short uni*-like name * @return void */ - public final function setAppShortName (string $shortName) { + public final function setAppShortName (string $shortName): void { // Cast and set it $this->shortName = $shortName; } diff --git a/framework/main/classes/class_BaseFrameworkSystem.php b/framework/main/classes/class_BaseFrameworkSystem.php index 3c826e9d..a8d65bed 100644 --- a/framework/main/classes/class_BaseFrameworkSystem.php +++ b/framework/main/classes/class_BaseFrameworkSystem.php @@ -202,7 +202,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @args $args Arguments passed to the method * @return void */ - public final function __call (string $methodName, array $args = NULL) { + public final function __call (string $methodName, array $args = NULL): void { // Set self-instance self::$selfInstance = $this; @@ -221,7 +221,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac * @return void * @throws InvalidArgumentException If self::$selfInstance is not a framework's own object */ - public static final function __callStatic (string $methodName, array $args = NULL) { + public static final function __callStatic (string $methodName, array $args = NULL): void { // Init argument string and class name //* PRINT-DEBUG: */ printf('[%s:%d]: methodName=%s,args[]=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $methodName, gettype($args)); $argsString = ''; @@ -298,7 +298,7 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac )); // Return nothing - return NULL; + return; } /** @@ -352,30 +352,30 @@ abstract class BaseFrameworkSystem extends stdClass implements FrameworkInterfac /** * Magic method to catch object serialization * - * @return $unsupported Unsupported method + * @return array * @throws UnsupportedOperationException Objects of this framework cannot be serialized */ - public final function __sleep () { + public final function __sleep (): array { throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); } /** * Magic method to catch object deserialization * - * @return $unsupported Unsupported method + * @return void * @throws UnsupportedOperationException Objects of this framework cannot be serialized */ - public final function __wakeup () { + public final function __wakeup (): void { throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); } /** * Magic method to catch calls when an object instance is called * - * @return $unsupported Unsupported method + * @return void * @throws UnsupportedOperationException Objects of this framework cannot be serialized */ - public final function __invoke () { + public final function __invoke (): void { throw new UnsupportedOperationException([$this, __FUNCTION__], FrameworkInterface::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/framework/main/classes/client/class_ b/framework/main/classes/client/class_ index d970e8d9..3430788b 100644 --- a/framework/main/classes/client/class_ +++ b/framework/main/classes/client/class_ @@ -37,7 +37,7 @@ class ???Client extends BaseClient implements Client { * * @return $clientInstance An instance of a Client class */ - public final static function create???Client () { + public final static function create???Client (): Client { // Get a new instance $clientInstance = new ???Client(); diff --git a/framework/main/classes/client/http/class_HttpClient.php b/framework/main/classes/client/http/class_HttpClient.php index 0fa97051..5b8c1cdc 100644 --- a/framework/main/classes/client/http/class_HttpClient.php +++ b/framework/main/classes/client/http/class_HttpClient.php @@ -59,7 +59,7 @@ class HttpClient extends BaseClient implements Client { * @param $socketResource An instance of a Socket class * @return $clientInstance An instance of a HttpClient class */ - public final static function createHttpClient (Socket $socketResouce = NULL) { + public final static function createHttpClient (Socket $socketResouce = NULL): Client { // Get a new instance /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HTTP-CLIENT: socketResource[%s]=%s - CALLED!', gettype($socketResource), $socketResource)); $clientInstance = new HttpClient(); @@ -77,7 +77,7 @@ class HttpClient extends BaseClient implements Client { * * @return $isUsed Wether proxy is used */ - protected function isProxyUsed () { + protected function isProxyUsed (): bool { // Do we have cache? /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HTTP-CLIENT: CALLED!'); if (!isset($GLOBALS[__METHOD__])) { @@ -99,7 +99,7 @@ class HttpClient extends BaseClient implements Client { * @throws InvalidArgumentException If a paramter has an invalid value * @throws UnexpectedValueException If an unexpected value was found */ - protected function setupProxyTunnel (string $host, int $port) { + protected function setupProxyTunnel (string $host, int $port): array { // Check paramters /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HTTP-CLIENT: host=%s,port=%d - CALLED!', $host, $port)); if (empty($host)) { @@ -143,7 +143,7 @@ class HttpClient extends BaseClient implements Client { * @param $port Port number to connect to * @return $responseArray Array with raw response */ - private function sendRawHttpRequest (string $method, string $host, int $port, array $header = []) { + private function sendRawHttpRequest (string $method, string $host, int $port, array $header = []): array { // Minimum raw HTTP/1.1 request /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HTTP-CLIENT: method=%s,host=%s,port=%d,header()=%d - CALLED!', $method, $host, $port, count($header))); $rawRequest = $method . ' ' . $host . ':' . $port . ' HTTP/1.1' . self::HTTP_EOL; @@ -193,7 +193,7 @@ class HttpClient extends BaseClient implements Client { * @return $responseArray An array with the read response * @throws InvalidArgumentException If a paramter has an invalid value */ - public function doConnectRequest (string $host, int $port) { + public function doConnectRequest (string $host, int $port): array { // Check paramters /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HTTP-CLIENT: host=%s,port=%d - CALLED!', $host, $port)); if (empty($host)) { diff --git a/framework/main/interfaces/application/class_ManageableApplication.php b/framework/main/interfaces/application/class_ManageableApplication.php index 3dc60b45..45a5f2e4 100644 --- a/framework/main/interfaces/application/class_ManageableApplication.php +++ b/framework/main/interfaces/application/class_ManageableApplication.php @@ -38,7 +38,7 @@ interface ManageableApplication extends FrameworkInterface { * * @return $appVersion The application's version number */ - function getAppVersion (); + function getAppVersion (): string; /** * Setter for the version number @@ -46,14 +46,14 @@ interface ManageableApplication extends FrameworkInterface { * @param $appVersion The application's version number * @return void */ - function setAppVersion (string $appVersion); + function setAppVersion (string $appVersion): void; /** * Getter for human-readable name * * @return $appName The application's human-readable name */ - function getAppName (); + function getAppName (): string; /** * Setter for human-readable name @@ -61,14 +61,14 @@ interface ManageableApplication extends FrameworkInterface { * @param $appName The application's human-readable name * @return void */ - function setAppName (string $appName); + function setAppName (string $appName): void; /** * Getter for short uni*-like name * * @return $shortName The application's short uni*-like name */ - function getAppShortName (); + function getAppShortName (): string; /** * Setter for short uni*-like name @@ -76,28 +76,28 @@ interface ManageableApplication extends FrameworkInterface { * @param $shortName The application's short uni*-like name * @return void */ - function setAppShortName (string $shortName); + function setAppShortName (string $shortName): void; /** * 1) Setups application data * * @return void */ - function setupApplicationData (); + function setupApplicationData (): void; /** * 2) Does initial stuff before starting the application * * @return void */ - function initApplication (); + function initApplication (): void; /** * 3) Launches the application * * @return void */ - function launchApplication (); + function launchApplication (): void; /** * Handle the indexed array of fatal messages and puts them out in an @@ -106,14 +106,14 @@ interface ManageableApplication extends FrameworkInterface { * @param $messageList An array of fatal messages * @return void */ - function handleFatalMessages (array $messageList); + function handleFatalMessages (array $messageList): void; /** * Builds the master template's name * * @return $masterTemplateName Name of the master template */ - function buildMasterTemplateName (); + function buildMasterTemplateName (): string; /** * Assigns extra application-depending data @@ -122,6 +122,6 @@ interface ManageableApplication extends FrameworkInterface { * @return void * @todo Nothing to add? */ - function assignExtraTemplateData (CompileableTemplate $templateInstance); + function assignExtraTemplateData (CompileableTemplate $templateInstance): void; } -- 2.39.5