Close #109 provide better error classes + phpdoc fixes

This commit is contained in:
Antonio Ramirez
2017-11-12 23:13:42 +01:00
parent c418ad967c
commit 83458a13e4
26 changed files with 109 additions and 20 deletions

View File

@ -51,6 +51,7 @@ class AssignmentsWidget extends Widget
* {@inheritdoc}
*
* @throws InvalidParamException
* @throws InvalidConfigException
*/
public function run()
{

View File

@ -15,6 +15,7 @@ use Yii;
use yii\authclient\ClientInterface;
use yii\authclient\widgets\AuthChoice;
use yii\authclient\widgets\AuthChoiceAsset;
use yii\base\InvalidParamException;
use yii\helpers\Html;
use yii\helpers\Url;
@ -40,6 +41,8 @@ class ConnectWidget extends AuthChoice
/**
* {@inheritdoc}
*
* @throws InvalidParamException
*/
public function createClientUrl($provider)
{
@ -59,6 +62,6 @@ class ConnectWidget extends AuthChoice
*/
public function isConnected(ClientInterface $provider)
{
return $this->accounts != null && isset($this->accounts[$provider->getId()]);
return null !== $this->accounts && isset($this->accounts[$provider->getId()]);
}
}

View File

@ -49,6 +49,8 @@ class ReCaptchaWidget extends InputWidget
/**
* @inheritdoc
*
* @throws InvalidConfigException
*/
public function init()
{
@ -78,6 +80,7 @@ class ReCaptchaWidget extends InputWidget
}
/**
* @throws InvalidConfigException
* @return array the google recaptcha options.
*/
protected function getCaptchaOptions()
@ -156,7 +159,7 @@ class ReCaptchaWidget extends InputWidget
'pt-PT'
];
return in_array($language, $except)
return in_array($language, $except, false)
? $language
: substr($language, 0, strpos($language, '-'));
}