Acceptance tests for PHPdomain

Globals

$global_var

A global variable

constant SOME_CONSTANT

A global constant

constant VALUE

A global constant

in_array(needle, haystack)

Checks for needle in haystack.

Parameters:
  • needle – The element to search for.

  • haystack (array) – The array to search.

Returns:

Element exists in array.

Return type:

boolean

Classes

class DateTime

Datetime class

setDate($year, $month, $day)

Set the date in the datetime object

Parameters:
  • $year (int) – The year.

  • $month (int) – The month.

  • $day (int) – The day.

setTime($hour, $minute[, $second])

Set the time. See setDate() for changing the date.

Parameters:
  • $hour (int) – The hour

  • $minute (int) – The minute

  • $second (int) – The second

public static getLastErrors ( )

Returns the warnings and errors

Returns:

array Returns array containing info about warnings and errors.

constant ATOM

Y-m-dTH:i:sP

property testattr

Value of some attribute

class OtherClass

Another class

OtherClass::update($arg='', $arg2=[], $arg3=[])

Update something.

property OtherClass::$ nonIndentedAttribute

This attribute wasn’t indented

constant OtherClass:: NO_INDENT

This class constant wasn’t indented

static OtherClass:: staticMethod

A static method.

Exceptions

exception InvalidArgumentException

Throw when you get an argument that is bad.

Interfaces

interface DateTimeInterface

Datetime interface

setDate($year, $month, $day)

Set the date in the datetime object

Parameters:
  • $year (int) – The year.

  • $month (int) – The month.

  • $day (int) – The day.

setTime($hour, $minute[, $second])

Set the time

Parameters:
  • $hour (int) – The hour

  • $minute (int) – The minute

  • $second (int) – The second

constant ATOM

Y-m-dTH:i:sP

property testattr

Value of some attribute

interface OtherInterface

Another interface

Traits

trait LogTrait

A logging trait

log($level, $string)

A method description.

More globals after classes

$other_global_var

A global variable

strpos($needle, $haystack)

Position of needle in haystack

Test Case - Global symbols with no namespaces

$global_var

$other_global_var

SOME_CONSTANT

in_array

strpos

DateTime

DateTime::setTime()

DateTime::getLastErrors()

DateTime::setDate()

DateTime::ATOM

DateTime::$testattr

OtherClass::update

OtherClass::$nonIndentedAttribute

OtherClass::NO_INDENT

OtherClass::staticMethod

InvalidArgumentException

DateTimeInterface

DateTimeInterface::setTime()

setDate()

DateTimeInterface::ATOM

DateTimeInterface::$testattr

OtherInterface

LogTrait

LogTrait::log()

Namespaced elements

namespaced_function($one[, $two])

A function in a namespace

Parameters:
  • $one (string) – First parameter.

  • $two (string) – Second parameter.

constant LibraryName\ NS_CONST

A constant in a namespace

exception LibraryName\ NamespaceException

This exception is in a namespace.

class LibraryName\ LibraryClass

A class in a namespace

LibraryClass:: instanceMethod ( $foo )

An instance method

constant TEST_CONST

Test constant

property property

A property!

static LibraryName\LibraryClass:: staticMethod

A static method in a namespace

class LibraryName\ NamespaceClass

A class in the namespace, no indenting on children

LibraryName\NamespaceClass::firstMethod($one, $two)

A normal instance method.

property LibraryName\NamespaceClass::$ property

A property

constant LibraryName\NamespaceClass:: NAMESPACE_CONST

Const on class in namespace

static LibraryName\NamespaceClass:: namespaceStatic ( $foo )

A static method here.

final class LibraryName\ LibraryClassFinal

A final class

publicLibraryName\LibraryClassFinal::firstMethod($one, $two)

A public instance method.

protectedLibraryName\LibraryClassFinal::secondMethod($one, $two)

A protected instance method.

privateLibraryName\LibraryClassFinal::thirdMethod($one, $two)

A private instance method.

