Update PHP-CS-Fixer to v3.x (#460)
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -47,8 +47,7 @@ codeception.yml
|
|||||||
|
|
||||||
# Code Style Checkers and Mess Detectors
|
# Code Style Checkers and Mess Detectors
|
||||||
/phpcs.xml
|
/phpcs.xml
|
||||||
/.php_cs.cache
|
.php-cs-fixer.cache
|
||||||
/.php_cs
|
|
||||||
|
|
||||||
# composer
|
# composer
|
||||||
composer.lock
|
composer.lock
|
||||||
|
|||||||
43
.php-cs-fixer.dist.php
Normal file
43
.php-cs-fixer.dist.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
$header = <<<'EOF'
|
||||||
|
This file is part of the 2amigos/yii2-usuario project.
|
||||||
|
|
||||||
|
(c) 2amigOS! <http://2amigos.us/>
|
||||||
|
|
||||||
|
For the full copyright and license information, please view
|
||||||
|
the LICENSE file that was distributed with this source code.
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
|
||||||
|
$finder = PhpCsFixer\Finder::create()
|
||||||
|
->exclude(['resources'])
|
||||||
|
->in("src/User")
|
||||||
|
;
|
||||||
|
|
||||||
|
$config = new PhpCsFixer\Config();
|
||||||
|
return $config->setRules([
|
||||||
|
'@PSR1' => true,
|
||||||
|
'@PSR2' => true,
|
||||||
|
'array_syntax' => ['syntax' => 'short'],
|
||||||
|
'header_comment' => ['header' => $header],
|
||||||
|
'combine_consecutive_unsets' => true,
|
||||||
|
'no_extra_blank_lines' => [
|
||||||
|
'tokens' => ['break', 'case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'switch', 'throw', 'use', 'use_trait',],
|
||||||
|
],
|
||||||
|
'no_useless_else' => true,
|
||||||
|
'no_useless_return' => true,
|
||||||
|
'ordered_class_elements' => true,
|
||||||
|
'ordered_imports' => true,
|
||||||
|
'phpdoc_add_missing_param_annotation' => true,
|
||||||
|
'phpdoc_order' => true,
|
||||||
|
'phpdoc_align' => true,
|
||||||
|
'no_trailing_whitespace' => true,
|
||||||
|
'no_whitespace_in_blank_line' => true,
|
||||||
|
'no_trailing_comma_in_singleline_array' => true,
|
||||||
|
'no_whitespace_before_comma_in_array' => true,
|
||||||
|
'trim_array_spaces' => true,
|
||||||
|
'explicit_string_variable' => true,
|
||||||
|
'binary_operator_spaces' => true,
|
||||||
|
])
|
||||||
|
->setFinder($finder)
|
||||||
|
;
|
||||||
49
.php_cs.dist
49
.php_cs.dist
@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
$header = <<<'EOF'
|
|
||||||
This file is part of the 2amigos/yii2-usuario project.
|
|
||||||
|
|
||||||
(c) 2amigOS! <http://2amigos.us/>
|
|
||||||
|
|
||||||
For the full copyright and license information, please view
|
|
||||||
the LICENSE file that was distributed with this source code.
|
|
||||||
EOF;
|
|
||||||
|
|
||||||
$finder = PhpCsFixer\Finder::create()
|
|
||||||
->exclude([
|
|
||||||
'.github',
|
|
||||||
'docs',
|
|
||||||
'temp',
|
|
||||||
'tests',
|
|
||||||
'vendor',
|
|
||||||
'src/User/resources'
|
|
||||||
])
|
|
||||||
->in(__DIR__);
|
|
||||||
|
|
||||||
return PhpCsFixer\Config::create()
|
|
||||||
->setRules(array(
|
|
||||||
'@PSR1' => true,
|
|
||||||
'@PSR2' => true,
|
|
||||||
'header_comment' => ['header' => $header],
|
|
||||||
'array_syntax' => array('syntax' => 'short'),
|
|
||||||
'combine_consecutive_unsets' => true,
|
|
||||||
'no_extra_consecutive_blank_lines' => array(
|
|
||||||
'break',
|
|
||||||
'continue',
|
|
||||||
'extra',
|
|
||||||
'return',
|
|
||||||
'throw',
|
|
||||||
'use',
|
|
||||||
'parenthesis_brace_block',
|
|
||||||
'square_brace_block',
|
|
||||||
'curly_brace_block'
|
|
||||||
),
|
|
||||||
'no_useless_else' => true,
|
|
||||||
'no_useless_return' => true,
|
|
||||||
'ordered_class_elements' => true,
|
|
||||||
'ordered_imports' => true,
|
|
||||||
'phpdoc_add_missing_param_annotation' => true,
|
|
||||||
'phpdoc_order' => true,
|
|
||||||
'phpdoc_align' => true
|
|
||||||
|
|
||||||
))
|
|
||||||
->setFinder($finder);
|
|
||||||
@ -1,7 +1,6 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
## 1.6.0 work in progress
|
## 1.6.0 work in progress
|
||||||
|
|
||||||
**WARNING**: this release (long time due) makes a step forward in PHP
|
**WARNING**: this release (long time due) makes a step forward in PHP
|
||||||
compatibility, leaving behind obsolete versions. While yii2-usuario should
|
compatibility, leaving behind obsolete versions. While yii2-usuario should
|
||||||
still work without issues on 5.6, from now on testing and development will
|
still work without issues on 5.6, from now on testing and development will
|
||||||
@ -24,6 +23,7 @@ look forward and manitain only >=7.4 versions.
|
|||||||
- Ehn #412: Allow role names to support UTF-8 chars (4khobta)
|
- Ehn #412: Allow role names to support UTF-8 chars (4khobta)
|
||||||
- Ehn #448: Remove deprecated SwiftMailer, use SymfonyMailer instead (TonisOrmisson)
|
- Ehn #448: Remove deprecated SwiftMailer, use SymfonyMailer instead (TonisOrmisson)
|
||||||
- Ehn #428: Translations of the placeholders in the login widget (anapaulaxenon)
|
- Ehn #428: Translations of the placeholders in the login widget (anapaulaxenon)
|
||||||
|
- Update PHP-CS-Fixer configuration to new version (maxxer)
|
||||||
|
|
||||||
## 1.5.1 April 5, 2020
|
## 1.5.1 April 5, 2020
|
||||||
|
|
||||||
|
|||||||
@ -52,10 +52,9 @@
|
|||||||
"2amigos/qrcode-library": "Needed if you want to enable 2FA with QR Code generation. Require version ^1.1"
|
"2amigos/qrcode-library": "Needed if you want to enable 2FA with QR Code generation. Require version ^1.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"friendsofphp/php-cs-fixer": "^3",
|
||||||
"php": ">=7.4",
|
"php": ">=7.4",
|
||||||
|
|
||||||
"yiisoft/yii2-symfonymailer": "~2.0.0",
|
"yiisoft/yii2-symfonymailer": "~2.0.0",
|
||||||
"friendsofphp/php-cs-fixer": "^2.3",
|
|
||||||
"squizlabs/php_codesniffer": "*",
|
"squizlabs/php_codesniffer": "*",
|
||||||
"phpmd/phpmd": "@stable",
|
"phpmd/phpmd": "@stable",
|
||||||
"codeception/verify": "^0.3.3",
|
"codeception/verify": "^0.3.3",
|
||||||
|
|||||||
@ -365,7 +365,7 @@ class Bootstrap implements BootstrapInterface
|
|||||||
$mapping = array_merge($defaults, $userClassMap);
|
$mapping = array_merge($defaults, $userClassMap);
|
||||||
|
|
||||||
foreach ($mapping as $name => $definition) {
|
foreach ($mapping as $name => $definition) {
|
||||||
$map[$this->getRoute($routes, $name) . "\\$name"] = $definition;
|
$map[$this->getRoute($routes, $name) . "\\{$name}"] = $definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $map;
|
return $map;
|
||||||
|
|||||||
@ -110,13 +110,13 @@ class RegistrationController extends Controller
|
|||||||
|
|
||||||
// Create a temporay $user so we can get the attributes, then get
|
// Create a temporay $user so we can get the attributes, then get
|
||||||
// the intersection between the $form fields and the $user fields.
|
// the intersection between the $form fields and the $user fields.
|
||||||
$user = $this->make(User::class, [] );
|
$user = $this->make(User::class, []);
|
||||||
$fields = array_intersect_key($form->attributes, $user->attributes);
|
$fields = array_intersect_key($form->attributes, $user->attributes);
|
||||||
|
|
||||||
// Becomes password_hash
|
// Becomes password_hash
|
||||||
$fields['password'] = $form['password'];
|
$fields['password'] = $form['password'];
|
||||||
|
|
||||||
$user = $this->make(User::class, [], $fields );
|
$user = $this->make(User::class, [], $fields);
|
||||||
|
|
||||||
$user->setScenario('register');
|
$user->setScenario('register');
|
||||||
$mailService = MailFactory::makeWelcomeMailerService($user);
|
$mailService = MailFactory::makeWelcomeMailerService($user);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ class AccessRuleFilter extends AccessRule
|
|||||||
/** @var User $identity */
|
/** @var User $identity */
|
||||||
$identity = $user->identity;
|
$identity = $user->identity;
|
||||||
if (!$identity->gdpr_consent) {
|
if (!$identity->gdpr_consent) {
|
||||||
Yii::$app->response->redirect([ "/$consentAction"])->send();
|
Yii::$app->response->redirect(["/{$consentAction}"])->send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,8 +13,8 @@ namespace Da\User\Helper;
|
|||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\Exception;
|
use yii\base\Exception;
|
||||||
use yii\base\Security;
|
|
||||||
use yii\base\InvalidConfigException;
|
use yii\base\InvalidConfigException;
|
||||||
|
use yii\base\Security;
|
||||||
|
|
||||||
class SecurityHelper
|
class SecurityHelper
|
||||||
{
|
{
|
||||||
@ -76,8 +76,7 @@ class SecurityHelper
|
|||||||
if (!isset($minPasswordRequirements)) {
|
if (!isset($minPasswordRequirements)) {
|
||||||
if (isset(Yii::$app->getModule('user')->minPasswordRequirements)) {
|
if (isset(Yii::$app->getModule('user')->minPasswordRequirements)) {
|
||||||
$minPasswordRequirements = Yii::$app->getModule('user')->minPasswordRequirements;
|
$minPasswordRequirements = Yii::$app->getModule('user')->minPasswordRequirements;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$minPasswordRequirements = [
|
$minPasswordRequirements = [
|
||||||
'lower' => 1,
|
'lower' => 1,
|
||||||
'digit' => 1,
|
'digit' => 1,
|
||||||
|
|||||||
@ -25,7 +25,7 @@ use yii\base\InvalidParamException;
|
|||||||
use yii\db\ActiveRecord;
|
use yii\db\ActiveRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string $public_email
|
* @property string $public_email
|
||||||
* @property string $gravatar_email
|
* @property string $gravatar_email
|
||||||
@ -34,7 +34,7 @@ use yii\db\ActiveRecord;
|
|||||||
* @property string $website
|
* @property string $website
|
||||||
* @property string $bio
|
* @property string $bio
|
||||||
* @property string $timezone
|
* @property string $timezone
|
||||||
* @property User $user
|
* @property User $user
|
||||||
*/
|
*/
|
||||||
class Profile extends ActiveRecord
|
class Profile extends ActiveRecord
|
||||||
{
|
{
|
||||||
|
|||||||
@ -22,17 +22,17 @@ use yii\helpers\Url;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* /**
|
* /**
|
||||||
* @property int $id Id
|
* @property int $id Id
|
||||||
* @property int $user_id User id, null if account is not bind to user
|
* @property int $user_id User id, null if account is not bind to user
|
||||||
* @property string $provider Name of service
|
* @property string $provider Name of service
|
||||||
* @property string $client_id Account id
|
* @property string $client_id Account id
|
||||||
* @property string $data Account properties returned by social network (json encoded)
|
* @property string $data Account properties returned by social network (json encoded)
|
||||||
* @property string $decodedData Json-decoded properties
|
* @property string $decodedData Json-decoded properties
|
||||||
* @property string $code
|
* @property string $code
|
||||||
* @property string $email
|
* @property string $email
|
||||||
* @property string $username
|
* @property string $username
|
||||||
* @property int $created_at
|
* @property int $created_at
|
||||||
* @property User $user User that this account is connected for
|
* @property User $user User that this account is connected for
|
||||||
*/
|
*/
|
||||||
class SocialNetworkAccount extends ActiveRecord
|
class SocialNetworkAccount extends ActiveRecord
|
||||||
{
|
{
|
||||||
|
|||||||
@ -24,13 +24,13 @@ use yii\helpers\Url;
|
|||||||
/**
|
/**
|
||||||
* Token Active Record model.
|
* Token Active Record model.
|
||||||
*
|
*
|
||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property string $code
|
* @property string $code
|
||||||
* @property int $type
|
* @property int $type
|
||||||
* @property string $url
|
* @property string $url
|
||||||
* @property bool $isExpired
|
* @property bool $isExpired
|
||||||
* @property int $created_at
|
* @property int $created_at
|
||||||
* @property User $user
|
* @property User $user
|
||||||
*/
|
*/
|
||||||
class Token extends ActiveRecord
|
class Token extends ActiveRecord
|
||||||
{
|
{
|
||||||
|
|||||||
@ -31,33 +31,33 @@ use yii\web\IdentityInterface;
|
|||||||
*
|
*
|
||||||
* @property bool $isAdmin
|
* @property bool $isAdmin
|
||||||
* @property bool $isBlocked
|
* @property bool $isBlocked
|
||||||
* @property bool $isConfirmed whether user account has been confirmed or not
|
* @property bool $isConfirmed whether user account has been confirmed or not
|
||||||
* @property bool $gdpr_deleted whether user requested deletion of his account
|
* @property bool $gdpr_deleted whether user requested deletion of his account
|
||||||
* @property bool $gdpr_consent whether user has consent personal data processing
|
* @property bool $gdpr_consent whether user has consent personal data processing
|
||||||
*
|
*
|
||||||
* Database fields:
|
* Database fields:
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $username
|
* @property string $username
|
||||||
* @property string $email
|
* @property string $email
|
||||||
* @property string $unconfirmed_email
|
* @property string $unconfirmed_email
|
||||||
* @property string $password_hash
|
* @property string $password_hash
|
||||||
* @property string $auth_key
|
* @property string $auth_key
|
||||||
* @property string $auth_tf_key
|
* @property string $auth_tf_key
|
||||||
* @property int $auth_tf_enabled
|
* @property int $auth_tf_enabled
|
||||||
* @property string $registration_ip
|
* @property string $registration_ip
|
||||||
* @property int $confirmed_at
|
* @property int $confirmed_at
|
||||||
* @property int $blocked_at
|
* @property int $blocked_at
|
||||||
* @property int $flags
|
* @property int $flags
|
||||||
* @property int $created_at
|
* @property int $created_at
|
||||||
* @property int $updated_at
|
* @property int $updated_at
|
||||||
* @property int $last_login_at
|
* @property int $last_login_at
|
||||||
* @property int $gdpr_consent_date date of agreement of data processing
|
* @property int $gdpr_consent_date date of agreement of data processing
|
||||||
* @property string $last_login_ip
|
* @property string $last_login_ip
|
||||||
* @property int $password_changed_at
|
* @property int $password_changed_at
|
||||||
* @property int $password_age
|
* @property int $password_age
|
||||||
* Defined relations:
|
* Defined relations:
|
||||||
* @property SocialNetworkAccount[] $socialNetworkAccounts
|
* @property SocialNetworkAccount[] $socialNetworkAccounts
|
||||||
* @property Profile $profile
|
* @property Profile $profile
|
||||||
*/
|
*/
|
||||||
class User extends ActiveRecord implements IdentityInterface
|
class User extends ActiveRecord implements IdentityInterface
|
||||||
{
|
{
|
||||||
|
|||||||
@ -232,7 +232,7 @@ class Module extends BaseModule
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array Minimum requirements when a new password is automatically generated.
|
* @var array Minimum requirements when a new password is automatically generated.
|
||||||
* Array structure: `requirement => minimum number characters`.
|
* Array structure: `requirement => minimum number characters`.
|
||||||
*
|
*
|
||||||
* Possible array keys:
|
* Possible array keys:
|
||||||
* - lower: minimum number of lowercase characters;
|
* - lower: minimum number of lowercase characters;
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Da\User\Module $module
|
* @var \Da\User\Module $module
|
||||||
|
|||||||
Reference in New Issue
Block a user