Skip to content

Commit

Permalink
Merge branch 'hotfix/9' into develop
Browse files Browse the repository at this point in the history
Forward port #9
  • Loading branch information
michalbundyra committed May 10, 2019
2 parents 824e361 + 7974d3c commit 3b6a852
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ All notable changes to this project will be documented in this file, in reverse

- [#8](https://github.com/webimpress/coding-standard/pull/8) `Formatting\StringClassReference` - fixes checking if string is a valid class name before check if class/interface/trait exists

- [#9](https://github.com/webimpress/coding-standard/pull/9) `PHP\DisallowFqn` - fixes conflict with `Namespaces\UnusedUseStatement` when newly added import was deleted straight away

## 1.0.0 - 2019-03-07

Initial release.
Expand Down
6 changes: 4 additions & 2 deletions src/WebimpressCodingStandard/Sniffs/PHP/DisallowFqnSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ private function processString(File $phpcsFile, int $stackPtr, string $namespace

$error = '%s must be imported as %s';
$data = [$name, $alias];
$fix = $phpcsFile->addFixableError($error, $stackPtr, 'Import', $data);
$fix = $this->error($phpcsFile, $error, $stackPtr, 'Import', $data, $alias);

if ($fix) {
return $this->import($type, $name, $alias);
Expand Down Expand Up @@ -460,7 +460,7 @@ private function error(
string $code,
array $data,
string $expected
) : void {
) : bool {
$fix = $phpcsFile->addFixableError($error, $stackPtr, $code, $data);
if ($fix) {
$tokens = $phpcsFile->getTokens();
Expand All @@ -481,6 +481,8 @@ private function error(
}
$phpcsFile->fixer->endChangeset();
}

return $fix;
}

private function import(string $type, string $fqn, string $alias) : array
Expand Down

0 comments on commit 3b6a852

Please sign in to comment.