Skip to content

Commit c1f9fd2

Browse files
author
plumthedev
committed
Update php-cs-fixer configuration files to add for project header.
1 parent 8579f28 commit c1f9fd2

File tree

4 files changed

+53
-4
lines changed

4 files changed

+53
-4
lines changed

.php_cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
<?php
2+
$projectHeader = <<<'HEADER'
3+
Yii2 PHP CS Fixer Config
4+
5+
@author Kacper Pruszynski (plumthedev)
6+
@link https://github.com/plumthedev/yii2-php-cs-fixer-config
7+
@copyright Copyright (c) 2019 plumthedev
8+
@license https://github.com/plumthedev/yii2-php-cs-fixer-config/blob/master/LICENSE
9+
@version 1.0.1
10+
HEADER;
211

312
use plumthedev\PhpCsFixer\Config;
413

514
$csConfig = Config::create();
6-
$csConfigFinder = $csConfig->getFinder();
715

8-
$csConfigFinder->in(__DIR__);
16+
// CS Config setup
17+
$csConfig->mergeRules([
18+
'header_comment' => [
19+
'header' => $projectHeader,
20+
'commentType' => 'PHPDoc',
21+
'separate' => 'bottom',
22+
]
23+
]);
24+
25+
// CS Finder setup
26+
$csConfigFinder = $csConfig->getFinder();
27+
$csConfigFinder->in(__DIR__); // set current project directory
928
$csConfig->setFinder($csConfigFinder);
1029

1130
return $csConfig;

src/Finder.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<?php
22
/**
3-
* Yii2 PHP CS Fixer Config - Finder.
3+
* Yii2 PHP CS Fixer Config
44
*
55
* @author Kacper Pruszynski (plumthedev)
6-
* @version 1.0.0
6+
* @link https://github.com/plumthedev/yii2-php-cs-fixer-config
7+
* @copyright Copyright (c) 2019 plumthedev
8+
* @license https://github.com/plumthedev/yii2-php-cs-fixer-config/blob/master/LICENSE
9+
* @version 1.0.1
710
*/
811

912
namespace plumthedev\PhpCsFixer;

tests/ConfigTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<?php
2+
/**
3+
* Yii2 PHP CS Fixer Config
4+
*
5+
* @author Kacper Pruszynski (plumthedev)
6+
* @link https://github.com/plumthedev/yii2-php-cs-fixer-config
7+
* @copyright Copyright (c) 2019 plumthedev
8+
* @license https://github.com/plumthedev/yii2-php-cs-fixer-config/blob/master/LICENSE
9+
* @version 1.0.1
10+
*/
211

312
namespace plumthedev\PhpCsFixer\tests;
413

@@ -43,4 +52,13 @@ public function testHasValidName()
4352
{
4453
$this->assertEquals('yii2-php-cs-fixer-config', $this->csFixerConfig->getName());
4554
}
55+
56+
public function testMergeSuccessfully()
57+
{
58+
$this->csFixerConfig->mergeRules([
59+
'mergedSuccessfully' => true,
60+
]);
61+
$csFixerConfigRules = $this->csFixerConfig->getRules();
62+
$this->assertTrue($csFixerConfigRules['mergedSuccessfully']);
63+
}
4664
}

tests/FinderTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<?php
2+
/**
3+
* Yii2 PHP CS Fixer Config
4+
*
5+
* @author Kacper Pruszynski (plumthedev)
6+
* @link https://github.com/plumthedev/yii2-php-cs-fixer-config
7+
* @copyright Copyright (c) 2019 plumthedev
8+
* @license https://github.com/plumthedev/yii2-php-cs-fixer-config/blob/master/LICENSE
9+
* @version 1.0.1
10+
*/
211

312
namespace plumthedev\PhpCsFixer\tests;
413

0 commit comments

Comments
 (0)