Repository: phpDocumentor/phpDocumentor (language: php)

Issue:
Error only when passing an XML config: Assert.php line 2074 - "" is not a valid path  
Using the phpdoc/phpdoc:latest Docker image, and **only if I pass along an XML config file**, I get the following error.
WITHOUT a config file, the documentation parsing works flawless.

## Expected behavior
Speakable error message, or the documentation should get parsed…

## Actual behavior
Using _different XML configs_ (initially I had still an old one… but updated it & tried agatin), I always get the following error:

```
Attaching to phpdoc-1
phpdoc-1  | phpDocumentor 3.4.2-v3.5.3+10b8a76
phpdoc-1  | 
phpdoc-1  | 
phpdoc-1  | In Assert.php line 2074:
phpdoc-1  |                           
phpdoc-1  |   "" is not a valid path  
phpdoc-1  |                           
phpdoc-1  | 
```

## Steps to reproduce the problem

1. Have a phpdoc XML-config file ready
2. Setup a docker-compose.yml & add a service for the image "phpdoc/phpdoc:latest"

```
phpdoc:
       image: phpdoc/phpdoc:latest
       platform: linux/x86_64
       restart: no
       volumes:
       command:
```

3. Bind the XML config file to the service using "volumes:"

```
volumes:
           - "./config.xml:/config.xml"
           - "./app-code:/data"
           - "./docs:/docs"
```

4. Set the "command:" to include an XML config file

```
command: -c /config.xml -d /data -t /docs
```

5. Run the docker-service: `docker compose up -d phpdoc`

## Your environment
Docker, macOS

* Version used: phpDocumentor 3.4.2-v3.5.3+10b8a76
* Install method: Docker image
* Operating system and version (e.g. Ubuntu 20.04, Windows 10): macOS 15
* Link to your project: n/a
* Attach code that is involved



Discussion / hints:
P.s.: following the creation of this issue, I got this email:

> [phpDocumentor/phpDocumentor] Issue Triage workflow run
> ❌ Issue Triage:
> add-new-issues-to-project-column	
> All jobs have failed

Fix patch:
diff --git a/src/phpDocumentor/Path.php b/src/phpDocumentor/Path.php
index 72df89d0a..81995ca7b 100644
--- a/src/phpDocumentor/Path.php
+++ b/src/phpDocumentor/Path.php
@@ -80,6 +80,11 @@ public static function dirname(Path $input): self
         $parts = explode('/', (string) $input);
         array_pop($parts);
 
-        return new self(implode('/', $parts));
+        $path = implode('/', $parts);
+        if ($path === '') {
+            return new self('/');
+        }
+
+        return new self($path);
     }
 }


Test patch:
diff --git a/tests/unit/phpDocumentor/PathTest.php b/tests/unit/phpDocumentor/PathTest.php
index 6581d615d..b34a7f2b1 100644
--- a/tests/unit/phpDocumentor/PathTest.php
+++ b/tests/unit/phpDocumentor/PathTest.php
@@ -48,4 +48,11 @@ public function testItCanCheckWhetherTheGivenPathIsAnAbsolutePath(): void
         $this->assertFalse(Path::isAbsolutePath('./my/absolute/path'));
         $this->assertFalse(Path::isAbsolutePath('../my/absolute/path'));
     }
+
+    public function testDirnameOnRootFile(): void
+    {
+        $path = Path::dirname(new Path('/config.xml'));
+
+        $this->assertEquals(new Path('/'), $path);
+    }
 }