Remove inheritance check

master
Anton Smirnov 2 years ago
parent f1f898eecf
commit 04b521b288

@ -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