Issue #3327853 by Spokje, bbrala, longwave: Don't allow {@inheritDoc} annotation in PHPDocBlocks

(cherry picked from commit 36a8edd987)
merge-requests/3180/head
xjm 2022-12-19 17:16:19 -06:00
parent 5b0d2b4686
commit 8a4328c88e
No known key found for this signature in database
GPG Key ID: 206B0B8743BDF4C2
13 changed files with 47 additions and 31 deletions

View File

@ -29,7 +29,7 @@ class EntityAutocompleteMatcher implements EntityAutocompleteMatcherInterface {
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
public function getMatches($target_type, $selection_handler, $selection_settings, $string = '') { public function getMatches($target_type, $selection_handler, $selection_settings, $string = '') {
$matches = []; $matches = [];

View File

@ -55,7 +55,7 @@ class Media extends CKEditor5PluginDefault implements ContainerFactoryPluginInte
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static( return new static(

View File

@ -48,7 +48,7 @@ class MediaLibrary extends CKEditor5PluginDefault implements ContainerFactoryPlu
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static( return new static(

View File

@ -23,7 +23,7 @@ class DblogTypes extends InOperator {
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function valueForm(&$form, FormStateInterface $form_state) { protected function valueForm(&$form, FormStateInterface $form_state) {
parent::valueForm($form, $form_state); parent::valueForm($form, $form_state);

View File

@ -13,28 +13,28 @@ use Drupal\Core\StreamWrapper\StreamWrapperInterface;
class DummyExternalReadOnlyWrapper extends ReadOnlyStream { class DummyExternalReadOnlyWrapper extends ReadOnlyStream {
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public static function getType() { public static function getType() {
return StreamWrapperInterface::READ_VISIBLE; return StreamWrapperInterface::READ_VISIBLE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function getName() { public function getName() {
return t('Dummy external stream wrapper (readonly)'); return t('Dummy external stream wrapper (readonly)');
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function getDescription() { public function getDescription() {
return t('Dummy external read-only stream wrapper for testing.'); return t('Dummy external read-only stream wrapper for testing.');
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function getExternalUrl() { public function getExternalUrl() {
[, $target] = explode('://', $this->uri, 2); [, $target] = explode('://', $this->uri, 2);
@ -42,105 +42,105 @@ class DummyExternalReadOnlyWrapper extends ReadOnlyStream {
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function realpath() { public function realpath() {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function dirname($uri = NULL) { public function dirname($uri = NULL) {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function dir_closedir() { public function dir_closedir() {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function dir_opendir($path, $options) { public function dir_opendir($path, $options) {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function dir_readdir() { public function dir_readdir() {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function dir_rewinddir() { public function dir_rewinddir() {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function stream_cast($cast_as) { public function stream_cast($cast_as) {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function stream_close() { public function stream_close() {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function stream_eof() { public function stream_eof() {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function stream_read($count) { public function stream_read($count) {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function stream_seek($offset, $whence = SEEK_SET) { public function stream_seek($offset, $whence = SEEK_SET) {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function stream_set_option($option, $arg1, $arg2) { public function stream_set_option($option, $arg1, $arg2) {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function stream_stat() { public function stream_stat() {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function stream_tell() { public function stream_tell() {
return FALSE; return FALSE;
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function url_stat($path, $flags) { public function url_stat($path, $flags) {
return FALSE; return FALSE;

View File

@ -46,7 +46,7 @@ class LinkCollectionNormalizerTest extends KernelTestBase {
protected $testUsers; protected $testUsers;
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected static $modules = [ protected static $modules = [
'jsonapi', 'jsonapi',
@ -56,7 +56,7 @@ class LinkCollectionNormalizerTest extends KernelTestBase {
]; ];
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function setUp(): void { protected function setUp(): void {
parent::setUp(); parent::setUp();

View File

@ -496,7 +496,7 @@ class Migration extends PluginBase implements MigrationInterface, RequirementsIn
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
public function getRequirements(): array { public function getRequirements(): array {
return $this->requirements; return $this->requirements;

View File

@ -368,7 +368,7 @@ class Connection extends DatabaseConnection {
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
public function hasJson(): bool { public function hasJson(): bool {
try { try {

View File

@ -12,7 +12,7 @@ use Drupal\Core\Url;
class JSInteractionTestForm extends FormBase { class JSInteractionTestForm extends FormBase {
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function getFormId() { public function getFormId() {
return __CLASS__; return __CLASS__;

View File

@ -40,7 +40,7 @@ class UserControllerTest extends KernelTestBase {
]; ];
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
protected function setUp(): void { protected function setUp(): void {

View File

@ -18,7 +18,7 @@ class ViewsConfigEntityTestViewsData implements EntityViewsDataInterface {
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function getViewsTableForEntityType(EntityTypeInterface $entity_type) { public function getViewsTableForEntityType(EntityTypeInterface $entity_type) {
return 'views_config_entity_test'; return 'views_config_entity_test';

View File

@ -93,7 +93,7 @@ class WorkspaceRequestSubscriber implements EventSubscriberInterface {
} }
/** /**
* {@inheritDoc} * {@inheritdoc}
*/ */
public static function getSubscribedEvents() { public static function getSubscribedEvents() {
// Use a priority of 190 in order to run after the generic core subscriber. // Use a priority of 190 in order to run after the generic core subscriber.

View File

@ -251,6 +251,22 @@
<rule ref="PSR2.Namespaces.NamespaceDeclaration"/> <rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
<rule ref="PSR2.Namespaces.UseDeclaration"/> <rule ref="PSR2.Namespaces.UseDeclaration"/>
<!-- SlevomatCodingStandard sniffs -->
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
<properties>
<property name="forbiddenAnnotations" type="array">
<element value="@inheritDoc"/>
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenComments">
<properties>
<property name="forbiddenCommentPatterns" type="array">
<element value="/@inheritDoc/"/>
</property>
</properties>
</rule>
<!-- Squiz sniffs --> <!-- Squiz sniffs -->
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/> <rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
<rule ref="Squiz.Arrays.ArrayDeclaration"> <rule ref="Squiz.Arrays.ArrayDeclaration">