|
| 1 | +<?php declare(strict_types=1); |
| 2 | +/* |
| 3 | + * This file is part of phpunit/php-code-coverage. |
| 4 | + * |
| 5 | + * (c) Sebastian Bergmann <[email protected]> |
| 6 | + * |
| 7 | + * For the full copyright and license information, please view the LICENSE |
| 8 | + * file that was distributed with this source code. |
| 9 | + */ |
| 10 | +namespace SebastianBergmann\CodeCoverage\Test\Target; |
| 11 | + |
| 12 | +/** |
| 13 | + * @immutable |
| 14 | + * |
| 15 | + * @no-named-arguments Parameter names are not covered by the backward compatibility promise for phpunit/php-code-coverage |
| 16 | + */ |
| 17 | +abstract class Target |
| 18 | +{ |
| 19 | + /** |
| 20 | + * @param non-empty-string $namespace |
| 21 | + */ |
| 22 | + public static function forNamespace(string $namespace): Namespace_ |
| 23 | + { |
| 24 | + return new Namespace_($namespace); |
| 25 | + } |
| 26 | + |
| 27 | + /** |
| 28 | + * @param class-string $className |
| 29 | + */ |
| 30 | + public static function forClass(string $className): Class_ |
| 31 | + { |
| 32 | + return new Class_($className); |
| 33 | + } |
| 34 | + |
| 35 | + /** |
| 36 | + * @param class-string $className |
| 37 | + * @param non-empty-string $methodName |
| 38 | + */ |
| 39 | + public static function forMethod(string $className, string $methodName): Method |
| 40 | + { |
| 41 | + return new Method($className, $methodName); |
| 42 | + } |
| 43 | + |
| 44 | + /** |
| 45 | + * @param class-string $interfaceName |
| 46 | + */ |
| 47 | + public static function forClassesThatImplementInterface(string $interfaceName): ClassesThatImplementInterface |
| 48 | + { |
| 49 | + return new ClassesThatImplementInterface($interfaceName); |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * @param class-string $className |
| 54 | + */ |
| 55 | + public static function forClassesThatExtendClass(string $className): ClassesThatExtendClass |
| 56 | + { |
| 57 | + return new ClassesThatExtendClass($className); |
| 58 | + } |
| 59 | + |
| 60 | + /** |
| 61 | + * @param non-empty-string $functionName |
| 62 | + */ |
| 63 | + public static function forFunction(string $functionName): Function_ |
| 64 | + { |
| 65 | + return new Function_($functionName); |
| 66 | + } |
| 67 | + |
| 68 | + public function isNamespace(): bool |
| 69 | + { |
| 70 | + return false; |
| 71 | + } |
| 72 | + |
| 73 | + public function isClass(): bool |
| 74 | + { |
| 75 | + return false; |
| 76 | + } |
| 77 | + |
| 78 | + public function isMethod(): bool |
| 79 | + { |
| 80 | + return false; |
| 81 | + } |
| 82 | + |
| 83 | + public function isClassesThatImplementInterface(): bool |
| 84 | + { |
| 85 | + return false; |
| 86 | + } |
| 87 | + |
| 88 | + public function isClassesThatExtendClass(): bool |
| 89 | + { |
| 90 | + return false; |
| 91 | + } |
| 92 | + |
| 93 | + public function isFunction(): bool |
| 94 | + { |
| 95 | + return false; |
| 96 | + } |
| 97 | +} |
0 commit comments