wol-soft/php-json-schema-model-generator

View on GitHub
src/Model/Validator/ComposedPropertyValidator.php

Summary

Maintainability
A
2 hrs
Test Coverage
A
100%

Method getCheck has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getCheck(): string
    {
        /**
         * Add a method to the schema to gather values from a nested object which are modified.
         * This is required to adopt filter changes to the values which are passed into a merged property
Severity: Minor
Found in src/Model/Validator/ComposedPropertyValidator.php - About 1 hr to fix

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            GeneratorConfiguration $generatorConfiguration,
            PropertyInterface $property,
            array $composedProperties,
            string $compositionProcessor,
            array $validatorVariables,
    Severity: Minor
    Found in src/Model/Validator/ComposedPropertyValidator.php - About 35 mins to fix

      Avoid unused parameters such as '$modifiedValuesMethod'.
      Open

                          private string $modifiedValuesMethod

      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 '$compositionProperties'.
      Open

                          private array $compositionProperties,

      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

      syntax error, unexpected 'string' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
      Open

          private string $modifiedValuesMethod;

      The first parameter of a multi-line function declaration must be on the line after the opening bracket
      Open

                          private array $compositionProperties,

      Line exceeds 120 characters; contains 170 characters
      Open

                      $composedProperty->filterValidators(static fn(Validator $validator): bool => !is_a($validator->getValidator(), AbstractComposedPropertyValidator::class));

      Line exceeds 120 characters; contains 145 characters
      Open

                                          && ($modifiedValue = $nestedCompositionObject->$accessor()) !== ($originalModelData[$key] ?? !$modifiedValue)

      Line indented incorrectly; expected 16 spaces, found 20
      Open

                          private string $modifiedValuesMethod

      Multi-line function call not indented correctly; expected 12 spaces but found 16
      Open

                      DIRECTORY_SEPARATOR,

      Multi-line function call not indented correctly; expected 12 spaces but found 16
      Open

                      '\\',

      Line indented incorrectly; expected 16 spaces, found 20
      Open

                          private array $compositionProperties,

      Closing brace must be on a line by itself
      Open

                      ) {}

      Opening parenthesis of a multi-line function call must be the last content on the line
      Open

                          return sprintf('

      Multi-line function call not indented correctly; expected 12 spaces but found 16
      Open

                      dirname(str_replace('\\', DIRECTORY_SEPARATOR, InvalidComposedValueException::class)),

      Multi-line function call not indented correctly; expected 8 spaces but found 12
      Open

                  ) . '\\' . str_replace(

      There are no issues that match your filters.

      Category
      Status