diff --git a/composer.json b/composer.json
index 9efafbd8a33cdb19c76fe1a550df2877bf9f9e75..973c56fd24bd1983c1951db1292df54dfc5d5188 100644
--- a/composer.json
+++ b/composer.json
@@ -10,7 +10,8 @@
     "drupal/externalauth": "^2.0"
   },
   "provide": {
-    "ext-ldap": "*"
+    "ext-ldap": "*",
+    "ext-exif": "*"
   },
   "repositories": {
     "drupal": {
diff --git a/ldap_authentication/src/Form/LdapAuthenticationAdminForm.php b/ldap_authentication/src/Form/LdapAuthenticationAdminForm.php
index ee1f201b17dec91a544bac8451bf70435f98f31c..23baa68c479dc23b898a66c505ecaeea23200b1e 100644
--- a/ldap_authentication/src/Form/LdapAuthenticationAdminForm.php
+++ b/ldap_authentication/src/Form/LdapAuthenticationAdminForm.php
@@ -76,6 +76,7 @@ final class LdapAuthenticationAdminForm extends ConfigFormBase {
       parent::__construct($config_factory, $config_type_manager);
     }
     else {
+      // @phpstan-ignore-next-line
       parent::__construct($config_factory);
     }
 
diff --git a/ldap_servers/src/Helper/ConversionHelper.php b/ldap_servers/src/Helper/ConversionHelper.php
index 9c2d6b2e92d543bfd1ecde7c6db1b0f641a89283..98b3fa330334ced2dffacb6249a677af3c3e6d05 100644
--- a/ldap_servers/src/Helper/ConversionHelper.php
+++ b/ldap_servers/src/Helper/ConversionHelper.php
@@ -89,7 +89,7 @@ class ConversionHelper {
    * @return string
    *   Converted string.
    */
-  public static function convertAttribute(string $value, string $conversion = NULL): string {
+  public static function convertAttribute(string $value, ?string $conversion = NULL): string {
 
     switch ($conversion) {
       case 'base64_encode':
diff --git a/ldap_servers/tests/modules/ldap_servers_dummy/src/FakeLdap.php b/ldap_servers/tests/modules/ldap_servers_dummy/src/FakeLdap.php
index 867d869e24422b399a998a505786a0c14b086d2d..fbd9686335ccaad75c9d452672f220ac862bc983 100644
--- a/ldap_servers/tests/modules/ldap_servers_dummy/src/FakeLdap.php
+++ b/ldap_servers/tests/modules/ldap_servers_dummy/src/FakeLdap.php
@@ -47,7 +47,7 @@ class FakeLdap implements LdapInterface {
   /**
    * {@inheritdoc}
    */
-  public function bind(string $dn = NULL, string $password = NULL): void {
+  public function bind(?string $dn = NULL, ?string $password = NULL): void {
     if ($this->bindException) {
       throw new ConnectionException('Failed connection');
     }
diff --git a/ldap_user/src/Form/LdapUserAdminForm.php b/ldap_user/src/Form/LdapUserAdminForm.php
index d5b3dcddb89f8317638e98878496a1e94c8787c5..34d77ca992ab52a6761a03968e868adb38c5e240 100644
--- a/ldap_user/src/Form/LdapUserAdminForm.php
+++ b/ldap_user/src/Form/LdapUserAdminForm.php
@@ -84,6 +84,7 @@ final class LdapUserAdminForm extends ConfigFormBase implements LdapUserAttribut
       parent::__construct($config_factory, $config_type_manager);
     }
     else {
+      // @phpstan-ignore-next-line
       parent::__construct($config_factory);
     }
 
diff --git a/ldap_user/src/Form/LdapUserMappingBaseForm.php b/ldap_user/src/Form/LdapUserMappingBaseForm.php
index 0e313495f4d251274d6eef52fb4d9b62fc6ac3cd..d3b847edc29bc048fc0b3b0ca42804f1916bac2e 100644
--- a/ldap_user/src/Form/LdapUserMappingBaseForm.php
+++ b/ldap_user/src/Form/LdapUserMappingBaseForm.php
@@ -95,6 +95,7 @@ abstract class LdapUserMappingBaseForm extends ConfigFormBase implements LdapUse
       parent::__construct($config_factory, $config_type_manager);
     }
     else {
+      // @phpstan-ignore-next-line
       parent::__construct($config_factory);
     }
 
diff --git a/ldap_user/src/Processor/DrupalUserProcessor.php b/ldap_user/src/Processor/DrupalUserProcessor.php
index 532cb1b2132c65ed22bc00ee76090b2b7eeb04d2..3e10f693d84a7b329c541a51c7ec242b0b29d96d 100644
--- a/ldap_user/src/Processor/DrupalUserProcessor.php
+++ b/ldap_user/src/Processor/DrupalUserProcessor.php
@@ -600,8 +600,15 @@ class DrupalUserProcessor implements LdapUserAttributesInterface {
 
       return NULL;
     }
-    // @todo Declare dependency on exif or resolve it.
     $image_type = exif_imagetype($unmanagedFile);
+    if ($image_type === FALSE) {
+      $this->detailLog
+        ->log('Unable to detect image type of @file. Possibly invalid or corrupted image',
+          ['@file' => $unmanagedFile]
+        );
+
+      return NULL;
+    }
     $extension = image_type_to_extension($image_type, FALSE);
     unlink($unmanagedFile);
 
diff --git a/ldap_user/src/Processor/OrphanProcessor.php b/ldap_user/src/Processor/OrphanProcessor.php
index 28acbfa4a4e06ebcafdd699a29ee8baee12a9133..e2955db70eb454f5e726b1ddc42676ea9376f165 100644
--- a/ldap_user/src/Processor/OrphanProcessor.php
+++ b/ldap_user/src/Processor/OrphanProcessor.php
@@ -374,7 +374,7 @@ class OrphanProcessor {
           ->load($user['uid']);
         $method = $this->configLdapUser->get('orphanedDrupalAcctBehavior');
         switch ($method) {
-          case 'ldap_user_orphan_email';
+          case 'ldap_user_orphan_email':
             $link = Url::fromRoute('entity.user.edit_form', ['user' => $user['uid']])->setAbsolute();
             $this->emailList[] = $account->getAccountName() . ',' . $account->getEmail() . ',' . $link->toString();
             $account->set('ldap_user_last_checked', time())->save();