Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix @var tags syntax
  • Loading branch information
mspirkov committed Jun 14, 2025
commit 5b0b3f4c027f0f07fe1613af8a64f2d941df1a4f
4 changes: 2 additions & 2 deletions docs/guide-ja/oauth-direct-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ OAuth プロバイダのウェブ・サイトを訪問する必要のない、
$loginForm = new LoginForm();

if ($loginForm->load(Yii::$app->request->post()) && $loginForm->validate()) {
/* @var $client \yii\authclient\OAuth2 */
/** @var \yii\authclient\OAuth2 $client */
$client = Yii::$app->authClientCollection->getClient('someOAuth2');

try {
Expand All @@ -45,7 +45,7 @@ if ($loginForm->load(Yii::$app->request->post()) && $loginForm->validate()) {
例えば、

```php
/* @var $client \yii\authclient\OAuth2 */
/** @var \yii\authclient\OAuth2 $client */
$client = Yii::$app->authClientCollection->getClient('someOAuth2');

// クライアントだけの直接認証
Expand Down
6 changes: 3 additions & 3 deletions docs/guide-ja/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ class AuthHandler
$id = ArrayHelper::getValue($attributes, 'id');
$nickname = ArrayHelper::getValue($attributes, 'login');

/* @var $auth Auth */
/** @var Auth $auth */
$auth = Auth::find()->where([
'source' => $this->client->getId(),
'source_id' => $id,
])->one();

if (Yii::$app->user->isGuest) {
if ($auth) { // ログイン
/* @var User $user */
/** @var User $user */
$user = $auth->user;
$this->updateUserInfo($user);
Yii::$app->user->login($user, Yii::$app->params['user.rememberMeDuration']);
Expand Down Expand Up @@ -130,7 +130,7 @@ class AuthHandler
'source_id' => (string)$attributes['id'],
]);
if ($auth->save()) {
/* @var User $user */
/** @var User $user */
$user = $auth->user;
$this->updateUserInfo($user);
Yii::$app->getSession()->setFlash('success', [
Expand Down
4 changes: 2 additions & 2 deletions docs/guide-ja/usage-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $userInfo = $client->api('userinfo', 'GET');
例えば、

```php
/* @var $client \yii\authclient\OAuth2 */
/** @var \yii\authclient\OAuth2 $client */
$client = Yii::$app->authClientCollection->getClient('someOAuth2');

// 外部サービスに追加すべきユーザを探す
Expand Down Expand Up @@ -68,7 +68,7 @@ HTTP リクエストの送信に関する詳細は、[yii2-httpclient](https://g
例えば、

```php
/* @var $client \yii\authclient\OAuth1 */
/** @var \yii\authclient\OAuth1 $client */
$client = Yii::$app->authClientCollection->getClient('someOAuth1');

$request = $client->createRequest()
Expand Down
4 changes: 2 additions & 2 deletions docs/guide-ru/oauth-direct-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$loginForm = new LoginForm();

if ($loginForm->load(Yii::$app->request->post()) && $loginForm->validate()) {
/* @var $client \yii\authclient\OAuth2 */
/** @var \yii\authclient\OAuth2 $client */
$client = Yii::$app->authClientCollection->getClient('someOAuth2');

try {
Expand All @@ -45,7 +45,7 @@ OAuth клиента (ваше приложение) без задействов
Например:

```php
/* @var $client \yii\authclient\OAuth2 */
/** @var \yii\authclient\OAuth2 $client */
$client = Yii::$app->authClientCollection->getClient('someOAuth2');

// аутентификация исключительно клиета напрямую:
Expand Down
4 changes: 2 additions & 2 deletions docs/guide-ru/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SiteController extends Controller
{
$attributes = $client->getUserAttributes();

/* @var $auth Auth */
/** @var Auth $auth */
$auth = Auth::find()->where([
'source' => $client->getId(),
'source_id' => $attributes['id'],
Expand Down Expand Up @@ -138,4 +138,4 @@ class SiteController extends Controller
'baseAuthUrl' => ['site/auth'],
'popupMode' => false,
]) ?>
```
```
4 changes: 2 additions & 2 deletions docs/guide-ru/usage-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $userInfo = $client->api('userinfo', 'GET');
Например:

```php
/* @var $client \yii\authclient\OAuth2 */
/** @var \yii\authclient\OAuth2 $client */
$client = Yii::$app->authClientCollection->getClient('someOAuth2');

// находим пользователя для добавлениея во внешний сервис:
Expand Down Expand Up @@ -68,7 +68,7 @@ echo $response->data['id'];
Например:

```php
/* @var $client \yii\authclient\OAuth1 */
/** @var \yii\authclient\OAuth1 $client */
$client = Yii::$app->authClientCollection->getClient('someOAuth1');

$request = $client->createRequest()
Expand Down
2 changes: 1 addition & 1 deletion docs/guide-zh-CN/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SiteController extends Controller
{
$attributes = $client->getUserAttributes();

/* @var $auth Auth */
/** @var Auth $auth */
$auth = Auth::find()->where([
'source' => $client->getId(),
'source_id' => $attributes['id'],
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/oauth-direct-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For example:
$loginForm = new LoginForm();

if ($loginForm->load(Yii::$app->request->post()) && $loginForm->validate()) {
/* @var $client \yii\authclient\OAuth2 */
/** @var \yii\authclient\OAuth2 $client */
$client = Yii::$app->authClientCollection->getClient('someOAuth2');

try {
Expand All @@ -45,7 +45,7 @@ You may authenticate client only via this work flow using [[\yii\authclient\OAut
For example:

```php
/* @var $client \yii\authclient\OAuth2 */
/** @var \yii\authclient\OAuth2 $client */
$client = Yii::$app->authClientCollection->getClient('someOAuth2');

// direct authentication of client only:
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ class AuthHandler
$id = ArrayHelper::getValue($attributes, 'id');
$nickname = ArrayHelper::getValue($attributes, 'login');

/* @var Auth $auth */
/** @var Auth $auth */
$auth = Auth::find()->where([
'source' => $this->client->getId(),
'source_id' => $id,
])->one();

if (Yii::$app->user->isGuest) {
if ($auth) { // login
/* @var User $user */
/** @var User $user */
$user = $auth->user;
$this->updateUserInfo($user);
Yii::$app->user->login($user, Yii::$app->params['user.rememberMeDuration']);
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/usage-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ instance of [[\yii\httpclient\Request]], which allows much more control over HTT
For example:

```php
/* @var $client \yii\authclient\OAuth2 */
/** @var \yii\authclient\OAuth2 $client */
$client = Yii::$app->authClientCollection->getClient('someOAuth2');

// find user to add to external service:
Expand Down Expand Up @@ -68,7 +68,7 @@ to perform missing actions for the API request.
For example:

```php
/* @var $client \yii\authclient\OAuth1 */
/** @var \yii\authclient\OAuth1 $client */
$client = Yii::$app->authClientCollection->getClient('someOAuth1');

$request = $client->createRequest()
Expand Down
2 changes: 1 addition & 1 deletion src/AuthAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function run()
{
$clientId = $this->getClientId();
if (!empty($clientId)) {
/* @var $collection \yii\authclient\Collection */
/** @var \yii\authclient\Collection $collection */
$collection = Yii::$app->get($this->clientCollection);
if (!$collection->hasClient($clientId)) {
throw new NotFoundHttpException("Unknown auth client '{$clientId}'");
Expand Down
9 changes: 6 additions & 3 deletions src/views/redirect.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?php
use yii\helpers\Json;
use yii\base\View;

/* @var $this \yii\base\View */
/* @var $url string */
/* @var $enforceRedirect bool */
/**
* @var View $this
* @var string $url
* @var bool $enforceRedirect
*/
?>
<!DOCTYPE html>
<html>
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/AuthChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function getBaseAuthUrl()
*/
protected function defaultClients()
{
/* @var $collection \yii\authclient\Collection */
/** @var \yii\authclient\Collection $collection */
$collection = Yii::$app->get($this->clientCollection);

return $collection->getClients();
Expand Down Expand Up @@ -211,7 +211,7 @@ public function clientLink($client, $text = null, array $htmlOptions = [])
if (!isset($widgetConfig['class'])) {
throw new InvalidConfigException('Widget config "class" parameter is missing');
}
/* @var $widgetClass Widget */
/** @var Widget $widgetClass */
$widgetClass = $widgetConfig['class'];
if (!(is_subclass_of($widgetClass, AuthChoiceItem::className()))) {
throw new InvalidConfigException('Item widget class must be subclass of "' . AuthChoiceItem::className() . '"');
Expand Down Expand Up @@ -283,4 +283,4 @@ public function run()
$content .= Html::endTag('div');
return $content;
}
}
}
2 changes: 1 addition & 1 deletion tests/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function testSetupHttpClient()
];
$collection->setClients($clients);

/* @var $provider TestClient */
/** @var TestClient $provider */
$provider = $collection->getClient($clientId);

$this->assertSame($collection->httpClient, $provider->getHttpClient());
Expand Down
2 changes: 1 addition & 1 deletion tests/OAuth1Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testSignRequest()
'a' => 'another',
]);

/* @var $oauthSignatureMethod BaseMethod|\PHPUnit_Framework_MockObject_MockObject */
/** @var BaseMethod|\PHPUnit_Framework_MockObject_MockObject $oauthSignatureMethod */
$oauthSignatureMethod = $this->getMockBuilder(BaseMethod::className())
->setMethods(['getName', 'generateSignature'])
->getMock();
Expand Down