Skip to content

Commit

Permalink
Improve code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
webeweb committed Jan 2, 2023
1 parent e07e806 commit ab639a9
Show file tree
Hide file tree
Showing 458 changed files with 2,114 additions and 2,112 deletions.
4 changes: 2 additions & 2 deletions src/adoria/Provider/ApiProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace WBW\Library\Adoria\Provider;

use Exception;
use Psr\Log\LoggerInterface;
use Throwable;
use WBW\Library\Adoria\Api\ApiProviderInterface;
use WBW\Library\Adoria\Model\RequestData;
use WBW\Library\Adoria\Model\Result;
Expand Down Expand Up @@ -67,7 +67,7 @@ protected function callApi(string $resourcePath, array $postData): string {
$response = $request->call();

return $response->getResponseBody();
} catch (Exception $ex) {
} catch (Throwable $ex) {

throw new ApiException("Failed to call Adoria API", 500, $ex);
}
Expand Down
5 changes: 3 additions & 2 deletions src/core/Exception/AbstractException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace WBW\Library\Core\Exception;

use Exception;
use Throwable;

/**
* Abstract exception.
Expand All @@ -27,9 +28,9 @@ abstract class AbstractException extends Exception {
*
* @param string $message The message.
* @param int $code The code.
* @param Exception|null $previous The previous exception.
* @param Throwable|null $previous The previous exception.
*/
public function __construct(string $message, int $code = 500, Exception $previous = null) {
public function __construct(string $message, int $code = 500, Throwable $previous = null) {
parent::__construct($message, $code, $previous);
}
}
4 changes: 2 additions & 2 deletions src/curl/Api/RequestInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace WBW\Library\Curl\Api;

use Exception;
use Throwable;
use WBW\Library\Curl\Configuration\Configuration;

/**
Expand Down Expand Up @@ -102,7 +102,7 @@ public function addQueryData(string $name, string $value): RequestInterface;
* Call the request.
*
* @return ResponseInterface Returns the response.
* @throws Exception Throws an exception if an error occurs.
* @throws Throwable Throws an exception if an error occurs.
*/
public function call(): ResponseInterface;

Expand Down
6 changes: 3 additions & 3 deletions src/curl/Exception/AbstractException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace WBW\Library\Curl\Exception;

use Exception;
use Throwable;
use WBW\Library\Core\Exception\AbstractException as BaseException;

/**
Expand All @@ -28,9 +28,9 @@ abstract class AbstractException extends BaseException {
*
* @param string $message The message.
* @param int $code The code.
* @param Exception|null $previous The previous exception.
* @param Throwable|null $previous The previous exception.
*/
public function __construct(string $message, int $code = 500, Exception $previous = null) {
public function __construct(string $message, int $code = 500, Throwable $previous = null) {
parent::__construct($message, $code, $previous);
}
}
4 changes: 2 additions & 2 deletions src/curl/Helper/CurlHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace WBW\Library\Curl\Helper;

