@@ -61,19 +61,17 @@ public function __construct($value)
6161
6262 /**
6363 * Returns the file name.
64- * @return string
6564 */
66- public function getName ()
65+ public function getName (): string
6766 {
6867 return $ this ->name ;
6968 }
7069
7170
7271 /**
7372 * Returns the sanitized file name.
74- * @return string
7573 */
76- public function getSanitizedName ()
74+ public function getSanitizedName (): string
7775 {
7876 return trim (Nette \Utils \Strings::webalize ($ this ->name , '. ' , FALSE ), '.- ' );
7977 }
@@ -94,69 +92,60 @@ public function getContentType()
9492
9593 /**
9694 * Returns the size of an uploaded file.
97- * @return int
9895 */
99- public function getSize ()
96+ public function getSize (): int
10097 {
10198 return $ this ->size ;
10299 }
103100
104101
105102 /**
106103 * Returns the path to an uploaded file.
107- * @return string
108104 */
109- public function getTemporaryFile ()
105+ public function getTemporaryFile (): string
110106 {
111107 return $ this ->tmpName ;
112108 }
113109
114110
115111 /**
116112 * Returns the path to an uploaded file.
117- * @return string
118113 */
119- public function __toString ()
114+ public function __toString (): string
120115 {
121116 return (string ) $ this ->tmpName ;
122117 }
123118
124119
125120 /**
126121 * Returns the error code. {@link http://php.net/manual/en/features.file-upload.errors.php}
127- * @return int
128122 */
129- public function getError ()
123+ public function getError (): int
130124 {
131125 return $ this ->error ;
132126 }
133127
134128
135129 /**
136130 * Is there any error?
137- * @return bool
138131 */
139- public function isOk ()
132+ public function isOk (): bool
140133 {
141134 return $ this ->error === UPLOAD_ERR_OK ;
142135 }
143136
144137
145- /**
146- * @return bool
147- */
148- public function hasFile ()
138+ public function hasFile (): bool
149139 {
150140 return $ this ->error !== UPLOAD_ERR_NO_FILE ;
151141 }
152142
153143
154144 /**
155145 * Move uploaded file to new location.
156- * @param string
157146 * @return static
158147 */
159- public function move ($ dest )
148+ public function move (string $ dest )
160149 {
161150 $ dir = dirname ($ dest );
162151 @mkdir ($ dir , 0777 , TRUE ); // @ - dir may already exist
@@ -179,20 +168,18 @@ function ($message) use ($dest) {
179168
180169 /**
181170 * Is uploaded file GIF, PNG or JPEG?
182- * @return bool
183171 */
184- public function isImage ()
172+ public function isImage (): bool
185173 {
186174 return in_array ($ this ->getContentType (), ['image/gif ' , 'image/png ' , 'image/jpeg ' ], TRUE );
187175 }
188176
189177
190178 /**
191179 * Returns the image.
192- * @return Nette\Utils\Image
193180 * @throws Nette\Utils\ImageException
194181 */
195- public function toImage ()
182+ public function toImage (): Nette \ Utils \ Image
196183 {
197184 return Nette \Utils \Image::fromFile ($ this ->tmpName );
198185 }
0 commit comments