Page MenuHomeDevCentral

D2494.diff
No OneTemporary

D2494.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 {
///
@@ -45,6 +47,19 @@
}
///
+ /// Issues
+ ///
+
+ /**
+ * @see https://devcentral.nasqueron.org/D2494
+ */
+ public function testNullPathIsNotAllowed () : void {
+ $this->expectException(TypeError::class);
+
+ $file = new File(null);
+ }
+
+ ///
/// Data providers
///

File Metadata

Mime Type
text/plain
Expires
Sun, Sep 29, 01:20 (21 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2162876
Default Alt Text
D2494.diff (887 B)

Event Timeline