stubtransform

package
v0.0.0-...-e49a3f0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Fastest based on benchmarking.
	MaxConcurrency = runtime.NumCPU() * 2

	NonStubs = map[string]struct{}{
		filepath.Join(string(os.PathSeparator), ".github"):                          {},
		filepath.Join(string(os.PathSeparator), ".idea"):                            {},
		filepath.Join(string(os.PathSeparator), "FFI", ".phpstorm.meta.php"):        {},
		filepath.Join(string(os.PathSeparator), "meta"):                             {},
		filepath.Join(string(os.PathSeparator), "Reflection", ".phpstorm.meta.php"): {},
		filepath.Join(string(os.PathSeparator), "tests"):                            {},
		filepath.Join(string(os.PathSeparator), ".php-cs-fixer.php"):                {},
		filepath.Join(string(os.PathSeparator), "PhpStormStubsMap.php"):             {},
		filepath.Join(string(os.PathSeparator), ".phpstorm.meta.php"):               {},

		filepath.Join(string(os.PathSeparator), "relay", "KeyType.php"): {},
	}
)

Functions

func All

func All(version *phpversion.PHPVersion, logger Logger) func() []ast.Visitor

logger is allowed to be nil.

Types

type AtSinceAtRemoved

type AtSinceAtRemoved struct {
	visitor.Null
	// contains filtered or unexported fields
}

AtSinceAtRemoved removes nodes that are @since > or @removed <= the given version in the PHP core stubs.

func NewAtSinceAtRemoved

func NewAtSinceAtRemoved(version *phpversion.PHPVersion, logger Logger) *AtSinceAtRemoved

func (*AtSinceAtRemoved) Root

func (r *AtSinceAtRemoved) Root(n *ast.Root)

func (*AtSinceAtRemoved) StmtClass

func (r *AtSinceAtRemoved) StmtClass(n *ast.StmtClass)

func (*AtSinceAtRemoved) StmtInterface

func (r *AtSinceAtRemoved) StmtInterface(n *ast.StmtInterface)

func (*AtSinceAtRemoved) StmtNamespace

func (r *AtSinceAtRemoved) StmtNamespace(n *ast.StmtNamespace)

func (*AtSinceAtRemoved) StmtTrait

func (r *AtSinceAtRemoved) StmtTrait(n *ast.StmtTrait)

type ElementAvailableAttribute

type ElementAvailableAttribute struct {
	visitor.Null
	// contains filtered or unexported fields
}

ElementAvailableAttribute removes nodes with the PhpStormStubsElementAvailable attribute that does not match the given version.

func NewElementAvailableAttribute

func NewElementAvailableAttribute(
	version *phpversion.PHPVersion,
	logger Logger,
) *ElementAvailableAttribute

func (*ElementAvailableAttribute) Root

func (e *ElementAvailableAttribute) Root(n *ast.Root)

func (*ElementAvailableAttribute) StmtClass

func (e *ElementAvailableAttribute) StmtClass(n *ast.StmtClass)

func (*ElementAvailableAttribute) StmtInterface

func (e *ElementAvailableAttribute) StmtInterface(n *ast.StmtInterface)

func (*ElementAvailableAttribute) StmtNamespace

func (e *ElementAvailableAttribute) StmtNamespace(n *ast.StmtNamespace)

func (*ElementAvailableAttribute) StmtTrait

func (e *ElementAvailableAttribute) StmtTrait(n *ast.StmtTrait)

func (*ElementAvailableAttribute) StmtUse

func (e *ElementAvailableAttribute) StmtUse(n *ast.StmtUseList)

func (*ElementAvailableAttribute) StmtUseDeclaration

func (e *ElementAvailableAttribute) StmtUseDeclaration(n *ast.StmtUse)

type LanguageLevelTypeAware

type LanguageLevelTypeAware struct {
	visitor.Null
	// contains filtered or unexported fields
}

LanguageLevelTypeAware applies the types in the LanguageLevelTypeAware args.

func NewLanguageLevelTypeAware

func NewLanguageLevelTypeAware(
	version *phpversion.PHPVersion,
	logger Logger,
) *LanguageLevelTypeAware

func (*LanguageLevelTypeAware) Root

func (e *LanguageLevelTypeAware) Root(n *ast.Root)

func (*LanguageLevelTypeAware) StmtClass

func (e *LanguageLevelTypeAware) StmtClass(n *ast.StmtClass)

func (*LanguageLevelTypeAware) StmtClassMethod

func (e *LanguageLevelTypeAware) StmtClassMethod(n *ast.StmtClassMethod)

func (*LanguageLevelTypeAware) StmtFunction

func (e *LanguageLevelTypeAware) StmtFunction(n *ast.StmtFunction)

func (*LanguageLevelTypeAware) StmtInterface

func (e *LanguageLevelTypeAware) StmtInterface(n *ast.StmtInterface)

func (*LanguageLevelTypeAware) StmtNamespace

func (e *LanguageLevelTypeAware) StmtNamespace(n *ast.StmtNamespace)

func (*LanguageLevelTypeAware) StmtPropertyList

func (e *LanguageLevelTypeAware) StmtPropertyList(n *ast.StmtPropertyList)

func (*LanguageLevelTypeAware) StmtTrait

func (e *LanguageLevelTypeAware) StmtTrait(n *ast.StmtTrait)

func (*LanguageLevelTypeAware) StmtUse

func (e *LanguageLevelTypeAware) StmtUse(n *ast.StmtUseList)

func (*LanguageLevelTypeAware) StmtUseDeclaration

func (e *LanguageLevelTypeAware) StmtUseDeclaration(n *ast.StmtUse)

type Logger

type Logger interface {
	Printf(format string, args ...any)
}

type Walker

type Walker struct {
	Transformers *sync.Pool
	Logger       Logger
	Version      *phpversion.PHPVersion
	Progress     *atomic.Uint32
	StubsFS      fs.FS
	StubsDir     string
	OutDir       string
}

func NewWalker

func NewWalker(
	logger Logger,
	stubsDir string,
	outDir string,
	version *phpversion.PHPVersion,
	transformers func() []ast.Visitor,
) *Walker

func (*Walker) TransformFile

func (w *Walker) TransformFile(transformers []ast.Visitor, path string, finalPath string) error

func (*Walker) Walk

func (w *Walker) Walk() error

Jump to

Keyboard shortcuts

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