[TASK] Remove custom InvalidArgumentException 62/62862/3
authorMarkus Klein <markus.klein@typo3.org>
Mon, 13 Jan 2020 12:18:40 +0000 (13:18 +0100)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Mon, 13 Jan 2020 12:52:16 +0000 (13:52 +0100)
The name clash with the PHP native exception is not beneficial.
We replace it with \InvalidArgumentException.

Resolves: #90101
Releases: master
Change-Id: Icc53bcca2dcc24352f4edd4f2e9ef66df7bdfdd5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62862
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Felix P. <f.pachowsky@neusta.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Felix P. <f.pachowsky@neusta.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/core/Classes/Exception/InvalidArgumentException.php [deleted file]
typo3/sysext/core/Classes/Mail/MailMessage.php
typo3/sysext/core/Tests/Unit/Mail/MailMessageTest.php

diff --git a/typo3/sysext/core/Classes/Exception/InvalidArgumentException.php b/typo3/sysext/core/Classes/Exception/InvalidArgumentException.php
deleted file mode 100644 (file)
index a70752d..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-declare(strict_types = 1);
-
-namespace TYPO3\CMS\Core\Exception;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-class InvalidArgumentException extends \RuntimeException
-{
-}
index 1a56dd7..056e17f 100644 (file)
@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Core\Mail;
 
 use Symfony\Component\Mime\Address;
 use Symfony\Component\Mime\Email;
-use TYPO3\CMS\Core\Exception\InvalidArgumentException;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -310,7 +309,7 @@ class MailMessage extends Email
     protected function checkArguments($addresses, string $name = null): void
     {
         if ($name !== null && !is_string($addresses)) {
-            throw new InvalidArgumentException('The combination of a name and an array of addresses is invalid.', 1570543657);
+            throw new \InvalidArgumentException('The combination of a name and an array of addresses is invalid.', 1570543657);
         }
     }
 }
index ce092b4..d3e35e8 100644 (file)
@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Core\Tests\Unit\Mail;
  */
 
 use Symfony\Component\Mime\Address;
-use TYPO3\CMS\Core\Exception\InvalidArgumentException;
 use TYPO3\CMS\Core\Mail\MailMessage;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
@@ -300,7 +299,7 @@ class MailMessageTest extends UnitTestCase
      */
     public function exceptionIsThrownForInvalidArgumentCombinations(string $method): void
     {
-        $this->expectException(InvalidArgumentException::class);
+        $this->expectException(\InvalidArgumentException::class);
         $this->expectExceptionCode(1570543657);
         $this->subject->{$method}(['foo@example.com'], 'A name');
     }