Classes, traits, and interfaces - Drupal 11.1.x - Drupal Core
Primary tabs
Introduction to classes
A lot of the PHP code in Drupal is object oriented (OO), making use of PHP classes, interfaces, and traits. See the Objected-oriented programming conventions for more information.
See also
Objected-oriented programming conventions
File
-
core/
core.api.php, line 1518
Name | Deprecated | Object type | Namespace | File name | Summary | Direct uses | Use statements | Strings |
---|---|---|---|---|---|---|---|---|
ClaroPreRender | class | Drupal\claro | core/ |
Implements trusted prerender callbacks for the Claro theme. | 1 | |||
ClassAndInterfaceTagRetriever | final class | Prophecy\PhpDocumentor | vendor/ |
@author Théo FIDRY <theo.fidry@gmail.com> | 1 | |||
ClassBody | class | Peast\Syntax\Node | vendor/ |
A node that represents a class body. | ||||
ClassCannotBeFoundException | final class | PHPUnit\Runner | vendor/ |
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit | ||||
ClassCodeGenerator | class | Prophecy\Doubler\Generator | vendor/ |
Class code creator. Generates PHP code for specific class node tree. | ||||
ClassCommentSniff | class | PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting | vendor/ |
|||||
ClassCommentSniff | class | Drupal\Sniffs\Commenting | vendor/ |
Checks that comment doc blocks exist on classes, interfaces and traits. Largely copied from PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting\ClassCommentSniff. | ||||
ClassCommentSniff | class | PHP_CodeSniffer\Standards\Squiz\Sniffs\Commenting | vendor/ |
|||||
ClassConst | class | PhpParser\Node\Stmt | vendor/ |
1 | ||||
ClassConst | class | PhpParser\Builder | vendor/ |
|||||
ClassConstantAccessor | class | OpenTelemetry\SDK\Common\Util | vendor/ |
1 | ||||
ClassConstantVisibilitySniff | class | SlevomatCodingStandard\Sniffs\Classes | vendor/ |
|||||
ClassConstFetch | class | PhpParser\Node\Expr | vendor/ |
3 | ||||
ClassCoversExistsRule | class | PHPStan\Rules\PHPUnit | vendor/ |
@implements Rule<InClassNode> | ||||
ClassCreateInstanceSniff | class | Drupal\Sniffs\Classes | vendor/ |
Class create instance Test. | ||||
ClassCreator | class | Prophecy\Doubler\Generator | vendor/ |
Class creator. Creates specific class in current environment. | 1 | |||
ClassCreatorException | class | Prophecy\Exception\Doubler | vendor/ |
2 | ||||
ClassDeclaration | class | Peast\Syntax\Node | vendor/ |
A node that represents a class declaration. For example: class test {} | ||||
ClassDeclarationSniff | class | PHP_CodeSniffer\Standards\PSR2\Sniffs\Classes | vendor/ |
3 | 3 | |||
ClassDeclarationSniff | class | PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes | vendor/ |
|||||
ClassDeclarationSniff | class | PHP_CodeSniffer\Standards\PEAR\Sniffs\Classes | vendor/ |
1 | 1 | |||
ClassDeclarationSniff | class | Drupal\Sniffs\Classes | vendor/ |
Class Declaration Test. | ||||
ClassDeclarationSniff | class | PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes | vendor/ |
|||||
ClassDefinitionClosingBraceSpaceSniff | class | PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS | vendor/ |
|||||
ClassDefinitionNameSpacingSniff | class | PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS | vendor/ |
|||||
ClassDefinitionNameSpacingSniff | class | Drupal\Sniffs\CSS | vendor/ |
Ensure there are no blank lines between the names of classes/IDs. Copied from \PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS\ClassDefinitionNameSpacingSniff because we also check for comma separated selectors on their own line. | ||||
ClassDefinitionOpeningBraceSpaceSniff | class | PHP_CodeSniffer\Standards\Squiz\Sniffs\CSS | vendor/ |
|||||
ClassDiscovery | abstract class | Http\Discovery | vendor/ |
Registry that based find results on class existence. | 7 | 3 | ||
ClassDiscriminatorFromClassMetadata | class | Symfony\Component\Serializer\Mapping | vendor/ |
@author Samuel Roze <samuel.roze@gmail.com> | 1 | |||
ClassDiscriminatorMapping | class | Symfony\Component\Serializer\Mapping | vendor/ |
@author Samuel Roze <samuel.roze@gmail.com> | 4 | |||
ClassDiscriminatorResolverInterface | interface | Symfony\Component\Serializer\Mapping | vendor/ |
Knows how to get the class discriminator mapping for classes and objects. | 1 | 3 | ||
ClassDoesNotExtendTestCaseException | final class | PHPUnit\Runner | vendor/ |
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit | ||||
ClassExpression | class | Peast\Syntax\Node | vendor/ |
A node that represents a class expression For example: test = class {} | ||||
ClassExtendsInternalClassRule | class | mglaman\PHPStanDrupal\Rules\Classes | vendor/ |
@implements Rule<Class_> | ||||
ClassFileNameSniff | class | Drupal\Sniffs\Classes | vendor/ |
|||||
ClassFileNameSniff | class | PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes | vendor/ |
|||||
ClassFilesSniff | class | Drupal\Sniffs\InfoFiles | vendor/ |
Checks files[] entries in info files. Only files containing classes/interfaces should be listed. | 1 | |||
ClassFinder | class | Drupal\Component\ClassFinder | core/ |
A Utility class that uses active autoloaders to find a file for a class. | 1 | |||
ClassFinderInterface | interface | Drupal\Component\ClassFinder | core/ |
Finds a class in a PSR-0 structure. | 2 | 1 | ||
ClassHelper | class | SlevomatCodingStandard\Helpers | vendor/ |
@internal | 17 | |||
ClassInstantiationFailedException | final class | Http\Discovery\Exception | vendor/ |
Thrown when a class fails to instantiate. | 1 | |||
ClassInstantiationSniff | class | PHP_CodeSniffer\Standards\PSR12\Sniffs\Classes | vendor/ |
|||||
ClassIsAbstractException | final class | PHPUnit\Runner | vendor/ |
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit | ||||
ClassIsEnumerationException | final class | PHPUnit\Framework\MockObject\Generator | vendor/ |
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit | 1 | |||
ClassIsFinalException | final class | PHPUnit\Framework\MockObject\Generator | vendor/ |
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit | 1 | |||
ClassIsReadonlyException | final class | PHPUnit\Framework\MockObject\Generator | vendor/ |
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit | 1 | |||
ClassLengthSniff | class | SlevomatCodingStandard\Sniffs\Classes | vendor/ |
|||||
ClassLike | abstract class | PhpParser\Node\Stmt | vendor/ |
4 | ||||
ClassLoader | class | Composer\Autoload | vendor/ |
ClassLoader implements a PSR-0, PSR-4 and classmap class loader. | 19 | |||
ClassLoader | class | Composer\Autoload | vendor/ |
ClassLoader implements a PSR-0, PSR-4 and classmap class loader. | 19 |