Showing 122 of 122 total issues
Avoid assigning values to variables in if clauses and the like (line '21', column '46'). Open
public function getModule()
{
if (Yii::$app->hasModule('vote') && ($module = Yii::$app->getModule('vote')) instanceof Module) {
return $module;
}
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\yii\helpers\ArrayHelper' in method 'getUserValue'. Open
return ArrayHelper::getValue($this->voteAttributes, ["{$name}UserValue"]);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Yii' in method 'checkModel'. Open
$this->addError('entity', Yii::t('vote', 'Guests are not allowed for this voting.'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Adjoining classes: .vote .vote-btn.vote-active.vote-down Open
.vote .vote-btn.vote-active.vote-down {
- Exclude checks
Adjoining classes: .vote-toggle.vote-toggle-like .vote-btn.vote-active .vote-icon Open
.vote-toggle.vote-toggle-like .vote-btn.vote-active .vote-icon {
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
from {
- Exclude checks
Expected (<filter-function-list> | none) but found 'alpha(opacity=100)'.</filter-function-list> Open
filter: alpha(opacity=100);
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
.vote .vote-btn {
- Exclude checks
Adjoining classes: .vote .vote-btn.vote-active i.glyphicon Open
.vote .vote-btn.vote-active i.glyphicon {
- Exclude checks
Duplicate property '-o-transition' found. Open
-o-transition: opacity 0.15s ease;
- Exclude checks
Expected (<filter-function-list> | none) but found 'alpha(opacity=0)'.</filter-function-list> Open
filter: alpha(opacity=0);
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
.vote .vote-loader span,
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
to {
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
.hide-text {
- Exclude checks
Adjoining classes: .vote.vote-visible-buttons .vote-btn Open
.vote.vote-visible-buttons .vote-btn {
- Exclude checks
Duplicate property '-o-transition' found. Open
-o-transition: opacity 0.2s ease;
- Exclude checks
Adjoining classes: .vote-toggle.vote-toggle-like .vote-btn.vote-active .vote-icon Open
.vote-toggle.vote-toggle-like .vote-btn.vote-active .vote-icon {
- Exclude checks
Expected (<filter-function-list> | none) but found 'alpha(opacity=100)'.</filter-function-list> Open
filter: alpha(opacity=100);
- Exclude checks
Expected (<filter-function-list> | none) but found 'alpha(opacity=100)'.</filter-function-list> Open
filter: alpha(opacity=100);
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
.vote .vote-btn i.glyphicon {
- Exclude checks