Method All_public_constants_can_be_given_by_getter
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function All_public_constants_can_be_given_by_getter()
{
$constants = $this->sutReflection->getConstants();
self::assertEquals($constants, array_unique($constants));
asort($constants);
Method I_can_extended_it_by_custom_translatable_code
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function I_can_extended_it_by_custom_translatable_code()
{
/** @var TranslatableExtendableCode $sutClass */
$sutClass = self::getSutClass();
$translations = $this->sutReflection->getProperty('translations');
Missing class import via use statement (line '26', column '36'). Open
$this->sutReflection = new \ReflectionClass($sutClass);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '123', column '32'). Open
$reflectionClass = new \ReflectionClass(TranslatableExtendableCode::class);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '35', column '43'). Open
$translatableExtendableCode = new \ReflectionClass(TranslatableExtendableCode::class);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '88', column '18'). Open
if ((new \ReflectionClass($sutClass))->isAbstract()) {
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\DrdPlus\Codes\Partials\TranslatableExtendableCode' in method 'It_uses_parent_values_as_default_if_not_overloaded'. Open
self::assertSame([], TranslatableExtendableCode::getPossibleValues());
- 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 excessively long variable names like $customCodeTranslations. Keep variable name length under 20. Open
$customCodeTranslations = $translatableExtendableCode->getProperty('customCodeTranslations');
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $translatableExtendableCode. Keep variable name length under 20. Open
$translatableExtendableCode = new \ReflectionClass(TranslatableExtendableCode::class);
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $customValuesReflection. Keep variable name length under 20. Open
$customValuesReflection = $reflectionClass->getProperty('customValues');
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $possibleValuesAndConstantsDifference. Keep variable name length under 20. Open
$possibleValuesAndConstantsDifference = array_diff($possibleValues, array_values($constants));
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
The method I_can_extended_it_by_custom_translatable_code is not named in camelCase. Open
public function I_can_extended_it_by_custom_translatable_code()
{
/** @var TranslatableExtendableCode $sutClass */
$sutClass = self::getSutClass();
$translations = $this->sutReflection->getProperty('translations');
- 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 It_uses_parent_values_as_default_if_not_overloaded is not named in camelCase. Open
public function It_uses_parent_values_as_default_if_not_overloaded()
{
self::assertSame([], TranslatableExtendableCode::getPossibleValues());
}
- 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_not_use_invalid_data_format_of_translations_for_custom_code is not named in camelCase. Open
public function I_can_not_use_invalid_data_format_of_translations_for_custom_code()
{
$this->expectException(\DrdPlus\Codes\Partials\Exceptions\InvalidTranslationFormat::class);
$this->expectExceptionMessageMatches('~this should be array~');
/** like @see \DrdPlus\Codes\Armaments\ArrowCode::addNewArrowCode */
- 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_not_use_empty_string_for_translation_of_custom_code is not named in camelCase. Open
public function I_can_not_use_empty_string_for_translation_of_custom_code()
{
$this->expectException(\DrdPlus\Codes\Partials\Exceptions\InvalidTranslationFormat::class);
$this->expectExceptionMessageMatches("~''~");
/** like @see \DrdPlus\Codes\Armaments\ArrowCode::addNewArrowCode */
- 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 All_public_constants_can_be_given_by_getter is not named in camelCase. Open
public function All_public_constants_can_be_given_by_getter()
{
$constants = $this->sutReflection->getConstants();
self::assertEquals($constants, array_unique($constants));
asort($constants);
- 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_not_use_invalid_language_code_format_for_custom_code is not named in camelCase. Open
public function I_can_not_use_invalid_language_code_format_for_custom_code()
{
$this->expectException(\DrdPlus\Codes\Partials\Exceptions\InvalidLanguageCode::class);
$this->expectExceptionMessageMatches('~a1~');
/** @var TranslatableExtendableCode $sutClass */
- 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_not_use_non_string_for_translation_of_custom_code is not named in camelCase. Open
public function I_can_not_use_non_string_for_translation_of_custom_code()
{
$this->expectException(\DrdPlus\Codes\Partials\Exceptions\InvalidTranslationFormat::class);
$this->expectExceptionMessageMatches('~NULL~');
/** like @see \DrdPlus\Codes\Armaments\ArrowCode::addNewArrowCode */
- 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 Method_to_get_default_values_is_not_public is not named in camelCase. Open
public function Method_to_get_default_values_is_not_public()
{
$sutClass = self::getSutClass();
$getDefaultValues = $this->sutReflection->getMethod('getDefaultValues');
self::assertFalse($getDefaultValues->isPublic(), "Method $sutClass::getDefaultValues is not intended to be public");
- 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_not_use_invalid_plural_for_translation_of_custom_code is not named in camelCase. Open
public function I_can_not_use_invalid_plural_for_translation_of_custom_code()
{
$this->expectException(\DrdPlus\Codes\Partials\Exceptions\UnknownTranslationPlural::class);
$this->expectExceptionMessageMatches('~all~');
/** like @see \DrdPlus\Codes\Armaments\ArrowCode::addNewArrowCode */
- 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() {
}
}