From 5f3cc51f5cbd58b54b52ef103052eada18664079 Mon Sep 17 00:00:00 2001 From: Arnaud Fornerot Date: Fri, 23 Sep 2022 15:34:07 +0200 Subject: [PATCH] fix(continuous-integration): correction point phpstan de level 1 --- Makefile | 2 +- src/Controller/CropController.php | 7 ++++++- src/Controller/GroupController.php | 10 ++++++++-- src/Controller/Niveau02Controller.php | 4 +++- src/Controller/RegistrationController.php | 3 ++- src/Controller/SecurityController.php | 7 ++++--- src/Controller/UserController.php | 3 ++- src/Service/ApiService.php | 2 ++ src/Service/LdapService.php | 3 ++- src/Service/UploadListener.php | 2 ++ 10 files changed, 32 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 658e662..bf5a7e1 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ deps: npm ci phpstan: - symfony php tools/phpstan/vendor/bin/phpstan analyze ./src + symfony php tools/phpstan/vendor/bin/phpstan analyze ./src -l 1 php-cs-fixer: tools/php-cs-fixer/symfony-php-cs-fixer.sh fix --verbose --show-progress=dots diff --git a/src/Controller/CropController.php b/src/Controller/CropController.php index 04e9171..e2969b0 100644 --- a/src/Controller/CropController.php +++ b/src/Controller/CropController.php @@ -43,6 +43,9 @@ class CropController extends AbstractController // Récupérer les tailles de l'image $width = $this->getWidth($large_image_location); $height = $this->getHeight($large_image_location); + $max_height=null; + $max_width=null; + $ratio=null; // Définir le pourcentage de réduction de l'image switch ($type) { @@ -146,6 +149,8 @@ class CropController extends AbstractController $newImageWidth = ceil($width * $scale); $newImageHeight = ceil($height * $scale); $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); + $source=null; + switch($imageType) { case "image/gif": $source=imagecreatefromgif($image); @@ -192,7 +197,7 @@ class CropController extends AbstractController $newImageWidth=900; $newImageHeight=900; $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); - + $source=null; switch($imageType) { case "image/gif": diff --git a/src/Controller/GroupController.php b/src/Controller/GroupController.php index 677732d..458d1ea 100644 --- a/src/Controller/GroupController.php +++ b/src/Controller/GroupController.php @@ -347,7 +347,10 @@ class GroupController extends AbstractController $draw= $query['draw']; $ordercolumn=$query['order'][0]['column']; $orderdir=$query['order'][0]['dir']; - + $usermodo=null; + $niveau01=null; + $niveau02=null; + // Nombre total d'enregistrement $qb = $em->getManager()->createQueryBuilder(); switch($access) { @@ -391,6 +394,7 @@ class GroupController extends AbstractController break; } $total=$qb->getQuery()->getSingleScalarResult(); + $totalf=null; // Nombre d'enregistrement filtré if($search["value"]=="") @@ -545,7 +549,8 @@ class GroupController extends AbstractController $draw= $query['draw']; $ordercolumn=$query['order'][0]['column']; $orderdir=$query['order'][0]['dir']; - + $usermodo=null; + // Nombre total d'enregistrement $qb = $em->getManager()->createQueryBuilder(); if($access=="admin"||$access=="user") @@ -785,6 +790,7 @@ class GroupController extends AbstractController } private function canseemember($access,$entity,$em,$fgblock=true) { + $toreturn=false; switch($access) { case "admin" : $toreturn=($entity->getId()>0); break; case "modo" : $toreturn=($entity->getId()>0); break; diff --git a/src/Controller/Niveau02Controller.php b/src/Controller/Niveau02Controller.php index 84ff5d1..13ca8e6 100644 --- a/src/Controller/Niveau02Controller.php +++ b/src/Controller/Niveau02Controller.php @@ -38,7 +38,9 @@ class Niveau02Controller extends AbstractController $draw= $query['draw']; $ordercolumn=$query['order'][0]['column']; $orderdir=$query['order'][0]['dir']; - + $total=null; + $totalf=null; + // Nombre total d'enregistrement switch($access) { case "admin": diff --git a/src/Controller/RegistrationController.php b/src/Controller/RegistrationController.php index 2820f7c..7ef003f 100755 --- a/src/Controller/RegistrationController.php +++ b/src/Controller/RegistrationController.php @@ -56,7 +56,8 @@ class RegistrationController extends AbstractController $draw= $query['draw']; $ordercolumn=$query['order'][0]['column']; $orderdir=$query['order'][0]['dir']; - + $usermodo=null; + // Nombre total d'enregistrement if($access=="admin") $total = $em->getManager()->createQueryBuilder()->select('COUNT(entity)')->from($this->entity,'entity')->getQuery()->getSingleScalarResult(); diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 3bfa417..d0d37dd 100755 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -65,7 +65,7 @@ class SecurityController extends AbstractController } } - public function loginSQL(Request $request, AuthenticationUtils $authenticationUtils) + public function loginSQL(Request $request, AuthenticationUtils $authenticationUtils,ManagerRegistry $em) { return $this->render('Home/loginSQL.html.twig', array( 'last_username' => $authenticationUtils->getLastUsername(), @@ -143,7 +143,7 @@ class SecurityController extends AbstractController return $this->autoconnexion($user,$redirect,$request); } - public function loginLDAP(Request $request) + public function loginLDAP(Request $request, AuthenticationUtils $authenticationUtils,ManagerRegistry $em) { // Création du formulaire $form = $this->createForm(LoginType::class); @@ -212,7 +212,7 @@ class SecurityController extends AbstractController } - public function loginOPENID(Request $request, AuthenticationUtils $authenticationUtils) + public function loginOPENID(Request $request, AuthenticationUtils $authenticationUtils,ManagerRegistry $em) { $state=Uuid::uuid4(); $request->getSession()->set("oauthState",$state); @@ -256,6 +256,7 @@ class SecurityController extends AbstractController $attributes=json_decode(json_encode($response->body), true); // Username + $username=""; if(isset($attributes[$this->getParameter('oauthUsername')])) $username = $attributes[$this->getParameter('oauthUsername')]; diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 734deba..ab4874d 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -44,7 +44,8 @@ class UserController extends AbstractController $draw= $query['draw']; $ordercolumn=$query['order'][0]['column']; $orderdir=$query['order'][0]['dir']; - + $niveau01=null; + $niveau02=null; // Nombre total d'enregistrement switch($access) { diff --git a/src/Service/ApiService.php b/src/Service/ApiService.php index 4388d96..3af8b91 100644 --- a/src/Service/ApiService.php +++ b/src/Service/ApiService.php @@ -20,7 +20,9 @@ class ApiService } public function run($method,$url,$query,$header=null,$content="json") { + // Entete + $headerini=null; switch($content) { case "json": $headerini = [ diff --git a/src/Service/LdapService.php b/src/Service/LdapService.php index 178a826..e8f6d93 100644 --- a/src/Service/LdapService.php +++ b/src/Service/LdapService.php @@ -367,7 +367,8 @@ class LdapService public function updateNiveauUser(User $user,$todel=false) { $dn = $this->basedn; $connection = $this->connect(); - + $result=null; + // NIVEAU01 // On recherche le Niveau01 actuellement asscocié à l'utilisateur $criteria = '(&(cn=*)(memberUid='.$user->getUsername().'))'; diff --git a/src/Service/UploadListener.php b/src/Service/UploadListener.php index 4c0c416..013475f 100644 --- a/src/Service/UploadListener.php +++ b/src/Service/UploadListener.php @@ -35,6 +35,8 @@ class UploadListener $newImageWidth = ceil($width * $scale); $newImageHeight = ceil($height * $scale); $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); + $source=null; + switch($imageType) { case "image/gif": $source=imagecreatefromgif($image);