‪TYPO3CMS  9.5
ClassNameMatcherFixture.php
Go to the documentation of this file.
1 <?php
2 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 
18 use TYPO3\CMS\Backend\Console\Application;
19 use TYPO3\CMS\Backend\Console\Application as App1;
20 use TYPO3\CMS\Backend\Console\Application as App2;
21 use TYPO3\CMS\Backend\Console\Application as App3;
22 use TYPO3\CMS\Backend\Console as Con;
23 use TYPO3\CMS\Backend\Console as Con2;
24 
28 class ‪ClassNameMatcherFixture extends App2 implements App3, Con\Application
29 {
30  public function ‪aMethod(Con2\Application $app)
31  {
32  // Matches
33  $foo = new \RemoveXSS();
34  $foo = new \RemoveXSS;
35  (new \RemoveXSS())->foo();
36  $foo = new \TYPO3\CMS\Backend\Console\Application();
37  (new \TYPO3\CMS\Backend\Console\Application)->foo();
38  Application::foo();
39  App1::bar();
40  \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(App2::class)->foo();
41  $bar = \RemoveXSS::class;
42  if ($baz instanceof App3) {
43  $foo = 'dummy';
44  }
45  \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Console\\Application')->foo();
46  \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Backend\Console\Application')->foo();
47 
48  // No matches:
49  // Not a matching name - mind the "2" at end
50  \RemoveXSS2::class;
51  // Prefixing with \ is not allowed and would throw exception in makeInstance anyway
52  \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\TYPO3\\CMS\\Backend\\Console\\Application')->foo();
53  \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\\TYPO3\CMS\Backend\Console\Application')->foo();
54  // @extensionScannerIgnoreLine
55  $bar = \RemoveXSS::class;
56  }
57 }
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures
Definition: ArrayDimensionMatcherFixture.php:3
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures\ClassNameMatcherFixture
Definition: ClassNameMatcherFixture.php:29
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures\ClassNameMatcherFixture\aMethod
‪aMethod(Con2\Application $app)
Definition: ClassNameMatcherFixture.php:30