| Conditions | 1 |
| Paths | 1 |
| Total Lines | 58 |
| Code Lines | 37 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 24 | public function provideGetIncluded(): iterable |
||
| 25 | { |
||
| 26 | yield "no includes" => [__FILE__, [], []]; |
||
| 27 | yield "simple include" => [__FILE__, ['anywhere/here.php'], [__DIR__ . '/anywhere/here.php']]; |
||
| 28 | yield "simple absolute include" => [__FILE__, ['/anywhere/here.php'], ['/anywhere/here.php']]; |
||
| 29 | yield "simple String_ include" => [ |
||
| 30 | __FILE__, |
||
| 31 | [new String_('anywhere/here.php')], |
||
| 32 | [__DIR__ . '/anywhere/here.php'] |
||
| 33 | ]; |
||
| 34 | yield "absolute include by DIR" => [ |
||
| 35 | __FILE__, |
||
| 36 | [ |
||
| 37 | new Concat( |
||
| 38 | new Dir(), |
||
| 39 | new String_('anywhere/here.php') |
||
| 40 | ) |
||
| 41 | ], |
||
| 42 | [__DIR__ . 'anywhere/here.php'] |
||
| 43 | ]; |
||
| 44 | yield "absolute include by FILE" => [ |
||
| 45 | __FILE__, |
||
| 46 | [ |
||
| 47 | new Concat( |
||
| 48 | new File(), |
||
| 49 | new String_('anywhere/here.php') |
||
| 50 | ) |
||
| 51 | ], |
||
| 52 | [__FILE__ . 'anywhere/here.php'] |
||
| 53 | ]; |
||
| 54 | yield "includes with variables" => [ |
||
| 55 | __FILE__, |
||
| 56 | [ |
||
| 57 | new Concat( |
||
| 58 | new ConstFetch(new Name("NAME")), |
||
| 59 | new String_('.php') |
||
| 60 | ) |
||
| 61 | ], |
||
| 62 | [ |
||
| 63 | __DIR__ . DIRECTORY_SEPARATOR . 'DefinedSymbolCollectorFunctionalTest.php', |
||
| 64 | __DIR__ . DIRECTORY_SEPARATOR . 'DefinedSymbolCollectorTest.php', |
||
| 65 | __DIR__ . DIRECTORY_SEPARATOR . 'UsedSymbolCollectorFunctionalTest.php', |
||
| 66 | __DIR__ . DIRECTORY_SEPARATOR . 'UsedSymbolCollectorTest.php' |
||
| 67 | ] |
||
| 68 | ]; |
||
| 69 | yield "includes with constants" => [ |
||
| 70 | __FILE__, |
||
| 71 | [ |
||
| 72 | new Concat( |
||
| 73 | new Variable(new Name('name')), |
||
| 74 | new String_('.php') |
||
| 75 | ) |
||
| 76 | ], |
||
| 77 | [ |
||
| 78 | __DIR__ . DIRECTORY_SEPARATOR . 'DefinedSymbolCollectorFunctionalTest.php', |
||
| 79 | __DIR__ . DIRECTORY_SEPARATOR . 'DefinedSymbolCollectorTest.php', |
||
| 80 | __DIR__ . DIRECTORY_SEPARATOR . 'UsedSymbolCollectorFunctionalTest.php', |
||
| 81 | __DIR__ . DIRECTORY_SEPARATOR . 'UsedSymbolCollectorTest.php' |
||
| 82 | ] |
||
| 150 |