The class IntegerEnumTest has 14 public methods. Consider refactoring IntegerEnumTest to keep number of public methods under 10. Open
class IntegerEnumTest extends TestCase
{
/**
* @test
*/
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Avoid using static access to class 'Doctrineum\Tests\Integer\TestInheritedIntegerEnum' in method 'getInheritedEnum'. Open
return TestInheritedIntegerEnum::getEnum($value);
- 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 float_with_decimal_cause_exception is not named in camelCase. Open
public function float_with_decimal_cause_exception(): void
{
$enumClass = $this->getEnumClass();
$enumClass::getEnum(12.345);
}
- 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 string_float_with_decimal_cause_exception is not named in camelCase. Open
public function string_float_with_decimal_cause_exception(): void
{
$enumClass = $this->getEnumClass();
$enumClass::getEnum('12.345');
}
- 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 string_with_partial_integer_cause_exception is not named in camelCase. Open
public function string_with_partial_integer_cause_exception(): void
{
$enumClass = $this->getEnumClass();
$enumClass::getEnum('12foo');
}
- 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 to_string_object_with_non_numeric_value_cause_exception is not named in camelCase. Open
public function to_string_object_with_non_numeric_value_cause_exception(): void
{
$enumClass = $this->getEnumClass();
$enumClass::getEnum(new WithToStringTestObject('foo'));
}
- 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 I_can_create_integer_enum is not named in camelCase. Open
public function I_can_create_integer_enum(): void
{
$enumClass = $this->getEnumClass();
$instance = $enumClass::getEnum(12345);
self::assertInstanceOf($enumClass, $instance);
- 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 I_will_get_same_integer_as_given_by_string_on_creation is not named in camelCase. Open
public function I_will_get_same_integer_as_given_by_string_on_creation(): void
{
$enumClass = $this->getEnumClass();
$enum = $enumClass::getEnum($stringInteger = '12345');
self::assertSame((int)$stringInteger, $enum->getValue());
- 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 string_with_integer_and_spaces_is_trimmed_and_accepted is not named in camelCase. Open
public function string_with_integer_and_spaces_is_trimmed_and_accepted(): void
{
$enumClass = $this->getEnumClass();
$enum = $enumClass::getEnum(' 12 ');
self::assertSame(12, $enum->getValue());
- 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 string_float_without_decimal_is_its_integer_value is not named in camelCase. Open
public function string_float_without_decimal_is_its_integer_value(): void
{
$enumClass = $this->getEnumClass();
$enum = $enumClass::getEnum('123.0');
self::assertSame(123, $enum->getValue());
- 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 I_will_get_same_integer_as_created_with is not named in camelCase. Open
public function I_will_get_same_integer_as_created_with(): void
{
$enumClass = $this->getEnumClass();
$enum = $enumClass::getEnum($integer = 12345);
self::assertSame($integer, $enum->getValue());
- 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 empty_string_cause_exception is not named in camelCase. Open
public function empty_string_cause_exception(): void
{
$enumClass = $this->getEnumClass();
$enumClass::getEnum('');
}
- 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 null_cause_exception is not named in camelCase. Open
public function null_cause_exception(): void
{
$enumClass = $this->getEnumClass();
$enumClass::getEnum(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() {
}
}
Source
The method object_with_integer_and_to_string_can_be_used is not named in camelCase. Open
public function object_with_integer_and_to_string_can_be_used(): void
{
$enumClass = $this->getEnumClass();
$enum = $enumClass::getEnum(new WithToStringTestObject($integer = 12345));
self::assertInstanceOf(ScalarEnumInterface::class, $enum);
- 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 inherited_enum_with_same_value_lives_in_own_inner_namespace is not named in camelCase. Open
public function inherited_enum_with_same_value_lives_in_own_inner_namespace(): void
{
$enumClass = $this->getEnumClass();
$enum = $enumClass::getEnum($value = 12345);
- 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 float_without_decimal_is_its_integer_value is not named in camelCase. Open
public function float_without_decimal_is_its_integer_value(): void
{
$enumClass = $this->getEnumClass();
$enum = $enumClass::getEnum(123.0);
self::assertSame(123, $enum->getValue());
- 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() {
}
}