PATH:
opt
/
cpanel
/
ea-wappspector
/
vendor
/
squizlabs
/
php_codesniffer
/
tests
/
Core
/
Ruleset
<?php /** * Tests deprecation of support for sniffs not implementing the PHPCS `Sniff` interface. * * @author Juliette Reinders Folmer <phpcs_nospam@adviesenzo.nl> * @copyright 2025 PHPCSStandards and contributors * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence */ namespace PHP_CodeSniffer\Tests\Core\Ruleset; use PHP_CodeSniffer\Ruleset; use PHP_CodeSniffer\Tests\ConfigDouble; use PHPUnit\Framework\TestCase; /** * Tests deprecation of support for sniffs not implementing the PHPCS `Sniff` interface. * * @covers \PHP_CodeSniffer\Ruleset::registerSniffs */ final class RegisterSniffsMissingInterfaceTest extends TestCase { /** * Test that no deprecation is shown when sniffs implement the `PHP_CodeSniffer\Sniffs\Sniff` interface. * * @return void */ public function testNoNoticesForSniffsImplementingInterface() { // Set up the ruleset. $standard = __DIR__.'/RegisterSniffsMissingInterfaceValidTest.xml'; $config = new ConfigDouble(["--standard=$standard"]); $this->expectOutputString(''); new Ruleset($config); }//end testNoNoticesForSniffsImplementingInterface() /** * Test that a deprecation notice is shown if a sniff doesn't implement the Sniff interface. * * @return void */ public function testDeprecationNoticeWhenSniffDoesntImplementInterface() { // Set up the ruleset. $standard = __DIR__.'/RegisterSniffsMissingInterfaceInvalidTest.xml'; $config = new ConfigDouble(["--standard=$standard"]); $expected = 'DEPRECATED: All sniffs must implement the PHP_CodeSniffer\\Sniffs\\Sniff interface.'.PHP_EOL; $expected .= 'Interface not implemented for sniff Fixtures\\TestStandard\\Sniffs\\MissingInterface\\InvalidImplementsWithoutImplementSniff.'.PHP_EOL; $expected .= 'Contact the sniff author to fix the sniff.'.PHP_EOL.PHP_EOL; $this->expectOutputString($expected); new Ruleset($config); }//end testDeprecationNoticeWhenSniffDoesntImplementInterface() }//end class
[+]
..
[-] ProcessRulesetShouldProcessElementTest.xml
[edit]
[-] ProcessRulesetAutoExpandSniffsDirectoryTest.xml
[edit]
[-] ProcessRulesetExcludeSniffGroupTest.xml
[edit]
[-] PropertyTypeHandlingTest.xml
[edit]
[-] ExplainCustomRulesetTest.xml
[edit]
[-] ShowSniffDeprecationsInvalidDeprecationVersionTest.xml
[edit]
[-] RegisterSniffsMissingInterfaceTest.php
[edit]
[-] ExpandRulesetReferenceCaseMismatch2Test.xml
[edit]
[-] PopulateTokenListenersTest.php
[edit]
[-] ExpandSniffDirectoryTest.xml
[edit]
[-] ExpandRulesetReferenceInvalidErrorCode1Test.xml
[edit]
[-] SetPropertyDoesNotThrowErrorOnInvalidPropertyWhenSetForStandardTest.xml
[edit]
[-] ExpandRulesetReferenceTest.php
[edit]
[-] RegisterSniffsMissingInterfaceValidTest.xml
[edit]
[-] ExpandRulesetReferenceHomePathTest.php
[edit]
[-] ExpandRulesetReferenceUnknownCategoryTest.xml
[edit]
[-] ExpandSniffDirectoryTest.php
[edit]
[-] RuleInclusionAbsoluteWindowsTest.php
[edit]
[-] AbstractRulesetTestCase.php
[edit]
[-] ProcessRulesetTest.php
[edit]
[-] ShowSniffDeprecationsEmptyRemovalVersionTest.xml
[edit]
[-] GetIncludePatternsTest.xml
[edit]
[-] RegisterSniffsRejectsInvalidSniffNoImplementsNoRegisterOrProcessTest.xml
[edit]
[-] RegisterSniffsTest.php
[edit]
[+]
Fixtures
[-] SetPropertyAppliesPropertyToMultipleSniffsInCategoryTest.xml
[edit]
[-] ShowSniffDeprecationsTest.xml
[edit]
[-] ExpandRulesetReferenceMissingFileTest.xml
[edit]
[-] ProcessRulesetBrokenRulesetEmptyFileTest.xml
[edit]
[-] ExpandRulesetReferenceInternalIgnoreTest.xml
[edit]
[-] ExpandRulesetReferenceInternalTest.php
[edit]
[-] ProcessRulesetMiscTest.xml
[edit]
[-] SetPropertyAllowedViaStdClassTest.xml
[edit]
[-] PopulateTokenListenersRegisterNoArrayTest.xml
[edit]
[-] RegisterSniffsRejectsInvalidSniffNoImplementsNoProcessTest.xml
[edit]
[-] ExpandRulesetReferenceUnknownSniffTest.xml
[edit]
[-] ProcessRulesetBrokenRulesetSingleErrorTest.xml
[edit]
[-] ExpandRulesetReferenceCaseMismatch1Test.xml
[edit]
[-] SetPropertyNotAllowedViaAttributeTest.xml
[edit]
[-] GetIgnorePatternsTest.xml
[edit]
[-] RuleInclusionAbsoluteLinuxTest.xml
[edit]
[-] ShowSniffDeprecationsEmptyDeprecationVersionTest.xml
[edit]
[-] PopulateTokenListenersSupportedTokenizersTest.php
[edit]
[-] ShowSniffDeprecationsInvalidRemovalVersionTest.xml
[edit]
[-] ShowSniffDeprecationsTest.php
[edit]
[-] ProcessRuleInvalidTypeTest.php
[edit]
[-] RegisterSniffsRejectsInvalidSniffTest.php
[edit]
[-] SetPropertyAllowedAsDeclaredTest.xml
[edit]
[-] ShowSniffDeprecationsReportWidthTest.xml
[edit]
[-] ProcessRuleInvalidTypeTest.xml
[edit]
[-] ExpandRulesetReferenceInternalStandardTest.xml
[edit]
[-] ExpandRulesetReferenceInvalidErrorCode2Test.xml
[edit]
[-] PopulateTokenListenersNamingConventionsTest.xml
[edit]
[-] SetSniffPropertyTest.php
[edit]
[-] ProcessRuleShouldProcessElementTest.xml
[edit]
[-] RuleInclusionTest-include.xml
[edit]
[-] ShowSniffDeprecationsInvalidDeprecationMessageTest.xml
[edit]
[-] PopulateTokenListenersSupportedTokenizersTest.xml
[edit]
[-] RuleInclusionTest.xml
[edit]
[-] ProcessRulesetAutoloadFileNotFoundTest.xml
[edit]
[-] RuleInclusionTest.php
[edit]
[-] PopulateTokenListenersNamingConventionsTest.php
[edit]
[-] ExplainSingleSniffTest.xml
[edit]
[-] GetIncludePatternsTest.php
[edit]
[-] GetIgnorePatternsTest.php
[edit]
[-] RegisterSniffsRejectsInvalidSniffNoImplementsNoRegisterTest.xml
[edit]
[-] ExpandRulesetReferenceHomePathFailTest.xml
[edit]
[-] ProcessRuleShouldProcessElementTest.php
[edit]
[-] ExpandRulesetReferenceUnknownStandardTest.xml
[edit]
[-] ExplainTest.php
[edit]
[-] PopulateTokenListenersTest.xml
[edit]
[-] ExpandRulesetReferenceHomePathTest.xml
[edit]
[-] ConstructorTest.php
[edit]
[-] PropertyTypeHandlingTest.php
[edit]
[-] ProcessRulesetAutoloadTest.php
[edit]
[-] PropertyTypeHandlingInlineTest.xml
[edit]
[-] SetPropertyDoesNotThrowErrorOnInvalidPropertyWhenSetForCategoryTest.xml
[edit]
[-] RegisterSniffsMissingInterfaceInvalidTest.xml
[edit]
[-] ProcessRulesetAutoloadTest.xml
[edit]
[-] SetPropertyAllowedViaMagicMethodTest.xml
[edit]
[-] ProcessRulesetInvalidNoSniffsDirTest.xml
[edit]
[-] ShowSniffDeprecationsOrderTest.xml
[edit]
[-] ExpandRulesetReferenceInvalidErrorCode3Test.xml
[edit]
[-] RuleInclusionAbsoluteLinuxTest.php
[edit]
[-] SetPropertyThrowsErrorOnInvalidPropertyTest.xml
[edit]
[-] ProcessRulesetBrokenRulesetTest.php
[edit]
[-] ConstructorNoSniffsTest.xml
[edit]
[-] ExpandRulesetReferenceInvalidHomePathRefTest.xml
[edit]
[-] ExpandRulesetReferenceTest.xml
[edit]
[-] ProcessRulesetBrokenRulesetMultiErrorTest.xml
[edit]
[-] RuleInclusionAbsoluteWindowsTest.xml
[edit]
[-] ProcessRulesetShouldProcessElementTest.php
[edit]
[-] DisplayCachedMessagesTest.php
[edit]