From cbca37560a3636d2ca2a82216263e2de33f241a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr>
Date: Tue, 1 Aug 2017 15:44:43 +0200
Subject: [PATCH] Passage en PHP 7.1.

---
 Command/CheckCommand.php                           |  2 +-
 Command/CollectGarbageCommand.php                  |  2 +-
 Command/CreateCommand.php                          |  2 +-
 Command/ReadCommand.php                            |  2 +-
 Controller/UploadController.php                    |  6 +++---
 Controller/UploadedFileController.php              |  2 +-
 DependencyInjection/Configuration.php              |  2 +-
 DependencyInjection/IrsteaFileUploadExtension.php  |  2 +-
 Entity/Repository/UploadedFileRepository.php       |  2 +-
 Entity/UploadedFile.php                            |  4 ++--
 Event/FileUploadCompleteEvent.php                  |  2 +-
 Exception/Exception.php                            |  2 +-
 Exception/RejectedFileException.php                |  2 +-
 FileUploadEvents.php                               |  4 ++--
 Form/DataTranformer/UploadedFileTransformer.php    |  2 +-
 Form/Type/FileUploadType.php                       |  2 +-
 Http/UploadedFileResponse.php                      |  2 +-
 IrsteaFileUploadBundle.php                         |  2 +-
 Listener/CreationDataListener.php                  |  2 +-
 Listener/UploadedFileListener.php                  |  2 +-
 Listener/VirusScannerListener.php                  |  2 +-
 Model/FileManagerInterface.php                     |  2 +-
 Model/UploadedFileInterface.php                    | 14 +++++++-------
 Service/FileUrlGenerator.php                       |  2 +-
 Service/FileUrlGeneratorInterface.php              |  2 +-
 Tests/Entity/UploadedFileTest.php                  |  2 +-
 .../DataTranformer/UploadedFileTransformerTest.php |  2 +-
 Tests/Listener/UploadedFileListenerTest.php        |  2 +-
 Tests/Listener/VirusScannerListenerTest.php        |  2 +-
 Tests/Utils/MimeTypeIconTest.php                   |  2 +-
 Twig/FileUploadExtension.php                       |  2 +-
 Utils/MimeTypeIcon.php                             |  2 +-
 Validation/FileMimeType.php                        |  2 +-
 Validation/FileMimeTypeValidator.php               |  2 +-
 Validation/FileSize.php                            |  2 +-
 Validation/FileSizeValidator.php                   |  2 +-
 composer.json                                      |  2 +-
 37 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/Command/CheckCommand.php b/Command/CheckCommand.php
