Skip to content

Instantly share code, notes, and snippets.

@gnat42
Created September 24, 2025 15:45
Show Gist options
  • Select an option

  • Save gnat42/86d84631383ae8db775928ccf011e31b to your computer and use it in GitHub Desktop.

Select an option

Save gnat42/86d84631383ae8db775928ccf011e31b to your computer and use it in GitHub Desktop.
dustin10/VichUploaderBundle Update with interfaces
commit 80f4ca24f7b4e9707d8bbf92bf3b4d592c7a289b
Author: Nathanael d. Noblet <[email protected]>
Date: Wed Sept 19 14:46:54 2024 -0600
General: Update vich uploader bundle to remove deprecation notices
diff --git a/composer.json b/composer.json
index e19d3b0cb..0c8486a97 100644
--- a/composer.json
+++ b/composer.json
@@ -143,7 +143,7 @@
"twig/string-extra": "*",
"twig/twig": "^3.1",
"twilio/sdk": "^5.16",
- "vich/uploader-bundle": "^1.0"
+ "vich/uploader-bundle": "dev-patch-add-interfaces"
},
"require-dev": {
"doctrine/data-fixtures": "^1.2",
@@ -232,6 +232,10 @@
{
"type" : "vcs",
"url" : "https://gitlab.com/prolegis/titleprotect-api-bundle.git"
+ },
+ {
+ "type" : "vcs",
+ "url" : "https://github.com/gnat42/VichUploaderBundle.git"
}
]
}
diff --git a/composer.lock b/composer.lock
index f052601b8..07350f616 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "a7d848a8df47f84463e8ded7490560b9",
+ "content-hash": "82d175c9016bf4023fa27e260aca3672",
"packages": [
{
"name": "beberlei/doctrineextensions",
@@ -11919,24 +11919,27 @@
},
{
"name": "symfony/intl",
- "version": "v7.0.8",
+ "version": "v7.3.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/intl.git",
- "reference": "4e4ffbfa65fae8bebb8e53712b3e493c85204612"
+ "reference": "754d5ad02c889e380efc5a74fa3f6cfe56b7454d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/intl/zipball/4e4ffbfa65fae8bebb8e53712b3e493c85204612",
- "reference": "4e4ffbfa65fae8bebb8e53712b3e493c85204612",
+ "url": "https://api.github.com/repos/symfony/intl/zipball/754d5ad02c889e380efc5a74fa3f6cfe56b7454d",
+ "reference": "754d5ad02c889e380efc5a74fa3f6cfe56b7454d",
"shasum": ""
},
"require": {
- "php": ">=8.2"
+ "php": ">=8.2",
+ "symfony/deprecation-contracts": "^2.5|^3"
+ },
+ "conflict": {
+ "symfony/string": "<7.1"
},
"require-dev": {
"symfony/filesystem": "^6.4|^7.0",
- "symfony/finder": "^6.4|^7.0",
"symfony/var-exporter": "^6.4|^7.0"
},
"type": "library",
@@ -11982,7 +11985,7 @@
"localization"
],
"support": {
- "source": "https://github.com/symfony/intl/tree/v7.0.8"
+ "source": "https://github.com/symfony/intl/tree/v7.3.3"
},
"funding": [
{
@@ -11993,12 +11996,16 @@
"url": "https://github.com/fabpot",
"type": "github"
},
+ {
+ "url": "https://github.com/nicolas-grekas",
+ "type": "github"
+ },
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
- "time": "2024-05-31T14:55:39+00:00"
+ "time": "2025-08-19T14:06:46+00:00"
},
{
"name": "symfony/lock",
@@ -14716,20 +14723,20 @@
},
{
"name": "symfony/string",
- "version": "v6.4.25",
+ "version": "v7.3.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
- "reference": "7cdec7edfaf2cdd9c18901e35bcf9653d6209ff1"
+ "reference": "17a426cce5fd1f0901fefa9b2a490d0038fd3c9c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/string/zipball/7cdec7edfaf2cdd9c18901e35bcf9653d6209ff1",
- "reference": "7cdec7edfaf2cdd9c18901e35bcf9653d6209ff1",
+ "url": "https://api.github.com/repos/symfony/string/zipball/17a426cce5fd1f0901fefa9b2a490d0038fd3c9c",
+ "reference": "17a426cce5fd1f0901fefa9b2a490d0038fd3c9c",
"shasum": ""
},
"require": {
- "php": ">=8.1",
+ "php": ">=8.2",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-intl-grapheme": "~1.0",
"symfony/polyfill-intl-normalizer": "~1.0",
@@ -14739,11 +14746,12 @@
"symfony/translation-contracts": "<2.5"
},
"require-dev": {
- "symfony/error-handler": "^5.4|^6.0|^7.0",
- "symfony/http-client": "^5.4|^6.0|^7.0",
- "symfony/intl": "^6.2|^7.0",
+ "symfony/emoji": "^7.1",
+ "symfony/error-handler": "^6.4|^7.0",
+ "symfony/http-client": "^6.4|^7.0",
+ "symfony/intl": "^6.4|^7.0",
"symfony/translation-contracts": "^2.5|^3.0",
- "symfony/var-exporter": "^5.4|^6.0|^7.0"
+ "symfony/var-exporter": "^6.4|^7.0"
},
"type": "library",
"autoload": {
@@ -14782,7 +14790,7 @@
"utf8"
],
"support": {
- "source": "https://github.com/symfony/string/tree/v6.4.25"
+ "source": "https://github.com/symfony/string/tree/v7.3.3"
},
"funding": [
{
@@ -14802,7 +14810,7 @@
"type": "tidelift"
}
],
- "time": "2025-08-22T12:33:20+00:00"
+ "time": "2025-08-25T06:35:40+00:00"
},
{
"name": "symfony/translation",
@@ -16041,64 +16049,65 @@
},
{
"name": "vich/uploader-bundle",
- "version": "1.23.1",
+ "version": "dev-patch-add-interfaces",
"source": {
"type": "git",
- "url": "https://github.com/dustin10/VichUploaderBundle.git",
- "reference": "7d20347fc92243ab8e261c0b6196c25b77c579f8"
+ "url": "https://github.com/gnat42/VichUploaderBundle.git",
+ "reference": "1ff84e2ae72f969051a224c14b8cf7222134a418"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/dustin10/VichUploaderBundle/zipball/7d20347fc92243ab8e261c0b6196c25b77c579f8",
- "reference": "7d20347fc92243ab8e261c0b6196c25b77c579f8",
+ "url": "https://api.github.com/repos/gnat42/VichUploaderBundle/zipball/1ff84e2ae72f969051a224c14b8cf7222134a418",
+ "reference": "1ff84e2ae72f969051a224c14b8cf7222134a418",
"shasum": ""
},
"require": {
- "doctrine/persistence": "^1.3 || ^2 || ^3",
+ "doctrine/persistence": "^3.0 || ^4.0",
"ext-simplexml": "*",
- "jms/metadata": "^1.7 || ^2.4",
- "php": "^7.3 || ^8.0",
- "symfony/config": "^4.4 || ^5.0 || ^6.0",
- "symfony/console": "^4.4 || ^5.0 || ^6.0",
- "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0",
- "symfony/event-dispatcher-contracts": "^1.1 || ^2.0 || ^3.0",
- "symfony/http-foundation": "^4.4 || ^5.0 || ^6.0",
- "symfony/http-kernel": "^4.4 || ^5.0 || ^6.0",
- "symfony/mime": "^4.4 || ^5.0 || ^6.0",
- "symfony/property-access": "^4.4 || ^5.0 || ^6.0",
- "symfony/string": "^5.0 || ^6.0"
+ "jms/metadata": "^2.4",
+ "php": "^8.1",
+ "symfony/config": "^5.4 || ^6.0 || ^7.0",
+ "symfony/console": "^5.4 || ^6.0 || ^7.0",
+ "symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
+ "symfony/event-dispatcher-contracts": "^3.1",
+ "symfony/http-foundation": "^5.4 || ^6.0 || ^7.0",
+ "symfony/http-kernel": "^5.4 || ^6.0 || ^7.0",
+ "symfony/mime": "^5.4 || ^6.0 || ^7.0",
+ "symfony/property-access": "^5.4 || ^6.0 || ^7.0",
+ "symfony/string": "^5.4 || ^6.0 || ^7.0"
},
"conflict": {
"doctrine/annotations": "<1.12",
"league/flysystem": "<2.0"
},
"require-dev": {
- "alcaeus/mongo-php-adapter": "^1.2",
- "doctrine/doctrine-bundle": "^2.2",
- "doctrine/mongodb-odm": "^1.2 || ^2.0",
- "doctrine/orm": "^2.7",
+ "dg/bypass-finals": "^1.9",
+ "doctrine/common": "^3.0",
+ "doctrine/doctrine-bundle": "^2.7",
+ "doctrine/mongodb-odm": "^2.4",
+ "doctrine/orm": "^2.13 || ^3.0",
"ext-sqlite3": "*",
"knplabs/knp-gaufrette-bundle": "dev-master",
- "league/flysystem-bundle": "^2.0",
- "league/flysystem-memory": "^2.0",
- "matthiasnoback/symfony-dependency-injection-test": "^4.1",
- "mikey179/vfsstream": "^1.6.8",
- "phpunit/phpunit": "^9.5",
- "symfony/asset": "^4.4 || ^5.0 || ^6.0",
- "symfony/browser-kit": "^4.4 || ^5.0 || ^6.0",
- "symfony/css-selector": "^4.4 || ^5.0 || ^6.0",
- "symfony/doctrine-bridge": "^4.4 || ^5.0 || ^6.0",
- "symfony/dom-crawler": "^4.4 || ^5.0 || ^6.0",
- "symfony/form": "^4.4 || ^5.0 || ^6.0",
- "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0",
- "symfony/phpunit-bridge": "^6.0",
- "symfony/security-csrf": "^4.4 || ^5.0 || ^6.0",
- "symfony/translation": "^4.4 || ^5.0 || ^6.0",
- "symfony/twig-bridge": "^4.4 || ^5.0 || ^6.0",
- "symfony/twig-bundle": "^4.4 || ^5.0 || ^6.0",
- "symfony/validator": "^4.4 || ^5.0 || ^6.0",
- "symfony/var-dumper": "^4.4 || ^5.0 || ^6.0",
- "symfony/yaml": "^4.4 || ^5.0 || ^6.0"
+ "league/flysystem-bundle": "^2.4 || ^3.0",
+ "league/flysystem-memory": "^2.0 || ^3.0",
+ "matthiasnoback/symfony-dependency-injection-test": "^5.1",
+ "mikey179/vfsstream": "^1.6.11",
+ "phpunit/phpunit": "^10.5 || ^11.5 || ^12.0",
+ "symfony/asset": "^5.4 || ^6.0 || ^7.0",
+ "symfony/browser-kit": "^5.4 || ^6.0 || ^7.0",
+ "symfony/css-selector": "^5.4 || ^6.0 || ^7.0",
+ "symfony/doctrine-bridge": "^5.4 || ^6.0 || ^7.0",
+ "symfony/dom-crawler": "^5.4 || ^6.0 || ^7.0",
+ "symfony/form": "^5.4 || ^6.0 || ^7.0",
+ "symfony/framework-bundle": "^5.4 || ^6.0 || ^7.0",
+ "symfony/phpunit-bridge": "^7.2",
+ "symfony/security-csrf": "^5.4 || ^6.0 || ^7.0",
+ "symfony/translation": "^5.4 || ^6.0 || ^7.0",
+ "symfony/twig-bridge": "^5.4 || ^6.0 || ^7.0",
+ "symfony/twig-bundle": "^5.4 || ^6.0 || ^7.0",
+ "symfony/validator": "^5.4 || ^6.0 || ^7.0",
+ "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0",
+ "symfony/yaml": "^5.4 || ^6.0 || ^7.0"
},
"suggest": {
"doctrine/doctrine-bundle": "For integration with Doctrine",
@@ -16108,7 +16117,6 @@
"knplabs/knp-gaufrette-bundle": "For integration with Gaufrette",
"league/flysystem-bundle": "For integration with Flysystem",
"liip/imagine-bundle": "To generate image thumbnails",
- "ocramius/proxy-manager": "To use lazy services",
"oneup/flysystem-bundle": "For integration with Flysystem",
"symfony/asset": "To generate better links",
"symfony/form": "To handle uploads in forms",
@@ -16117,7 +16125,7 @@
"type": "symfony-bundle",
"extra": {
"branch-alias": {
- "dev-master": "1.x-dev"
+ "dev-master": "2.x-dev"
}
},
"autoload": {
@@ -16125,7 +16133,12 @@
"Vich\\UploaderBundle\\": "src"
}
},
- "notification-url": "https://packagist.org/downloads/",
+ "autoload-dev": {
+ "psr-4": {
+ "Vich\\TestBundle\\": "tests/Fixtures/TestBundle/src",
+ "Vich\\UploaderBundle\\Tests\\": "tests"
+ }
+ },
"license": [
"MIT"
],
@@ -16142,10 +16155,9 @@
"upload"
],
"support": {
- "issues": "https://github.com/dustin10/VichUploaderBundle/issues",
- "source": "https://github.com/dustin10/VichUploaderBundle/tree/1.23.1"
+ "source": "https://github.com/gnat42/VichUploaderBundle/tree/patch-add-interfaces"
},
- "time": "2023-04-14T09:05:19+00:00"
+ "time": "2025-09-20T20:21:30+00:00"
},
{
"name": "web-token/jwt-core",
@@ -19656,6 +19668,7 @@
"minimum-stability": "stable",
"stability-flags": {
"prolegis/stewart-title-bundle": 20,
+ "vich/uploader-bundle": 20,
"nimut/phpunit-merger": 20
},
"prefer-stable": false,
diff --git a/src/Bundles/PracticeBundle/Controller/Settings/PrecedentStyleController.php b/src/Bundles/PracticeBundle/Controller/Settings/PrecedentStyleController.php
index d47c7be4d..daa1ba08d 100644
--- a/src/Bundles/PracticeBundle/Controller/Settings/PrecedentStyleController.php
+++ b/src/Bundles/PracticeBundle/Controller/Settings/PrecedentStyleController.php
@@ -26,7 +26,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Attribute\Route;
use Twig\Error\Error;
-use Vich\UploaderBundle\Handler\UploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
#[Route(path: '/settings/precedent-style')]
class PrecedentStyleController
@@ -148,7 +148,7 @@ class PrecedentStyleController
}
#[Route(path: '/duplicate/{name}', name: 'practiceSettingPrecedentStyleDuplicate')]
- public function duplicateAction(FirmSettingProvider $firmSettingProvider, UploadHandler $uploadHandler, string $name): RedirectResponse
+ public function duplicateAction(FirmSettingProvider $firmSettingProvider, UploadHandlerInterface $uploadHandler, string $name): RedirectResponse
{
try {
$setting = $firmSettingProvider->getSetting($this->getFirm(), Setting::PRECEDENT_STYLE);
diff --git a/src/Bundles/PracticeBundle/Form/Settings/PrecedentStyle/BaseStyleType.php b/src/Bundles/PracticeBundle/Form/Settings/PrecedentStyle/BaseStyleType.php
index 1f805c19b..fe1e73cf5 100644
--- a/src/Bundles/PracticeBundle/Form/Settings/PrecedentStyle/BaseStyleType.php
+++ b/src/Bundles/PracticeBundle/Form/Settings/PrecedentStyle/BaseStyleType.php
@@ -13,16 +13,13 @@ use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\File\UploadedFile;
-use Vich\UploaderBundle\Handler\UploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
use function in_array;
abstract class BaseStyleType extends AbstractType
{
- private UploadHandler $uploadHandler;
-
- public function __construct(UploadHandler $handler)
+ public function __construct(private readonly UploadHandlerInterface $uploadHandler)
{
- $this->uploadHandler = $handler;
}
public function buildForm(FormBuilderInterface $builder, array $options): void
diff --git a/src/Bundles/PracticeBundle/Form/Type/UserProfileType.php b/src/Bundles/PracticeBundle/Form/Type/UserProfileType.php
index e18564e68..9e7e10eb6 100644
--- a/src/Bundles/PracticeBundle/Form/Type/UserProfileType.php
+++ b/src/Bundles/PracticeBundle/Form/Type/UserProfileType.php
@@ -18,7 +18,6 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
-use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
diff --git a/src/Bundles/PracticeBundle/Resources/config/services.yml b/src/Bundles/PracticeBundle/Resources/config/services.yml
index a720421ee..d8142946b 100644
--- a/src/Bundles/PracticeBundle/Resources/config/services.yml
+++ b/src/Bundles/PracticeBundle/Resources/config/services.yml
@@ -41,6 +41,7 @@ services:
- '../../Events/User'
- '../../Form/Transformer'
- '../../Vich/SubDirectoryNamer.php'
+ - '../../Vich/FirmLogoNamer.php'
- '../../DataFixtures'
- '../../Authenticators/ThirdParty/ThirdPartyUserLoader.php'
- '../../Authenticators/Api/ApiUserLoader.php'
diff --git a/src/Bundles/RealEstateBundle/Resources/config/services.yml b/src/Bundles/RealEstateBundle/Resources/config/services.yml
index 6bc9e2b88..f3ca1345a 100644
--- a/src/Bundles/RealEstateBundle/Resources/config/services.yml
+++ b/src/Bundles/RealEstateBundle/Resources/config/services.yml
@@ -27,7 +27,9 @@ services:
NS\RealEstateBundle\:
resource: '../../*'
- exclude: '../../Controller'
+ exclude:
+ - '../../Controller'
+ - '../../Vich/OntarioRegistrationDocumentDirectoryNamer.php'
NS\RealEstateBundle\Controller\:
resource: '../../Controller/*'
diff --git a/src/CoreDomain/Firm/Communication/Email/SendEmailCommunication.php b/src/CoreDomain/Firm/Communication/Email/SendEmailCommunication.php
index cccc0f39c..5cf32fd80 100644
--- a/src/CoreDomain/Firm/Communication/Email/SendEmailCommunication.php
+++ b/src/CoreDomain/Firm/Communication/Email/SendEmailCommunication.php
@@ -16,13 +16,13 @@ use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email;
-use Vich\UploaderBundle\Handler\UploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
class SendEmailCommunication
{
private HtmlConverter $htmlConverter;
- private UploadHandler $uploadHandler;
+ private UploadHandlerInterface $uploadHandler;
private EntityManagerInterface $entityManager;
@@ -31,7 +31,7 @@ class SendEmailCommunication
protected LoggerInterface $logger;
private Address $fromEmailAddress;
- public function __construct(HtmlConverter $htmlConverter, UploadHandler $uploadHandler, EntityManagerInterface $entityManager, MailerInterface $mailer, LoggerInterface $logger, Address $fromEmailAddress)
+ public function __construct(HtmlConverter $htmlConverter, UploadHandlerInterface $uploadHandler, EntityManagerInterface $entityManager, MailerInterface $mailer, LoggerInterface $logger, Address $fromEmailAddress)
{
$this->htmlConverter = $htmlConverter;
$this->uploadHandler = $uploadHandler;
diff --git a/src/CoreDomain/Firm/Communication/Fax/SendFaxCommunication.php b/src/CoreDomain/Firm/Communication/Fax/SendFaxCommunication.php
index a4ced99eb..f5b0f50f7 100644
--- a/src/CoreDomain/Firm/Communication/Fax/SendFaxCommunication.php
+++ b/src/CoreDomain/Firm/Communication/Fax/SendFaxCommunication.php
@@ -17,13 +17,13 @@ use NS\CoreDomain\Firm\MatterTargetInterface;
use NS\CoreDomain\Firm\User;
use Prolegis\DocuFaxBundle\Client\DocumoFaxClient;
use Prolegis\DocuFaxBundle\Fax\FaxRequest;
-use Vich\UploaderBundle\Handler\UploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
class SendFaxCommunication
{
private EntityManagerInterface $entityManager;
- private UploadHandler $uploadHandler;
+ private UploadHandlerInterface $uploadHandler;
private DocumoFaxClient $documoFaxClient;
@@ -32,7 +32,7 @@ class SendFaxCommunication
private DocumentUrlGenerator $documentUrlGenerator;
public function __construct(EntityManagerInterface $entityManager,
- UploadHandler $uploadHandler,
+ UploadHandlerInterface $uploadHandler,
PhoneNumberUtil $phoneNumberUtil,
DocumentUrlGenerator $documentUrlGenerator,
DocumoFaxClient $documoFaxClient
diff --git a/src/CoreDomain/Firm/Document.php b/src/CoreDomain/Firm/Document.php
index 56e0be1da..b1f20e554 100644
--- a/src/CoreDomain/Firm/Document.php
+++ b/src/CoreDomain/Firm/Document.php
@@ -14,9 +14,7 @@ use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
-/**
- * @Vich\Uploadable
- */
+#[Vich\Uploadable]
abstract class Document
{
public const int
@@ -24,9 +22,7 @@ abstract class Document
private ?int $id = null;
- /**
- * @Vich\UploadableField(mapping="documents", fileNameProperty="fileName")
- */
+ #[Vich\UploadableField(mapping: 'documents', fileNameProperty: 'fileName')]
protected ?File $uploadedFile = null;
protected ?string $fileName = null;
diff --git a/src/CoreDomain/Firm/Document/DocumentTemplateManager.php b/src/CoreDomain/Firm/Document/DocumentTemplateManager.php
index 8851c1a1b..150cadbe0 100644
--- a/src/CoreDomain/Firm/Document/DocumentTemplateManager.php
+++ b/src/CoreDomain/Firm/Document/DocumentTemplateManager.php
@@ -14,7 +14,7 @@ use NS\CoreDomain\PdfEditor\Preview\PreviewBuilder;
use NS\CoreDomain\PdfEditor\SelectedSourceFile;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\File\File;
-use Vich\UploaderBundle\Handler\UploadHandler as VichUploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
abstract class DocumentTemplateManager
{
@@ -31,7 +31,7 @@ abstract class DocumentTemplateManager
protected LegalDocumentRepository $legalDocumentRepository,
protected LoggerInterface $logger,
protected PreviewBuilder $previewBuilder,
- protected VichUploadHandler $fileHandler,
+ protected UploadHandlerInterface $fileHandler,
protected string $dataDir
)
{
diff --git a/src/CoreDomain/Firm/Document/PDF/StyleConfigToFooterStyle.php b/src/CoreDomain/Firm/Document/PDF/StyleConfigToFooterStyle.php
index 0e33c4583..07a866420 100644
--- a/src/CoreDomain/Firm/Document/PDF/StyleConfigToFooterStyle.php
+++ b/src/CoreDomain/Firm/Document/PDF/StyleConfigToFooterStyle.php
@@ -5,18 +5,13 @@ namespace NS\CoreDomain\Firm\Document\PDF;
use NS\CoreDomain\Firm\Settings\PrecedentStyle\StyleConfig;
use Twig\Environment;
use Twig\Error\Error;
-use Vich\UploaderBundle\Handler\UploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
class StyleConfigToFooterStyle
{
- private UploadHandler $uploadHandler;
-
- private Environment $twig;
-
- public function __construct(UploadHandler $uploadHandler, Environment $twig)
+ public function __construct(private UploadHandlerInterface $uploadHandler, private Environment $twig)
{
- $this->uploadHandler = $uploadHandler;
- $this->twig = $twig;
+
}
public function convert(StyleConfig $config, bool $includePageNumbers = false, bool $excludeFooterContent = false, ?array $renderParams = []): ?PrintOptions
diff --git a/src/CoreDomain/Firm/Firm.php b/src/CoreDomain/Firm/Firm.php
index ac8f58b80..b7d7b6f15 100644
--- a/src/CoreDomain/Firm/Firm.php
+++ b/src/CoreDomain/Firm/Firm.php
@@ -17,9 +17,7 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
-/**
- * @Vich\Uploadable()
- */
+#[Vich\Uploadable]
class Firm
{
public const string
@@ -131,9 +129,7 @@ class Firm
private ?string $referralSource = null;
- /**
- * @Vich\UploadableField(mapping="firmLogos", fileNameProperty="logo")
- */
+ #[Vich\UploadableField(mapping: 'firmLogos', fileNameProperty: 'logo')]
private ?File $logoFile = null;
private ?string $logo = null;
diff --git a/src/CoreDomain/Firm/FormAi/DocumentSubmission.php b/src/CoreDomain/Firm/FormAi/DocumentSubmission.php
index bb307a75d..f92488de6 100644
--- a/src/CoreDomain/Firm/FormAi/DocumentSubmission.php
+++ b/src/CoreDomain/Firm/FormAi/DocumentSubmission.php
@@ -16,9 +16,7 @@ use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
-/**
- * @Vich\Uploadable()
- */
+#[Vich\Uploadable]
class DocumentSubmission implements PdfDocumentPreviewInterface, FirmSubObjectDirectoryInterface
{
public const string
@@ -39,9 +37,7 @@ class DocumentSubmission implements PdfDocumentPreviewInterface, FirmSubObjectDi
private ?string $type = null;
private string $status = self::STATUS_SUBMITTED;
- /**
- * @Vich\UploadableField(mapping="form_ai_document", fileNameProperty="fileName")
- */
+ #[Vich\UploadableField(mapping: 'form_ai_document', fileNameProperty: 'fileName')]
private null|UploadedFile|File $uploadedFile = null;
private ?string $fileName = null;
private ?string $checksum = null;
diff --git a/src/CoreDomain/Firm/IdentificationDocument.php b/src/CoreDomain/Firm/IdentificationDocument.php
index d97958c70..d1b8837d0 100644
--- a/src/CoreDomain/Firm/IdentificationDocument.php
+++ b/src/CoreDomain/Firm/IdentificationDocument.php
@@ -8,9 +8,7 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use JMS\Serializer\Annotation as JMS;
-/**
- * @Vich\Uploadable
- */
+#[Vich\Uploadable]
abstract class IdentificationDocument
{
public const string
@@ -114,16 +112,12 @@ abstract class IdentificationDocument
protected DateTime $createdAt;
protected ?DateTime $updatedAt = null;
- /**
- * @Vich\UploadableField(mapping="identity", fileNameProperty="frontImageFilename")
- */
+ #[Vich\UploadableField(mapping: 'identity', fileNameProperty: 'frontImageFilename')]
protected ?File $frontImageFile = null;
protected ?string $frontImageFilename = null;
- /**
- * @Vich\UploadableField(mapping="identity", fileNameProperty="backImageFilename")
- */
+ #[Vich\UploadableField(mapping: 'identity', fileNameProperty: 'backImageFilename')]
protected ?File $backImageFile = null;
protected ?string $backImageFilename = null;
diff --git a/src/CoreDomain/Firm/LegalDocument.php b/src/CoreDomain/Firm/LegalDocument.php
index 7c903d553..6cd53e919 100644
--- a/src/CoreDomain/Firm/LegalDocument.php
+++ b/src/CoreDomain/Firm/LegalDocument.php
@@ -10,9 +10,8 @@ use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* This stores the Firm's configuration of a PDF document which could have originated as a MortgageDocument or any other uploaded/edited PDF
- *
- * @Vich\Uploadable()
*/
+#[Vich\Uploadable]
class LegalDocument implements EditablePdfDocumentInterface, PdfDocumentInterface
{
private ?int $id = null;
@@ -24,9 +23,7 @@ class LegalDocument implements EditablePdfDocumentInterface, PdfDocumentInterfac
private string $name;
- /**
- * @Vich\UploadableField(mapping="legal_docs", fileNameProperty="document")
- */
+ #[Vich\UploadableField(mapping: 'legal_docs', fileNameProperty: 'document')]
private File|UploadedFile|null $uploadedFile = null;
private ?string $document = null;
diff --git a/src/CoreDomain/Firm/Repository/LegalDocumentRepository.php b/src/CoreDomain/Firm/Repository/LegalDocumentRepository.php
index eb97c462e..892c8354f 100644
--- a/src/CoreDomain/Firm/Repository/LegalDocumentRepository.php
+++ b/src/CoreDomain/Firm/Repository/LegalDocumentRepository.php
@@ -11,14 +11,14 @@ use NS\CoreDomain\Firm\Firm;
use NS\CoreDomain\Firm\LegalDocument;
use NS\CoreDomain\PdfEditor\Preview\PreviewBuilder;
use Symfony\Component\HttpFoundation\File\UploadedFile;
-use Vich\UploaderBundle\Handler\UploadHandler as VichUploadHandlerAlias;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
class LegalDocumentRepository extends ServiceEntityRepository
{
- private PreviewBuilder $previewBuilder;
- private VichUploadHandlerAlias $uploadHandler;
+ private PreviewBuilder $previewBuilder;
+ private UploadHandlerInterface $uploadHandler;
- public function __construct(ManagerRegistry $registry, PreviewBuilder $previewBuilder, VichUploadHandlerAlias $uploadHandler)
+ public function __construct(ManagerRegistry $registry, PreviewBuilder $previewBuilder, UploadHandlerInterface $uploadHandler)
{
parent::__construct($registry, LegalDocument::class);
$this->previewBuilder = $previewBuilder;
diff --git a/src/CoreDomain/Firm/Settings/PrecedentStyle/Footer.php b/src/CoreDomain/Firm/Settings/PrecedentStyle/Footer.php
index 3ad1406d3..ecefc5c70 100644
--- a/src/CoreDomain/Firm/Settings/PrecedentStyle/Footer.php
+++ b/src/CoreDomain/Firm/Settings/PrecedentStyle/Footer.php
@@ -5,9 +5,7 @@ namespace NS\CoreDomain\Firm\Settings\PrecedentStyle;
use Exception;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
-/**
- * @Vich\Uploadable
- */
+#[Vich\Uploadable]
class Footer extends Header
{
protected ?string $numberStyle = 'full';
diff --git a/src/CoreDomain/Firm/Settings/PrecedentStyle/Header.php b/src/CoreDomain/Firm/Settings/PrecedentStyle/Header.php
index f4e3b5591..29e1de2ae 100644
--- a/src/CoreDomain/Firm/Settings/PrecedentStyle/Header.php
+++ b/src/CoreDomain/Firm/Settings/PrecedentStyle/Header.php
@@ -9,9 +9,7 @@ use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
-/**
- * @Vich\Uploadable
- */
+#[Vich\Uploadable]
class Header implements Serializable
{
protected ?string $height = null;
@@ -25,9 +23,7 @@ class Header implements Serializable
protected ?Font $font = null;
- /**
- * @Vich\UploadableField(mapping="logos", fileNameProperty="image")
- */
+ #[Vich\UploadableField(mapping: 'logos', fileNameProperty: 'image')]
protected ?File $uploadedFile = null;
protected ?string $image = null;
diff --git a/src/CoreDomain/Firm/Settings/PrecedentStyle/Page.php b/src/CoreDomain/Firm/Settings/PrecedentStyle/Page.php
index 0dfa09a8e..e95591351 100644
--- a/src/CoreDomain/Firm/Settings/PrecedentStyle/Page.php
+++ b/src/CoreDomain/Firm/Settings/PrecedentStyle/Page.php
@@ -8,9 +8,7 @@ use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
-/**
- * @Vich\Uploadable
- */
+#[Vich\Uploadable]
class Page implements Serializable
{
protected ?Font $font = null;
@@ -35,9 +33,7 @@ class Page implements Serializable
protected ?string $textAlignment = null;
- /**
- * @Vich\UploadableField(mapping="logos", fileNameProperty="image")
- */
+ #[Vich\UploadableField(mapping: 'logos', fileNameProperty: 'image')]
protected ?File $uploadedFile = null;
protected ?string $image = null;
diff --git a/src/CoreDomain/Firm/Settings/PrecedentStyle/StyleConfig.php b/src/CoreDomain/Firm/Settings/PrecedentStyle/StyleConfig.php
index a79ce8151..6b000d394 100644
--- a/src/CoreDomain/Firm/Settings/PrecedentStyle/StyleConfig.php
+++ b/src/CoreDomain/Firm/Settings/PrecedentStyle/StyleConfig.php
@@ -3,7 +3,7 @@
namespace NS\CoreDomain\Firm\Settings\PrecedentStyle;
use NS\CoreDomain\Firm\Settings\Font;
-use Vich\UploaderBundle\Handler\UploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
/**
* This class governs print formatting for precedents, in contrast to NS\CoreDomain\Firm\Document\Precedent\PrecedentStylesheet which contains stylesheets for content
@@ -27,7 +27,7 @@ class StyleConfig
$this->defaultForModule = $defaultForModule ?? [];
}
- public function duplicate(UploadHandler $uploadHandler): self
+ public function duplicate(UploadHandlerInterface $uploadHandler): self
{
$header = $this->header ? $this->createAndMoveNewFile($uploadHandler, $this->header) : null;
$page = $this->page ? $this->createAndMoveNewFile($uploadHandler, $this->page) : null;
@@ -152,7 +152,7 @@ class StyleConfig
};
}
- private function createAndMoveNewFile(UploadHandler $uploadHandler, Header|Footer|Page $section): Page|Header|Footer
+ private function createAndMoveNewFile(UploadHandlerInterface $uploadHandler, Header|Footer|Page $section): Page|Header|Footer
{
$clonedSection = clone $section;
diff --git a/src/CoreDomain/Firm/User.php b/src/CoreDomain/Firm/User.php
index b2da22729..4128b7e30 100644
--- a/src/CoreDomain/Firm/User.php
+++ b/src/CoreDomain/Firm/User.php
@@ -24,9 +24,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
-/**
- * @Vich\Uploadable()
- */
+#[Vich\Uploadable]
#[UniqueEntity(fields: ['email', 'thirdParty'], message: 'Email address already exists, perhaps reset your password?', groups: ['registration'])]
class User implements LoginLinkUserInterface, Serializable, EmailTwoFactorInterfaceAlias, TrustedDeviceInterface, EquatableInterface, LegacyPasswordAuthenticatedUserInterface, WitnessInterface, CommissionerOrNotaryInterface
{
@@ -103,16 +101,12 @@ class User implements LoginLinkUserInterface, Serializable, EmailTwoFactorInterf
private string $type;
- /**
- * @Vich\UploadableField(mapping="signatures", fileNameProperty="signature")
- */
+ #[Vich\UploadableField(mapping: 'signatures', fileNameProperty: 'signature')]
private ?File $signatureFile = null;
private ?string $signature = null;
- /**
- * @Vich\UploadableField(mapping="signatures", fileNameProperty="profilePicture")
- */
+ #[Vich\UploadableField(mapping: 'signatures', fileNameProperty: 'profilePicture')]
private ?File $profilePictureFile = null;
private ?string $profilePicture = null;
diff --git a/src/CoreDomain/RealEstate/Document/RealEstateDocumentTemplateManager.php b/src/CoreDomain/RealEstate/Document/RealEstateDocumentTemplateManager.php
index 954d2a2e6..97d59746a 100644
--- a/src/CoreDomain/RealEstate/Document/RealEstateDocumentTemplateManager.php
+++ b/src/CoreDomain/RealEstate/Document/RealEstateDocumentTemplateManager.php
@@ -15,20 +15,21 @@ use NS\CoreDomain\RealEstate\Mortgages\MortgageDocument;
use NS\CoreDomain\RealEstate\Repository\FormDocumentRepository;
use NS\CoreDomain\RealEstate\Repository\Mortgages\MortgageDocumentRepository;
use Psr\Log\LoggerInterface;
-use Vich\UploaderBundle\Handler\UploadHandler as VichUploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
class RealEstateDocumentTemplateManager extends DocumentTemplateManager
{
public function __construct(
protected MortgageDocumentRepository $repository,
- protected EntityManagerInterface $entityManager,
- protected LegalDocumentRepository $legalDocumentRepository,
- protected FormDocumentRepository $formDocumentRepository,
- protected LoggerInterface $logger,
- protected PreviewBuilder $previewBuilder,
- protected VichUploadHandler $fileHandler,
- protected string $dataDir
- ) {
+ protected EntityManagerInterface $entityManager,
+ protected LegalDocumentRepository $legalDocumentRepository,
+ protected FormDocumentRepository $formDocumentRepository,
+ protected LoggerInterface $logger,
+ protected PreviewBuilder $previewBuilder,
+ protected UploadHandlerInterface $fileHandler,
+ protected string $dataDir
+ )
+ {
parent::__construct($entityManager, $legalDocumentRepository, $logger, $previewBuilder, $fileHandler, $dataDir);
}
diff --git a/src/CoreDomain/RealEstate/FormDocument.php b/src/CoreDomain/RealEstate/FormDocument.php
index dd9a1bb0b..d22e55c1b 100644
--- a/src/CoreDomain/RealEstate/FormDocument.php
+++ b/src/CoreDomain/RealEstate/FormDocument.php
@@ -9,16 +9,12 @@ use NS\CoreDomain\PdfEditor\PdfDocumentInterface;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
-/**
- * @Vich\Uploadable
- */
+#[Vich\Uploadable]
class FormDocument implements ProlegisSourceDocumentInterface, PdfDocumentInterface
{
private ?int $id = null;
- /**
- * @Vich\UploadableField(mapping="realestate_forms", fileNameProperty="document")
- */
+ #[Vich\UploadableField(mapping: 'realestate_forms', fileNameProperty: 'document')]
protected ?File $uploadedFile = null;
private string $name;
diff --git a/src/CoreDomain/RealEstate/Mortgages/MortgageDocument.php b/src/CoreDomain/RealEstate/Mortgages/MortgageDocument.php
index 593dbc257..dd3d0a5b8 100644
--- a/src/CoreDomain/RealEstate/Mortgages/MortgageDocument.php
+++ b/src/CoreDomain/RealEstate/Mortgages/MortgageDocument.php
@@ -15,8 +15,8 @@ use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* Represents a document provided by a MortgageProvider
* i.e. TD/RBC etc, 99% of these are automatically downloaded
- * @Vich\Uploadable()
*/
+#[Vich\Uploadable]
class MortgageDocument implements ProlegisSourceDocumentInterface, PdfDocumentInterface
{
private ?int $id = null;
@@ -24,9 +24,7 @@ class MortgageDocument implements ProlegisSourceDocumentInterface, PdfDocumentIn
private string $url;
private string $document;
- /**
- * @Vich\UploadableField(mapping="re_mortgage_documents", fileNameProperty="document")
- */
+ #[Vich\UploadableField(mapping: 're_mortgage_documents', fileNameProperty: 'document')]
private File|UploadedFile|null $uploadedFile = null;
private string $checksum;
diff --git a/src/CoreDomain/RealEstate/OntarioRegistrationDocument.php b/src/CoreDomain/RealEstate/OntarioRegistrationDocument.php
index 859d0770e..3d4aa495c 100644
--- a/src/CoreDomain/RealEstate/OntarioRegistrationDocument.php
+++ b/src/CoreDomain/RealEstate/OntarioRegistrationDocument.php
@@ -6,9 +6,7 @@ use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
-/**
- * @Vich\Uploadable()
- */
+#[Vich\Uploadable]
class OntarioRegistrationDocument
{
private ?int $id = null;
@@ -16,9 +14,7 @@ class OntarioRegistrationDocument
private int $documentNumber;
private ?string $documentName = null;
- /**
- * @Vich\UploadableField(mapping="on_title_registration", fileNameProperty="documentName")
- */
+ #[Vich\UploadableField(mapping: 'on_title_registration', fileNameProperty: 'documentName')]
private ?File $uploadedFile = null;
public function __construct(Registration $registration, int $documentNumber, UploadedFile $uploadedDocument)
diff --git a/src/CoreDomain/RealEstate/Registration.php b/src/CoreDomain/RealEstate/Registration.php
index c9e07d9e7..ed32d5798 100644
--- a/src/CoreDomain/RealEstate/Registration.php
+++ b/src/CoreDomain/RealEstate/Registration.php
@@ -13,9 +13,7 @@ use Vich\UploaderBundle\Mapping\Annotation as Vich;
use function array_slice;
use function count;
-/**
- * @Vich\Uploadable
- */
+#[Vich\Uploadable]
class Registration
{
public const string
@@ -69,12 +67,7 @@ class Registration
private ?array $details = null;
- /**
- * @Vich\UploadableField(mapping="title_registration", fileNameProperty="document")
- *
- *
- * Unmapped field
- */
+ #[Vich\UploadableField(mapping: 'title_registration', fileNameProperty: 'document')]
private ?File $uploadedDocument = null;
/**
diff --git a/src/CoreDomain/RealEstate/Repository/Mortgages/MortgageDocumentRepository.php b/src/CoreDomain/RealEstate/Repository/Mortgages/MortgageDocumentRepository.php
index e96a85b77..996e9b839 100644
--- a/src/CoreDomain/RealEstate/Repository/Mortgages/MortgageDocumentRepository.php
+++ b/src/CoreDomain/RealEstate/Repository/Mortgages/MortgageDocumentRepository.php
@@ -13,15 +13,15 @@ use NS\CoreDomain\PdfEditor\PdfDocumentInterface;
use NS\CoreDomain\PdfEditor\Preview\PreviewBuilder;
use NS\CoreDomain\RealEstate\Mortgages\MortgageDocument;
use Symfony\Component\HttpFoundation\File\UploadedFile;
-use Vich\UploaderBundle\Handler\UploadHandler as VichUploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
class MortgageDocumentRepository extends ServiceEntityRepository
{
private LegalDocumentRepository $legalDocumentRepository;
- private VichUploadHandler $fileHandler;
- private PreviewBuilder $previewBuilder;
+ private UploadHandlerInterface $fileHandler;
+ private PreviewBuilder $previewBuilder;
- public function __construct(ManagerRegistry $registry, LegalDocumentRepository $legalDocumentRepository, PreviewBuilder $previewBuilder, VichUploadHandler $fileHandler)
+ public function __construct(ManagerRegistry $registry, LegalDocumentRepository $legalDocumentRepository, PreviewBuilder $previewBuilder, UploadHandlerInterface $fileHandler)
{
parent::__construct($registry, MortgageDocument::class);
$this->legalDocumentRepository = $legalDocumentRepository;
@@ -130,7 +130,9 @@ class MortgageDocumentRepository extends ServiceEntityRepository
$this->createQueryBuilder('md')
->delete()
->where('md.id NOT IN (:ids) AND md.checksum IN (:checksums)')
- ->setParameter('checksums', array_map(static function ($item) {return $item['checksum'];}, $duplicates))
+ ->setParameter('checksums', array_map(static function ($item) {
+ return $item['checksum'];
+ }, $duplicates))
->setParameter('ids', array_keys($duplicates))
->getQuery()
->execute();
diff --git a/tests/unit/CoreDomain/Firm/Communication/Email/SendEmailCommunicationTest.php b/tests/unit/CoreDomain/Firm/Communication/Email/SendEmailCommunicationTest.php
index 60c6ba08b..0d1f39211 100644
--- a/tests/unit/CoreDomain/Firm/Communication/Email/SendEmailCommunicationTest.php
+++ b/tests/unit/CoreDomain/Firm/Communication/Email/SendEmailCommunicationTest.php
@@ -23,44 +23,35 @@ use Symfony\Component\Mailer\Exception\TransportException;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email;
-use Vich\UploaderBundle\Handler\UploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
class SendEmailCommunicationTest extends TestCase
{
- private HtmlConverter $htmlConverter;
+ private UploadHandlerInterface|MockObject $uploadHandler;
- /** @var UploadHandler|MockObject */
- private UploadHandler $uploadHandler;
+ private EntityManagerInterface|MockObject $entityManager;
- /** @var EntityManagerInterface|MockObject */
- private EntityManagerInterface $entityManager;
-
- /** @var MailerInterface|MockObject */
- private MailerInterface $mailer;
+ private MailerInterface|MockObject $mailer;
private SendEmailCommunication $communicationService;
- /** @var MatterTargetInterface|MockObject */
- private MatterTargetInterface $matterTarget;
+ private MatterTargetInterface|MockObject $matterTarget;
- /** @var User|MockObject */
- private User $user;
+ private User|MockObject $user;
- /** @var Firm|MockObject */
- private Firm $practice;
+ private Firm|MockObject $practice;
- /** @var LoggerInterface|MockObject */
- private LoggerInterface $logger;
+ private LoggerInterface|MockObject $logger;
public function setUp(): void
{
$this->entityManager = $this->createMock(EntityManagerInterface::class);
- $this->uploadHandler = $this->createMock(UploadHandler::class);
+ $this->uploadHandler = $this->createMock(UploadHandlerInterface::class);
$this->mailer = $this->createMock(MailerInterface::class);
$this->logger = $this->createMock(LoggerInterface::class);
- $this->htmlConverter = new HtmlConverter(['strip_tags' => true]);
+ $htmlConverter = new HtmlConverter(['strip_tags' => true]);
- $this->communicationService = new SendEmailCommunication($this->htmlConverter, $this->uploadHandler, $this->entityManager, $this->mailer, $this->logger, Address::create('[email protected]'));
+ $this->communicationService = new SendEmailCommunication($htmlConverter, $this->uploadHandler, $this->entityManager, $this->mailer, $this->logger, Address::create('[email protected]'));
$this->matterTarget = $this->createMock(MatterTargetInterface::class);
diff --git a/tests/unit/CoreDomain/Firm/Communication/Fax/SendFaxCommunicationTest.php b/tests/unit/CoreDomain/Firm/Communication/Fax/SendFaxCommunicationTest.php
index a1e213d41..e6169f6ab 100644
--- a/tests/unit/CoreDomain/Firm/Communication/Fax/SendFaxCommunicationTest.php
+++ b/tests/unit/CoreDomain/Firm/Communication/Fax/SendFaxCommunicationTest.php
@@ -16,47 +16,39 @@ use NS\CoreDomain\Firm\Firm;
use NS\CoreDomain\Firm\Matter;
use NS\CoreDomain\Firm\MatterTargetInterface;
use NS\CoreDomain\Firm\User;
+use NS\SiteBundle\Vich\DecoratedVichUploadHandlerInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Prolegis\DocuFaxBundle\Client\DocumoFaxClient;
use Prolegis\DocuFaxBundle\Fax\FaxResponse;
-use Vich\UploaderBundle\Handler\UploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
class SendFaxCommunicationTest extends TestCase
{
- /** @var EntityManagerInterface|MockObject */
- private EntityManagerInterface $entityManager;
+ private EntityManagerInterface|MockObject $entityManager;
- /** @var UploadHandler|MockObject */
- private UploadHandler $uploadHandler;
+ private UploadHandlerInterface|MockObject $uploadHandler;
- /** @var DocumoFaxClient|MockObject */
- private DocumoFaxClient $documoFaxClient;
+ private DocumoFaxClient|MockObject $documoFaxClient;
- private PhoneNumberUtil $phoneUtil;
-
- /** @var DocumentUrlGenerator|MockObject */
- private DocumentUrlGenerator $documentUrlGenerator;
+ private DocumentUrlGenerator|MockObject $documentUrlGenerator;
private SendFaxCommunication $communicationService;
- /** @var MatterTargetInterface|MockObject */
- private MatterTargetInterface $matterTarget;
+ private MatterTargetInterface|MockObject $matterTarget;
- /** @var User|MockObject */
- private User $user;
+ private User|MockObject $user;
- /** @var Firm|MockObject */
- private Firm $firm;
+ private Firm|MockObject $firm;
public function setUp(): void
{
$this->entityManager = $this->createMock(EntityManagerInterface::class);
- $this->uploadHandler = $this->createMock(UploadHandler::class);
- $this->phoneUtil = PhoneNumberUtil::getInstance();
+ $this->uploadHandler = $this->createMock(UploadHandlerInterface::class);
+ $phoneUtil = PhoneNumberUtil::getInstance();
$this->documentUrlGenerator = $this->createMock(DocumentUrlGenerator::class);
$this->documoFaxClient = $this->createMock(DocumoFaxClient::class);
- $this->communicationService = new SendFaxCommunication($this->entityManager, $this->uploadHandler, $this->phoneUtil, $this->documentUrlGenerator, $this->documoFaxClient);
+ $this->communicationService = new SendFaxCommunication($this->entityManager, $this->uploadHandler, $phoneUtil, $this->documentUrlGenerator, $this->documoFaxClient);
$this->matterTarget = $this->createMock(MatterTargetInterface::class);
$this->firm = $this->createMock(Firm::class);
@@ -72,7 +64,7 @@ class SendFaxCommunicationTest extends TestCase
public function testSendEmptyRecipientsThrowsException(): void
{
$this->expectException(InvalidRecipientException::class);
- $this->communicationService->send($this->firm, $this->user, new FaxCommunicationRequest('subject', [],[],[],[],'coverPage'), [], $this->matterTarget);
+ $this->communicationService->send($this->firm, $this->user, new FaxCommunicationRequest('subject', [], [], [], [], 'coverPage'), [], $this->matterTarget);
}
/**
diff --git a/tests/unit/CoreDomain/Firm/Document/AbstractTestDocumentTemplateManager.php b/tests/unit/CoreDomain/Firm/Document/AbstractTestDocumentTemplateManager.php
index e04080e70..63c894536 100644
--- a/tests/unit/CoreDomain/Firm/Document/AbstractTestDocumentTemplateManager.php
+++ b/tests/unit/CoreDomain/Firm/Document/AbstractTestDocumentTemplateManager.php
@@ -15,12 +15,13 @@ use NS\CoreDomain\PdfEditor\PdfDocumentCommonInterface;
use NS\CoreDomain\PdfEditor\Preview\PreviewBuilder;
use NS\CoreDomain\PdfEditor\SelectedSourceFile;
use NS\CoreDomain\RealEstate\Repository\FormDocumentRepository;
+use NS\SiteBundle\Vich\DecoratedVichUploadHandlerInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\File;
-use Vich\UploaderBundle\Handler\UploadHandler as VichUploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
abstract class AbstractTestDocumentTemplateManager extends TestCase
{
@@ -29,8 +30,8 @@ abstract class AbstractTestDocumentTemplateManager extends TestCase
protected Firm|MockObject $firm;
protected LoggerInterface|MockObject $logger;
protected EntityManagerInterface|MockObject $entityManager;
- protected PreviewBuilder|MockObject $previewBuilder;
- protected VichUploadHandler|MockObject $vichUploadHandler;
+ protected PreviewBuilder|MockObject $previewBuilder;
+ protected UploadHandlerInterface|MockObject $vichUploadHandler;
protected DocumentTemplateManager $templateManager;
protected string $dataDir;
@@ -49,7 +50,7 @@ abstract class AbstractTestDocumentTemplateManager extends TestCase
$this->entityManager = $this->createMock(EntityManager::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->previewBuilder = $this->createMock(PreviewBuilder::class);
- $this->vichUploadHandler = $this->createMock(VichUploadHandler::class);
+ $this->vichUploadHandler = $this->createMock(UploadHandlerInterface::class);
$this->firm = $this->createMock(Firm::class);
}
diff --git a/tests/unit/CoreDomain/Firm/Document/PDF/StyleConfigToFooterStyleTest.php b/tests/unit/CoreDomain/Firm/Document/PDF/StyleConfigToFooterStyleTest.php
index 10d631b9a..eabe6d7f6 100644
--- a/tests/unit/CoreDomain/Firm/Document/PDF/StyleConfigToFooterStyleTest.php
+++ b/tests/unit/CoreDomain/Firm/Document/PDF/StyleConfigToFooterStyleTest.php
@@ -12,22 +12,19 @@ use Symfony\Component\HttpFoundation\File\File;
use Twig\Environment;
use Twig\Error\Error;
use Twig\TemplateWrapper;
-use Vich\UploaderBundle\Handler\UploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
class StyleConfigToFooterStyleTest extends TestCase
{
- /** @var StyleConfigToFooterStyle */
- private $converter;
+ private StyleConfigToFooterStyle $converter;
- /** @var UploadHandler|MockObject */
- private $uploadHandler;
+ private UploadHandlerInterface|MockObject $uploadHandler;
- /** @var Environment|MockObject */
- private $twig;
+ private Environment|MockObject $twig;
protected function setUp(): void
{
- $this->uploadHandler = $this->createMock(UploadHandler::class);
+ $this->uploadHandler = $this->createMock(UploadHandlerInterface::class);
$this->twig = $this->createMock(Environment::class);
$this->converter = new StyleConfigToFooterStyle($this->uploadHandler, $this->twig);
diff --git a/tests/unit/CoreDomain/General/Document/Pdf/GeneralMatterDocumentTemplateManagerTest.php b/tests/unit/CoreDomain/General/Document/Pdf/GeneralMatterDocumentTemplateManagerTest.php
index 9ff725d17..127ce0e53 100644
--- a/tests/unit/CoreDomain/General/Document/Pdf/GeneralMatterDocumentTemplateManagerTest.php
+++ b/tests/unit/CoreDomain/General/Document/Pdf/GeneralMatterDocumentTemplateManagerTest.php
@@ -11,16 +11,16 @@ use NS\CoreDomain\PdfEditor\Preview\PreviewBuilder;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
-use Vich\UploaderBundle\Handler\UploadHandler as VichUploadHandler;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
class GeneralMatterDocumentTemplateManagerTest extends TestCase
{
protected EntityManagerInterface&MockObject $entityManager;
protected LegalDocumentRepository&MockObject $legalDocumentRepository;
protected LoggerInterface $logger;
- protected PreviewBuilder&MockObject $previewBuilder;
- protected VichUploadHandler&MockObject $fileHandler;
- protected string $dataDir;
+ protected PreviewBuilder&MockObject $previewBuilder;
+ protected UploadHandlerInterface&MockObject $fileHandler;
+ protected string $dataDir;
protected function setUp(): void
{
@@ -28,7 +28,7 @@ class GeneralMatterDocumentTemplateManagerTest extends TestCase
$this->legalDocumentRepository = $this->createMock(LegalDocumentRepository::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->previewBuilder = $this->createMock(PreviewBuilder::class);
- $this->fileHandler = $this->createMock(VichUploadHandler::class);
+ $this->fileHandler = $this->createMock(UploadHandlerInterface::class);
}
public function testSimpleMethods(): void
diff --git a/tests/unit/PracticeBundle/Form/AllFormTest.php b/tests/unit/PracticeBundle/Form/AllFormTest.php
index 2db9eae7b..055d8c488 100644
--- a/tests/unit/PracticeBundle/Form/AllFormTest.php
+++ b/tests/unit/PracticeBundle/Form/AllFormTest.php
@@ -25,15 +25,19 @@ use NS\PracticeBundle\Form\Type\LandingPageChoiceType;
use NS\PracticeBundle\Form\Type\MatterType;
use NS\CoreDomain\Firm\Repository\MatterRepository;
use NS\SiteBundle\PostalCode\AddressCompleteChecker;
+use NS\SiteBundle\Vich\DecoratedVichImageType;
+use NS\SiteBundle\Vich\DecoratedVichPropertyMappingFactory;
+use NS\SiteBundle\Vich\DecoratedVichUploadHandlerInterface;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Form\Extension\Validator\Type\FormTypeValidatorExtension;
use Symfony\Component\Form\PreloadedExtension;
use Symfony\Component\Form\Test\TypeTestCase;
use Symfony\Component\Validator\Validation;
use Vich\UploaderBundle\Form\Type\VichImageType;
+use Vich\UploaderBundle\Handler\UploadHandlerInterface;
use Vich\UploaderBundle\Mapping\PropertyMappingFactory;
+use Vich\UploaderBundle\Mapping\PropertyMappingFactoryInterface;
use Vich\UploaderBundle\Storage\StorageInterface;
-use Vich\UploaderBundle\Handler\UploadHandler;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Routing\RouterInterface;
use NS\PracticeBundle\Form\Type\UserProfileType;
@@ -160,8 +164,8 @@ class AllFormTest extends TypeTestCase
$this->addressChecker->method('search');
$storage = $this->createMock(StorageInterface::class);
- $handler = $this->createMock(UploadHandler::class);
- $factory = $this->createMock(PropertyMappingFactory::class);
+ $handler = $this->createMock(UploadHandlerInterface::class);
+ $factory = $this->createMock(PropertyMappingFactoryInterface::class);
$cacheManager = $this->createMock(CacheManager::class);
$vichImage = new VichImageType($storage, $handler, $factory, null, $cacheManager);
$this->practice = Firm::createLawFirm('name');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment