@@ -209,14 +209,14 @@ public static function getContents(
209209 * save contents to file use file_put_contents()
210210 *
211211 * @param string $filename
212- * @param string|array|resource $data string, array(仅一维数组) 或者是 stream 资源
212+ * @param string|array|resource|mixed $data string, array(仅一维数组) 或者是 stream 资源
213213 * @param int $flags
214- * @param null $context
214+ * @param resource| null $context
215215 *
216216 * @return int
217217 * @see file_put_contents()
218218 */
219- public static function putContents (string $ filename , $ data , int $ flags = 0 , $ context = null ): int
219+ public static function putContents (string $ filename , mixed $ data , int $ flags = 0 , $ context = null ): int
220220 {
221221 $ number = file_put_contents ($ filename , $ data , $ flags , $ context );
222222 if ($ number === false ) {
@@ -236,7 +236,7 @@ public static function putContents(string $filename, $data, int $flags = 0, $con
236236 *
237237 * @return int
238238 */
239- public static function save (string $ filename , $ data , int $ flags = 0 , $ context = null ): int
239+ public static function save (string $ filename , mixed $ data , int $ flags = 0 , $ context = null ): int
240240 {
241241 return self ::putContents ($ filename , $ data , $ flags , $ context );
242242 }
@@ -247,11 +247,11 @@ public static function save(string $filename, $data, int $flags = 0, $context =
247247 * @param string $filename
248248 * @param string|array|resource $data
249249 * @param int $flags
250- * @param null|mixed $context
250+ * @param null|resource $context
251251 *
252252 * @return int
253253 */
254- public static function mkdirSave (string $ filename , $ data , int $ flags = 0 , $ context = null ): int
254+ public static function mkdirSave (string $ filename , mixed $ data , int $ flags = 0 , $ context = null ): int
255255 {
256256 if (!is_dir ($ dir = dirname ($ filename ))) {
257257 self ::mkdir ($ dir );
@@ -474,7 +474,7 @@ public static function getContentsV2(
474474 bool $ useIncludePath = false ,
475475 $ streamContext = null ,
476476 int $ curlTimeout = 5
477- ) {
477+ ): bool | string {
478478 $ isUrl = preg_match ('/^https?:\/\// ' , $ file );
479479 if (null === $ streamContext && $ isUrl ) {
480480 $ streamContext = @stream_context_create (['http ' => ['timeout ' => $ curlTimeout ]]);
@@ -524,16 +524,14 @@ public static function getContentsV2(
524524 }
525525
526526 /**
527- * @param $inFile
528- * @param $outFile
527+ * @param array|string $inFile
528+ * @param string $outFile
529529 *
530- * @return mixed
531- * @throws InvalidArgumentException
532- * @throws FileNotFoundException
530+ * @return string
533531 */
534- public static function combine ($ inFile , $ outFile )
532+ public static function combine (array | string $ inFile , string $ outFile ): string
535533 {
536- self ::check ($ inFile );
534+ // self::check($inFile);
537535
538536 $ data = '' ;
539537 if (is_array ($ inFile )) {
@@ -544,13 +542,10 @@ public static function combine($inFile, $outFile)
544542 throw new FileNotFoundException ('File: ' . $ value . ' not exists! ' );
545543 }
546544 }
547- }
548-
549- /*if (is_string($inFile) && is_file($value)) {
550- $data .= trim( file_get_contents($inFile) );
551545 } else {
552- Trigger::error('文件'.$value.'不存在!!');
553- }*/
546+ self ::check ($ inFile );
547+ $ data = trim (file_get_contents ($ inFile ));
548+ }
554549
555550 $ preg_arr = [
556551 '/\/\*.*?\*\/\s*/is ' , // 去掉所有多行注释/* .... */
0 commit comments