Avoid assigning values to variables in if clauses and the like (line '28', column '15'). Open
public function locate()
{
if (!($class = $this->_getClass())) {
throw new RuntimeException(sprintf('Could not locate tests from class: Class must be specified'));
}
- 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 variable $_method is not named in camelCase. Open
protected function _getClassTests(ReflectionClass $class)
{
$methods = array();
foreach ($class->getMethods() as $_method) {
/* @var $_method ReflectionMethod */
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $_method is not named in camelCase. Open
protected function _getClassTests(ReflectionClass $class)
{
$methods = array();
foreach ($class->getMethods() as $_method) {
/* @var $_method ReflectionMethod */
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $_method is not named in camelCase. Open
protected function _getClassTests(ReflectionClass $class)
{
$methods = array();
foreach ($class->getMethods() as $_method) {
/* @var $_method ReflectionMethod */
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $_method is not named in camelCase. Open
protected function _getClassTests(ReflectionClass $class)
{
$methods = array();
foreach ($class->getMethods() as $_method) {
/* @var $_method ReflectionMethod */
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The method _getClassTests is not named in camelCase. Open
protected function _getClassTests(ReflectionClass $class)
{
$methods = array();
foreach ($class->getMethods() as $_method) {
/* @var $_method ReflectionMethod */
- 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() {
}
}
Source
The method _getClass is not named in camelCase. Open
protected function _getClass()
{
if (empty($this->class)) {
return;
}
- 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() {
}
}
Source
The method _generateTestKey is not named in camelCase. Open
protected function _generateTestKey($className, $methodName)
{
$key = sprintf('%1$s#%2$s', $className, $methodName);
return $key;
- 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() {
}
}
Source
The method _getObjectReflection is not named in camelCase. Open
protected function _getObjectReflection($object)
{
return new ReflectionClass($object);
}
- 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() {
}
}
Source
The method _createTest is not named in camelCase. Open
abstract protected function _createTest($className, $methodName, $key);
- 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() {
}
}
Source
The method _matchMethod is not named in camelCase. Open
abstract protected function _matchMethod(ReflectionMethod $method);
- 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() {
}
}