Showing 92 of 92 total issues
Avoid unused parameters such as '$value'. Open
public static function reverseEventTime($value, Event $context) {
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
The method initPropertyMapDefinition() has 112 lines of code. Current threshold is set to 100. Avoid really long methods. Open
protected static function initPropertyMapDefinition() {
static::$propertyMapDefinition
->addPropertyMap(
new PropertyDefinition('idPlayer'),
new PropertyDefinition('id')
- Exclude checks
Avoid assigning values to variables in if clauses and the like (line '99', column '10'). Open
public function sanitizeProperty(\stdClass &$object, FactoryContainerInterface $factoryContainer) {
if (($entityType = $this->getEntityType()) && isset($object->{$this->getName()})) {
$value = &$object->{$this->getName()};
if ($this->isArray()) {
foreach ($value as &$val) {
- 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 '\TheSportsDb\Entity\EntityPropertyUtil' in method 'raw'. Open
$this->_raw->{$prop} = EntityPropertyUtil::getRawValue($val);
- 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
The method initPropertyMapDefinition() has 129 lines of code. Current threshold is set to 100. Avoid really long methods. Open
protected static function initPropertyMapDefinition() {
static::$propertyMapDefinition
->addPropertyMap(
new PropertyDefinition('idTeam'),
new PropertyDefinition('id')
- Exclude checks
Avoid unused parameters such as '$context'. Open
public static function transformEvents(array $values, $context, EntityManagerInterface $entityManager) {
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$value'. Open
public static function transformEventTime($value) {
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
The variable $time_parts is not named in camelCase. Open
public static function transformDateTime($value, $format, $time = NULL) {
$date = new \DateTime($value);
$date->createFromFormat($format, $value);
if ($time && $time !== EntityManager::EMPTYPROPERTYPLACEHOLDER) {
$time_parts = explode(':', $time);
- 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 $time_parts is not named in camelCase. Open
public static function transformDateTime($value, $format, $time = NULL) {
$date = new \DateTime($value);
$date->createFromFormat($format, $value);
if ($time && $time !== EntityManager::EMPTYPROPERTYPLACEHOLDER) {
$time_parts = explode(':', $time);
- 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 $time_parts is not named in camelCase. Open
public static function transformDateTime($value, $format, $time = NULL) {
$date = new \DateTime($value);
$date->createFromFormat($format, $value);
if ($time && $time !== EntityManager::EMPTYPROPERTYPLACEHOLDER) {
$time_parts = explode(':', $time);
- 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 $time_parts is not named in camelCase. Open
public static function transformDateTime($value, $format, $time = NULL) {
$date = new \DateTime($value);
$date->createFromFormat($format, $value);
if ($time && $time !== EntityManager::EMPTYPROPERTYPLACEHOLDER) {
$time_parts = explode(':', $time);
- 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 $time_parts is not named in camelCase. Open
public static function transformDateTime($value, $format, $time = NULL) {
$date = new \DateTime($value);
$date->createFromFormat($format, $value);
if ($time && $time !== EntityManager::EMPTYPROPERTYPLACEHOLDER) {
$time_parts = explode(':', $time);
- 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();
}
}