Skip to content

Commit

Permalink
Add Module.stub.
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Oct 10, 2023
1 parent ef049c6 commit 0f0ebc5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions extension.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ parameters:
config_path: null
stubFiles:
- stubs/BaseYii.stub
- stubs/Module.stub

parametersSchema:
yii2: structure([
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ parameters:

paths:
- src
- tests

scanFiles:
- vendor/yiisoft/yii2/Yii.php
Expand Down
18 changes: 18 additions & 0 deletions stubs/Module.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace yii\base;

use yii\mail\MailerInterface;
use yii\web\Request;
use yii\web\Session;

/**
* Module is the base class for module and application classes.
*
* @property MailerInterface $mailer The mailer component. This property is read-only.
* @property Session $session The session component. This property is read-only.
* @property Request $request The request component. This property is read-only.
*/
class Module
{
}
4 changes: 4 additions & 0 deletions tests/Yii/MyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public function actionMy(): void

$values = Yii::$app->request->headers->get('X-Key', '', false);

$mailer = $this->module->mailer;
$session = $this->module->session;
$request = $this->module->request;

reset($values);
}
}

0 comments on commit 0f0ebc5

Please sign in to comment.