Page MenuHomeDevCentral

D2494.id6287.diff
No OneTemporary

D2494.id6287.diff

diff --git a/src/IO/File.php b/src/IO/File.php
--- a/src/IO/File.php
+++ b/src/IO/File.php
@@ -14,7 +14,7 @@
/// Constructors
///
- public function __construct (string $path = null) {
+ public function __construct (string $path) {
$this->path = $path;
}
diff --git a/tests/IO/FileTest.php b/tests/IO/FileTest.php
--- a/tests/IO/FileTest.php
+++ b/tests/IO/FileTest.php
@@ -6,6 +6,8 @@
use Keruald\OmniTools\OS\CurrentOS;
use PHPUnit\Framework\TestCase;
+use TypeError;
+
class FileTest extends TestCase {
///
@@ -44,6 +46,19 @@
$this->assertSame($expected, File::from($filename)->getExtension());
}
+ ///
+ /// Issues
+ ///
+
+ /**
+ * @see https://devcentral.nasqueron.org/D2494
+ */
+ public function testNullPathIsNotAllow () : void {
+ $this->expectException(TypeError::class);
+
+ $file = new File(null);
+ }
+
///
/// Data providers
///

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 20, 03:12 (20 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2361517
Default Alt Text
D2494.id6287.diff (961 B)

Event Timeline