fix(continuous-integration): correction point phpstan de level 1
Cadoles/nineskeletor/pipeline/pr-master This commit looks good Details

This commit is contained in:
Arnaud Fornerot 2022-09-23 15:34:07 +02:00
parent 86b11372e7
commit 5f3cc51f5c
10 changed files with 32 additions and 11 deletions

View File

@ -9,7 +9,7 @@ deps:
npm ci npm ci
phpstan: phpstan:
symfony php tools/phpstan/vendor/bin/phpstan analyze ./src symfony php tools/phpstan/vendor/bin/phpstan analyze ./src -l 1
php-cs-fixer: php-cs-fixer:
tools/php-cs-fixer/symfony-php-cs-fixer.sh fix --verbose --show-progress=dots tools/php-cs-fixer/symfony-php-cs-fixer.sh fix --verbose --show-progress=dots

View File

@ -43,6 +43,9 @@ class CropController extends AbstractController
// Récupérer les tailles de l'image // Récupérer les tailles de l'image
$width = $this->getWidth($large_image_location); $width = $this->getWidth($large_image_location);
$height = $this->getHeight($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 // Définir le pourcentage de réduction de l'image
switch ($type) { switch ($type) {
@ -146,6 +149,8 @@ class CropController extends AbstractController
$newImageWidth = ceil($width * $scale); $newImageWidth = ceil($width * $scale);
$newImageHeight = ceil($height * $scale); $newImageHeight = ceil($height * $scale);
$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);
$source=null;
switch($imageType) { switch($imageType) {
case "image/gif": case "image/gif":
$source=imagecreatefromgif($image); $source=imagecreatefromgif($image);
@ -192,7 +197,7 @@ class CropController extends AbstractController
$newImageWidth=900; $newImageWidth=900;
$newImageHeight=900; $newImageHeight=900;
$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);
$source=null;
switch($imageType) { switch($imageType) {
case "image/gif": case "image/gif":

View File

@ -347,7 +347,10 @@ class GroupController extends AbstractController
$draw= $query['draw']; $draw= $query['draw'];
$ordercolumn=$query['order'][0]['column']; $ordercolumn=$query['order'][0]['column'];
$orderdir=$query['order'][0]['dir']; $orderdir=$query['order'][0]['dir'];
$usermodo=null;
$niveau01=null;
$niveau02=null;
// Nombre total d'enregistrement // Nombre total d'enregistrement
$qb = $em->getManager()->createQueryBuilder(); $qb = $em->getManager()->createQueryBuilder();
switch($access) { switch($access) {
@ -391,6 +394,7 @@ class GroupController extends AbstractController
break; break;
} }
$total=$qb->getQuery()->getSingleScalarResult(); $total=$qb->getQuery()->getSingleScalarResult();
$totalf=null;
// Nombre d'enregistrement filtré // Nombre d'enregistrement filtré
if($search["value"]=="") if($search["value"]=="")
@ -545,7 +549,8 @@ class GroupController extends AbstractController
$draw= $query['draw']; $draw= $query['draw'];
$ordercolumn=$query['order'][0]['column']; $ordercolumn=$query['order'][0]['column'];
$orderdir=$query['order'][0]['dir']; $orderdir=$query['order'][0]['dir'];
$usermodo=null;
// Nombre total d'enregistrement // Nombre total d'enregistrement
$qb = $em->getManager()->createQueryBuilder(); $qb = $em->getManager()->createQueryBuilder();
if($access=="admin"||$access=="user") if($access=="admin"||$access=="user")
@ -785,6 +790,7 @@ class GroupController extends AbstractController
} }
private function canseemember($access,$entity,$em,$fgblock=true) { private function canseemember($access,$entity,$em,$fgblock=true) {
$toreturn=false;
switch($access) { switch($access) {
case "admin" : $toreturn=($entity->getId()>0); break; case "admin" : $toreturn=($entity->getId()>0); break;
case "modo" : $toreturn=($entity->getId()>0); break; case "modo" : $toreturn=($entity->getId()>0); break;

View File

@ -38,7 +38,9 @@ class Niveau02Controller extends AbstractController
$draw= $query['draw']; $draw= $query['draw'];
$ordercolumn=$query['order'][0]['column']; $ordercolumn=$query['order'][0]['column'];
$orderdir=$query['order'][0]['dir']; $orderdir=$query['order'][0]['dir'];
$total=null;
$totalf=null;
// Nombre total d'enregistrement // Nombre total d'enregistrement
switch($access) { switch($access) {
case "admin": case "admin":

View File

@ -56,7 +56,8 @@ class RegistrationController extends AbstractController
$draw= $query['draw']; $draw= $query['draw'];
$ordercolumn=$query['order'][0]['column']; $ordercolumn=$query['order'][0]['column'];
$orderdir=$query['order'][0]['dir']; $orderdir=$query['order'][0]['dir'];
$usermodo=null;
// Nombre total d'enregistrement // Nombre total d'enregistrement
if($access=="admin") if($access=="admin")
$total = $em->getManager()->createQueryBuilder()->select('COUNT(entity)')->from($this->entity,'entity')->getQuery()->getSingleScalarResult(); $total = $em->getManager()->createQueryBuilder()->select('COUNT(entity)')->from($this->entity,'entity')->getQuery()->getSingleScalarResult();

View File

@ -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( return $this->render('Home/loginSQL.html.twig', array(
'last_username' => $authenticationUtils->getLastUsername(), 'last_username' => $authenticationUtils->getLastUsername(),
@ -143,7 +143,7 @@ class SecurityController extends AbstractController
return $this->autoconnexion($user,$redirect,$request); return $this->autoconnexion($user,$redirect,$request);
} }
public function loginLDAP(Request $request) public function loginLDAP(Request $request, AuthenticationUtils $authenticationUtils,ManagerRegistry $em)
{ {
// Création du formulaire // Création du formulaire
$form = $this->createForm(LoginType::class); $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(); $state=Uuid::uuid4();
$request->getSession()->set("oauthState",$state); $request->getSession()->set("oauthState",$state);
@ -256,6 +256,7 @@ class SecurityController extends AbstractController
$attributes=json_decode(json_encode($response->body), true); $attributes=json_decode(json_encode($response->body), true);
// Username // Username
$username="";
if(isset($attributes[$this->getParameter('oauthUsername')])) if(isset($attributes[$this->getParameter('oauthUsername')]))
$username = $attributes[$this->getParameter('oauthUsername')]; $username = $attributes[$this->getParameter('oauthUsername')];

View File

@ -44,7 +44,8 @@ class UserController extends AbstractController
$draw= $query['draw']; $draw= $query['draw'];
$ordercolumn=$query['order'][0]['column']; $ordercolumn=$query['order'][0]['column'];
$orderdir=$query['order'][0]['dir']; $orderdir=$query['order'][0]['dir'];
$niveau01=null;
$niveau02=null;
// Nombre total d'enregistrement // Nombre total d'enregistrement
switch($access) { switch($access) {

View File

@ -20,7 +20,9 @@ class ApiService
} }
public function run($method,$url,$query,$header=null,$content="json") { public function run($method,$url,$query,$header=null,$content="json") {
// Entete // Entete
$headerini=null;
switch($content) { switch($content) {
case "json": case "json":
$headerini = [ $headerini = [

View File

@ -367,7 +367,8 @@ class LdapService
public function updateNiveauUser(User $user,$todel=false) { public function updateNiveauUser(User $user,$todel=false) {
$dn = $this->basedn; $dn = $this->basedn;
$connection = $this->connect(); $connection = $this->connect();
$result=null;
// NIVEAU01 // NIVEAU01
// On recherche le Niveau01 actuellement asscocié à l'utilisateur // On recherche le Niveau01 actuellement asscocié à l'utilisateur
$criteria = '(&(cn=*)(memberUid='.$user->getUsername().'))'; $criteria = '(&(cn=*)(memberUid='.$user->getUsername().'))';

View File

@ -35,6 +35,8 @@ class UploadListener
$newImageWidth = ceil($width * $scale); $newImageWidth = ceil($width * $scale);
$newImageHeight = ceil($height * $scale); $newImageHeight = ceil($height * $scale);
$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);
$source=null;
switch($imageType) { switch($imageType) {
case "image/gif": case "image/gif":
$source=imagecreatefromgif($image); $source=imagecreatefromgif($image);