diff --git a/composer.json b/composer.json
index d07137d0f114d0b7b3d9809c82c32a1b8a00c19c..61259cef9da66a428a31e2d3626128082edee9dd 100644
--- a/composer.json
+++ b/composer.json
@@ -40,7 +40,8 @@
     "symfony/finder": "^3.0 | ^4.0",
     "symfony/framework-bundle": "^3.0 | ^4.0",
     "symfony/http-kernel": "^3.0 | ^4.0",
-    "symfony/security": "^3.0 | ^4.0"
+    "symfony/security": "^3.0 | ^4.0",
+    "webmozart/path-util": "^2.3"
   },
   "config": {
     "sort-packages": true
diff --git a/composer.lock b/composer.lock
index 238b10954f7ec95468137dbb1c551f2fb5897e70..db33a3d3d98bffdffbd0463f2ac37366f1c704f6 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "494a1c8e105df4c7e4e321f93d67cbc3",
+    "content-hash": "990dc5b362986aa1165a78bc94e7a8de",
     "packages": [
         {
             "name": "doctrine/annotations",
@@ -2991,6 +2991,103 @@
                 "serialize"
             ],
             "time": "2019-06-22T08:39:44+00:00"
+        },
+        {
+            "name": "webmozart/assert",
+            "version": "1.4.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/webmozart/assert.git",
+                "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9",
+                "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^5.3.3 || ^7.0",
+                "symfony/polyfill-ctype": "^1.8"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.6",
+                "sebastian/version": "^1.0.1"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.3-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Webmozart\\Assert\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Bernhard Schussek",
+                    "email": "bschussek@gmail.com"
+                }
+            ],
+            "description": "Assertions to validate method input/output with nice error messages.",
+            "keywords": [
+                "assert",
+                "check",
+                "validate"
+            ],
+            "time": "2018-12-25T11:19:39+00:00"
+        },
+        {
+            "name": "webmozart/path-util",
+            "version": "2.3.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/webmozart/path-util.git",
+                "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725",
+                "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.3",
+                "webmozart/assert": "~1.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^4.6",
+                "sebastian/version": "^1.0.1"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.3-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Webmozart\\PathUtil\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Bernhard Schussek",
+                    "email": "bschussek@gmail.com"
+                }
+            ],
+            "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.",
+            "time": "2015-12-17T08:42:14+00:00"
         }
     ],
     "packages-dev": [
@@ -5391,57 +5488,6 @@
             "homepage": "https://github.com/theseer/fDOMDocument",
             "time": "2017-06-30T11:53:12+00:00"
         },
-        {
-            "name": "webmozart/assert",
-            "version": "1.4.0",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/webmozart/assert.git",
-                "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9",
-                "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9",
-                "shasum": ""
-            },
-            "require": {
-                "php": "^5.3.3 || ^7.0",
-                "symfony/polyfill-ctype": "^1.8"
-            },
-            "require-dev": {
-                "phpunit/phpunit": "^4.6",
-                "sebastian/version": "^1.0.1"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "1.3-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "Webmozart\\Assert\\": "src/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Bernhard Schussek",
-                    "email": "bschussek@gmail.com"
-                }
-            ],
-            "description": "Assertions to validate method input/output with nice error messages.",
-            "keywords": [
-                "assert",
-                "check",
-                "validate"
-            ],
-            "time": "2018-12-25T11:19:39+00:00"
-        },
         {
             "name": "webmozart/glob",
             "version": "4.1.0",
@@ -5488,52 +5534,6 @@
             ],
             "description": "A PHP implementation of Ant's glob.",
             "time": "2015-12-29T11:14:33+00:00"
-        },
-        {
-            "name": "webmozart/path-util",
-            "version": "2.3.0",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/webmozart/path-util.git",
-                "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725",
-                "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=5.3.3",
-                "webmozart/assert": "~1.0"
-            },
-            "require-dev": {
-                "phpunit/phpunit": "^4.6",
-                "sebastian/version": "^1.0.1"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "2.3-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "Webmozart\\PathUtil\\": "src/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Bernhard Schussek",
-                    "email": "bschussek@gmail.com"
-                }
-            ],
-            "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.",
-            "time": "2015-12-17T08:42:14+00:00"
         }
     ],
     "aliases": [],
diff --git a/src/Finder/ClassFinder.php b/src/Finder/ClassFinder.php
index d5f54316a800c84d048cde75f5b40a02086515c5..62c32e2cae7bfdf2413257670f6cd56f46f9c3b6 100644
--- a/src/Finder/ClassFinder.php
+++ b/src/Finder/ClassFinder.php
@@ -42,12 +42,16 @@ class ClassFinder implements FinderInterface
      */
     private $classes = null;
 
-    public function __construct($directories)
+    /**
+     * ClassFinder constructor.
+     * @param string[] $directories
+     */
+    public function __construct(array $directories)
     {
         $this->directories = $directories;
     }
 
-    private function initialize()
+    private function initialize(): void
     {
         $files = Finder::create()
             ->in($this->directories)
@@ -75,6 +79,9 @@ class ClassFinder implements FinderInterface
         }
     }
 
+    /**
+     * @return ArrayIterator|\Traversable
+     */
     public function getIterator()
     {
         if ($this->classes === null) {
@@ -84,6 +91,9 @@ class ClassFinder implements FinderInterface
         return new ArrayIterator($this->classes);
     }
 
+    /**
+     * @param array $conf
+     */
     public function toConfig(array &$conf)
     {
         $conf['type'] = 'classes';
diff --git a/src/Model/Filter/DirectoryFilter.php b/src/Model/Filter/DirectoryFilter.php
index 9c1d7f4bf76e0f090d556db6070e7eed86eda330..c27de0306b52ce7d86be5f5ae4528597c05af4ca 100644
--- a/src/Model/Filter/DirectoryFilter.php
+++ b/src/Model/Filter/DirectoryFilter.php
@@ -21,6 +21,7 @@
 namespace Irstea\PlantUmlBundle\Model\Filter;
 
 use ReflectionClass;
+use Webmozart\PathUtil\Path;
 
 /**
  * Description of DirectoryFilter.
@@ -41,7 +42,7 @@ class DirectoryFilter extends AbstractListFilter
         if ($filename === false) {
             return '';
         }
-        return dirname($class->getFileName());
+        return Path::getDirectory($filename);
     }
 
     /**
@@ -51,6 +52,7 @@ class DirectoryFilter extends AbstractListFilter
      */
     protected function matches($tested, $reference): bool
     {
+        dump(compact('tested', 'reference'));
         return strpos($tested, $reference) === 0;
     }
 
@@ -60,6 +62,6 @@ class DirectoryFilter extends AbstractListFilter
      */
     protected function normalize($path): string
     {
-        return rtrim(strtr($path, '/\\', DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
+        return Path::canonicalize($path) . \DIRECTORY_SEPARATOR;
     }
 }