use DateTime;
use Exception;
use Throwable;
use WBW\Library\Curl\Api\RequestInterface;
use WBW\Library\Curl\Api\ResponseInterface;
use WBW\Library\Curl\Configuration\Configuration;
Expand Down Expand Up @@ -260,7 +260,7 @@ public static function setUserAgent($stream, Configuration $config): void {
* @param string $url The URL.
* @param string $postData The POST data.
* @return void
* @throws Exception Throws an exception if an error occurs.
* @throws Throwable Throws an exception if an error occurs.
*/
public static function setVerbose($stream, Configuration $config, string $url, string $postData): void {

Expand Down
6 changes: 3 additions & 3 deletions src/database/Connector/AbstractDatabaseConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace WBW\Library\Database\Connector;

use Exception;
use PDO;
use Throwable;
use WBW\Library\Security\Authenticator;

/**
Expand Down Expand Up @@ -57,7 +57,7 @@ protected function __construct(Authenticator $authenticator) {
* Connect.
*
* @return PDO Returns the connection.
* @throws Exception Throws an exception if the connection failed.
* @throws Throwable Throws an exception if the connection failed.
*/
abstract protected function connect(): PDO;

Expand All @@ -74,7 +74,7 @@ public function getAuthenticator(): Authenticator {
* Get the connection.
*
* @return PDO Returns the connection.
* @throws Exception Throws an exception if the connection failed.
* @throws Throwable Throws an exception if the connection failed.
*/
public function getConnection(): PDO {

Expand Down
6 changes: 3 additions & 3 deletions src/provider/Exception/ApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace WBW\Library\Provider\Exception;

use Exception;
use Throwable;
use WBW\Library\Core\Exception\AbstractException as BaseException;

/**
Expand All @@ -27,9 +27,9 @@ class ApiException extends BaseException {
*
* @param string $message The message.
* @param int $code The code.
* @param Exception|null $previous The previous exception.
* @param Throwable|null $previous The previous exception.
*/
public function __construct(string $message, int $code = 500, Exception $previous = null) {
public function __construct(string $message, int $code = 500, Throwable $previous = null) {
parent::__construct($message, $code, $previous);
}
}
4 changes: 2 additions & 2 deletions src/security/TokenGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace WBW\Library\Security;

use Exception;
use Throwable;

/**
* Token generator.
Expand All @@ -25,7 +25,7 @@ class TokenGenerator {
* Generate a token.
*
* @return string Returns the generated token.
* @throws Exception Throws an exception if an error occurs.
* @throws Throwable Throws an exception if an error occurs.
*/
public function generateToken(): string {

Expand Down
4 changes: 2 additions & 2 deletions src/symfony/Service/TokenGeneratorServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace WBW\Library\Symfony\Service;

use Exception;
use Throwable;

/**
* Token generator service interface.
Expand All @@ -25,7 +25,7 @@ interface TokenGeneratorServiceInterface {
* Generate a token.
*
* @return string Returns the generated token.
* @throws Exception Throws an exception if an error occurs.
* @throws Throwable Throws an exception if an error occurs.
*/
public function generateToken(): string;
}
4 changes: 2 additions & 2 deletions src/symfony/Service/UploadedFileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace WBW\Library\Symfony\Service;

use Exception;
use SplFileInfo;
use Throwable;
use WBW\Library\Traits\Strings\StringDirectoryTrait;
use WBW\Library\Types\Helper\StringHelper;

Expand Down Expand Up @@ -123,7 +123,7 @@ public function save(SplFileInfo $uploadedFile, string $subdirectory, string $fi
* Unique id.
*
* @return string Returns the unique id.
* @throws Exception Throws an exception if an error occurs.
* @throws Throwable Throws an exception if an error occurs.
*/
public function uniqid(): string {

Expand Down
4 changes: 2 additions & 2 deletions src/symfony/Service/UploadedFileServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace WBW\Library\Symfony\Service;

use Exception;
use SplFileInfo;
use Throwable;

/**
* Uploaded file service interface.
Expand Down Expand Up @@ -59,7 +59,7 @@ public function save(SplFileInfo $uploadedFile, string $subdirectory, string $fi
* Unique id.
*
* @return string Returns the unique id.
* @throws Exception Throws an exception if an error occurs.
* @throws Throwable Throws an exception if an error occurs.
*/
public function uniqid(): string;

Expand Down
6 changes: 3 additions & 3 deletions src/types/Exception/ArrayArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace WBW\Library\Types\Exception;

use Exception;
use InvalidArgumentException;
use Throwable;

/**
* Array argument exception.
Expand All @@ -26,9 +26,9 @@ class ArrayArgumentException extends InvalidArgumentException {
* Constructor.
*
* @param mixed $argument The argument.
* @param Exception|null $previous The previous exception.
* @param Throwable|null $previous The previous exception.
*/
public function __construct($argument, Exception $previous = null) {
public function __construct($argument, Throwable $previous = null) {
parent::__construct(sprintf('The argument "%s" is not an array', print_r($argument, true)), 500, $previous);
}
}
6 changes: 3 additions & 3 deletions src/types/Exception/BooleanArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace WBW\Library\Types\Exception;

use Exception;
use InvalidArgumentException;
use Throwable;

/**
* Boolean argument exception.
Expand All @@ -26,9 +26,9 @@ class BooleanArgumentException extends InvalidArgumentException {
* Constructor.
*
* @param mixed $argument The argument.
* @param Exception|null $previous The previous exception.
* @param Throwable|null $previous The previous exception.
*/
public function __construct($argument, Exception $previous = null) {
public function __construct($argument, Throwable $previous = null) {
parent::__construct(sprintf('The argument "%s" is not a boolean', print_r($argument, true)), 500, $previous);
}
}
6 changes: 3 additions & 3 deletions src/types/Exception/DateArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace WBW\Library\Types\Exception;

use Exception;
use InvalidArgumentException;
use Throwable;

/**
* Double argument exception.
Expand All @@ -26,9 +26,9 @@ class DateArgumentException extends InvalidArgumentException {
* Constructor.
*
* @param mixed $argument The argument.
* @param Exception|null $previous The previous exception.
* @param Throwable|null $previous The previous exception.
*/
public function __construct($argument, Exception $previous = null) {
public function __construct($argument, Throwable $previous = null) {
parent::__construct(sprintf('The argument "%s" is not a date', print_r($argument, true)), 500, $previous);
}
}
6 changes: 3 additions & 3 deletions src/types/Exception/DoubleArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace WBW\Library\Types\Exception;

use Exception;
use InvalidArgumentException;
use Throwable;

/**
* Double argument exception.
Expand All @@ -26,9 +26,9 @@ class DoubleArgumentException extends InvalidArgumentException {
* Constructor.
*
* @param mixed $argument The argument.
* @param Exception|null $previous The previous exception.
* @param Throwable|null $previous The previous exception.
*/
public function __construct($argument, Exception $previous = null) {
public function __construct($argument, Throwable $previous = null) {
parent::__construct(sprintf('The argument "%s" is not a double', print_r($argument, true)), 500, $previous);
}
}
6 changes: 3 additions & 3 deletions src/types/Exception/FloatArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace WBW\Library\Types\Exception;

use Exception;
use InvalidArgumentException;
use Throwable;

/**
* Float argument exception.
Expand All @@ -26,9 +26,9 @@ class FloatArgumentException extends InvalidArgumentException {
* Constructor.
*
* @param mixed $argument The argument.
* @param Exception|null $previous The previous exception.
* @param Throwable|null $previous The previous exception.
*/
public function __construct($argument, Exception $previous = null) {
public function __construct($argument, Throwable $previous = null) {
parent::__construct(sprintf('The argument "%s" is not a float', print_r($argument, true)), 500, $previous);
}
}
6 changes: 3 additions & 3 deletions src/types/Exception/IntegerArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace WBW\Library\Types\Exception;

use Exception;
use InvalidArgumentException;
use Throwable;

/**
* Integer argument exception.
Expand All @@ -26,9 +26,9 @@ class IntegerArgumentException extends InvalidArgumentException {
* Constructor.
*
* @param mixed $argument The argument.
* @param Exception|null $previous The previous exception.
* @param Throwable|null $previous The previous exception.
*/
public function __construct($argument, Exception $previous = null) {
public function __construct($argument, Throwable $previous = null) {
parent::__construct(sprintf('The argument "%s" is not an integer', print_r($argument, true)), 500, $previous);
}
}
6 changes: 3 additions & 3 deletions src/types/Exception/NumberArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace WBW\Library\Types\Exception;

use Exception;
use InvalidArgumentException;
use Throwable;

/**
* Number argument exception.
Expand All @@ -26,9 +26,9 @@ class NumberArgumentException extends InvalidArgumentException {
* Constructor.
*
* @param mixed $argument The argument.
* @param Exception|null $previous The previous exception.
* @param Throwable|null $previous The previous exception.
*/
public function __construct($argument, Exception $previous = null) {
public function __construct($argument, Throwable $previous = null) {
parent::__construct(sprintf('The argument "%s" is not a number', print_r($argument, true)), 500, $previous);
}
}
6 changes: 3 additions & 3 deletions src/types/Exception/ObjectArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace WBW\Library\Types\Exception;

use Exception;
use InvalidArgumentException;
use Throwable;

/**
* Object argument exception.
Expand All @@ -26,9 +26,9 @@ class ObjectArgumentException extends InvalidArgumentException {
* Constructor.
*
* @param mixed $argument The argument.
* @param Exception|null $previous The previous exception.
* @param Throwable|null $previous The previous exception.
*/
public function __construct($argument, Exception $previous = null) {
public function __construct($argument, Throwable $previous = null) {
parent::__construct(sprintf('The argument "%s" is not an object', print_r($argument, true)), 500, $previous);
}
}
Loading

0 comments on commit ab639a9

Please sign in to comment.