minor #14567 [Filesystem] Simplify if statement (kix)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #14567).
Discussion
----------
[Filesystem] Simplify if statement
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | none
Simplified the `if` statement if `Symfony\Component\Filesystem\Filesystem::isAbsolutePath`
Commits
-------
4d974ced
[Filesystem] Simplified an if statement
This commit is contained in:
commit
8e0f822edb
@ -423,17 +423,13 @@ class Filesystem
|
|||||||
*/
|
*/
|
||||||
public function isAbsolutePath($file)
|
public function isAbsolutePath($file)
|
||||||
{
|
{
|
||||||
if (strspn($file, '/\\', 0, 1)
|
return (strspn($file, '/\\', 0, 1)
|
||||||
|| (strlen($file) > 3 && ctype_alpha($file[0])
|
|| (strlen($file) > 3 && ctype_alpha($file[0])
|
||||||
&& substr($file, 1, 1) === ':'
|
&& substr($file, 1, 1) === ':'
|
||||||
&& (strspn($file, '/\\', 2, 1))
|
&& (strspn($file, '/\\', 2, 1))
|
||||||
)
|
)
|
||||||
|| null !== parse_url($file, PHP_URL_SCHEME)
|
|| null !== parse_url($file, PHP_URL_SCHEME)
|
||||||
) {
|
);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user