com doc/ja: Link to SplFileInfo from is_file()/file_exi sts() docs: reference/filesystem/functions/file-exist s.xml reference/filesystem/functions/is-file.xml refere nce/spl/splfileinfo/gettype.xml
[email protected] (Yoshinari Takaoka) Mon, 11 Jan 2021 00:43:59 +0000
| Newsgroups | php.doc.ja |
|---|---|
| Message-ID | <[email protected]> |
Commit: 2823c4bc6c5f08bcb8687e2b7193ac72e9bbc1ba Author: Yoshinari Takaoka <[email protected]> Mon, 11 Jan 2021 09:43:59 +0900 Parents: 8c575df1472e8508d5ebc6e431b8160eba9e7655 Branches: master Link: http://git.php.net/?p=doc/ja.git;a=commitdiff;h=2823c4bc6c5f08bcb8687e2b7193ac72e9bbc1ba Log: Link to SplFileInfo from is_file()/file_exists() docs And update the list of values that can be returned by getType based on php 8.0 ext/standard/filestat.c SplFileInfo is the only way to do some things, such as 1. Check for the existence of a file that may or may not be readable without emitting a notice that is caught by whatever error handler the project uses. (e.g. file_exists can return false for unix sockets) 2. Check for file types such as unix sockets (e.g. `$info->getType() === 'socket'`) Recently, I was looking for how to check if a given path was a unix socket and the filesystem functions didn't have any links to that information. Closes GH-319. Changed paths: M reference/filesystem/functions/file-exists.xml M reference/filesystem/functions/is-file.xml M reference/spl/splfileinfo/gettype.xml Diff: diff --git a/reference/filesystem/functions/file-exists.xml b/reference/filesystem/functions/file-exists.xml index 044e2fb7cc..1c3f72d088 100644 --- a/reference/filesystem/functions/file-exists.xml +++ b/reference/filesystem/functions/file-exists.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: dec1f8445ab2af7fbafef012fb7907ab2cd349b5 Maintainer: hirokawa Status: ready --> +<!-- EN-Revision: b4d9a0a908c543898609cf269df8d9c21b0d6b61 Maintainer: hirokawa Status: ready --> <!-- CREDITS: shimooka,mumumu --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.file-exists"> <refnamediv> @@ -102,6 +102,7 @@ if (file_exists($filename)) { <member><function>is_writable</function></member> <member><function>is_file</function></member> <member><function>file</function></member> + <member><classname>SplFileInfo</classname></member> </simplelist> </para> </refsect1> diff --git a/reference/filesystem/functions/is-file.xml b/reference/filesystem/functions/is-file.xml index 6234c4415a..7b5ab027ec 100644 --- a/reference/filesystem/functions/is-file.xml +++ b/reference/filesystem/functions/is-file.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: 71895e9afbfad9767d53f4f37b8573744aedaf96 Maintainer: hirokawa Status: ready --> +<!-- EN-Revision: b4d9a0a908c543898609cf269df8d9c21b0d6b61 Maintainer: hirokawa Status: ready --> <!-- CREDITS: shimooka --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.is-file"> <refnamediv> @@ -85,6 +85,7 @@ bool(false) <simplelist> <member><function>is_dir</function></member> <member><function>is_link</function></member> + <member><classname>SplFileInfo</classname></member> </simplelist> </para> </refsect1> diff --git a/reference/spl/splfileinfo/gettype.xml b/reference/spl/splfileinfo/gettype.xml index a6970d0171..15ddaeaae3 100644 --- a/reference/spl/splfileinfo/gettype.xml +++ b/reference/spl/splfileinfo/gettype.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: 60760b181deb1558a9061eb7daa86722235e98d1 Maintainer: takagi Status: ready --> +<!-- EN-Revision: b4d9a0a908c543898609cf269df8d9c21b0d6b61 Maintainer: takagi Status: ready --> +<!-- Credits: mumumu --> <refentry xml:id="splfileinfo.gettype" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <refnamediv> @@ -27,8 +28,12 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - このエントリの型を文字列で返します。<literal>file</literal>、<literal>link</literal> - あるいは <literal>dir</literal> のいずれかとなります。 + このエントリの型を文字列で返します。 + <literal>file</literal>, <literal>link</literal>, + <literal>dir</literal>, <literal>block</literal>, + <literal>fifo</literal>, <literal>char</literal>, + <literal>socket</literal>, <literal>unknown</literal> + のいずれかとなります。 </para> </refsect1>