Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4020169
D2494.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
887 B
Referenced Files
None
Subscribers
None
D2494.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 20, 00:27 (17 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2361457
Default Alt Text
D2494.diff (887 B)
Attached To
Mode
D2494: Don't allow to construct a File with a null path
Attached
Detach File
Event Timeline
Log In to Comment