core

package
v0.0.0-...-18194de Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2026 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ASSERT_ACTIVE    phpv.ZInt = 1
	ASSERT_WARNING   phpv.ZInt = 2
	ASSERT_CALLBACK  phpv.ZInt = 3
	ASSERT_BAIL      phpv.ZInt = 4
	ASSERT_QUIET     phpv.ZInt = 5
	ASSERT_EXCEPTION phpv.ZInt = 6
)

PHP assert option constants

View Source
const (
	COUNT_NORMAL phpv.ZInt = iota
	COUNT_RECURSIVE
)

> const

View Source
const (
	TRUE                 = phpv.ZBool(true)
	FALSE                = phpv.ZBool(false)
	ZEND_THREAD_SAFE     = phpv.ZBool(true) // consider things thread safe
	PHP_ZTS              = phpv.ZInt(1)
	PHP_DEBUG            = phpv.ZInt(0)
	DEFAULT_INCLUDE_PATH = phpv.ZString(".:")
	DIRECTORY_SEPARATOR  = phpv.ZString("/")
	PHP_EOL              = phpv.ZString("\n")
	PHP_INT_MAX          = phpv.ZInt(math.MaxInt64)
	PHP_INT_MIN          = phpv.ZInt(math.MinInt64)
	PHP_INT_SIZE         = phpv.ZInt(8)

	// standard values
	PHP_FD_SETSIZE    = phpv.ZInt(1024)
	PHP_MAXPATHLEN    = phpv.ZInt(4096)
	PHP_FLOAT_DIG     = phpv.ZInt(15)
	PHP_FLOAT_EPSILON = phpv.ZFloat(2.220446049250313e-16)
	PHP_FLOAT_MAX     = phpv.ZFloat(math.MaxFloat64)
	PHP_FLOAT_MIN     = phpv.ZFloat(math.SmallestNonzeroFloat64)
	PATH_SEPARATOR    = phpv.ZString(":")

	// Seek constants
	SEEK_SET = phpv.ZInt(0)
	SEEK_CUR = phpv.ZInt(1)
	SEEK_END = phpv.ZInt(2)

	E_ERROR             = phpv.ZInt(phpv.E_ERROR)
	E_WARNING           = phpv.ZInt(phpv.E_WARNING)
	E_PARSE             = phpv.ZInt(phpv.E_PARSE)
	E_NOTICE            = phpv.ZInt(phpv.E_NOTICE)
	E_CORE_ERROR        = phpv.ZInt(phpv.E_CORE_ERROR)
	E_CORE_WARNING      = phpv.ZInt(phpv.E_CORE_WARNING)
	E_COMPILE_ERROR     = phpv.ZInt(phpv.E_COMPILE_ERROR)
	E_COMPILE_WARNING   = phpv.ZInt(phpv.E_COMPILE_WARNING)
	E_USER_ERROR        = phpv.ZInt(phpv.E_USER_ERROR)
	E_USER_WARNING      = phpv.ZInt(phpv.E_USER_WARNING)
	E_USER_NOTICE       = phpv.ZInt(phpv.E_USER_NOTICE)
	E_STRICT            = phpv.ZInt(phpv.E_STRICT)
	E_RECOVERABLE_ERROR = phpv.ZInt(phpv.E_RECOVERABLE_ERROR)
	E_DEPRECATED        = phpv.ZInt(phpv.E_DEPRECATED)
	E_USER_DEPRECATED   = phpv.ZInt(phpv.E_USER_DEPRECATED)
	E_ALL               = phpv.ZInt(phpv.E_ALL)
)

> const

View Source
const (
	DEBUG_BACKTRACE_PROVIDE_OBJECT = phpv.ZInt(1)
	DEBUG_BACKTRACE_IGNORE_ARGS    = phpv.ZInt(2)
)

> const

View Source
const (
	PHP_OS        = phpv.ZString(runtime.GOOS)
	PHP_OS_FAMILY = phpv.ZString(runtime.GOOS)
)

> const

View Source
const (
	PHP_VERSION         = phpv.ZString(VERSION) // version of PHP
	PHP_MAJOR_VERSION   = phpv.ZInt(8)
	PHP_MINOR_VERSION   = phpv.ZInt(2)
	PHP_RELEASE_VERSION = phpv.ZInt(0)
	PHP_EXTRA_VERSION   = phpv.ZString("")
	PHP_VERSION_ID      = phpv.ZInt(80200)
)

> const

View Source
const VERSION = "8.2.0"

php targetted version

Variables

View Source
var ErrNotEnoughArguments = errors.New("Too few arguments")
View Source
var NULL = phpv.ZNull{}

> const

Functions

func CallbackErrorReason

func CallbackErrorReason(err error) string

CallbackErrorReason extracts the reason portion from a SpawnCallable error. SpawnCallable errors are typically formatted as:

"funcName(): Argument #N ($callback) must be a valid callback, <reason>"

This function returns just the "<reason>" part for re-wrapping by callers. If the error is not a callback error, it returns the full error string.

func Deref

func Deref[T any](ptr *T, defValue T) T

func Eval

func Eval(ctx phpv.Context, expr string) (*phpv.ZVal, error)

func Every

func Every[T any](xs []T, predicate func(T) bool) bool

func Expand

func Expand(ctx phpv.Context, args []*phpv.ZVal, out ...interface{}) (int, error)

func ExpandAt

func ExpandAt(ctx phpv.Context, args []*phpv.ZVal, i int, out interface{}) error

func Idx

func Idx[T any](xs []T, i int, defaultVal ...T) T

safe-index, returns defaultVal or default(T) if out of bounds

func IfElse

func IfElse[T any](cond bool, consequence, alternative T) T

func IterateBackwards

func IterateBackwards[T any](xs []T) iter.Seq2[int, T]

func SpawnCallable

func SpawnCallable(ctx phpv.Context, v *phpv.ZVal) (phpv.Callable, error)

func SpawnCallableParam

func SpawnCallableParam(ctx phpv.Context, v *phpv.ZVal, paramNo int) (phpv.Callable, error)

func StrIdx

func StrIdx(str string, i int, defaultVal ...byte) byte

safe-index on strings, returns 0 or defaultVal if out of bounds

func ZFprintf

func ZFprintf(ctx phpv.Context, w printfWriter, format phpv.ZString, arg ...*phpv.ZVal) (int, error)

Zprintf implements printf with zvals

func Zprintf

func Zprintf(ctx phpv.Context, fmt phpv.ZString, arg ...*phpv.ZVal) (*phpv.ZVal, error)

func Zscanf

func Zscanf(ctx phpv.Context, r io.Reader, format phpv.ZString, args ...*phpv.ZVal) (*phpv.ZVal, error)

Types

type Optional

type Optional[T phpv.Val] struct {
	// contains filtered or unexported fields
}

func (*Optional[T]) AsVal

func (o *Optional[T]) AsVal(ctx phpv.Context, t phpv.ZType) (phpv.Val, error)

func (*Optional[T]) Get

func (o *Optional[T]) Get() T

func (*Optional[T]) GetOrDefault

func (o *Optional[T]) GetOrDefault(defaultVal T) T

func (*Optional[T]) GetType

func (o *Optional[T]) GetType() phpv.ZType

func (*Optional[T]) HasArg

func (or *Optional[T]) HasArg() bool

func (*Optional[T]) Set

func (o *Optional[T]) Set(v T)

func (*Optional[T]) String

func (o *Optional[T]) String() string

func (*Optional[T]) Value

func (o *Optional[T]) Value() phpv.Val

func (*Optional[T]) ZVal

func (o *Optional[T]) ZVal() *phpv.ZVal

type OptionalRef

type OptionalRef[T phpv.Val] struct {
	Ref[T]
	// contains filtered or unexported fields
}

func (*OptionalRef[T]) GetOrDefault

func (or *OptionalRef[T]) GetOrDefault(defaultVal T) T

func (*OptionalRef[T]) HasArg

func (or *OptionalRef[T]) HasArg() bool

type Ref

type Ref[T phpv.Val] struct {
	Value T
	// contains filtered or unexported fields
}

func (*Ref[T]) Get

func (rp *Ref[T]) Get() T

func (*Ref[T]) Set

func (rp *Ref[T]) Set(ctx phpv.Context, value T)

func (*Ref[T]) SetNull

func (rp *Ref[T]) SetNull(ctx phpv.Context)

SetNull sets the referenced variable to NULL in the parent scope.

Directories

Path Synopsis
Package locale provides a pure-Go emulation of POSIX setlocale/localeconv/ nl_langinfo for PHP.
Package locale provides a pure-Go emulation of POSIX setlocale/localeconv/ nl_langinfo for PHP.
Package phpv contains all required types and interfaces for storing Goro values, context or compiled PHP code.
Package phpv contains all required types and interfaces for storing Goro values, context or compiled PHP code.
vm
Package vm implements a stack-based bytecode virtual machine for Goro that runs in parallel to the AST tree-walking executor in core/compiler.
Package vm implements a stack-based bytecode virtual machine for Goro that runs in parallel to the AST tree-walking executor in core/compiler.
vmcompiler
Package vmcompiler walks a compiled AST tree (phpv.Runnable) and emits a *vm.Function that the VM can execute.
Package vmcompiler walks a compiled AST tree (phpv.Runnable) and emits a *vm.Function that the VM can execute.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL