Skip to content

Commit

Permalink
csfixed
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Dec 23, 2016
1 parent f54246d commit dcc87b7
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 68 deletions.
75 changes: 37 additions & 38 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,46 @@ Yii2 module providing multi-factor authentication
@copyright Copyright (c) 2016, HiQDev (http://hiqdev.com/)
EOF;

Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);

return Symfony\CS\Config\Config::create()
return PhpCsFixer\Config::create()
->setUsingCache(true)
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers([
'header_comment', /// Add, replace or remove header comment
'-long_array_syntax', /// Arrays should use the long syntax
'-php4_constructor', /// Convert PHP4-style constructors to __construct. Warning! This could change code behavior
'-phpdoc_var_to_type', /// @var should always be written as @type
'-align_double_arrow', /// Align double arrow symbols in consecutive lines
'-unalign_double_arrow', /// Unalign double arrow symbols in consecutive lines
'-align_equals', /// Align equals symbols in consecutive lines
'-unalign_equals', /// Unalign equals symbols in consecutive lines
'-phpdoc_no_empty_return', /// @return void and @return null annotations should be omitted from phpdocs
'-simplified_null_return', /// A return statement wishing to return nothing should be simply "return"
'-blank_line_before_return', /// n empty line feed should precede a return statement
'-phpdoc_align', /// All items of the @param, @throws, @return, @var, and @type phpdoc tags must be aligned vertically
'-phpdoc_params', /// All items of the @param, @throws, @return, @var, and @type phpdoc tags must be aligned vertically
'-phpdoc_scalar', /// Scalar types should always be written in the same form. "int", not "integer"; "bool", not "boolean"
'-phpdoc_separation', /// Annotations of a different type are separated by a single blank line
'-phpdoc_to_comment', /// Docblocks should only be used on structural elements
'-method_argument_space', /// In method arguments and method call, there MUST NOT be a space before each comma and there MUST be one space after each comma
'-concat_without_spaces', /// Concatenation should be used without spaces
'concat_with_spaces', /// Concatenation should be used with at least one whitespace around
'ereg_to_preg', /// Replace deprecated ereg regular expression functions with preg. Warning! This could change code behavior
'blank_line_after_opening_tag', /// Ensure there is no code on the same line as the PHP open tag and it is followed by a blankline
'single_blank_line_before_namespace', /// There should be no blank lines before a namespace declaration
'ordered_imports', /// Ordering use statements
'phpdoc_order', /// Annotations in phpdocs should be ordered so that @param come first, then @throws, then @return
'pre_increment', /// Pre incrementation/decrementation should be used if possible
'short_array_syntax', /// PHP arrays should use the PHP 5.4 short-syntax
'strict_comparison', /// Comparison should be strict. (Risky fixer!)
'strict_param', /// Functions should be used with $strict param. Warning! This could change code behavior
'no_multiline_whitespace_before_semicolons', /// Multi-line whitespace before closing semicolon are prohibited
])
->finder(
Symfony\CS\Finder\DefaultFinder::create()
->setRiskyAllowed(true)
->setRules(array(
'@Symfony' => true,
'header_comment' => [
'header' => $header,
'separate' => 'bottom',
'location' => 'after_declare_strict',
'commentType' => 'PHPDoc',
],
'binary_operator_spaces' => [
'align_double_arrow' => null,
'align_equals' => null,
],
'concat_space' => ['spacing' => 'one'],
'array_syntax' => ['syntax' => 'short'],
'empty_return' => false,
'blank_line_before_return' => false,
'phpdoc_align' => false,
'phpdoc_params' => false,
'phpdoc_scalar' => false,
'phpdoc_separation' => false,
'phpdoc_to_comment' => false,
'method_argument_space' => false,
'ereg_to_preg' => true,
'blank_line_after_opening_tag' => true,
'single_blank_line_before_namespace' => true,
'ordered_imports' => true,
'phpdoc_order' => true,
'pre_increment' => true,
'strict_comparison' => true,
'strict_param' => true,
'no_multiline_whitespace_before_semicolons' => true,
))
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
->notPath('vendor')
->notPath('runtime')
->notPath('web/assets')
)
)
;
4 changes: 1 addition & 3 deletions src/Module.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

/*
/**
* Yii2 module providing multi-factor authentication
*
* @link https://github.com/hiqdev/yii2-mfa
Expand Down Expand Up @@ -104,5 +103,4 @@ public function validateTotp(IdentityInterface $identity)
Yii::$app->response->redirect('/mfa/totp/check');
Yii::$app->end();
}

}
3 changes: 1 addition & 2 deletions src/base/Totp.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

/*
/**
* Yii2 module providing multi-factor authentication
*
* @link https://github.com/hiqdev/yii2-mfa
Expand Down
3 changes: 1 addition & 2 deletions src/behaviors/ValidateMfaBehavior.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

/*
/**
* Yii2 module providing multi-factor authentication
*
* @link https://github.com/hiqdev/yii2-mfa
Expand Down
3 changes: 1 addition & 2 deletions src/config/hisite.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

/*
/**
* Yii2 module providing multi-factor authentication
*
* @link https://github.com/hiqdev/yii2-mfa
Expand Down
8 changes: 8 additions & 0 deletions src/config/i18n.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<?php
/**
* Yii2 module providing multi-factor authentication
*
* @link https://github.com/hiqdev/yii2-mfa
* @package yii2-mfa
* @license BSD-3-Clause
* @copyright Copyright (c) 2016, HiQDev (http://hiqdev.com/)
*/

return [
'languages' => ['ru'],
Expand Down
3 changes: 1 addition & 2 deletions src/controllers/AllowedIpsController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

/*
/**
* Yii2 module providing multi-factor authentication
*
* @link https://github.com/hiqdev/yii2-mfa
Expand Down
3 changes: 1 addition & 2 deletions src/controllers/TotpController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

/*
/**
* Yii2 module providing multi-factor authentication
*
* @link https://github.com/hiqdev/yii2-mfa
Expand Down
3 changes: 1 addition & 2 deletions src/forms/InputForm.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

/*
/**
* Yii2 module providing multi-factor authentication
*
* @link https://github.com/hiqdev/yii2-mfa
Expand Down
20 changes: 6 additions & 14 deletions src/messages/ru/mfa.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
<?php
/**
* Message translations.
* Yii2 module providing multi-factor authentication
*
* This file is automatically generated by 'yii message/extract' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty, the message is considered as not translated.
* Messages that no longer need translation will have their translations
* enclosed between a pair of '@@' marks.
*
* Message string can be used with plural forms format. Check i18n section
* of the guide for details.
*
* NOTE: this file must be saved in UTF-8 encoding.
* @link https://github.com/hiqdev/yii2-mfa
* @package yii2-mfa
* @license BSD-3-Clause
* @copyright Copyright (c) 2016, HiQDev (http://hiqdev.com/)
*/

return [
'Add this IP to the list of allowed IPs' => 'Добавить этот IP в список разрешённых',
'Allow IP {ip} for {org}' => 'Разрешить IP {ip} для {org}',
Expand Down
1 change: 0 additions & 1 deletion src/views/mail/addAllowedIpToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/** @var yii\web\IdentityInterface $user */
/** @var yii\mail\MessageInterface $message */
/** @var string $token */

$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['/mfa/allowed-ips/not-allowed-ip', 'token' => (string) $token]);

$message->setSubject(Yii::t('mfa', 'Allow IP {ip} for {org}', ['ip' => $token->get('ip'), 'org' => Yii::$app->params['organizationName']]));
Expand Down

0 comments on commit dcc87b7

Please sign in to comment.