Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php | ||
| 5 | class EnvironmentFinderTest extends FileSystemTest | ||
|  | |||
| 6 | { | ||
| 7 | /** | ||
| 8 | * @test | ||
| 9 | */ | ||
| 10 | View Code Duplication | public function it_can_find_an_environment_varaible_in_a_dot_env_file() | |
| 17 | |||
| 18 | /** | ||
| 19 | * @test | ||
| 20 | */ | ||
| 21 | View Code Duplication | public function it_can_find_multiple_environment_varaibles_in_a_dot_env_file() | |
| 29 | |||
| 30 | /** | ||
| 31 | * @test | ||
| 32 | */ | ||
| 33 | public function it_can_find_zero_environment_varaibles_in_a_dot_env_file() | ||
| 39 | |||
| 40 | /** | ||
| 41 | * @test | ||
| 42 | */ | ||
| 43 | View Code Duplication | public function it_can_find_an_environment_varaible_in_a_dot_env_example_file() | |
| 50 | |||
| 51 | /** | ||
| 52 | * @test | ||
| 53 | */ | ||
| 54 | View Code Duplication | public function it_can_find_multiple_environment_varaibles_in_a_dot_env_example_file() | |
| 62 | |||
| 63 | /** | ||
| 64 | * @test | ||
| 65 | */ | ||
| 66 | public function it_can_find_zero_environment_varaibles_in_a_dot_env_example_file() | ||
| 72 | |||
| 73 | /** | ||
| 74 | * @test | ||
| 75 | */ | ||
| 76 | View Code Duplication | public function it_can_find_an_environment_varaible_in_a_php_file() | |
| 83 | |||
| 84 | /** | ||
| 85 | * @test | ||
| 86 | */ | ||
| 87 | View Code Duplication | public function it_can_find_multiple_environment_varaibles_in_a_php_file() | |
| 95 | |||
| 96 | /** | ||
| 97 | * @test | ||
| 98 | */ | ||
| 99 | public function it_can_find_zero_environment_varaibles_in_a_php_file() | ||
| 105 | |||
| 106 | /** | ||
| 107 | * @test | ||
| 108 | */ | ||
| 109 | public function if_the_php_file_doesnt_exist_then_no_results_are_found() | ||
| 114 | |||
| 115 | /** | ||
| 116 | * @test | ||
| 117 | */ | ||
| 118 | public function if_the_dot_env_file_doesnt_exist_then_no_results_are_found() | ||
| 123 | |||
| 124 | /** | ||
| 125 | * @test | ||
| 126 | */ | ||
| 127 | public function if_the_dont_env_example_file_doesnt_exist_then_no_results_are_found() | ||
| 132 | |||
| 133 | public function setup() | ||
| 138 | } | ||
| 139 | 
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.