Correct some minor warnings and delete useless file
continuous-integration/drone/push Build is passing Details

LoginModification
dorian.hodin 2 years ago
parent ea54dc6789
commit bb6644d1b9

@ -4,33 +4,33 @@ class Autoload
{
private static $instance = null;
public static function charger()
public static function charger(): void
{
if (null !== self::$instance) {
throw RuntimeException(sprintf('%s is already started', __CLASS__));
throw new RuntimeException(sprintf('%s is already started', __CLASS__));
}
self::$instance = new self();
if (!spl_autoload_register(array(self::$instance, 'autoloader'), false)) {
throw RuntimeException(sprintf('%s : Could not start the autoload', __CLASS__));
throw new RuntimeException(sprintf('%s : Could not start the autoload', __CLASS__));
}
}
public static function shutDown()
public static function shutDown(): void
{
if (null !== self::$instance) {
if (!spl_autoload_unregister(array(self::$instance, 'autoloader'))) {
throw RuntimeException('Could not stop the autoload');
throw new RuntimeException('Could not stop the autoload');
}
self::$instance = null;
}
}
private static function autoloader($className)
private static function autoloader($className): void
{
$folder = "./";
$className = ltrim($className, '\\');

@ -11,7 +11,7 @@ class Clean
* @return string La chaîne nettoyée
*/
static function simpleString($string): string
static function simpleString(string $string): string
{
$string = trim($string);
$string = strip_tags($string);
@ -21,11 +21,11 @@ class Clean
/**
* Cette fonction prend une chaîne de caractères en entrée et retourne une version nettoyée de cette chaîne.
* Elle supprime les espaces de début et de fin, ainsi que toutes les balises HTML, et encode les caractères spéciaux.
* @param string $string La chaîne à nettoyer
* @param $email
* @return string La chaîne nettoyée
*/
static function email($email)
static function email($email): string
{
$email = self::simpleString($email);
return filter_var($email, FILTER_SANITIZE_EMAIL);
@ -38,7 +38,7 @@ class Clean
* @return int Le nombre entier formaté
*/
static function int($int)
static function int(int $int): int
{
return filter_var($int, FILTER_SANITIZE_NUMBER_INT);
}

@ -29,7 +29,7 @@
* $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine');
* $classLoader->register();
*
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @author Jonathan H. Wage <jonwage@gmail.com>
* @author Roman S. Borschel <roman@code-factory.org>
* @author Matthew Weier O'Phinney <matthew@zend.com>
@ -38,10 +38,10 @@
*/
class SplClassLoader
{
private $fileExtension = '.php';
private $namespace;
private $includePath;
private $namespaceSeparator = '\\';
private string $fileExtension = '.php';
private ?string $namespace;
private ?string $includePath;
private string $namespaceSeparator = '\\';
/**
* Creates a new <tt>SplClassLoader</tt> that loads classes of the

@ -11,7 +11,7 @@ class Validate
* @return bool Vrai si l'adresse e-mail est valide et respecte la longueur maximale définie, faux sinon.
*/
static function email (String $email)
static function email (String $email): bool
{
global $emailMaxLength;
if(filter_var($email, FILTER_VALIDATE_EMAIL) && strlen($email) <= $emailMaxLength){
@ -28,7 +28,7 @@ class Validate
* @return bool Vrai si le pseudo est valide, faux sinon.
*/
static function pseudo($pseudo) : bool
static function pseudo(string $pseudo) : bool
{
global $pseudoMaxLength;
if(strlen($pseudo) >= 3 && preg_match("#[a-zA-Z0-9]+#", $pseudo) && strlen($pseudo) <= $pseudoMaxLength){
@ -45,7 +45,7 @@ class Validate
* @return bool Vrai si le mot de passe est valide, faux sinon.
*/
static function password($password) : bool
static function password(string $password) : bool
{
global $passwordMaxLength;
if(strlen($password) >= 8 && strlen($password) <=$passwordMaxLength && preg_match("#[0-9]+#", $password) && preg_match("#[a-zA-Z]+#", $password)){
@ -57,14 +57,14 @@ class Validate
/**
* Vérifie si le mot-clé est valide.
*
* @param string $keyword Le mot-clé à vérifier.
* @param string $keyword Le mot-clé a vérifié.
* @return bool Vrai si le mot-clé est valide, faux sinon.
*/
static function keyWord($keyword) : bool
static function keyWord(string $keyword) : bool
{
global $keyWordMaxLength;
if (isset($keyword) && strlen($keyword) <= $keyWordMaxLength && strlen($keyword) >= 3)
if (strlen($keyword) <= $keyWordMaxLength && strlen($keyword) >= 3)
return true;
else return false;
}
@ -72,14 +72,14 @@ class Validate
/**
* Vérifie si le titre est valide.
*
* @param string $title Le titre à vérifier.
* @param string $title Le titre a vérifié.
* @return bool Vrai si le titre est valide, faux sinon.
*/
static function title($title) : bool
static function title(string $title) : bool
{
global $titleMaxLength;
if (isset($title) && strlen($title) <= $titleMaxLength && strlen($title) >= 3)
if (strlen($title) <= $titleMaxLength && strlen($title) >= 3)
return true;
else return false;
}
@ -87,14 +87,14 @@ class Validate
/**
* Vérifie si le type est valide.
*
* @param string $type Le type à vérifier.
* @param string $type Le type a vérifié.
* @return bool Vrai si le type est valide, faux sinon.
*/
static function type($type) : bool
static function type(string $type) : bool
{
global $typeMaxLength;
if (isset($type) && strlen($type) <= $typeMaxLength && strlen($type) >=3)
if (strlen($type) <= $typeMaxLength && strlen($type) >=3)
return true;
else return false;
}
@ -102,13 +102,13 @@ class Validate
/**
* Vérifie si la réponse est valide.
*
* @param string $response La réponse à vérifier.
* @param string $response La réponse a vérifié.
* @return bool Vrai si la réponse est valide, faux sinon.
*/
static function response($response) : bool{
static function response(string $response) : bool{
global $responseMaxLength;
if(isset($response) && strlen($response) <= $responseMaxLength)
if(strlen($response) <= $responseMaxLength)
return true;
else return false;
}

Loading…
Cancel
Save