Skip to content

Commit c8cc5dc

Browse files
author
Igor Chepurnoy
committed
added php-cs-fixer
1 parent 28446d7 commit c8cc5dc

File tree

8 files changed

+56
-28
lines changed

8 files changed

+56
-28
lines changed

.php_cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->exclude('vendor')
5+
->in([__DIR__]);
6+
7+
$config = PhpCsFixer\Config::create()
8+
->setUsingCache(false)
9+
->setRules([
10+
'@Symfony' => true,
11+
'phpdoc_align' => false,
12+
'phpdoc_summary' => false,
13+
'phpdoc_inline_tag' => false,
14+
'pre_increment' => false,
15+
'heredoc_to_nowdoc' => false,
16+
'cast_spaces' => false,
17+
'include' => false,
18+
'phpdoc_no_package' => false,
19+
'concat_space' => ['spacing' => 'one'],
20+
'ordered_imports' => true,
21+
'array_syntax' => ['syntax' => 'short'],
22+
])
23+
->setFinder($finder);
24+
25+
return $config;

.travis.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
11
language: php
22

33
php:
4-
- 5.4
5-
- 5.5
6-
- 5.6
7-
- 7.0
8-
- hhvm
9-
10-
# run build against hhvm but allow them to fail
11-
# http://docs.travis-ci.com/user/build-configuration/#Rows-That-are-Allowed-To-Fail
12-
matrix:
13-
fast_finish: true
14-
allow_failures:
15-
- php: hhvm
4+
- 7.1
165

176
# faster builds on new travis setup not using sudo
187
sudo: false
@@ -24,9 +13,10 @@ cache:
2413

2514
install:
2615
- travis_retry composer self-update && composer --version
27-
- travis_retry composer global require "fxp/composer-asset-plugin:~1.1.1"
16+
- travis_retry composer global require "fxp/composer-asset-plugin:^1.2.0"
2817
- export PATH="$HOME/.composer/vendor/bin:$PATH"
2918
- travis_retry composer install --prefer-dist --no-interaction
3019

3120
script:
32-
- phpunit --verbose $PHPUNIT_FLAGS
21+
- vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --dry-run --diff
22+
- phpunit --verbose $PHPUNIT_FLAGS

IonSlider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
/**
1111
* Class IonSlider
12+
*
1213
* @package yii2mod\slider
1314
*/
1415
class IonSlider extends InputWidget
@@ -71,4 +72,4 @@ public function getPluginOptions()
7172

7273
return Json::encode($this->pluginOptions);
7374
}
74-
}
75+
}

IonSliderAsset.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
/**
88
* Class IonSliderAsset
9+
*
910
* @package yii2mod\slider
1011
*/
1112
class IonSliderAsset extends AssetBundle
@@ -21,7 +22,7 @@ class IonSliderAsset extends AssetBundle
2122
public $css = [
2223
'css/normalize.css',
2324
'css/ion.rangeSlider.css',
24-
'css/ion.rangeSlider.skinHTML5.css'
25+
'css/ion.rangeSlider.skinHTML5.css',
2526
];
2627

2728
/**
@@ -35,6 +36,6 @@ class IonSliderAsset extends AssetBundle
3536
* @var array
3637
*/
3738
public $depends = [
38-
'yii\web\YiiAsset'
39+
'yii\web\YiiAsset',
3940
];
4041
}

composer.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
"name": "yii2mod/yii2-ion-slider",
33
"description": "Ion.RangeSlider Widget for Yii 2",
44
"type": "yii2-extension",
5-
"keywords": ["yii2", "yii2 ion slider", "yii2 slider", "yii2 range slider"],
5+
"keywords": [
6+
"yii2",
7+
"yii2 ion slider",
8+
"yii2 slider",
9+
"yii2 range slider"
10+
],
611
"license": "MIT",
712
"authors": [
813
{
@@ -14,6 +19,9 @@
1419
"yiisoft/yii2": "*",
1520
"bower-asset/ionrangeslider": "*"
1621
},
22+
"require-dev": {
23+
"friendsofphp/php-cs-fixer": "~2.0"
24+
},
1725
"autoload": {
1826
"psr-4": {
1927
"yii2mod\\slider\\": ""

tests/IonSliderTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/**
1010
* Class IonSliderTest
11+
*
1112
* @package yii2mod\slider\tests
1213
*/
1314
class IonSliderTest extends TestCase
@@ -26,8 +27,8 @@ public function testRenderSliderWithModel()
2627
'to' => 18,
2728
'step' => 1,
2829
'hide_min_max' => true,
29-
'hide_from_to' => true
30-
]
30+
'hide_from_to' => true,
31+
],
3132
]);
3233

3334
$this->assertEquals(Html::activeTextInput($model, 'price'), $widget);
@@ -44,9 +45,9 @@ public function testRenderSliderWithoutModel()
4445
'from' => 2,
4546
'to' => 18,
4647
'step' => 1,
47-
]
48+
],
4849
]);
4950

5051
$this->assertEquals(Html::textInput('price', null, ['id' => 'w0']), $widget);
5152
}
52-
}
53+
}

tests/TestCase.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
namespace yii2mod\slider\tests;
44

5-
use yii\helpers\ArrayHelper;
65
use Yii;
6+
use yii\helpers\ArrayHelper;
77
use yii\helpers\FileHelper;
88

99
/**
1010
* This is the base class for all yii framework unit tests.
1111
*/
12-
class TestCase extends \PHPUnit_Framework_TestCase
12+
class TestCase extends \PHPUnit\Framework\TestCase
1313
{
1414
protected function setUp()
1515
{
@@ -27,6 +27,7 @@ protected function tearDown()
2727
/**
2828
* Populates Yii::$app with a new application
2929
* The application will be destroyed on tearDown() automatically.
30+
*
3031
* @param array $config The application configuration, if needed
3132
* @param string $appClass name of the application class to create
3233
*/
@@ -39,7 +40,7 @@ protected function mockApplication($config = [], $appClass = '\yii\web\Applicati
3940
'components' => [
4041
'request' => [
4142
'hostInfo' => 'http://domain.com',
42-
'scriptUrl' => 'index.php'
43+
'scriptUrl' => 'index.php',
4344
],
4445
'assetManager' => [
4546
'basePath' => $this->getTestFilePath(),
@@ -66,10 +67,11 @@ protected function destroyApplication()
6667

6768
/**
6869
* Returns the test file path.
69-
* @return string file path.
70+
*
71+
* @return string file path
7072
*/
7173
protected function getTestFilePath()
7274
{
7375
return dirname(__DIR__) . '/tests/runtime' . DIRECTORY_SEPARATOR . getmypid();
7476
}
75-
}
77+
}

tests/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
1111

1212
require_once(__DIR__ . '/../vendor/autoload.php');
13-
require_once(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
13+
require_once(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');

0 commit comments

Comments
 (0)