Showing 387 of 387 total issues
Method __construct
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(
SchemaProcessor $schemaProcessor,
Schema $schema,
JsonSchema $itemStructure,
PropertyInterface $property,
Method process
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(Schema $schema, GeneratorConfiguration $generatorConfiguration): void
{
$json = $schema->getJsonSchema()->getJson();
if ((!$this->addForModelsWithoutAdditionalPropertiesDefinition && !isset($json['additionalProperties']))
Function addAdditionalPropertiesSerialization
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function addAdditionalPropertiesSerialization(
Schema $schema,
GeneratorConfiguration $generatorConfiguration,
): void {
$validationProperty = null;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validateEnum
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function validateEnum(PropertyInterface $property): bool
{
$throw = function (string $message) use ($property): void {
throw new SchemaException(
sprintf(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method addComposedValueValidator
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addComposedValueValidator(PropertyInterface $property, JsonSchema $propertySchema): void
{
$composedValueKeywords = ['allOf', 'anyOf', 'oneOf', 'not', 'if'];
$propertyFactory = new PropertyFactory(new ComposedValueProcessorFactory($property instanceof BaseProperty));
Method addSetAdditionalPropertyMethod
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function addSetAdditionalPropertyMethod(
Schema $schema,
GeneratorConfiguration $generatorConfiguration,
?PropertyInterface $validationProperty,
): void {
Method __construct
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(
SchemaProcessor $schemaProcessor,
Schema $schema,
string $pattern,
JsonSchema $propertyStructure,
Method process
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(string $propertyName, JsonSchema $propertySchema): PropertyInterface
{
$path = [];
$reference = $propertySchema->getJson()['$ref'];
$dictionary = $this->schema->getSchemaDictionary();
Method addEnumValidator
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addEnumValidator(PropertyInterface $property, array $allowedValues): void
{
if (empty($allowedValues)) {
throw new SchemaException(
sprintf(
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(
SchemaProcessor $schemaProcessor,
Schema $schema,
JsonSchema $propertiesStructure,
string $propertyName,
Method addTransformedValuePassThrough
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function addTransformedValuePassThrough(
PropertyInterface $property,
TransformingFilterInterface $filter,
ReflectionType $filteredType,
): void {
Function addFilter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addFilter(FilterInterface ...$additionalFilter): self
{
foreach ($additionalFilter as $filter) {
$this->validateFilterCallback(
$filter->getFilter(),
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function addComposedValueValidator
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function addComposedValueValidator(PropertyInterface $property, JsonSchema $propertySchema): void
{
$composedValueKeywords = ['allOf', 'anyOf', 'oneOf', 'not', 'if'];
$propertyFactory = new PropertyFactory(new ComposedValueProcessorFactory($property instanceof BaseProperty));
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function transferComposedPropertiesToSchema
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function transferComposedPropertiesToSchema(PropertyInterface $property): void
{
foreach ($property->getValidators() as $validator) {
$validator = $validator->getValidator();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function resolveReference
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function resolveReference(
string $propertyName,
array $path,
PropertyMetaDataCollection $propertyMetaDataCollection,
): PropertyInterface {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function processSubProperties
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function processSubProperties(
string $propertyName,
JsonSchema $propertySchema,
PropertyInterface $property,
): array {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid variables with short names like $b. Configured minimum length is 3. Open
function ($a, $b): int { return $a === $b ? 0 : 1; },
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $di. Configured minimum length is 3. Open
$di = new RecursiveDirectoryIterator($modelPath, FilesystemIterator::SKIP_DOTS);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $a. Configured minimum length is 3. Open
function ($a, $b): int { return $a === $b ? 0 : 1; },
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $ri. Configured minimum length is 3. Open
$ri = new RecursiveIteratorIterator($di, RecursiveIteratorIterator::CHILD_FIRST);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}