staticLibraryName\LibraryClassFinal::fourthMethod($one, $two)

A static method.

protectedfinalLibraryName\LibraryClassFinal::fifthMethod($one, $two)

A protected final method.

abstract class LibraryName\ LibraryClassAbstract

An abstract class

interface LibraryName\ LibraryInterface

A interface in a namespace

instanceMethod ( $foo )

An instance method

trait LibraryName\ TemplateTrait

A trait in a namespace

render ( $template )

Render a template.

Test Case - not including namespace

Within a namespace context you don’t need to include the namespace in links.

LibraryName

namespaced_function()

NS_CONST

LibraryClass

LibraryClass::instanceMethod

LibraryClass::staticMethod()

LibraryClass::$property

LibraryClass::TEST_CONST

LibraryName\OtherClass

LibraryName\ThirdClass

NamespaceClass

NamespaceClass::firstMethod

NamespaceClass::$property

LibraryName\LibraryInterface

LibraryName\NamespaceException

TemplateTrait

LibraryName\TemplateTrait

LibraryName\TemplateTrait::render()

Test Case - global access

DateTime

DateTime::setTime()

$global_var

SOME_CONSTANT

LibraryName\LibraryClass::TEST_CONST

LibraryName\NS_CONST

DateTimeInterface

DateTimeInterface::setTime()

LibraryName\LibraryClass::$property

Should not be prefixed with classname.

$property

Any Cross Ref

LibraryName\NS_CONST

DateTimeInterface::setTime()

Nested namespaces

exception LibraryName\SubPackage\ NestedNamespaceException

In a package

class LibraryName\SubPackage\ SubpackageClass

A class in a subpackage

interface LibraryName\SubPackage\ SubpackageInterface

A class in a subpackage

Return Types

class OtherLibrary\ ReturningClass

A class to do some returning.

returnClassFromSameNamespace ( )
Returns:

An object instance of a class from the same namespace.

Return type:

OtherLibrary\ReturnedClass

returnClassFromOtherNamespace ( )
Returns:

An object instance of a class from another namespace.

Return type:

LibraryName\SubPackage\SubpackageInterface

returnClassConstant ( )
Returns:

The value of a specific class constant.

Return type:

LibraryName\NamespaceClass::NAMESPACE_CONST

returnGlobalConstant ( )
Returns:

The value of a specific global constant.

Return type:

SOME_CONSTANT

returnExceptionInstance ( )
Returns:

An instance of an exception.

Return type:

InvalidArgumentException

returnScalarType ( )
Returns:

A scalar string type.

Return type:

string

returnUnionType ( )
Returns:

Any of a whole bunch of things specified with a PHP 8 union type.

Return type:

int|string|OtherLibrary\ReturnedClass|LibraryName\SubPackage\SubpackageInterface|null

class OtherLibrary\ ReturnedClass

A class to return.

Enums

Basic Enumerations

enum Example\Basic\ Suit

In playing cards, a suit is one of the categories into which the cards of a deck are divided.

case Hearts
case Diamonds
case Clubs
case Spades

Backed Enumerations

enum Example\Backed\ Suit string

In playing cards, a suit is one of the categories into which the cards of a deck are divided.

case Hearts 'H'
case Diamonds 'D'
case Clubs 'C'
case Spades 'S'

Advanced Enumerations

enum Example\Advanced\ Suit string

In playing cards, a suit is one of the categories into which the cards of a deck are divided.

case Hearts 'H'
case Diamonds 'D'
case Clubs 'C'
case Spades 'S'
color ( ) string

Returns “red” for hearts and diamonds, “black” for clubs and spades.

static values string[]

Returns an array of the values of all the cases on this enum.

constant Roses Hearts

An alias for Example\Advanced\Suit::Hearts.

constant Bells Diamonds

An alias for Example\Advanced\Suit::Diamonds.

constant Acorns Clubs

An alias for Example\Advanced\Suit::Clubs.

constant Shields Spades

An alias for Example\Advanced\Suit::Spades.