Remove inheritance check

master
Anton Smirnov 11 months ago
parent f1f898eecf
commit 04b521b288
  1. 10
      src/FilesystemPath.php
  2. 24
      tests/FilesystemPathTest.php

@ -6,16 +6,6 @@ namespace Arokettu\Path;
abstract class FilesystemPath extends AbstractAbsolutePath
{
public function __construct(string $path, bool $strict = false)
{
if ($this instanceof WindowsPath || $this instanceof UnixPath) {
parent::__construct($path, $strict);
return;
}
throw new \LogicException('The class is not meant to be extended externally');
}
/**
* @codeCoverageIgnore OS specific
*/

@ -1,24 +0,0 @@
<?php
declare(strict_types=1);
namespace Arokettu\Path\Tests;
use Arokettu\Path\FilesystemPath;
use PHPUnit\Framework\TestCase;
class FilesystemPathTest extends TestCase
{
public function testDoNotAllowExtending(): void
{
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('The class is not meant to be extended externally');
new class ('') extends FilesystemPath {
protected function parsePath(string $path, bool $strict): void
{
// whatever
}
};
}
}
Loading…
Cancel
Save