Documentation

UseStatementParser
in package

Use-statement parser class

Scrapes use Foo\Bar; / use Foo\Bar as Baz; lines out of raw PHP source text. Native reflection has no API for "which traits/classes does this file use," so ClassReflection and TraitReflection both need this; it previously lived as an identical copy of this regex in each of them.

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
6.0.0

Table of Contents

Methods

parse()  : array<string|int, mixed>
Parse `use` statements out of raw PHP source

Methods

parse()

Parse `use` statements out of raw PHP source

public static parse(string $sourceCode) : array<string|int, mixed>
Parameters
$sourceCode : string
Return values
array<string|int, mixed>

        
On this page

Search results