Loading coder_sniffer/DrupalPractice/Sniffs/Objects/GlobalFunctionSniff.php +5 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,11 @@ class GlobalFunctionSniff implements Sniff { $tokens = $phpcsFile->getTokens(); // Only run this sniff on Drupal 8+. if (Project::getCoreVersion($phpcsFile) < 8) { return; } // We are only interested in function calls, which are not in the global // scope. if (isset($this->functions[$tokens[$stackPtr]['content']]) === false Loading coder_sniffer/DrupalPractice/Test/Objects/GlobalFunctionUnitTest.php +3 −2 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ class GlobalFunctionUnitTest extends CoderSniffUnitTest protected function getWarningList($testFile=null) { switch ($testFile) { case 'GlobalFunctionUnitTest.inc': case 'TestForm.php': return [ 6 => 1, 8 => 1, Loading Loading @@ -70,11 +70,12 @@ class GlobalFunctionUnitTest extends CoderSniffUnitTest protected function getTestFiles($testFileBase) { return [ __DIR__.'/GlobalFunctionUnitTest.inc', __DIR__.'/src/example.module', __DIR__.'/src/ExampleClass.php', __DIR__.'/src/ExampleClassWithDependencyInjection.php', __DIR__.'/src/ExampleService.php', __DIR__.'/src/TestForm.php', __DIR__.'/drupal7/ExampleMigration.php', ]; }//end getTestFiles() Loading coder_sniffer/DrupalPractice/Test/Objects/drupal7/ExampleMigration.php 0 → 100644 +28 −0 Original line number Diff line number Diff line <?php /** * A class from Drupal 7 that should not throw errors. */ class ExampleMigration extends ExampleMigrateBase { /** * {@inheritdoc} */ public function __construct($arguments) { parent::__construct($arguments); $this->description = t('Import users from the CSV.'); $columns = [ ['uuid', t('UUID')], ['name', t('Username')], ['pass', t('User password')], ['email', t('User email')], ['role', t('User role')], ['site', t('Site')], ['first_name', t('First name')], ['last_name', t('Last name')], ['phone', t('Phone')], ['status', t('Status')], ]; } } coder_sniffer/DrupalPractice/Test/Objects/drupal7/example.info 0 → 100644 +2 −0 Original line number Diff line number Diff line name = Test core = 7.x coder_sniffer/DrupalPractice/Test/Objects/GlobalFunctionUnitTest.inc→coder_sniffer/DrupalPractice/Test/Objects/src/TestForm.php +0 −0 File moved. View file Loading
coder_sniffer/DrupalPractice/Sniffs/Objects/GlobalFunctionSniff.php +5 −0 Original line number Diff line number Diff line Loading @@ -81,6 +81,11 @@ class GlobalFunctionSniff implements Sniff { $tokens = $phpcsFile->getTokens(); // Only run this sniff on Drupal 8+. if (Project::getCoreVersion($phpcsFile) < 8) { return; } // We are only interested in function calls, which are not in the global // scope. if (isset($this->functions[$tokens[$stackPtr]['content']]) === false Loading
coder_sniffer/DrupalPractice/Test/Objects/GlobalFunctionUnitTest.php +3 −2 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ class GlobalFunctionUnitTest extends CoderSniffUnitTest protected function getWarningList($testFile=null) { switch ($testFile) { case 'GlobalFunctionUnitTest.inc': case 'TestForm.php': return [ 6 => 1, 8 => 1, Loading Loading @@ -70,11 +70,12 @@ class GlobalFunctionUnitTest extends CoderSniffUnitTest protected function getTestFiles($testFileBase) { return [ __DIR__.'/GlobalFunctionUnitTest.inc', __DIR__.'/src/example.module', __DIR__.'/src/ExampleClass.php', __DIR__.'/src/ExampleClassWithDependencyInjection.php', __DIR__.'/src/ExampleService.php', __DIR__.'/src/TestForm.php', __DIR__.'/drupal7/ExampleMigration.php', ]; }//end getTestFiles() Loading
coder_sniffer/DrupalPractice/Test/Objects/drupal7/ExampleMigration.php 0 → 100644 +28 −0 Original line number Diff line number Diff line <?php /** * A class from Drupal 7 that should not throw errors. */ class ExampleMigration extends ExampleMigrateBase { /** * {@inheritdoc} */ public function __construct($arguments) { parent::__construct($arguments); $this->description = t('Import users from the CSV.'); $columns = [ ['uuid', t('UUID')], ['name', t('Username')], ['pass', t('User password')], ['email', t('User email')], ['role', t('User role')], ['site', t('Site')], ['first_name', t('First name')], ['last_name', t('Last name')], ['phone', t('Phone')], ['status', t('Status')], ]; } }
coder_sniffer/DrupalPractice/Test/Objects/drupal7/example.info 0 → 100644 +2 −0 Original line number Diff line number Diff line name = Test core = 7.x
coder_sniffer/DrupalPractice/Test/Objects/GlobalFunctionUnitTest.inc→coder_sniffer/DrupalPractice/Test/Objects/src/TestForm.php +0 −0 File moved. View file