mini\Util\Path::canonical() Method

public

Signature

public function canonical(): mini\Contracts\PathInterface

Returns

mini\Contracts\PathInterface

Documentation

Get canonical (normalized) form of this path (lexical operation)

Returns a new Path with all . and .. segments resolved. This is a pure lexical operation with no filesystem access.

Resolution rules:

  • . segments are removed
  • .. segments collapse the previous segment when safe
  • In absolute paths, .. cannot go above root
  • In relative paths, unmatched .. are preserved at the beginning

Source

src/Util/Path.php:414-417