File tree 8 files changed +42
-68
lines changed
8 files changed +42
-68
lines changed Original file line number Diff line number Diff line change 1
1
language : php
2
2
3
3
php :
4
- - ' 5.6'
5
4
- ' 7.0'
6
5
- ' 7.1'
6
+ - ' 7.2'
7
+ - ' 7.3'
8
+ - ' 7.4'
7
9
8
10
# faster builds on new travis setup not using sudo
9
11
sudo : false
@@ -20,12 +22,12 @@ install:
20
22
before_script :
21
23
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
22
24
- chmod +x ./cc-test-reporter
23
- - if [ $(phpenv version-name) = "7.1" ]; then . /cc-test-reporter before-build; fi
25
+ - . /cc-test-reporter before-build
24
26
25
27
script :
26
28
- composer validate --strict
27
29
- vendor/bin/phpunit
28
30
29
31
after_script :
30
- - if [ $(phpenv version-name) = "7.1" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
31
- - if [ $(phpenv version-name) = "7.1 " ]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi
32
+ - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
33
+ - if [ "$TRAVIS_PULL_REQUEST" == "false " ]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ Flatpickr is a lightweight and powerful datetime picker written in vanilla javas
16
16
![ flatpickr-theme-dark] ( https://user-images.githubusercontent.com/17989224/33085189-a6d0688a-ceec-11e7-8a38-be258ff692b2.png )
17
17
18
18
## Latest release
19
- The latest stable version of the extension is v1 .0
19
+ The latest stable version of the extension is v2 .0
20
20
21
21
## Installation
22
22
@@ -25,12 +25,12 @@ The preferred way to install this extension is through [composer](http://getcomp
25
25
Either run
26
26
27
27
``` bash
28
- $ composer require codenix-sv/yii2-flatpickr:~ 1 .0
28
+ $ composer require codenix-sv/yii2-flatpickr:~ 2 .0
29
29
```
30
30
or add
31
31
32
32
``` json
33
- "codenix-sv/yii2-flatpickr" : " ~1 .0"
33
+ "codenix-sv/yii2-flatpickr" : " ~2 .0"
34
34
```
35
35
36
36
to the require section of your application's ` composer.json ` file.
@@ -46,7 +46,7 @@ use codenixsv\flatpickr\Flatpickr;
46
46
47
47
?>
48
48
...
49
- <?= $form->field($model, 'date')->widget(Flatpickr::className() ) ?>
49
+ <?= $form->field($model, 'date')->widget(Flatpickr::class ) ?>
50
50
```
51
51
### Example of use as a widget:
52
52
``` php
@@ -61,7 +61,7 @@ use codenixsv\flatpickr\Flatpickr;
61
61
62
62
?>
63
63
...
64
- <?= $form->field($model, 'email')->widget(Flatpickr::className() , [
64
+ <?= $form->field($model, 'email')->widget(Flatpickr::class , [
65
65
'theme' =>'dark',
66
66
'clientOptions' => [
67
67
'locale' => 'ru',
Original file line number Diff line number Diff line change 21
21
}
22
22
],
23
23
"require" : {
24
+ "php" : " >=7.0" ,
24
25
"yiisoft/yii2" : " ~2.0.0" ,
25
26
"npm-asset/flatpickr" : " ~4.0"
26
27
},
27
28
"require-dev" : {
28
- "phpunit/phpunit" : " ~5 .0"
29
+ "phpunit/phpunit" : " ~6 .0"
29
30
},
30
31
"autoload" : {
31
32
"psr-4" : {
Original file line number Diff line number Diff line change @@ -25,26 +25,18 @@ class Flatpickr extends InputWidget
25
25
*/
26
26
public $ clientOptions = [];
27
27
28
- /**
29
- * @var array
30
- */
28
+ /** @var array */
31
29
public $ defaultOptions = [
32
30
'allowInput ' => true
33
31
];
34
32
35
- /**
36
- * @var string
37
- */
33
+ /** @var string */
38
34
private $ _locale ;
39
35
40
- /**
41
- * @var string
42
- */
36
+ /** @var string */
43
37
public $ theme ;
44
38
45
- /**
46
- * @var string
47
- */
39
+ /** @var string */
48
40
private $ _id ;
49
41
50
42
/**
@@ -64,17 +56,14 @@ public function init()
64
56
65
57
/**
66
58
* @inheritdoc
67
- * @return string
68
59
*/
69
- public function run ()
60
+ public function run (): string
70
61
{
71
62
parent ::run ();
72
63
73
64
$ this ->registerClientScript ();
74
65
75
- $ content = $ this ->renderContent ();
76
-
77
- return $ content ;
66
+ return $ this ->renderContent ();
78
67
}
79
68
80
69
/**
@@ -96,15 +85,13 @@ private function registerClientScript()
96
85
97
86
/**
98
87
* Renders widget
99
- * @return string
100
88
*/
101
- private function renderContent ()
89
+ private function renderContent (): string
102
90
{
103
91
$ options = ArrayHelper::merge (['class ' => 'form-control ' , 'data-input ' => true ], $ this ->options );
104
- $ content = $ this ->hasModel ()
92
+
93
+ return $ this ->hasModel ()
105
94
? Html::activeTextInput ($ this ->model , $ this ->attribute , $ options )
106
95
: Html::textInput ($ this ->name , $ this ->value , $ options );
107
-
108
- return $ content ;
109
96
}
110
97
}
Original file line number Diff line number Diff line change 15
15
*/
16
16
class FlatpickrAsset extends AssetBundle
17
17
{
18
- /**
19
- * @inheritdoc
20
- * @var string
21
- */
18
+ /** @var string */
22
19
public $ sourcePath = '@npm/flatpickr/dist ' ;
23
20
24
- /**
25
- * @inheritdoc
26
- * @var array
27
- */
21
+ /** @var array */
28
22
public $ js = [
29
23
'flatpickr.min.js ' ,
30
24
];
31
25
32
- /**
33
- * @inheritdoc
34
- * @var array
35
- */
26
+ /** @var array */
36
27
public $ css = [
37
28
'flatpickr.min.css ' ,
38
29
];
39
30
40
- /**
41
- * @var string
42
- */
31
+ /** @var string */
43
32
public $ theme ;
44
33
45
- /**
46
- * @var string
47
- */
34
+ /** @var string */
48
35
public $ locale ;
49
36
50
37
/**
Original file line number Diff line number Diff line change 4
4
5
5
use tests \data \models \TestModel ;
6
6
use codenixsv \flatpickr \Flatpickr ;
7
- use yii \widgets \ActiveForm ;
8
7
9
8
/**
10
9
* Class FlatpickrTest
Original file line number Diff line number Diff line change 3
3
namespace codenixsv \flatpickr \tests \functional ;
4
4
5
5
use yii \web \View ;
6
- use \yii \web \Application ;
6
+ use yii \web \Application ;
7
+ use Yii ;
7
8
8
9
/**
9
10
* Class TestCase
10
11
* @package codenixsv\flatpickr\tests\functional
11
12
*/
12
- abstract class TestCase extends \PHPUnit_Framework_TestCase
13
+ abstract class TestCase extends \PHPUnit \ Framework \TestCase
13
14
{
14
15
/**
15
16
* @inheritdoc
@@ -40,9 +41,8 @@ protected function mockApplication()
40
41
/**
41
42
* Returns vendor directory path
42
43
*
43
- * @return string
44
44
*/
45
- protected function getVendorPath ()
45
+ protected function getVendorPath (): string
46
46
{
47
47
return dirname (dirname (__DIR__ )) . '/vendor ' ;
48
48
}
@@ -52,28 +52,24 @@ protected function getVendorPath()
52
52
*/
53
53
protected function destroyApplication ()
54
54
{
55
- \ Yii::$ app = null ;
55
+ Yii::$ app = null ;
56
56
}
57
57
58
58
/**
59
59
* Creates view for testing
60
60
*
61
- * @return View
62
61
*/
63
- protected function getView ()
62
+ protected function getView (): View
64
63
{
65
- $ view = new View ();
66
-
67
- return $ view ;
64
+ return new View ();
68
65
}
69
66
70
67
/**
71
68
* Returns config for Application
72
- * @return array
73
69
*/
74
- protected function getApplicationConfig ()
70
+ protected function getApplicationConfig (): array
75
71
{
76
- $ config = [
72
+ return [
77
73
'id ' => 'testapp ' ,
78
74
'basePath ' => __DIR__ ,
79
75
'vendorPath ' => $ this ->getVendorPath (),
@@ -101,7 +97,5 @@ protected function getApplicationConfig()
101
97
],
102
98
],
103
99
];
104
-
105
- return $ config ;
106
100
}
107
101
}
Original file line number Diff line number Diff line change 1
1
<?php
2
- // ensure we get report on all possible php errors
2
+
3
3
error_reporting (-1 );
4
4
define ('YII_ENABLE_ERROR_HANDLER ' , false );
5
5
define ('YII_DEBUG ' , true );
6
+
6
7
$ _SERVER ['SCRIPT_NAME ' ] = '/ ' . __DIR__ ;
7
8
$ _SERVER ['SCRIPT_FILENAME ' ] = __FILE__ ;
9
+
8
10
require_once (__DIR__ . '/../../vendor/autoload.php ' );
9
11
require_once (__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php ' );
12
+
10
13
Yii::setAlias ('@tests ' , __DIR__ );
11
- require_once (__DIR__ . '/TestCase.php ' );
14
+
15
+ require_once (__DIR__ . '/TestCase.php ' );
You can’t perform that action at this time.
0 commit comments