phpcode

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package phpcode is the PHP backend for `sf code`: a structural summary of a PHP file (namespace, class/interface/trait/enum, extends/implements, attributes, enum cases, constructor deps, properties, method signatures) and single-method slicing. It reuses the shared VKCOM-based reader (internal/common/php), which normalizes PHP 8.2–8.5 to the 8.1 grammar.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Brief added in v0.6.0

func Brief(s *php.Symbol)

Brief collapses field/value-level detail for a signature-only view: properties disappear entirely (they're the class-body equivalent of Go struct fields), and enum cases keep their names but drop the backing value — class/interface/trait name, extends/implements, constructor and method signatures are all left alone, since those already sit at signature level. Dropping every case's value also makes enumIsBacked report false, so rendering falls through to the existing name-only cases header for free.

func Slice

func Slice(src []byte, symbol string) (string, []string, error)

Slice returns the source of one named method from src.

func Summarize

func Summarize(w io.Writer, path, format string, exported, api, brief bool) (map[string]any, error)

Summarize writes the structural summary of the PHP file at path to w. When api is set and the file declares a class or trait, the methods block becomes the effective public surface — own methods plus those composed via traits and inherited from parent classes (see effectiveSurface). api implies the public-only filter. brief drops properties and enum cases' backing values (see Brief). The json format stays structural (machine output); callers wanting the flattened surface use toon/md.

Types

This section is empty.

Jump to

Keyboard shortcuts

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