‪TYPO3CMS  10.4
ClassNameMatcherFixture.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use TYPO3\CMS\Backend\Console\Application;
21 use TYPO3\CMS\Backend\Console\Application as App1;
22 use TYPO3\CMS\Backend\Console\Application as App2;
23 use TYPO3\CMS\Backend\Console\Application as App3;
24 use TYPO3\CMS\Backend\Console as Con;
25 use TYPO3\CMS\Backend\Console as Con2;
26 
30 class ‪ClassNameMatcherFixture extends App2 implements App3, Con\Application
31 {
32  public function ‪aMethod(Con2\Application $app)
33  {
34  // Matches
35  $foo = new \RemoveXSS();
36  $foo = new \RemoveXSS();
37  (new \RemoveXSS())->foo();
38  $foo = new \TYPO3\CMS\Backend\Console\Application();
39  (new \TYPO3\CMS\Backend\Console\Application())->foo();
40  Application::foo();
41  App1::bar();
42  \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(App2::class)->foo();
43  $bar = \RemoveXSS::class;
44  if ($baz instanceof App3) {
45  $foo = 'dummy';
46  }
47  \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Console\\Application')->foo();
48  \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Console\Application')->foo();
49 
50  // No matches:
51  // Not a matching name - mind the "2" at end
52  \RemoveXSS2::class;
53  // Prefixing with \ is not allowed and would throw exception in makeInstance anyway
54  \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\TYPO3\\CMS\\Backend\\Console\\Application')->foo();
55  \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\\TYPO3\CMS\Backend\Console\Application')->foo();
56  // @extensionScannerIgnoreLine
57  $bar = \RemoveXSS::class;
58  }
59 }
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures
Definition: ArrayDimensionMatcherFixture.php:18
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures\ClassNameMatcherFixture
Definition: ClassNameMatcherFixture.php:31
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures\ClassNameMatcherFixture\aMethod
‪aMethod(Con2\Application $app)
Definition: ClassNameMatcherFixture.php:32