Extracts the PHP namespace from the given PHP code
public extractNamespace ( ) : string | ||
return | string | the PHP namespace in the form "Some\Namespace" (w/o leading backslash) - or NULL if no namespace modifier was found |
/** * @param string $phpCode * @param string $namespace * @test * @dataProvider sampleClasses */ public function extractNamespaceTests($phpCode, $namespace) { $phpAnalyzer = new PhpAnalyzer($phpCode); $this->assertSame($namespace, $phpAnalyzer->extractNamespace()); }