Code should not be duplicated

More information: https://insight.symfony.com/what-we-analyse/php.duplicated_code

  1. }
  2. /**
  3. * {@inheritdoc}
  4. */
  5. public function supportsNormalization($data, $format = null, array $context = []): bool

    The next 25 lines appear in src/GraphQl/Serializer/ObjectNormalizer.php:49, src/Hal/Serializer/ObjectNormalizer.php:42 and src/JsonApi/Serializer/ObjectNormalizer.php:49.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Teoh Han Hui
  6. {
  7. return self::FORMAT === $format && $this->decorated->supportsNormalization($data, $format, $context);
  8. }
  9. /**

Source code should not contain TODO comments 4

More information: https://insight.symfony.com/what-we-analyse/task_todo_comment

  1. $attributes = RequestAttributesExtractor::extractAttributes($request);
  2. // BC check to be removed in 3.0
  3. if ($this->resourceMetadataFactory) {
  4. if ($attributes) {
  5. // TODO: Subresource operation metadata aren't available by default, for now we have to fallback on default formats.

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Kévin Dunglas
  6. // TODO: A better approach would be to always populate the subresource operation array.
  7. $formats = $this
  8. ->resourceMetadataFactory
  9. ->create($attributes['resource_class'])
  10. ->getOperationAttribute($attributes, 'output_formats', $this->formats, true);
  1. // BC check to be removed in 3.0
  2. if ($this->resourceMetadataFactory) {
  3. if ($attributes) {
  4. // TODO: Subresource operation metadata aren't available by default, for now we have to fallback on default formats.
  5. // TODO: A better approach would be to always populate the subresource operation array.

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Kévin Dunglas
  6. $formats = $this
  7. ->resourceMetadataFactory
  8. ->create($attributes['resource_class'])
  9. ->getOperationAttribute($attributes, 'output_formats', $this->formats, true);
  10. } else {
  1. $pathOperation['tags'] = $subresourceOperation['shortNames'];
  2. $pathOperation['operationId'] = $operationId;
  3. $pathOperation['summary'] = sprintf('Retrieves %s%s resource%s.', $subresourceOperation['collection'] ? 'the collection of ' : 'a ', $subresourceOperation['shortNames'][0], $subresourceOperation['collection'] ? 's' : '');
  4. if (null === $this->formatsProvider) {
  5. // TODO: Subresource operation metadata aren't available by default, for now we have to fallback on default formats.

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Kévin Dunglas
  6. // TODO: A better approach would be to always populate the subresource operation array.
  7. $responseFormats = $this
  8. ->resourceMetadataFactory
  9. ->create($subresourceOperation['resource_class'])
  10. ->getTypedOperationAttribute(OperationType::SUBRESOURCE, $operationName, 'output_formats', $this->formats, true);
  1. $pathOperation['operationId'] = $operationId;
  2. $pathOperation['summary'] = sprintf('Retrieves %s%s resource%s.', $subresourceOperation['collection'] ? 'the collection of ' : 'a ', $subresourceOperation['shortNames'][0], $subresourceOperation['collection'] ? 's' : '');
  3. if (null === $this->formatsProvider) {
  4. // TODO: Subresource operation metadata aren't available by default, for now we have to fallback on default formats.
  5. // TODO: A better approach would be to always populate the subresource operation array.

    TODO comments are left in the code when a feature (or a bug) isn't completely developed (or fixed). You should complete the implementation and remove the comment.

    Time to fix: about 4 hours
    Open Issue Permalink
    Last edited by Kévin Dunglas
  6. $responseFormats = $this
  7. ->resourceMetadataFactory
  8. ->create($subresourceOperation['resource_class'])
  9. ->getTypedOperationAttribute(OperationType::SUBRESOURCE, $operationName, 'output_formats', $this->formats, true);
  10. } else {

Templates should not be too long

More information: https://insight.symfony.com/what-we-analyse/twig.template_too_long

25% of all your templates have more than 200 lines, the threshold is 5%.

Time to fix: about 6 hours
Open Issue Permalink
Collective

Unused method, property, variable or parameter 5

More information: https://insight.symfony.com/what-we-analyse/php.unused_local_variable_or_private_member

  1. /**
  2. * @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112
  3. *
  4. * @var string
  5. */
  6. private $security;

    This security attribute is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Vincent Chalamon
  7. /**
  8. * @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112
  9. *
  10. * @var string
  1. /**
  2. * @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112
  3. *
  4. * @var string
  5. */
  6. private $securityMessage;

    This securityMessage attribute is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Vincent Chalamon
  7. /**
  8. * @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112
  9. *
  10. * @var string
  1. /**
  2. * @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112
  3. *
  4. * @var string
  5. */
  6. private $securityPostDenormalize;

    This securityPostDenormalize attribute is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Vincent Chalamon
  7. /**
  8. * @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112
  9. *
  10. * @var string
  1. /**
  2. * @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112
  3. *
  4. * @var string
  5. */
  6. private $securityPostDenormalizeMessage;

    This securityPostDenormalizeMessage attribute is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Vincent Chalamon
  7. /**
  8. * @see https://github.com/Haehnchen/idea-php-annotation-plugin/issues/112
  9. *
  10. * @var array
  1. private $title;
  2. private $description;
  3. private $version;
  4. private $formats;
  5. private $formatsProvider;
  6. private $resourceMetadataFactory;

    This resourceMetadataFactory attribute is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by Kévin Dunglas
  7. public function __construct(ResourceNameCollectionFactoryInterface $resourceNameCollectionFactory, string $title = '', string $description = '', string $version = '', $formatsProvider = null)
  8. {
  9. $this->resourceNameCollectionFactory = $resourceNameCollectionFactory;
  10. $this->title = $title;