Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class FullyQualifiedSniff implements Sniff
*/
public function register()
{
return array(T_DOUBLE_COLON, T_NEW, T_EXTENDS);
return array(T_DOUBLE_COLON, T_NEW, T_EXTENDS, T_IMPLEMENTS);
}

/**
Expand Down Expand Up @@ -63,6 +63,7 @@ private function getClassCall(File $phpcsFile, $stackPtr): string
);

case T_EXTENDS:
case T_IMPLEMENTS:
$tokensAsString = $phpcsFile->getTokensAsString(
$stackPtr,
$phpcsFile->findEndOfStatement($stackPtr) - $stackPtr
Expand Down
7 changes: 6 additions & 1 deletion tests/rules/classes/allowed/FullyQualifiedSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

namespace flyeralarm\Test;

use IteratorAggregate;
use RuntimeException;
use stdClass;

class FullyQualifiedSniff extends stdClass
class FullyQualifiedSniff extends stdClass implements IteratorAggregate
{
public function a()
{
Expand All @@ -21,4 +22,8 @@ public function b()
'We can\'t explain'
);
}

public function getIterator()
{
}
}
12 changes: 12 additions & 0 deletions tests/rules/classes/not-allowed/FullyQualifiedSniffImplements.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

// @expectedError Qualifier should be replaced with an import: "implements \IteratorAggregate"

namespace flyeralarm\Test;

class FullyQualifiedSniffImplements implements \IteratorAggregate
{
public function getIterator()
{
}
}