drupal_debug_classloader_test_classes.php

Namespace

Drupal\drupal_debug_test_core

File

core/tests/fixtures/TestTools/drupal_debug_classloader_test_classes.php

View source
<?php

// phpcs:ignoreFile
declare (strict_types=1);
namespace Drupal\drupal_debug_test_core;


/**
 * Fixture: parent class with @return annotations but no native return types.
 */
class ParentWithReturn {
  
  /**
   * @return string
   *   A test string.
   */
  public function testMethod() {
    return 'test';
  }
  
  /**
   * @return int
   *   A test integer.
   */
  public function anotherMethod() {
    return 42;
  }

}

/**
 * Fixture: child in the same module as the parent.
 */
class SameModuleChild extends ParentWithReturn {
  
  /**
   * {@inheritdoc}
   */
  public function testMethod() {
    return 'same module';
  }

}
namespace Drupal\drupal_debug_test_other;

use Drupal\drupal_debug_test_core\ParentWithReturn;

/**
 * Fixture: cross-module child without native return type.
 */
class ChildWithoutReturnType extends ParentWithReturn {
  
  /**
   * {@inheritdoc}
   */
  public function testMethod() {
    return 'overridden';
  }

}

/**
 * Fixture: cross-module child with native return type.
 */
class ChildWithNativeReturnType extends ParentWithReturn {
  
  /**
   * {@inheritdoc}
   */
  public function testMethod() : string {
    return 'overridden';
  }

}

/**
 * Fixture: cross-module child with own @return annotation.
 */
class ChildWithReturnAnnotation extends ParentWithReturn {
  
  /**
   * @return string
   *   A test string.
   */
  public function testMethod() {
    return 'overridden';
  }

}

/**
 * Fixture: cross-module child with deprecated method.
 */
class ChildWithDeprecatedMethod extends ParentWithReturn {
  
  /**
   * @deprecated in drupal:11.0.0 and is removed from drupal:12.0.0.
   *   Use something else instead.
   * @see https://www.drupal.org/node/9999999
   */
  public function testMethod() {
    return 'overridden';
  }

}

/**
 * Fixture: cross-module child that does not override the method.
 */
class ChildWithoutOverride extends ParentWithReturn {

}

Classes

Title Deprecated Summary
ChildWithDeprecatedMethod Fixture: cross-module child with deprecated method.
ChildWithNativeReturnType Fixture: cross-module child with native return type.
ChildWithoutOverride Fixture: cross-module child that does not override the method.
ChildWithoutReturnType Fixture: cross-module child without native return type.
ChildWithReturnAnnotation Fixture: cross-module child with own
ParentWithReturn Fixture: parent class with
SameModuleChild Fixture: child in the same module as the parent.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.