‪TYPO3CMS  ‪main
MethodCallMatcherFixture.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 
24 {
25  public function ‪aMethod(): void
26  {
27  // Match: confirmMsg() needs at least 4 args
28  $foo->confirmMsg('arg1', 'arg2', 'arg3', 'arg4');
29  // Match: confirmMsg() can be called with 5 args (1 optional)
30  $foo->confirmMsg('arg1', 'arg2', 'arg3', 'arg4', 'arg5');
31  // Match: With argument unpacking we don't know how many args are actually given
32  ‪$args = [ 'arg1', 'arg2' ];
33  $foo->confirmMsg(...‪$args);
34  // Match: Too many args but some could be empty arrays
35  $foo->confirmMsg(...$arg1, ...$arg2, ...$arg3, ...$arg4, ...$arg5, ...$arg6);
36 
37  \confirmMsg();
38 
39  // No match: Only 3 args given
40  $foo->confirmMsg('arg1', 'arg2', 'arg3');
41  // No match: Too many arguments given
42  $foo->confirmMsg('arg1', 'arg2', 'arg3', 'arg4', 'arg5', 'arg6');
43  // No match: Only 3 args given and called statically
44  $foo::confirmMsg('arg1', 'arg2', 'arg3');
45  // No match: Called statically
46  $foo::confirmMsg('arg1', 'arg2', 'arg3', 'arg4');
47  // No match: Called statically
48  $foo::confirmMsg('arg1', 'arg2', 'arg3', 'arg4', 'arg5');
49  // No match: Line ignored
50  // @extensionScannerIgnoreLine
51  $foo->confirmMsg('arg1', 'arg2', 'arg3', 'arg4');
52  // @extensionScannerIgnoreLine
53  // No match: Line ignored and annotation belongs to code line below
54  $foo->confirmMsg('arg1', 'arg2', 'arg3', 'arg4');
55  // No match since @extensionScannerIgnoreLine annotation is used
56  $foo->confirmMsg('arg1', 'arg2', 'arg3', 'arg4');
57  // @extensionScannerIgnoreLine
58  $foo->confirmMsg('arg1', 'arg2', 'arg3', 'arg4', 'arg5');
59  // @extensionScannerIgnoreLine
60  $bar->bar($foo->confirmMsg('arg1', 'arg2', 'arg3', 'arg4', 'arg5'));
61  }
62 }
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures\MethodCallMatcherFixture\aMethod
‪aMethod()
Definition: MethodCallMatcherFixture.php:25
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures
Definition: AbstractCoreMatcherFixture.php:18
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures\MethodCallMatcherFixture
Definition: MethodCallMatcherFixture.php:24
‪$args
‪$args
Definition: validateRstFiles.php:258