Browse Source

fix code quality and update CI

Olivier Massot 2 years ago
parent
commit
e7294633ef

+ 3 - 1
.gitlab-ci.yml

@@ -16,7 +16,9 @@ before_script:
 
 static_analysis:
   script:
-    - php --version && php -d memory_limit=512M vendor/bin/phpstan analyse -c phpstan.neon.dist --error-format gitlab > phpstan.json
+    - php --version
+    - php -d memory_limit=512M vendor/bin/phpstan analyse -c phpstan.neon.dist  # Display in console
+    - php -d memory_limit=512M vendor/bin/phpstan analyse -c phpstan.neon.dist --error-format gitlab > phpstan.json  # Display code quality in MR
   artifacts:
     when: always
     reports:

+ 1 - 0
src/Doctrine/Billing/CurrentResidenceAreaExtension.php

@@ -5,6 +5,7 @@ namespace App\Doctrine\Billing;
 
 use ApiPlatform\Metadata\Operation;
 use App\Doctrine\AbstractExtension;
+use App\Entity\Access\Access;
 use App\Entity\Billing\ResidenceArea;
 use Doctrine\ORM\QueryBuilder;
 use Symfony\Bundle\SecurityBundle\Security;

+ 1 - 0
src/Doctrine/Booking/CurrentCoursesExtension.php

@@ -5,6 +5,7 @@ namespace App\Doctrine\Booking;
 
 use ApiPlatform\Metadata\Operation;
 use App\Doctrine\AbstractExtension;
+use App\Entity\Access\Access;
 use App\Entity\Booking\Course;
 use Doctrine\ORM\QueryBuilder;
 use Symfony\Bundle\SecurityBundle\Security;

+ 1 - 0
src/Doctrine/Core/AllowedAddressPostalExtension.php

@@ -5,6 +5,7 @@ namespace App\Doctrine\Core;
 
 use ApiPlatform\Metadata\Operation;
 use App\Doctrine\AbstractExtension;
+use App\Entity\Access\Access;
 use App\Entity\Core\AddressPostal;
 use Doctrine\ORM\QueryBuilder;
 use Symfony\Bundle\SecurityBundle\Security;

+ 1 - 0
src/Doctrine/Core/CurrentUserNotificationUserExtension.php

@@ -5,6 +5,7 @@ namespace App\Doctrine\Core;
 
 use ApiPlatform\Metadata\Operation;
 use App\Doctrine\AbstractExtension;
+use App\Entity\Access\Access;
 use App\Entity\Core\NotificationUser;
 use Doctrine\ORM\QueryBuilder;
 use Symfony\Bundle\SecurityBundle\Security;

+ 1 - 1
tests/Unit/Service/Access/AccessProfileCreatorTest.php

@@ -382,7 +382,7 @@ class AccessProfileCreatorTest extends TestCase
         $this->assertEquals('MR', $accessProfile->getGender());
         $this->assertEquals(2020, $accessProfile->getActivityYear());
         $this->assertEquals(123, $accessProfile->getAvatarId());
-        $this->assertEquals(false, $accessProfile->getIsSuperAdminAccess());
+        $this->assertFalse($accessProfile->getIsSuperAdminAccess());
         $this->assertEquals($this->organizationProfile, $accessProfile->getOrganization());
     }
 }

+ 1 - 1
tests/Unit/Service/Dolibarr/DolibarrAccountCreatorTest.php

@@ -203,6 +203,6 @@ class DolibarrAccountCreatorTest extends TestCase
         $this->assertEquals('foo', $dolibarrBill->getRef());
         $this->assertEquals(100.0, $dolibarrBill->getTaxExcludedAmount());
         $this->assertEquals(120.0, $dolibarrBill->getTaxIncludedAmount());
-        $this->assertEquals(false, $dolibarrBill->getPaid());
+        $this->assertFalse($dolibarrBill->getPaid());
     }
 }

+ 1 - 1
tests/Unit/Service/Export/LicenceCmfExporterTest.php

@@ -157,7 +157,7 @@ class LicenceCmfExporterTest extends TestCase
         $qrCode = $this->getMockBuilder(File::class)->getMock();
 
         $this->assertEquals('my_network', $licence->getFederationName());
-        $this->assertEquals(true, $licence->isOrganizationLicence());
+        $this->assertTrue($licence->isOrganizationLicence());
         $this->assertEquals(2020, $licence->getYear());
         $this->assertEquals('931572', $licence->getColor());
         $this->assertEquals($qrCode, $licence->getQrCode());

+ 1 - 1
tests/Unit/Service/Export/Model/LicenceCmfTest.php

@@ -64,7 +64,7 @@ class LicenceCmfTest extends TestCase
 
         $this->assertEquals(1, $model->getId());
         $this->assertEquals(2020, $model->getYear());
-        $this->assertEquals(true, $model->isOrganizationLicence());
+        $this->assertTrue($model->isOrganizationLicence());
         $this->assertEquals('foo', $model->getOrganizationName());
         $this->assertEquals('123', $model->getOrganizationIdentifier());
         $this->assertEquals('bar', $model->getFederationName());

+ 2 - 2
tests/Unit/Service/File/Storage/LocalStorageTest.php

@@ -162,7 +162,7 @@ class LocalStorageTest extends TestCase
         $this->assertEquals('file.ext', $file->getName());
         $this->assertEquals(null, $file->getSlug());
         $this->assertEquals(FileTypeEnum::LICENCE_CMF()->getValue(), $file->getType());
-        $this->assertEquals(true, $file->getIsTemporaryFile());
+        $this->assertTrue($file->getIsTemporaryFile());
         $this->assertEquals('ONLY_ORGANIZATION', $file->getVisibility());
         $this->assertEquals('application/pdf', $file->getMimeType());
         $this->assertEquals(123, $file->getCreatedBy());
@@ -193,7 +193,7 @@ class LocalStorageTest extends TestCase
         $this->assertEquals($owner, $file->getPerson());
         $this->assertEquals('file.txt', $file->getName());
         $this->assertEquals(FileTypeEnum::NONE()->getValue(), $file->getType());
-        $this->assertEquals(false, $file->getIsTemporaryFile());
+        $this->assertFalse($file->getIsTemporaryFile());
         $this->assertEquals('NOBODY', $file->getVisibility());
         $this->assertEquals('text/plain', $file->getMimeType());
     }

+ 1 - 1
tests/Unit/Service/MercureHubTest.php

@@ -43,7 +43,7 @@ class MercureHubTest extends TestCase
 
         $this->assertEquals(['access/1'], $update->getTopics());
         $this->assertEquals("{'foo': 1}", $update->getData());
-        $this->assertEquals(true, $update->isPrivate());
+        $this->assertTrue($update->isPrivate());
     }
 
     /**