Browse Source

Added InvalidArgumentException

main
Dustin Wilson 1 year ago
parent
commit
3778836d66
  1. 5
      lib/Filesystem.php
  2. 16
      lib/Filesystem/InvalidArgumentException.php

5
lib/Filesystem.php

@ -10,6 +10,7 @@ declare(strict_types=1);
namespace MensBeam;
use MensBeam\Filesystem\{
FileNotFoundException,
InvalidArgumentException,
IOException
};
@ -407,11 +408,11 @@ class Filesystem {
*/
public static function makePathRelative(string $endPath, string $startPath): string {
if (!self::isAbsolutePath($startPath)) {
throw new \InvalidArgumentException(sprintf('The start path "%s" is not absolute.', $startPath));
throw new InvalidArgumentException(sprintf('The start path "%s" is not absolute.', $startPath));
}
if (!self::isAbsolutePath($endPath)) {
throw new \InvalidArgumentException(sprintf('The end path "%s" is not absolute.', $endPath));
throw new InvalidArgumentException(sprintf('The end path "%s" is not absolute.', $endPath));
}
// Normalize separators on Windows

16
lib/Filesystem/InvalidArgumentException.php

@ -0,0 +1,16 @@
<?php
/**
* @license MIT
* Copyright 2023 Dustin Wilson, J. King, et al.
* Original copyright 2023 Fabien Potencier
* See LICENSE and AUTHORS files for details
*/
declare(strict_types=1);
namespace MensBeam\Filesystem;
/**
* @author Christian Flothmann <christian.flothmann@sensiolabs.de>
*/
class InvalidArgumentException extends \InvalidArgumentException {}
Loading…
Cancel
Save