Skip to content

Commit

Permalink
NoPhpStormGeneratedCommentFixer - handle more comments (#973)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Apr 8, 2024
1 parent 795a936 commit d3f5e8d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG for PHP CS Fixer: custom fixers

## v3.22.0
- NoPhpStormGeneratedCommentFixer - handle more comments

## v3.21.0
- Deprecate PhpdocArrayStyleFixer - use "phpdoc_array_type"
- NoUselessParenthesisFixer - keep parentheses around `and`, `xor` and `or`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Latest stable version](https://img.shields.io/packagist/v/kubawerlos/php-cs-fixer-custom-fixers.svg?label=current%20version)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)
[![PHP version](https://img.shields.io/packagist/php-v/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://php.net)
[![License](https://img.shields.io/github/license/kubawerlos/php-cs-fixer-custom-fixers.svg)](LICENSE)
![Tests](https://img.shields.io/badge/tests-3542-brightgreen.svg)
![Tests](https://img.shields.io/badge/tests-3543-brightgreen.svg)
[![Downloads](https://img.shields.io/packagist/dt/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)

[![CI status](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml/badge.svg)](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml)
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer/NoPhpStormGeneratedCommentFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function fix(\SplFileInfo $file, Tokens $tokens): void
continue;
}

if (!Preg::match('/\\*\\h+Created by PhpStorm/i', $tokens[$index]->getContent(), $matches)) {
if (!Preg::match('/\\*\\h+Created by( JetBrains)? PhpStorm/i', $tokens[$index]->getContent(), $matches)) {
continue;
}

Expand Down
17 changes: 17 additions & 0 deletions tests/Fixer/NoPhpStormGeneratedCommentFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,22 @@ class Bar {}
namespace Foo;
',
];

yield [
<<<'PHP'
<?php
$foo = 2;
PHP,
<<<'PHP'
<?php
/**
* Created by JetBrains PhpStorm.
* User: john
* Date: 1/1/11
* Time: 11:11 AM
*/
$foo = 2;
PHP,
];
}
}

0 comments on commit d3f5e8d

Please sign in to comment.