Skip to content

Commit 499c8c0

Browse files
committed
fixes, add phpstorm file watcher
1 parent f5a6d26 commit 499c8c0

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ php composer.phar require --prefer-dist bazilio/yii2-stubs-generator
1919
or add
2020

2121
```json
22-
"bazilio/yii2-stubs-generator": "~0.0.1"
22+
"bazilio/yii2-stubs-generator": "*"
2323
```
2424

2525
to the require section of your composer.json.
@@ -46,4 +46,12 @@ php yii stubs console
4646
php yii stubs console common frontend
4747
```
4848

49-
File with stubs by default located in vendor directory.
49+
File with stubs by default located in vendor directory.
50+
51+
Usage with PhpStorm
52+
-------------------
53+
yii stubs common console frontend
54+
55+
1. Install `File Watchers` JetBrains plugin
56+
2. Open `File Watchers` plugin config and import [watcher.xml](watcher.xml)
57+
3. Edit imported watcher for your needs

StubsController.php

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

88
class StubsController extends Controller
99
{
10-
public $outputFile = 'yii2stubs.php';
10+
public $outputFile = null;
1111

1212
protected function getTemplate()
1313
{
@@ -48,7 +48,7 @@ class ConsoleApplication extends yii\console\Application
4848

4949
public function actionIndex($app)
5050
{
51-
$path = \Yii::$app->getVendorPath() . DIRECTORY_SEPARATOR . 'Yii.php';
51+
$path = $this->outputFile ? $this->outputFile : \Yii::$app->getVendorPath() . DIRECTORY_SEPARATOR . 'Yii.php';
5252

5353
$components = [];
5454

watcher.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<TaskOptions>
3+
<TaskOptions>
4+
<option name="arguments" value="stubs console common frontend" />
5+
<option name="checkSyntaxErrors" value="true" />
6+
<option name="description" value="" />
7+
<option name="exitCodeBehavior" value="ERROR" />
8+
<option name="fileExtension" value="php" />
9+
<option name="immediateSync" value="true" />
10+
<option name="name" value="Generate Yii2 stubs" />
11+
<option name="output" value="$Projectpath$/vendor/Yii.php" />
12+
<option name="outputFilters">
13+
<array />
14+
</option>
15+
<option name="outputFromStdout" value="false" />
16+
<option name="passParentEnvs" value="true" />
17+
<option name="program" value="$Projectpath$/yii" />
18+
<option name="scopeName" value="main.php files" />
19+
<option name="trackOnlyRoot" value="false" />
20+
<option name="workingDir" value="$Projectpath$" />
21+
<envs />
22+
</TaskOptions>
23+
</TaskOptions>
24+

0 commit comments

Comments
 (0)