Skip to content
Permalink
Browse files

CommentedOutFunctionFixer - fix for multiple calls (#238)

  • Loading branch information
kubawerlos committed Mar 1, 2020
1 parent 49886f7 commit 5b1b925191591ffaaa2af6aaa4aad9e91648ba9b
Showing with 15 additions and 1 deletion.
  1. +1 −1 README.md
  2. +1 −0 src/Fixer/CommentedOutFunctionFixer.php
  3. +13 −0 tests/Fixer/CommentedOutFunctionFixerTest.php
@@ -9,7 +9,7 @@
[![Travis CI build status](https://img.shields.io/travis/kubawerlos/php-cs-fixer-custom-fixers/master.svg?label=Travis+CI)](https://travis-ci.org/kubawerlos/php-cs-fixer-custom-fixers)
[![AppVeyor build status](https://img.shields.io/appveyor/ci/kubawerlos/php-cs-fixer-custom-fixers/master?label=AppVeyor)](https://ci.appveyor.com/project/kubawerlos/php-cs-fixer-custom-fixers)
[![Code coverage](https://img.shields.io/coveralls/github/kubawerlos/php-cs-fixer-custom-fixers/master.svg)](https://coveralls.io/github/kubawerlos/php-cs-fixer-custom-fixers?branch=master)
![Tests](https://img.shields.io/badge/tests-1989-brightgreen.svg)
![Tests](https://img.shields.io/badge/tests-1990-brightgreen.svg)
[![Mutation testing badge](https://badge.stryker-mutator.io/github.com/kubawerlos/php-cs-fixer-custom-fixers/master)](https://stryker-mutator.github.io)
[![Psalm type coverage](https://shepherd.dev/github/kubawerlos/php-cs-fixer-custom-fixers/coverage.svg)](https://shepherd.dev/github/kubawerlos/php-cs-fixer-custom-fixers)

@@ -203,6 +203,7 @@ private function fixBlockWithSingleLineComments(Tokens $tokens, int $indexStart,

$newTokens = Tokens::fromCode('<?php ' . $codeToCommentOut);
$newTokens->clearAt(0);
$newTokens->clearEmptyTokens();

$tokens->overrideRange(
$indexStart,
@@ -59,6 +59,19 @@ public static function provideFixCases(): iterable
',
];

yield 'multiple' => [
'<?php
// var_dump($a);
// var_dump($b);
// var_dump($c);
',
'<?php
var_dump($a);
var_dump($b);
var_dump($c);
',
];

yield 'after few empty lines' => [
'<?php
' . '

0 comments on commit 5b1b925

Please sign in to comment.
You can’t perform that action at this time.