This is an abstraction around a PHPUnit-specific docBlock,
allowing us to ask meaningful questions about a specific
reflection symbol.

  • internal This class is not covered by the backward compatibility promise for PHPUnit
CloneableFinal
Constants
public PHPUnit\Util\Annotation\DocBlock::REGEX_DATA_PROVIDER = '/@dataProvider\s+([a-zA-Z0-9._:-\\x7f-\xff]+)/'
 
  • todo This constant should be private (it's public because of TestTest::testGetProvidedDataRegEx)
Methods
public expectedException()
 
  • return array|bool
  • psalm-return false|array{ class: class-string, code: int|string|null, message: string, message_regex: string }
public getInlineAnnotations() : array
 
  • psalm-return array
public getProvidedData() : array
 

Returns the provided data for a method.

  • throws Exception
public isHookToBeExecutedAfterClass() : bool
public isHookToBeExecutedBeforeClass() : bool
public isToBeExecutedAfterTest() : bool
public isToBeExecutedBeforeTest() : bool
public static ofClass(ReflectionClass $class) : self
public static ofMethod(ReflectionMethod $method, string $classNameInHierarchy) : self
 
  • psalm-param class-string $classNameInHierarchy
public requirements() : array
 
  • psalm-return array{ __OFFSET: array&array{__FILE: string}, setting?: array, extension_versions?: array }&array< string, string|array{version: string, operator: string}|array{constraint: string}|array >
  • throws Warning if the requirements version constraint is not well-formed
public symbolAnnotations() : array
Constants
private PHPUnit\Util\Annotation\DocBlock::REGEX_EXPECTED_EXCEPTION = '(@expectedException\s+([:.\w\\x7f-\xff]+)(?:[\t ]+(\S*))?(?:[\t ]+(\S*))?\s*$)m'
private PHPUnit\Util\Annotation\DocBlock::REGEX_REQUIRES = '/@requires\s+(?Pfunction|extension)\s+(?P([^\s<>=!]+))\s*(?P[<>=!]{0,2})\s*(?P[\d\.-]+[\d\.]?)?[ \t]*\r?$/m'
private PHPUnit\Util\Annotation\DocBlock::REGEX_REQUIRES_OS = '/@requires\s+(?POS(?:FAMILY)?)\s+(?P.+?)[ \t]*\r?$/m'
private PHPUnit\Util\Annotation\DocBlock::REGEX_REQUIRES_SETTING = '/@requires\s+(?Psetting)\s+(?P([^ ]+?))\s*(?P[\w\.-]+[\w\.]?)?[ \t]*\r?$/m'
private PHPUnit\Util\Annotation\DocBlock::REGEX_REQUIRES_VERSION = '/@requires\s+(?PPHP(?:Unit)?)\s+(?P[<>=!]{0,2})\s*(?P[\d\.-]+(dev|(RC|alpha|beta)[\d\.])?)[ \t]*\r?$/m'
private PHPUnit\Util\Annotation\DocBlock::REGEX_REQUIRES_VERSION_CONSTRAINT = '/@requires\s+(?PPHP(?:Unit)?)\s+(?P[\d\t \-.|~^]+)[ \t]*\r?$/m'
private PHPUnit\Util\Annotation\DocBlock::REGEX_TEST_WITH = '/@testWith\s+/'
Properties
private $className
 
  • var string
  • psalm-var class-string
private $docComment
 
  • var string
private $endLine
 
  • var int
private $fileName
 
  • var string
private $isMethod
 
  • var bool
private $name
 
  • var string
private $parsedRequirements
 
  • var null|array
  • psalm-var null|(array{ __OFFSET: array&array{__FILE: string}, setting?: array, extension_versions?: array }&array< string, string|array{version: string, operator: string}|array{constraint: string}|array >)
private $startLine
 
  • var int
private $symbolAnnotations
 
  • var array> pre-parsed annotations indexed by name and occurrence index
Methods
private __construct(string $docComment, bool $isMethod, array $symbolAnnotations, int $startLine, int $endLine, string $fileName, string $name, string $className)
 

Note: we do not preserve an instance of the reflection object, since it cannot be safely (de-)serialized.

  • psalm-param class-string $className
private cleanUpMultiLineAnnotation(string $docComment) : string
private static extractAnnotationsFromReflector(Reflector $reflector) : array
 
    private getDataFromDataProviderAnnotation(string $docComment) : array
    private getDataFromTestWithAnnotation(string $docComment) : array
     
    • throws Exception
    private parseAnnotationContent(string $message) : string
     

    Parse annotation content to use constant/class constant values

    Constants are specified using a starting '@'. For example: @ClassName::CONST_NAME

    If the constant is not found the string is used as is to ensure maximum BC.

    private static parseDocBlock(string $docBlock) : array
     
    • return array>
    Methods
    private static extractAnnotationsFromReflector(Reflector $reflector) : array
     
      public static ofClass(ReflectionClass $class) : self
      public static ofMethod(ReflectionMethod $method, string $classNameInHierarchy) : self
       
      • psalm-param class-string $classNameInHierarchy
      private static parseDocBlock(string $docBlock) : array
       
      • return array>
      © 2020 Bruce Wells
      Search Namespaces \ Classes
      ConfigurationNumbers (0-9.) only