Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpcbf fixer loop with SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly #1564

Closed
klausi opened this issue Apr 30, 2023 · 2 comments
Closed

Comments

@klausi
Copy link

klausi commented Apr 30, 2023

I have the following test files which causes the fixer to run into an endless loop and error out:

<?php

namespace foo;

$x = [new Foo(), []];
$y = new Foo();
$z = new $class();
$bar = new $foo[$x + 1]();

$obj1 = new DateTime();
$obj1 = new \DateTime();
$obj2 = $obj1->add(new \DateTime());
$obj2 = $obj1->add(new Vendor());
$obj2 = $obj1->add(new Vendor\DateTools());
$obj2 = $obj1->add(new Vendor\DateTools\DateInterval());
$obj2 = $obj1->add(new DateInterval());

$bar = new $foo[$x + 1][$y + 1]();

/**
 * Test class.
 */
class Test2 {

  /**
   * Using PHP 7 return type hints is fine.
   *
   * @return ValidatorInterface[]
   *   The validators.
   */
  public function getValidators(): array {
    return [
      new PublishedNodesValidator(),
      new MinimumNodesValidator($this->nrOfArticles),
      new AccessibleOnCurrentDomainValidator($this->sectionService),
    ];
  }

}

Executed the fixer with ./vendor/bin/phpcbf --standard=SlevomatCodingStandard Test.php -v

Was not able to track down the cause yet.

@klausi
Copy link
Author

klausi commented Apr 30, 2023

OK, looks like I run SlevomatCodingStandard wrong. In the default config sniffs will contradict each other, so doe not make sense to test like this.

@klausi klausi closed this as completed Apr 30, 2023
@github-actions
Copy link

github-actions bot commented Jun 1, 2023

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant