Skip to main content

PHPBackend

Struct PHPBackend 

Source
pub struct PHPBackend { /* private fields */ }
Expand description

PHP 8.x code generation backend for OxiLean.

Implementations§

Source§

impl PHPBackend

Source

pub fn new() -> Self

Create a new PHPBackend with default settings.

Source

pub fn with_indent(indent: impl Into<String>) -> Self

Create a PHPBackend with a custom indent string.

Source

pub fn emit_type(&self, ty: &PHPType) -> String

Emit a PHP type hint as a string.

Source

pub fn emit_expr(&self, expr: &PHPExpr) -> String

Emit a PHP expression as a string.

Source

pub fn mangle_name(&self, name: &str) -> String

Mangle an OxiLean name to a valid PHP identifier.

PHP identifiers must match [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*.

Source

pub fn emit_function(&self, func: &PHPFunction) -> String

Emit a PHP function (top-level or standalone).

Source

pub fn emit_interface(&self, iface: &PHPInterface) -> String

Emit a PHP interface declaration.

Source

pub fn emit_trait(&self, tr: &PHPTrait) -> String

Emit a PHP trait declaration.

Source

pub fn emit_enum(&self, en: &PHPEnum) -> String

Emit a PHP 8.1 enum declaration.

Source

pub fn emit_class(&self, class: &PHPClass) -> String

Emit a PHP class declaration.

Source

pub fn emit_script(&self, script: &PHPScript) -> String

Emit a complete PHP script.

Source

pub fn emit_namespace(&self, ns: &PHPNamespace) -> String

Emit a namespace block.

Trait Implementations§

Source§

impl Default for PHPBackend

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.