Object parameters should be type hinted

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

  1. {
  2. $this->translations = $translations;
  3. return $this;
  4. }
  5. public function addTranslation($translation)

    The parameter translation, which is an object, should be typehinted.

    Time to fix: about 1 hour
    Open Issue Permalink
    Last edited by a2lix
  6. {
  7. $this->getTranslations()->set($translation->getLocale(), $translation);
  8. $translation->setTranslatable($this);
  9. return $this;
  10. }

Unused method, property, variable or parameter 2

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

  1. public function getCurrentTranslation()
  2. {
  3. return $this->getTranslations()->first();
  4. }
  5. public function __call($method, $args)

    This args argument is declared but never used. You should remove it.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix
  6. {
  7. $method = ('get' === substr($method, 0, 3)) ? $method : 'get'. ucfirst($method);
  8. if (!$translation = $this->getCurrentTranslation()) {
  9. return;
  1. */
  2. class DoctrineListener extends BaseDoctrineListener
  3. {
  4. private $translatableTrait;
  5. private $translationTrait;
  6. private $translatableFetchMode;

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

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by David ALLIX
  7. private $translationFetchMode;
  8. private $isRecursive;
  9. /**
  10. *

Project files should not mix end of lines

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

Some files contain mixed and/or invalid end of lines ( \r\n instead of \n). Homogenize them to improve compatibility across different platforms.

  • Annotation/I18nDoctrine.php
  • composer.json
  • DependencyInjection/A2lixI18nDoctrineExtension.php
  • DependencyInjection/Configuration.php
  • Doctrine/Interfaces/ManyLocalesInterface.php
  • Doctrine/Interfaces/OneLocaleInterface.php
  • Doctrine/ODM/EventListener/ControllerListener.php
  • Doctrine/ODM/EventListener/DoctrineListener.php
  • Doctrine/ODM/Filter/ManyLocalesFilter.php
  • Doctrine/ODM/Filter/OneLocaleFilter.php
  • Doctrine/ORM/EventListener/ControllerListener.php
  • Doctrine/ORM/EventListener/DoctrineListener.php
  • Doctrine/ORM/Filter/ManyLocalesFilter.php
  • Doctrine/ORM/Filter/OneLocaleFilter.php
  • EventListener/ControllerListener.php
  • EventListener/DoctrineListener.php
  • README.md
  • Resources/config/services.xml

To solve this issue, run the below command:

Time to fix: about 15 minutes
Open Issue Permalink
Collective
sed -i "s/\r//g" 'Annotation/I18nDoctrine.php' \
    'composer.json' \
    'DependencyInjection/A2lixI18nDoctrineExtension.php' \
    'DependencyInjection/Configuration.php' \
    'Doctrine/Interfaces/ManyLocalesInterface.php' \
    'Doctrine/Interfaces/OneLocaleInterface.php' \
    'Doctrine/ODM/EventListener/ControllerListener.php' \
    'Doctrine/ODM/EventListener/DoctrineListener.php' \
    'Doctrine/ODM/Filter/ManyLocalesFilter.php' \
    'Doctrine/ODM/Filter/OneLocaleFilter.php' \
    'Doctrine/ORM/EventListener/ControllerListener.php' \
    'Doctrine/ORM/EventListener/DoctrineListener.php' \
    'Doctrine/ORM/Filter/ManyLocalesFilter.php' \
    'Doctrine/ORM/Filter/OneLocaleFilter.php' \
    'EventListener/ControllerListener.php' \
    'EventListener/DoctrineListener.php' \
    'README.md' \
    'Resources/config/services.xml'

Text files should end with a valid new line character. 12

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

  1. {
  2. public function build(ContainerBuilder $container)
  3. {
  4. parent::build($container);
  5. }
  6. }

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix
  1. * @Target("METHOD")
  2. */
  3. class I18nDoctrine extends Annotation
  4. {
  5. }

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix
  1. interface ManyLocalesInterface
  2. {
  3. public function getLocales();
  4. public function setLocales($locales);
  5. }

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix
  1. interface OneLocaleInterface
  2. {
  3. public function getLocale();
  4. public function setLocale($locale);
  5. }

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix
  1. } else {
  2. $this->om->getFilterCollection()->enable('oneLocale')->setParameter('locale', $event->getRequest()->getLocale());
  3. }
  4. }
  5. }

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix
  1. return array(
  2. Events::loadClassMetadata,
  3. );
  4. }
  5. }

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix
  1. public function addFilterCriteria(ClassMetadata $targetMetadata)
  2. {
  3. }
  4. }

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix
  1. public function addFilterCriteria(ClassMetadata $targetMetadata)
  2. {
  3. }
  4. }

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix
  1. }
  2. return $targetTableAlias .'.locales LIKE %'. $this->getParameter('locale') .'%';
  3. }
  4. }

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix
  1. }
  2. return $targetTableAlias .'.locale = '. $this->getParameter('locale');
  3. }
  4. }

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix
  1. {
  2. $this->annotationReader = $annotationReader;
  3. $this->om = $om;
  4. }
  5. }

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix
  1. }
  2. return $this->hasTrait($parentClass, $traitName, $isRecursive);
  3. }
  4. }

    This file ends with no newline character, or with a different newline character than other files in your project. It won't render properly on a terminal, and it's considered a bad practice.

    Time to fix: about 15 minutes
    Open Issue Permalink
    Last edited by a2lix