diff --git a/src/Symfony/Component/CssSelector/Exception/ExpressionErrorException.php b/src/Symfony/Component/CssSelector/Exception/ExpressionErrorException.php index 756a12a75a..fd5deeabe4 100644 --- a/src/Symfony/Component/CssSelector/Exception/ExpressionErrorException.php +++ b/src/Symfony/Component/CssSelector/Exception/ExpressionErrorException.php @@ -19,6 +19,6 @@ namespace Symfony\Component\CssSelector\Exception; * * @author Jean-François Simon */ -class ExpressionErrorException extends ParseException implements ExceptionInterface +class ExpressionErrorException extends ParseException { } diff --git a/src/Symfony/Component/CssSelector/Exception/InternalErrorException.php b/src/Symfony/Component/CssSelector/Exception/InternalErrorException.php index 2decde67fe..e60e5ed0f2 100644 --- a/src/Symfony/Component/CssSelector/Exception/InternalErrorException.php +++ b/src/Symfony/Component/CssSelector/Exception/InternalErrorException.php @@ -19,6 +19,6 @@ namespace Symfony\Component\CssSelector\Exception; * * @author Jean-François Simon */ -class InternalErrorException extends ParseException implements ExceptionInterface +class InternalErrorException extends ParseException { } diff --git a/src/Symfony/Component/CssSelector/Exception/SyntaxErrorException.php b/src/Symfony/Component/CssSelector/Exception/SyntaxErrorException.php index 831b001340..418bc301cb 100644 --- a/src/Symfony/Component/CssSelector/Exception/SyntaxErrorException.php +++ b/src/Symfony/Component/CssSelector/Exception/SyntaxErrorException.php @@ -21,7 +21,7 @@ use Symfony\Component\CssSelector\Parser\Token; * * @author Jean-François Simon */ -class SyntaxErrorException extends ParseException implements ExceptionInterface +class SyntaxErrorException extends ParseException { /** * @param string $expectedValue diff --git a/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php index e7deac29aa..fdd71b36ee 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php @@ -173,7 +173,7 @@ class GraphvizDumper extends Dumper foreach ($container->getServiceIds() as $id) { $service = $container->get($id); - if (in_array($id, array_keys($container->getAliases()))) { + if (array_key_exists($id, $container->getAliases())) { continue; } diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 135ffc959c..b7ae31bb71 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -41,10 +41,9 @@ class Filesystem $this->mkdir(dirname($targetFile)); - if (!$override && is_file($targetFile) && null === parse_url($originFile, PHP_URL_HOST)) { + $doCopy = true; + if (!$override && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) { $doCopy = filemtime($originFile) > filemtime($targetFile); - } else { - $doCopy = true; } if ($doCopy) { @@ -274,7 +273,7 @@ class Filesystem */ public function symlink($originDir, $targetDir, $copyOnWindows = false) { - if (!function_exists('symlink') && $copyOnWindows) { + if ($copyOnWindows && !function_exists('symlink')) { $this->mirror($originDir, $targetDir); return; @@ -291,16 +290,14 @@ class Filesystem } } - if (!$ok) { - if (true !== @symlink($originDir, $targetDir)) { - $report = error_get_last(); - if (is_array($report)) { - if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) { - throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?'); - } + if (!$ok && true !== @symlink($originDir, $targetDir)) { + $report = error_get_last(); + if (is_array($report)) { + if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) { + throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?'); } - throw new IOException(sprintf('Failed to create symbolic link from %s to %s', $originDir, $targetDir)); } + throw new IOException(sprintf('Failed to create symbolic link from %s to %s', $originDir, $targetDir)); } } @@ -339,9 +336,9 @@ class Filesystem $endPathRemainder = implode('/', array_slice($endPathArr, $index)); // Construct $endPath from traversing to the common path, then to the remaining $endPath - $relativePath = $traverser.(strlen($endPathRemainder) > 0 ? $endPathRemainder.'/' : ''); + $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : ''); - return (strlen($relativePath) === 0) ? './' : $relativePath; + return '' === $relativePath ? './' : $relativePath; } /** diff --git a/src/Symfony/Component/Form/NativeRequestHandler.php b/src/Symfony/Component/Form/NativeRequestHandler.php index a888967bb3..7c883f12eb 100644 --- a/src/Symfony/Component/Form/NativeRequestHandler.php +++ b/src/Symfony/Component/Form/NativeRequestHandler.php @@ -184,10 +184,10 @@ class NativeRequestHandler implements RequestHandlerInterface unset($files[$k]); } - foreach (array_keys($data['name']) as $key) { + foreach ($data['name'] as $key => $name) { $files[$key] = self::fixPhpFilesArray(array( 'error' => $data['error'][$key], - 'name' => $data['name'][$key], + 'name' => $name, 'type' => $data['type'][$key], 'tmp_name' => $data['tmp_name'][$key], 'size' => $data['size'][$key], diff --git a/src/Symfony/Component/HttpFoundation/FileBag.php b/src/Symfony/Component/HttpFoundation/FileBag.php index 467c31576b..43b8af3c83 100644 --- a/src/Symfony/Component/HttpFoundation/FileBag.php +++ b/src/Symfony/Component/HttpFoundation/FileBag.php @@ -140,10 +140,10 @@ class FileBag extends ParameterBag unset($files[$k]); } - foreach (array_keys($data['name']) as $key) { + foreach ($data['name'] as $key => $name) { $files[$key] = $this->fixPhpFilesArray(array( 'error' => $data['error'][$key], - 'name' => $data['name'][$key], + 'name' => $name, 'type' => $data['type'][$key], 'tmp_name' => $data['tmp_name'][$key], 'size' => $data['size'][$key], diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index f6c319c9ed..de798de27a 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1549,7 +1549,7 @@ class Request foreach (array_keys($languages) as $lang) { if (strstr($lang, '-')) { $codes = explode('-', $lang); - if ($codes[0] == 'i') { + if ('i' === $codes[0]) { // Language not listed in ISO 639 that are not variants // of any listed language, which can be registered with the // i-prefix, such as i-cherokee @@ -1558,7 +1558,7 @@ class Request } } else { for ($i = 0, $max = count($codes); $i < $max; $i++) { - if ($i == 0) { + if ($i === 0) { $lang = strtolower($codes[0]); } else { $lang .= '_'.strtoupper($codes[$i]); diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php index 81c581291c..b2a573e27a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php @@ -75,7 +75,7 @@ class MimeTypeTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('Can not verify chmod operations on Windows'); } - if (in_array(get_current_user(), array('root'))) { + if ('root' === get_current_user()) { $this->markTestSkipped('This test will fail if run under superuser'); } diff --git a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php b/src/Symfony/Component/Translation/Loader/CsvFileLoader.php index a5f590dba4..ddcf595baf 100644 --- a/src/Symfony/Component/Translation/Loader/CsvFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/CsvFileLoader.php @@ -22,7 +22,7 @@ use Symfony\Component\Config\Resource\FileResource; * * @api */ -class CsvFileLoader extends ArrayLoader implements LoaderInterface +class CsvFileLoader extends ArrayLoader { private $delimiter = ';'; private $enclosure = '"'; diff --git a/src/Symfony/Component/Translation/Loader/IniFileLoader.php b/src/Symfony/Component/Translation/Loader/IniFileLoader.php index 616fa7e0e7..3f01ab4e99 100644 --- a/src/Symfony/Component/Translation/Loader/IniFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/IniFileLoader.php @@ -20,7 +20,7 @@ use Symfony\Component\Config\Resource\FileResource; * * @author stealth35 */ -class IniFileLoader extends ArrayLoader implements LoaderInterface +class IniFileLoader extends ArrayLoader { /** * {@inheritdoc} diff --git a/src/Symfony/Component/Translation/Loader/MoFileLoader.php b/src/Symfony/Component/Translation/Loader/MoFileLoader.php index 3f0dd921ee..18d07b0ccc 100644 --- a/src/Symfony/Component/Translation/Loader/MoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/MoFileLoader.php @@ -18,7 +18,7 @@ use Symfony\Component\Config\Resource\FileResource; /** * @copyright Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/) */ -class MoFileLoader extends ArrayLoader implements LoaderInterface +class MoFileLoader extends ArrayLoader { /** * Magic used for validating the format of a MO file as well as diff --git a/src/Symfony/Component/Translation/Loader/PhpFileLoader.php b/src/Symfony/Component/Translation/Loader/PhpFileLoader.php index 55913d6c75..1cc9d06d9c 100644 --- a/src/Symfony/Component/Translation/Loader/PhpFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/PhpFileLoader.php @@ -22,7 +22,7 @@ use Symfony\Component\Config\Resource\FileResource; * * @api */ -class PhpFileLoader extends ArrayLoader implements LoaderInterface +class PhpFileLoader extends ArrayLoader { /** * {@inheritdoc} diff --git a/src/Symfony/Component/Translation/Loader/PoFileLoader.php b/src/Symfony/Component/Translation/Loader/PoFileLoader.php index 6d5e835568..9f51af3ba6 100644 --- a/src/Symfony/Component/Translation/Loader/PoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/PoFileLoader.php @@ -19,7 +19,7 @@ use Symfony\Component\Config\Resource\FileResource; * @copyright Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/) * @copyright Copyright (c) 2012, Clemens Tolboom */ -class PoFileLoader extends ArrayLoader implements LoaderInterface +class PoFileLoader extends ArrayLoader { public function load($resource, $locale, $domain = 'messages') { diff --git a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php index 419a82dcc6..e50e0fa385 100644 --- a/src/Symfony/Component/Translation/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/YamlFileLoader.php @@ -24,7 +24,7 @@ use Symfony\Component\Yaml\Exception\ParseException; * * @api */ -class YamlFileLoader extends ArrayLoader implements LoaderInterface +class YamlFileLoader extends ArrayLoader { private $yamlParser;