Skip to content

Commit

Permalink
Hotfix: rtrim with a charlist removes more than 'Test'. (#41)
Browse files Browse the repository at this point in the history
* Hotfix: rtrim with a charlist removes more than 'Test'.

* Call the functions globally.
  • Loading branch information
rickprent authored Jan 3, 2019
1 parent 27427b8 commit 0d50d25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Hostnet/Sniffs/Commenting/AtCoversCounterPartSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function process(File $phpcs_file, $stack_ptr)

$test_namespace = $this->getNamespaceFromFile($phpcs_file->getFilename());
$counter_part_namespace = str_replace('Tests\\', '', $test_namespace);
$counter_part_namespace = rtrim($counter_part_namespace, 'Test');
$counter_part_namespace = \substr($counter_part_namespace, 0, \strrpos($counter_part_namespace, 'Test'));
$expected_covers_namespace = "\\$counter_part_namespace";
if (!\class_exists($counter_part_namespace) || \in_array($expected_covers_namespace, $namespaces, true)) {
return count($tokens) + 1;
Expand Down

0 comments on commit 0d50d25

Please sign in to comment.