Showing 5 of 5 total issues
Avoid using short method names like FactoryAwareTrait::__(). The configured minimum method name length is 3. Open
Open
abstract protected function __($string, $args = [], $context = null);
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
$message = '',
$code = 0,
RootException $previous = null,
$factory = null,
$config = null
Method _createCouldNotMakeException
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
$message = null,
$code = null,
RootException $previous = null,
$factory = null,
$config = null
Avoid assigning values to variables in if clauses and the like (line '49', column '40'). Open
Open
protected function _setSubjectConfig($subjectConfig)
{
if ($subjectConfig === null || $subjectConfig = $this->_normalizeContainer($subjectConfig)) {
$this->subjectConfig = $subjectConfig;
}
- 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
The method __ is not named in camelCase. Open
Open
abstract protected function __($string, $args = [], $context = null);
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}