index d08190ca..74d68246 100644
--- a/Command/CheckCommand.php
+++ b/Command/CheckCommand.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Command/CollectGarbageCommand.php b/Command/CollectGarbageCommand.php
index 8031485f..c82a8faf 100644
--- a/Command/CollectGarbageCommand.php
+++ b/Command/CollectGarbageCommand.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Command/CreateCommand.php b/Command/CreateCommand.php
index 12870c00..29941f50 100644
--- a/Command/CreateCommand.php
+++ b/Command/CreateCommand.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Command/ReadCommand.php b/Command/ReadCommand.php
index aa835ca2..5fe31c4e 100644
--- a/Command/ReadCommand.php
+++ b/Command/ReadCommand.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Controller/UploadController.php b/Controller/UploadController.php
index cb53aa90..aa090075 100644
--- a/Controller/UploadController.php
+++ b/Controller/UploadController.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
@@ -31,7 +31,7 @@ use Symfony\Component\Templating\EngineInterface;
  */
 class UploadController extends Controller
 {
-    const CSRF_INTENTION = 'uploaded_file';
+    public const CSRF_INTENTION = 'uploaded_file';
 
     /**
      * @var FileManagerInterface
@@ -89,7 +89,7 @@ class UploadController extends Controller
                 $data['name'],
                 $data['size'],
                 $data['type'],
-                isset($data['lastModified']) ? $data['lastModified'] : null,
+                $data['lastModified'] ?? null,
                 null !== $token ? $token->getUsername() : null,
                 $request->getClientIp()
             );
diff --git a/Controller/UploadedFileController.php b/Controller/UploadedFileController.php
index 665500af..ab7f04e2 100644
--- a/Controller/UploadedFileController.php
+++ b/Controller/UploadedFileController.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 82810d3b..6db2e0a7 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/DependencyInjection/IrsteaFileUploadExtension.php b/DependencyInjection/IrsteaFileUploadExtension.php
index 2fbce612..76aca9c2 100644
--- a/DependencyInjection/IrsteaFileUploadExtension.php
+++ b/DependencyInjection/IrsteaFileUploadExtension.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Entity/Repository/UploadedFileRepository.php b/Entity/Repository/UploadedFileRepository.php
index 4b4f58ce..eb98e6f6 100644
--- a/Entity/Repository/UploadedFileRepository.php
+++ b/Entity/Repository/UploadedFileRepository.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Entity/UploadedFile.php b/Entity/UploadedFile.php
index d556bfe0..d40d37c8 100644
--- a/Entity/UploadedFile.php
+++ b/Entity/UploadedFile.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
@@ -29,7 +29,7 @@ class UploadedFile implements UploadedFileInterface
     // Taille de bloc utilisé pour les copies
     public static $copyBlockSize = 8192;
 
-    const ORPHAN_PREFIX = 'orphan/';
+    public const ORPHAN_PREFIX = 'orphan/';
 
     /**
      * @ORM\Id
diff --git a/Event/FileUploadCompleteEvent.php b/Event/FileUploadCompleteEvent.php
index a88860b5..5b624c72 100644
--- a/Event/FileUploadCompleteEvent.php
+++ b/Event/FileUploadCompleteEvent.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Exception/Exception.php b/Exception/Exception.php
index 1709a8d1..29b75e6d 100644
--- a/Exception/Exception.php
+++ b/Exception/Exception.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Exception/RejectedFileException.php b/Exception/RejectedFileException.php
index ff44eacf..70042117 100644
--- a/Exception/RejectedFileException.php
+++ b/Exception/RejectedFileException.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/FileUploadEvents.php b/FileUploadEvents.php
index a63f3ade..adc1ddf3 100644
--- a/FileUploadEvents.php
+++ b/FileUploadEvents.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
@@ -11,5 +11,5 @@ namespace Irstea\FileUploadBundle;
  */
 final class FileUploadEvents
 {
-    const UPLOAD_COMPLETE = 'file_upload.complete';
+    public const UPLOAD_COMPLETE = 'file_upload.complete';
 }
diff --git a/Form/DataTranformer/UploadedFileTransformer.php b/Form/DataTranformer/UploadedFileTransformer.php
index 26524818..f42be6e5 100644
--- a/Form/DataTranformer/UploadedFileTransformer.php
+++ b/Form/DataTranformer/UploadedFileTransformer.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Form/Type/FileUploadType.php b/Form/Type/FileUploadType.php
index 18ea24bf..e12d32dc 100644
--- a/Form/Type/FileUploadType.php
+++ b/Form/Type/FileUploadType.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Http/UploadedFileResponse.php b/Http/UploadedFileResponse.php
index df18db87..6a4d140e 100644
--- a/Http/UploadedFileResponse.php
+++ b/Http/UploadedFileResponse.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/IrsteaFileUploadBundle.php b/IrsteaFileUploadBundle.php
index ede2ba02..04e1e1dc 100644
--- a/IrsteaFileUploadBundle.php
+++ b/IrsteaFileUploadBundle.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Listener/CreationDataListener.php b/Listener/CreationDataListener.php
index 59bdce93..ae40523d 100644
--- a/Listener/CreationDataListener.php
+++ b/Listener/CreationDataListener.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Listener/UploadedFileListener.php b/Listener/UploadedFileListener.php
index 0d798bfd..cce11d12 100644
--- a/Listener/UploadedFileListener.php
+++ b/Listener/UploadedFileListener.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Listener/VirusScannerListener.php b/Listener/VirusScannerListener.php
index 1f38ac22..7c784c82 100644
--- a/Listener/VirusScannerListener.php
+++ b/Listener/VirusScannerListener.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Model/FileManagerInterface.php b/Model/FileManagerInterface.php
index 690c4157..dba07e9c 100644
--- a/Model/FileManagerInterface.php
+++ b/Model/FileManagerInterface.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Model/UploadedFileInterface.php b/Model/UploadedFileInterface.php
index 41e8536c..c248f7fc 100644
--- a/Model/UploadedFileInterface.php
+++ b/Model/UploadedFileInterface.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
@@ -16,42 +16,42 @@ interface UploadedFileInterface
     /** Fichier en cours d'upload.
      * @var string
      */
-    const ETAT_EN_COURS = 'en-cours';
+    public const ETAT_EN_COURS = 'en-cours';
 
     /** Fichier orphelin.
      * Fichier qui n'a pas encore été associé à un objet métier.
      *
      * @var string
      */
-    const ETAT_ORPHELIN = 'orphelin';
+    public const ETAT_ORPHELIN = 'orphelin';
 
     /** Fichier normal.
      * Fichier associé à un objet métier.
      *
      * @var string
      */
-    const ETAT_NORMAL = 'normal';
+    public const ETAT_NORMAL = 'normal';
 
     /** Fichier corrompu.
      * Fichier dont le contenu disque ne correspond pas à la somme de contrôle enregistreé en base de données.
      *
      * @var string
      */
-    const ETAT_CORROMPU = 'corrompu';
+    public const ETAT_CORROMPU = 'corrompu';
 
     /** Fichier manquant.
      * Fichier existant en base de données mais introuvable sur disque.
      *
      * @var string
      */
-    const ETAT_MANQUANT = 'manquant';
+    public const ETAT_MANQUANT = 'manquant';
 
     /** Fichier rejeté.
      * Fichier uploadé mais rejeté par un listener (par exemple l'antivirus).
      *
      * @var string
      */
-    const ETAT_REJETE = 'rejete';
+    public const ETAT_REJETE = 'rejete';
 
     /** Retourne l'identifiant du fichier.
      * @return string
diff --git a/Service/FileUrlGenerator.php b/Service/FileUrlGenerator.php
index 6ca79bee..cbf30fdc 100644
--- a/Service/FileUrlGenerator.php
+++ b/Service/FileUrlGenerator.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Service/FileUrlGeneratorInterface.php b/Service/FileUrlGeneratorInterface.php
index bee15eee..b70b9acb 100644
--- a/Service/FileUrlGeneratorInterface.php
+++ b/Service/FileUrlGeneratorInterface.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Tests/Entity/UploadedFileTest.php b/Tests/Entity/UploadedFileTest.php
index ffc7472d..b88cf866 100644
--- a/Tests/Entity/UploadedFileTest.php
+++ b/Tests/Entity/UploadedFileTest.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Tests/Form/DataTranformer/UploadedFileTransformerTest.php b/Tests/Form/DataTranformer/UploadedFileTransformerTest.php
index 706646b8..3c4cb679 100644
--- a/Tests/Form/DataTranformer/UploadedFileTransformerTest.php
+++ b/Tests/Form/DataTranformer/UploadedFileTransformerTest.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Tests/Listener/UploadedFileListenerTest.php b/Tests/Listener/UploadedFileListenerTest.php
index 9a68c361..dbf5822d 100644
--- a/Tests/Listener/UploadedFileListenerTest.php
+++ b/Tests/Listener/UploadedFileListenerTest.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Tests/Listener/VirusScannerListenerTest.php b/Tests/Listener/VirusScannerListenerTest.php
index 86af4fdc..fc98d766 100644
--- a/Tests/Listener/VirusScannerListenerTest.php
+++ b/Tests/Listener/VirusScannerListenerTest.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Tests/Utils/MimeTypeIconTest.php b/Tests/Utils/MimeTypeIconTest.php
index 1fffeb42..b299324d 100644
--- a/Tests/Utils/MimeTypeIconTest.php
+++ b/Tests/Utils/MimeTypeIconTest.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Twig/FileUploadExtension.php b/Twig/FileUploadExtension.php
index 4429cb02..428ff0d1 100644
--- a/Twig/FileUploadExtension.php
+++ b/Twig/FileUploadExtension.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Utils/MimeTypeIcon.php b/Utils/MimeTypeIcon.php
index 52695180..57cd4d6d 100644
--- a/Utils/MimeTypeIcon.php
+++ b/Utils/MimeTypeIcon.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Validation/FileMimeType.php b/Validation/FileMimeType.php
index f015d0f4..daf09060 100644
--- a/Validation/FileMimeType.php
+++ b/Validation/FileMimeType.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Validation/FileMimeTypeValidator.php b/Validation/FileMimeTypeValidator.php
index d1c45d6a..e81b823e 100644
--- a/Validation/FileMimeTypeValidator.php
+++ b/Validation/FileMimeTypeValidator.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Validation/FileSize.php b/Validation/FileSize.php
index db5158ab..9d9f978f 100644
--- a/Validation/FileSize.php
+++ b/Validation/FileSize.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/Validation/FileSizeValidator.php b/Validation/FileSizeValidator.php
index 48601f32..ab523f33 100644
--- a/Validation/FileSizeValidator.php
+++ b/Validation/FileSizeValidator.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
 /*
  * Copyright (C) 2015-2017 IRSTEA
  * All rights reserved.
diff --git a/composer.json b/composer.json
index 6a049b5e..86bcfa96 100644
--- a/composer.json
+++ b/composer.json
@@ -21,7 +21,7 @@
         { "type": "composer", "url": "https://isdevtools.irstea.fr/satis" }
     ],
     "require": {
-        "php": ">=5.4",
+        "php": ">=7.1",
         "doctrine/doctrine-bundle": "^1.6",
         "doctrine/orm": "^2.5",
         "sensio/framework-extra-bundle": "^3.0.2",
-- 
GitLab