File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,17 @@ public function addNamespace(string|PhpNamespace $namespace): PhpNamespace
110110 }
111111
112112
113+ /**
114+ * Removes the namespace from the file.
115+ */
116+ public function removeNamespace (string |PhpNamespace $ namespace ): static
117+ {
118+ $ name = $ namespace instanceof PhpNamespace ? $ namespace ->getName () : $ namespace ;
119+ unset($ this ->namespaces [$ name ]);
120+ return $ this ;
121+ }
122+
123+
113124 /** @return PhpNamespace[] */
114125 public function getNamespaces (): array
115126 {
Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ $file->addComment('This file is auto-generated. DO NOT EDIT!');
1818$ file ->addComment ('Hey there, I \'m here to document things. ' );
1919
2020
21+ $ namespace = $ file ->addNamespace ('Deleted ' );
22+ $ namespace ->addClass ('Foo ' );
23+ $ file ->removeNamespace ('Deleted ' );
24+
2125$ namespaceFoo = $ file ->addNamespace ('Foo ' );
2226
2327$ classA = $ namespaceFoo ->addClass ('A ' );
You can’t perform that action at this time.
0 commit comments