diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-02-03 13:44:03 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-02-04 11:17:33 +0000 |
| commit | 7def76c7d817a9ec81e9ae4a03a850514b1a2e1c (patch) | |
| tree | 3fcf7e8236356daac44f7c17b8c0c5bc736a0926 | |
| parent | adfb3656b8dac8505590490f4f8aaf4bea27881b (diff) | |
| download | webtrees-7def76c7d817a9ec81e9ae4a03a850514b1a2e1c.tar.gz webtrees-7def76c7d817a9ec81e9ae4a03a850514b1a2e1c.tar.bz2 webtrees-7def76c7d817a9ec81e9ae4a03a850514b1a2e1c.zip | |
Working on upgrade wizard and testing
507 files changed, 6493 insertions, 5559 deletions
diff --git a/.travis.yml b/.travis.yml index f9240ae77b..5b47fb4c10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,14 +27,8 @@ before_script: script: - mkdir -p build/logs - vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover tests/clover.xml - - - - composer require wata727/pahout - vendor/bin/pahout --php-version=7.1.3 --ignore-paths=data --ignore-paths=vendor - - composer remove wata727/pahout - - - - composer require wapmorgan/php-code-fixer - - vendor/bin/phpcf --target=7.1 --exclude=vendor . - - composer remove wapmorgan/php-code-fixer + - vendor/bin/phpcf --exclude=vendor . after_script: - travis_retry php vendor/bin/php-coveralls -v diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index e7a73af96f..0722a4bfb9 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -38,17 +38,16 @@ class Handler */ public function render(Request $request, Throwable $exception): Response { + $controller = new ErrorController(); + if ($exception instanceof HttpException) { - // Show a friendly page for expected exceptions. if ($request->isXmlHttpRequest()) { - $response = new Response($exception->getMessage(), $exception->getStatusCode()); + $response = $controller->ajaxErrorResponse($exception); } else { - $controller = new ErrorController(); - $response = $controller->errorResponse($exception); + $response = $controller->errorResponse($exception); } } else { - $controller = new ErrorController(); - $response = $controller->unhandledExceptionResponse($request, $exception); + $response = $controller->unhandledExceptionResponse($request, $exception); } return $response; diff --git a/app/Exceptions/InternalServerErrorException.php b/app/Exceptions/InternalServerErrorException.php new file mode 100644 index 0000000000..d2483dc175 --- /dev/null +++ b/app/Exceptions/InternalServerErrorException.php @@ -0,0 +1,37 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2019 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +declare(strict_types=1); + +namespace Fisharebest\Webtrees\Exceptions; + +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\HttpException; + +/** + * Exception thrown when we can't easily display an error, such as AJAX requests. + */ +class InternalServerErrorException extends HttpException +{ + /** + * InternalServerErrorException constructor. + * + * @param string $message + */ + public function __construct(string $message) + { + parent::__construct(Response::HTTP_INTERNAL_SERVER_ERROR, $message); + } +} diff --git a/app/Http/Controllers/Admin/UpgradeController.php b/app/Http/Controllers/Admin/UpgradeController.php index d25bdeb4bd..76f1ea4a3b 100644 --- a/app/Http/Controllers/Admin/UpgradeController.php +++ b/app/Http/Controllers/Admin/UpgradeController.php @@ -17,40 +17,48 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\Controllers\Admin; -use Exception; +use Fisharebest\Flysystem\Adapter\ChrootAdapter; +use Fisharebest\Webtrees\Exceptions\InternalServerErrorException; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Services\TimeoutService; use Fisharebest\Webtrees\Services\UpgradeService; use Fisharebest\Webtrees\Tree; use Fisharebest\Webtrees\Webtrees; -use GuzzleHttp\Client; use Illuminate\Database\Capsule\Manager as DB; use League\Flysystem\Adapter\Local; +use League\Flysystem\Cached\CachedAdapter; +use League\Flysystem\Cached\Storage\Memory; use League\Flysystem\Filesystem; -use League\Flysystem\ZipArchive\ZipArchiveAdapter; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Throwable; -use ZipArchive; /** * Controller for upgrading to a new version of webtrees. */ class UpgradeController extends AbstractAdminController { - // Icons for success and failure - private const SUCCESS = '<i class="fas fa-check" style="color:green"></i> '; - private const FAILURE = '<i class="fas fa-times" style="color:red"></i> '; + // We make the upgrade in a number of small steps to keep within server time limits. + private const STEP_CHECK = 'Check'; + private const STEP_PREPARE = 'Prepare'; + private const STEP_PENDING = 'Pending'; + private const STEP_EXPORT = 'Export'; + private const STEP_DOWNLOAD = 'Download'; + private const STEP_UNZIP = 'Unzip'; + private const STEP_COPY = 'Copy'; + private const STEP_CLEANUP = 'Cleanup'; - // Options for fetching files using GuzzleHTTP - private const GUZZLE_OPTIONS = [ - 'connect_timeout' => 25, - 'read_timeout' => 25, - 'timeout' => 55, - ]; + // Somewhere for our temporary files + private const TMP_FOLDER = 'tmp/webtrees'; - private const LOCK_FILE = 'data/offline.txt'; + /** @var Filesystem */ + private $filesystem; + + /** @var Filesystem */ + private $root_filesystem; + + /** @var Filesystem */ + private $temporary_filesystem; /** @var TimeoutService */ private $timeout_service; @@ -61,13 +69,21 @@ class UpgradeController extends AbstractAdminController /** * AdminUpgradeController constructor. * + * @param Filesystem $filesystem * @param TimeoutService $timeout_service * @param UpgradeService $upgrade_service */ - public function __construct(TimeoutService $timeout_service, UpgradeService $upgrade_service) + public function __construct(Filesystem $filesystem, TimeoutService $timeout_service, UpgradeService $upgrade_service) { + $this->filesystem = $filesystem; $this->timeout_service = $timeout_service; $this->upgrade_service = $upgrade_service; + + $this->root_filesystem = new Filesystem(new CachedAdapter(new Local(WT_ROOT), new Memory())); + $this->temporary_filesystem = new Filesystem(new ChrootAdapter($this->filesystem, self::TMP_FOLDER)); + + // @TODO DO NOT OVERWRITE LIVE DATA DURING TESTING! + $this->root_filesystem = new Filesystem(new CachedAdapter(new Local(WT_ROOT . 'data/test'), new Memory())); } /** @@ -96,40 +112,6 @@ class UpgradeController extends AbstractAdminController } /** - * Perform one step of the wizard - * - * @param Request $request - * @param Tree|null $tree - * - * @return Response - */ - public function step(Request $request, Tree $tree = null): Response - { - $step = $request->get('step'); - - switch ($step) { - case 'Check': - return $this->wizardStepCheck(); - case 'Pending': - return $this->wizardStepPending(); - case 'Export': - if ($tree instanceof Tree) { - return $this->wizardStepExport($tree); - } - - return $this->success('The tree no longer exists.'); - case 'Download': - return $this->wizardStepDownload(); - case 'Unzip': - return $this->wizardStepUnzip(); - case 'Copy': - return $this->wizardStepCopy(); - default: - throw new NotFoundHttpException(); - } - } - - /** * @return string[] */ private function wizardSteps(): array @@ -140,7 +122,7 @@ class UpgradeController extends AbstractAdminController foreach (Tree::getAll() as $tree) { $route = route('upgrade', [ - 'step' => 'Export', + 'step' => self::STEP_EXPORT, 'ged' => $tree->name(), ]); @@ -148,16 +130,59 @@ class UpgradeController extends AbstractAdminController } return [ - route('upgrade', ['step' => 'Check']) => 'config.php', - route('upgrade', ['step' => 'Pending']) => I18N::translate('Check for pending changes…'), + route('upgrade', ['step' => self::STEP_CHECK]) => I18N::translate('Upgrade wizard'), + route('upgrade', ['step' => self::STEP_PREPARE]) => I18N::translate('Create a temporary folder…'), + route('upgrade', ['step' => self::STEP_PENDING]) => I18N::translate('Check for pending changes…'), ] + $export_steps + [ - route('upgrade', ['step' => 'Download']) => I18N::translate('Download %s…', e($download_url)), - route('upgrade', ['step' => 'Unzip']) => I18N::translate('Unzip %s to a temporary folder…', e(basename($download_url))), - route('upgrade', ['step' => 'Copy']) => I18N::translate('Copy files…'), + route('upgrade', ['step' => self::STEP_DOWNLOAD]) => I18N::translate('Download %s…', e($download_url)), + route('upgrade', ['step' => self::STEP_UNZIP]) => I18N::translate('Unzip %s to a temporary folder…', e(basename($download_url))), + route('upgrade', ['step' => self::STEP_COPY]) => I18N::translate('Copy files…'), + route('upgrade', ['step' => self::STEP_CLEANUP]) => I18N::translate('Delete old files…'), ]; } /** + * Perform one step of the wizard + * + * @param Request $request + * @param Tree|null $tree + * + * @return Response + */ + public function step(Request $request, ?Tree $tree): Response + { + $step = $request->get('step'); + + switch ($step) { + case self::STEP_CHECK: + //return $this->wizardStepCheck(); + + case self::STEP_PREPARE: + return $this->wizardStepPrepare(); + + case self::STEP_PENDING: + return $this->wizardStepPending(); + + case self::STEP_EXPORT: + return $this->wizardStepExport($tree); + + case self::STEP_DOWNLOAD: + return $this->wizardStepDownload(); + + case self::STEP_UNZIP: + return $this->wizardStepUnzip(); + + case self::STEP_COPY: + return $this->wizardStepCopy(); + + case self::STEP_CLEANUP: + return $this->wizardStepCleanup(); + } + + throw new NotFoundHttpException(); + } + + /** * @return Response */ private function wizardStepCheck(): Response @@ -165,16 +190,33 @@ class UpgradeController extends AbstractAdminController $latest_version = $this->upgrade_service->latestVersion(); if ($latest_version === '') { - return $this->failure(I18N::translate('No upgrade information is available.')); + throw new InternalServerErrorException(I18N::translate('No upgrade information is available.')); } if (version_compare(Webtrees::VERSION, $latest_version) >= 0) { - return $this->failure(I18N::translate('This is the latest version of webtrees. No upgrade is available.')); + $message = I18N::translate('This is the latest version of webtrees. No upgrade is available.'); + throw new InternalServerErrorException($message); } /* I18N: %s is a version number, such as 1.2.3 */ + $alert = I18N::translate('Upgrade to webtrees %s.', e($latest_version)); + + return new Response(view('components/alert-success', [ + 'alert' => $alert, + ])); + } - return $this->success(I18N::translate('Upgrade to webtrees %s.', e($latest_version))); + /** + * @return Response + */ + private function wizardStepPrepare(): Response + { + $this->filesystem->deleteDir(self::TMP_FOLDER); + $this->filesystem->createDir(self::TMP_FOLDER); + + return new Response(view('components/alert-success', [ + 'alert' => I18N::translate('The folder %s has been created.', WT_DATA_DIR . self::TMP_FOLDER), + ])); } /** @@ -184,15 +226,13 @@ class UpgradeController extends AbstractAdminController { $changes = DB::table('change')->where('status', '=', 'pending')->exists(); - if (!$changes) { - return $this->success(I18N::translate('There are no pending changes.')); + if ($changes) { + throw new InternalServerErrorException(I18N::translate('You should accept or reject all pending changes before upgrading.')); } - $route = route('show-pending'); - $message = I18N::translate('You should accept or reject all pending changes before upgrading.'); - $message .= ' <a href="' . e($route) . '">' . I18N::translate('Pending changes') . '</a>'; - - return $this->failure($message); + return new Response(view('components/alert-success', [ + 'alert' => I18N::translate('There are no pending changes.'), + ])); } /** @@ -203,21 +243,14 @@ class UpgradeController extends AbstractAdminController private function wizardStepExport(Tree $tree): Response { $filename = WT_DATA_DIR . $tree->name() . date('-Y-m-d') . '.ged'; + $stream = fopen($filename, 'w'); - try { - $stream = fopen($filename, 'w'); + $tree->exportGedcom($stream); + fclose($stream); - if ($stream !== false) { - $tree->exportGedcom($stream); - fclose($stream); - - return $this->success(I18N::translate('The family tree has been exported to %s.', e($filename))); - } - } catch (Throwable $ex) { - // Can't write to the data folder. - } - - return $this->failure(I18N::translate('The file %s could not be created.', e($filename))); + return new Response(view('components/alert-success', [ + 'alert' => I18N::translate('The family tree has been exported to %s.', e($filename)), + ])); } /** @@ -225,48 +258,18 @@ class UpgradeController extends AbstractAdminController */ private function wizardStepDownload(): Response { - try { - $download_url = $this->upgrade_service->downloadUrl(); - $zip_file = WT_DATA_DIR . basename($download_url); - $zip_stream = fopen($zip_file, 'w'); - - if ($zip_stream === false) { - throw new Exception('Cannot read ZIP file: ' . $zip_file); - } - - $start_time = microtime(true); - $client = new Client(); - - $response = $client->get($download_url, self::GUZZLE_OPTIONS); - $stream = $response->getBody(); - - while (!$stream->eof()) { - fwrite($zip_stream, $stream->read(65536)); - } - - $stream->close(); - fclose($zip_stream); - $zip_size = filesize($zip_file); - $end_time = microtime(true); - - if ($zip_size > 0) { - $kb = I18N::number(intdiv($zip_size + 1023, 1024)); - $seconds = I18N::number($end_time - $start_time, 2); - - /* I18N: %1$s is a number of KB, %2$s is a (fractional) number of seconds */ - - return $this->success(I18N::translate('%1$s KB were downloaded in %2$s seconds.', $kb, $seconds)); - } + $start_time = microtime(true); + $download_url = $this->upgrade_service->downloadUrl(); + $zip_file = basename($download_url); - if (!in_array('ssl', stream_get_transports())) { - // Guess why we might have failed... - return $this->failure(I18N::translate('This server does not support secure downloads using HTTPS.')); - } + $bytes = $this->upgrade_service->downloadFile($download_url, $this->temporary_filesystem, $zip_file); + $kb = I18N::number(intdiv($bytes + 1023, 1024)); + $end_time = microtime(true); + $seconds = I18N::number($end_time - $start_time, 2); - return $this->failure(''); - } catch (Exception $ex) { - return $this->failure($ex->getMessage()); - } + return new Response(view('components/alert-success', [ + 'alert' => I18N::translate('%1$s KB were downloaded in %2$s seconds.', $kb, $seconds), + ])); } /** @@ -274,36 +277,24 @@ class UpgradeController extends AbstractAdminController */ private function wizardStepUnzip(): Response { - $download_url = $this->upgrade_service->downloadUrl(); - $zip_file = WT_DATA_DIR . basename($download_url); - $tmp_folder = WT_DATA_DIR . basename($download_url, '.zip'); - $src_filesystem = new Filesystem(new ZipArchiveAdapter($zip_file, null, 'webtrees')); - $paths = $src_filesystem->listContents('', true); - $paths = array_filter($paths, function (array $file): bool { - return $file['type'] === 'file'; - }); - - $start_time = microtime(true); - - // The Flysystem/ZipArchiveAdapter is very slow, taking over a second per file. - // So we do this step using the native PHP library. + $start_time = microtime(true); + $download_url = $this->upgrade_service->downloadUrl(); + $zip_file = basename($download_url); + $path = basename($zip_file, '.zip'); + $prefix = WT_DATA_DIR . self::TMP_FOLDER . '/'; - $zip = new ZipArchive(); - if ($zip->open($zip_file)) { - $zip->extractTo($tmp_folder); - $zip->close(); - echo 'ok'; - } else { - echo 'failed'; - } + $this->upgrade_service->extractWebtreesZip($prefix . $zip_file, $prefix . $path); + $count = $this->upgrade_service->webtreesZipContents(WT_DATA_DIR . self::TMP_FOLDER . '/' . $zip_file)->count(); $end_time = microtime(true); $seconds = I18N::number($end_time - $start_time, 2); - $count = count($paths); /* I18N: …from the .ZIP file, %2$s is a (fractional) number of seconds */ + $alert = I18N::plural('%1$s file was extracted in %2$s seconds.', '%1$s files were extracted in %2$s seconds.', $count, I18N::number($count), $seconds); - return $this->success(I18N::plural('%1$s file was extracted in %2$s seconds.', '%1$s files were extracted in %2$s seconds.', $count, $count, $seconds)); + return new Response(view('components/alert-success', [ + 'alert' => $alert, + ])); } /** @@ -311,56 +302,44 @@ class UpgradeController extends AbstractAdminController */ private function wizardStepCopy(): Response { - $download_url = $this->upgrade_service->downloadUrl(); - $src_filesystem = new Filesystem(new Local(WT_DATA_DIR . basename($download_url, '.zip') . '/webtrees')); - $dst_filesystem = new Filesystem(new Local(WT_ROOT)); - $paths = $src_filesystem->listContents('', true); - $paths = array_filter($paths, function (array $file): bool { - return $file['type'] === 'file'; - }); + // The zipfile contains a subfolder "webtrees". + $source_filesystem = new Filesystem(new ChrootAdapter($this->temporary_filesystem, 'webtrees')); - $lock_file_text = I18N::translate('This website is being upgraded. Try again in a few minutes.'); - $dst_filesystem->put(self::LOCK_FILE, $lock_file_text); + $this->upgrade_service->startMaintenanceMode(); + $this->upgrade_service->moveFiles($source_filesystem, $this->root_filesystem); + $this->upgrade_service->endMaintenanceMode(); - foreach ($paths as $path) { - $dst_filesystem->put($path['path'], $src_filesystem->read($path['path'])); - - if ($this->timeout_service->isTimeNearlyUp()) { - return $this->failure(I18N::translate('The server’s time limit has been reached.')); - } - } + return new Response(view('components/alert-success', [ + 'alert' => I18N::translate('The upgrade is complete.'), + ])); + } - $dst_filesystem->delete(self::LOCK_FILE); + /** + * @return Response + */ + private function wizardStepCleanup(): Response + { + $download_url = $this->upgrade_service->downloadUrl(); + $zip_file = basename($download_url); - // Delete the temporary files - if there is enough time. - foreach ($paths as $path) { - $src_filesystem->delete($path['path']); + $paths = $this->upgrade_service->webtreesZipContents(WT_DATA_DIR . self::TMP_FOLDER . '/' . $zip_file); - if (($this->timeout_service->isTimeNearlyUp())) { - break; + // Delete old files from previous versions + foreach (['vendor', 'app', 'resources'] as $folder) { + foreach ($this->root_filesystem->listContents($folder, true) as $path) { + if (!$paths->has($path['path'])) { + $this->root_filesystem->delete($path['path']); + } } } - return $this->success(I18N::translate('The upgrade is complete.')); - } + $this->filesystem->deleteDir(self::TMP_FOLDER); - /** - * @param string $message - * - * @return Response - */ - private function success(string $message): Response - { - return new Response(self::SUCCESS . $message); - } + $url = route('control-panel'); + $button = '<a href="' . e($url) . '" class="btn btn-primary">' . I18N::translate('continue') . '</a>'; - /** - * @param string $message - * - * @return Response - */ - private function failure(string $message): Response - { - return new Response(self::FAILURE . $message, Response::HTTP_INTERNAL_SERVER_ERROR); + return new Response(view('components/alert-success', [ + 'alert' => $button, + ])); } } diff --git a/app/Http/Controllers/AdminUpgradeController.php b/app/Http/Controllers/AdminUpgradeController.php new file mode 100644 index 0000000000..e9df2f85b0 --- /dev/null +++ b/app/Http/Controllers/AdminUpgradeController.php @@ -0,0 +1,366 @@ +<?php +/** + * webtrees: online genealogy + * Copyright (C) 2018 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +declare(strict_types=1); + +namespace Fisharebest\Webtrees\Http\Controllers; + +use Exception; +use Fisharebest\Webtrees\Database; +use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Services\TimeoutService; +use Fisharebest\Webtrees\Services\UpgradeService; +use Fisharebest\Webtrees\Tree; +use Fisharebest\Webtrees\Webtrees; +use GuzzleHttp\Client; +use League\Flysystem\Adapter\Local; +use League\Flysystem\Filesystem; +use League\Flysystem\ZipArchive\ZipArchiveAdapter; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Throwable; +use ZipArchive; + +/** + * Controller for upgrading to a new version of webtrees. + */ +class AdminUpgradeController extends AbstractBaseController +{ + // Icons for success and failure + const SUCCESS = '<i class="fas fa-check" style="color:green"></i> '; + const FAILURE = '<i class="fas fa-times" style="color:red"></i> '; + + // Options for fetching files using GuzzleHTTP + const GUZZLE_OPTIONS = [ + 'connect_timeout' => 25, + 'read_timeout' => 25, + 'timeout' => 55, + ]; + + const LOCK_FILE = 'data/offline.txt'; + + /** @var string */ + protected $layout = 'layouts/administration'; + + /** @var TimeoutService */ + private $timeout_service; + + /** @var UpgradeService */ + private $upgrade_service; + + /** + * AdminUpgradeController constructor. + * + * @param TimeoutService $timeout_service + * @param UpgradeService $upgrade_service + */ + public function __construct(TimeoutService $timeout_service, UpgradeService $upgrade_service) + { + $this->timeout_service = $timeout_service; + $this->upgrade_service = $upgrade_service; + } + + /** + * @param Request $request + * + * @return Response + */ + public function wizard(Request $request): Response + { + $continue = (bool) $request->get('continue'); + + $title = I18N::translate('Upgrade wizard'); + + if ($continue) { + return $this->viewResponse('admin/upgrade/steps', [ + 'steps' => $this->wizardSteps(), + 'title' => $title, + ]); + } + + return $this->viewResponse('admin/upgrade/wizard', [ + 'current_version' => Webtrees::VERSION, + 'latest_version' => $this->upgrade_service->latestVersion(), + 'title' => $title, + ]); + } + + /** + * Perform one step of the wizard + * + * @param Request $request + * @param Tree|null $tree + * + * @return Response + */ + public function step(Request $request, Tree $tree = null): Response + { + $step = $request->get('step'); + + switch ($step) { + case 'Check': + return $this->wizardStepCheck(); + case 'Pending': + return $this->wizardStepPending(); + case 'Export': + if ($tree instanceof Tree) { + return $this->wizardStepExport($tree); + } + + return $this->success('The tree no longer exists.'); + case 'Download': + return $this->wizardStepDownload(); + case 'Unzip': + return $this->wizardStepUnzip(); + case 'Copy': + return $this->wizardStepCopy(); + default: + throw new NotFoundHttpException(); + } + } + + /** + * @return string[] + */ + private function wizardSteps(): array + { + $download_url = $this->upgrade_service->downloadUrl(); + + $export_steps = []; + + foreach (Tree::getAll() as $tree) { + $route = route('upgrade', [ + 'step' => 'Export', + 'ged' => $tree->name(), + ]); + + $export_steps[$route] = I18N::translate('Export all the family trees to GEDCOM files…') . ' ' . e($tree->title()); + } + + return [ + route('upgrade', ['step' => 'Check']) => 'config.php', + route('upgrade', ['step' => 'Pending']) => I18N::translate('Check for pending changes…'), + ] + $export_steps + [ + route('upgrade', ['step' => 'Download']) => I18N::translate('Download %s…', e($download_url)), + route('upgrade', ['step' => 'Unzip']) => I18N::translate('Unzip %s to a temporary folder…', e(basename($download_url))), + route('upgrade', ['step' => 'Copy']) => I18N::translate('Copy files…'), + ]; + } + + /** + * @return Response + */ + private function wizardStepCheck(): Response + { + $latest_version = $this->upgrade_service->latestVersion(); + + if ($latest_version === '') { + return $this->failure(I18N::translate('No upgrade information is available.')); + } + + if (version_compare(Webtrees::VERSION, $latest_version) >= 0) { + return $this->failure(I18N::translate('This is the latest version of webtrees. No upgrade is available.')); + } + + /* I18N: %s is a version number, such as 1.2.3 */ + return $this->success(I18N::translate('Upgrade to webtrees %s.', e($latest_version))); + } + + /** + * @return Response + */ + private function wizardStepPending(): Response + { + $changes = Database::prepare("SELECT 1 FROM `##change` WHERE status='pending' LIMIT 1")->fetchOne(); + + if (empty($changes)) { + return $this->success(I18N::translate('There are no pending changes.')); + } + + $route = route('show-pending'); + $message = I18N::translate('You should accept or reject all pending changes before upgrading.'); + $message .= ' <a href="' . e($route) . '">' . I18N::translate('Pending changes') . '</a>'; + + return $this->failure($message); + } + + /** + * @param Tree $tree + * + * @return Response + */ + private function wizardStepExport(Tree $tree): Response + { + $filename = WT_DATA_DIR . $tree->name() . date('-Y-m-d') . '.ged'; + + try { + $stream = fopen($filename, 'w'); + + if ($stream !== false) { + $tree->exportGedcom($stream); + fclose($stream); + + return $this->success(I18N::translate('The family tree has been exported to %s.', e($filename))); + } + } catch (Throwable $ex) { + // Can't write to the data folder. + } + + return $this->failure(I18N::translate('The file %s could not be created.', e($filename))); + } + + /** + * @return Response + */ + private function wizardStepDownload(): Response + { + try { + $download_url = $this->upgrade_service->downloadUrl(); + $zip_file = WT_DATA_DIR . basename($download_url); + $zip_stream = fopen($zip_file, 'w'); + + if ($zip_stream === false) { + throw new Exception('Cannot read ZIP file: ' . $zip_file); + } + + $start_time = microtime(true); + $client = new Client(); + + $response = $client->get($download_url, self::GUZZLE_OPTIONS); + $stream = $response->getBody(); + + while (!$stream->eof()) { + fwrite($zip_stream, $stream->read(65536)); + } + + $stream->close(); + fclose($zip_stream); + $zip_size = filesize($zip_file); + $end_time = microtime(true); + + if ($zip_size > 0) { + $kb = I18N::number(intdiv($zip_size + 1023, 1024)); + $seconds = I18N::number($end_time - $start_time, 2); + + /* I18N: %1$s is a number of KB, %2$s is a (fractional) number of seconds */ + return $this->success(I18N::translate('%1$s KB were downloaded in %2$s seconds.', $kb, $seconds)); + } + + if (!in_array('ssl', stream_get_transports())) { + // Guess why we might have failed... + return $this->failure(I18N::translate('This server does not support secure downloads using HTTPS.')); + } + + return $this->failure(''); + } catch (Exception $ex) { + return $this->failure($ex->getMessage()); + } + } + + /** + * @return Response + */ + private function wizardStepUnzip(): Response + { + $download_url = $this->upgrade_service->downloadUrl(); + $zip_file = WT_DATA_DIR . basename($download_url); + $tmp_folder = WT_DATA_DIR . basename($download_url, '.zip'); + $src_filesystem = new Filesystem(new ZipArchiveAdapter($zip_file, null, 'webtrees')); + $paths = $src_filesystem->listContents('', true); + $paths = array_filter($paths, function (array $file): bool { + return $file['type'] === 'file'; + }); + + $start_time = microtime(true); + + // The Flysystem/ZipArchiveAdapter is very slow, taking over a second per file. + // So we do this step using the native PHP library. + + $zip = new ZipArchive(); + if ($zip->open($zip_file)) { + $zip->extractTo($tmp_folder); + $zip->close(); + echo 'ok'; + } else { + echo 'failed'; + } + + $end_time = microtime(true); + $seconds = I18N::number($end_time - $start_time, 2); + $count = count($paths); + + /* I18N: …from the .ZIP file, %2$s is a (fractional) number of seconds */ + return $this->success(I18N::plural('%1$s file was extracted in %2$s seconds.', '%1$s files were extracted in %2$s seconds.', $count, $count, $seconds)); + } + + /** + * @return Response + */ + private function wizardStepCopy(): Response + { + $download_url = $this->upgrade_service->downloadUrl(); + $src_filesystem = new Filesystem(new Local(WT_DATA_DIR . basename($download_url, '.zip') . '/webtrees')); + $dst_filesystem = new Filesystem(new Local(WT_ROOT)); + $paths = $src_filesystem->listContents('', true); + $paths = array_filter($paths, function (array $file): bool { + return $file['type'] === 'file'; + }); + + $lock_file_text = I18N::translate('This website is being upgraded. Try again in a few minutes.'); + $dst_filesystem->put(self::LOCK_FILE, $lock_file_text); + + foreach ($paths as $path) { + $dst_filesystem->put($path['path'], $src_filesystem->read($path['path'])); + + if ($this->timeout_service->isTimeNearlyUp()) { + return $this->failure(I18N::translate('The server’s time limit has been reached.')); + } + } + + $dst_filesystem->delete(self::LOCK_FILE); + + // Delete the temporary files - if there is enough time. + foreach ($paths as $path) { + $src_filesystem->delete($path['path']); + + if (($this->timeout_service->isTimeNearlyUp())) { + break; + } + } + + return $this->success(I18N::translate('The upgrade is complete.')); + } + + /** + * @param string $message + * + * @return Response + */ + private function success(string $message): Response + { + return new Response(self::SUCCESS . $message); + } + + /** + * @param string $message + * + * @return Response + */ + private function failure(string $message): Response + { + return new Response(self::FAILURE . $message, Response::HTTP_INTERNAL_SERVER_ERROR); + } +} diff --git a/app/Http/Controllers/ErrorController.php b/app/Http/Controllers/ErrorController.php index 9e550d79ee..b10d0446d1 100644 --- a/app/Http/Controllers/ErrorController.php +++ b/app/Http/Controllers/ErrorController.php @@ -71,7 +71,6 @@ class ErrorController extends AbstractBaseController public function errorResponse(HttpException $ex): Response { return $this->viewResponse('components/alert-danger', [ - 'title' => 'Error', 'alert' => $ex->getMessage(), ], $ex->getStatusCode()); } @@ -79,6 +78,20 @@ class ErrorController extends AbstractBaseController /** * Convert an exception into an error message * + * @param HttpException $ex + * + * @return Response + */ + public function ajaxErrorResponse(HttpException $ex): Response + { + return new Response(view('components/alert-danger', [ + 'alert' => $ex->getMessage(), + ]), $ex->getStatusCode()); + } + + /** + * Convert an exception into an error message + * * @param Request $request * @param Throwable $ex * diff --git a/app/Services/UpgradeService.php b/app/Services/UpgradeService.php index c7c2128e25..77acf86da4 100644 --- a/app/Services/UpgradeService.php +++ b/app/Services/UpgradeService.php @@ -18,27 +18,165 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Services; use Carbon\Carbon; +use Fisharebest\Webtrees\Exceptions\InternalServerErrorException; +use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Site; use Fisharebest\Webtrees\Webtrees; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; +use Illuminate\Support\Collection; +use League\Flysystem\Cached\CachedAdapter; +use League\Flysystem\Cached\Storage\Memory; +use League\Flysystem\Filesystem; +use League\Flysystem\ZipArchive\ZipArchiveAdapter; +use function rewind; use Symfony\Component\HttpFoundation\Response; +use ZipArchive; /** * Automatic upgrades. */ class UpgradeService { - // Only check the webtrees server infrequently. + // Options for fetching files using GuzzleHTTP + private const GUZZLE_OPTIONS = [ + 'connect_timeout' => 25, + 'read_timeout' => 25, + 'timeout' => 55, + ]; + + // Transfer stream data in blocks of this number of bytes. + private const READ_BLOCK_SIZE = 65535; + + // Only check the webtrees server once per day. private const CHECK_FOR_UPDATE_INTERVAL = 24 * 60 * 60; // Fetch information about upgrades from here. // Note: earlier versions of webtrees used svn.webtrees.net, so we must maintain both URLs. private const UPDATE_URL = 'https://dev.webtrees.net/build/latest-version.txt'; + // Create this file to put the site into maintenance mode. + private const LOCK_FILE = 'data/offline.txt'; + // If the update server doesn't respond after this time, give up. private const HTTP_TIMEOUT = 3.0; + /** @var TimeoutService */ + private $timeout_service; + + /** + * UpgradeService constructor. + * + * @param TimeoutService $timeout_service + */ + public function __construct(TimeoutService $timeout_service) + { + $this->timeout_service = $timeout_service; + } + + /** + * Unpack webtrees.zip. + * + * @param string $zip_file + * @param string $target_folder + */ + public function extractWebtreesZip(string $zip_file, string $target_folder) + { + // The Flysystem ZIP archive adapter is painfully slow, so use the native PHP library. + $zip = new ZipArchive(); + + if ($zip->open($zip_file)) { + $zip->extractTo($target_folder); + $zip->close(); + } else { + throw new InternalServerErrorException('Cannot read ZIP file. Is it corrupt?'); + } + } + + /** + * Create a list of all the files in a webtrees .ZIP archive + * + * @return Collection + */ + public function webtreesZipContents($zip_file): Collection { + $zip_adapter = new ZipArchiveAdapter($zip_file, null, 'webtrees'); + $zip_filesystem = new Filesystem(new CachedAdapter($zip_adapter, new Memory())); + $paths = new Collection($zip_filesystem->listContents('', true)); + + return $paths->filter(function (array $path): bool { + return $path['type'] === 'file'; + }) + ->map(function (array $path): string { + return $path['path']; + }); + } + + /** + * Fetch a file from a URL and save it in a filesystem. + * Use streams so that we can copy files larger than our available memory. + * + * @param string $url + * @param Filesystem $filesystem + * @param string $path + * + * @return int The number of bytes downloaded + */ + public function downloadFile(string $url, Filesystem $filesystem, string $path): int + { + // Overwrite any previous/partial/failed download. + if ($filesystem->has($path)) { + $filesystem->delete($path); + } + + // We store the data in PHP temporary storage. + $tmp = fopen('php://temp', 'w+'); + + // Read from the URL + $client = new Client(); + $response = $client->get($url, self::GUZZLE_OPTIONS); + $stream = $response->getBody(); + + // Download the file to temporary storage. + while (!$stream->eof()) { + fwrite($tmp, $stream->read(self::READ_BLOCK_SIZE)); + + if (!$this->timeout_service->isTimeNearlyUp()) { + throw new InternalServerErrorException(I18N::translate('The server’s time limit has been reached.')); + } + } + + if (is_resource($stream)) { + fclose($stream); + } + + // Copy from temporary storage to the file. + $bytes = ftell($stream); + rewind($tmp); + $filesystem->writeStream($path, $tmp); + fclose($tmp); + + return $bytes; + } + + /** + * Move (copy and delete) all files from one filesystem to another. + * + * @param Filesystem $source + * @param Filesystem $destination + */ + public function moveFiles(Filesystem $source, Filesystem $destination) { + foreach ($source->listContents() as $path) { + if ($path['type'] === 'file') { + $destination->put($path['path'], $source->read($path['path'])); + $source->delete($path['path']); + + if (!$this->timeout_service->isTimeNearlyUp()) { + throw new InternalServerErrorException(I18N::translate('The server’s time limit has been reached.')); + } + } + } + } + /** * @return bool */ @@ -77,6 +215,20 @@ class UpgradeService return $url; } + public function startMaintenanceMode(): void + { + $message = I18N::translate('This website is being upgraded. Try again in a few minutes.'); + + file_put_contents(WT_ROOT . self::LOCK_FILE, $message); + } + + public function endMaintenanceMode(): void + { + if (file_exists(WT_ROOT . self::LOCK_FILE)) { + unlink(WT_ROOT . self::LOCK_FILE); + } + } + /** * Check with the webtrees.net server for the latest version of webtrees. * Fetching the remote file can be slow, so check infrequently, and cache the result. diff --git a/composer.json b/composer.json index 78a21c80b8..9688713328 100644 --- a/composer.json +++ b/composer.json @@ -65,11 +65,13 @@ }, "require-dev": { "ext-pdo_sqlite": "*", + "league/flysystem-memory": "*", "maximebf/debugbar": "*", "mockery/mockery": "*", "php-coveralls/php-coveralls": "*", "phpunit/phpunit": "*", - "wapmorgan/php-code-fixer": "dev-master" + "wapmorgan/php-code-fixer": "*", + "wata727/pahout": "*" }, "scripts": { "webtrees:build": [ diff --git a/composer.lock b/composer.lock index 03f4eb814a..c39c9f1943 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "020443c5c3bf4ab81adec5dcbe90e3a7", + "content-hash": "eb7f5ee54c3905ce0cbc56855652cebc", "packages": [ { "name": "doctrine/cache", @@ -1267,16 +1267,16 @@ }, { "name": "league/flysystem", - "version": "1.0.49", + "version": "1.0.50", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "a63cc83d8a931b271be45148fa39ba7156782ffd" + "reference": "dab4e7624efa543a943be978008f439c333f2249" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a63cc83d8a931b271be45148fa39ba7156782ffd", - "reference": "a63cc83d8a931b271be45148fa39ba7156782ffd", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/dab4e7624efa543a943be978008f439c333f2249", + "reference": "dab4e7624efa543a943be978008f439c333f2249", "shasum": "" }, "require": { @@ -1347,7 +1347,7 @@ "sftp", "storage" ], - "time": "2018-11-23T23:41:29+00:00" + "time": "2019-02-01T08:50:36+00:00" }, { "name": "league/flysystem-cached-adapter", @@ -2030,16 +2030,16 @@ }, { "name": "symfony/cache", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "dd223d4bb9a2f9a4b4992851800b349739c40860" + "reference": "7c5b85bcc5f87dd7938123be12ce3323be6cde5a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/dd223d4bb9a2f9a4b4992851800b349739c40860", - "reference": "dd223d4bb9a2f9a4b4992851800b349739c40860", + "url": "https://api.github.com/repos/symfony/cache/zipball/7c5b85bcc5f87dd7938123be12ce3323be6cde5a", + "reference": "7c5b85bcc5f87dd7938123be12ce3323be6cde5a", "shasum": "" }, "require": { @@ -2103,7 +2103,7 @@ "caching", "psr6" ], - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-01-31T15:08:08+00:00" }, { "name": "symfony/contracts", @@ -2175,16 +2175,16 @@ }, { "name": "symfony/debug", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "64cb33c81e37d19b7715d4a6a4d49c1c382066dd" + "reference": "cf9b2e33f757deb884ce474e06d2647c1c769b65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/64cb33c81e37d19b7715d4a6a4d49c1c382066dd", - "reference": "64cb33c81e37d19b7715d4a6a4d49c1c382066dd", + "url": "https://api.github.com/repos/symfony/debug/zipball/cf9b2e33f757deb884ce474e06d2647c1c769b65", + "reference": "cf9b2e33f757deb884ce474e06d2647c1c769b65", "shasum": "" }, "require": { @@ -2227,20 +2227,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-01-25T14:35:16+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "887de6d34c86cf0cb6cbf910afb170cdb743cb5e" + "reference": "bd09ad265cd50b2b9d09d65ce6aba2d29bc81fe1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/887de6d34c86cf0cb6cbf910afb170cdb743cb5e", - "reference": "887de6d34c86cf0cb6cbf910afb170cdb743cb5e", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bd09ad265cd50b2b9d09d65ce6aba2d29bc81fe1", + "reference": "bd09ad265cd50b2b9d09d65ce6aba2d29bc81fe1", "shasum": "" }, "require": { @@ -2291,20 +2291,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-01-05T16:37:49+00:00" + "time": "2019-01-16T20:35:37+00:00" }, { "name": "symfony/expression-language", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "78a427af5e08eba1b391ddfbcaebb6dc6ab715be" + "reference": "a69b153996a13ffdb05395e8724c7217a8448e9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/78a427af5e08eba1b391ddfbcaebb6dc6ab715be", - "reference": "78a427af5e08eba1b391ddfbcaebb6dc6ab715be", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/a69b153996a13ffdb05395e8724c7217a8448e9e", + "reference": "a69b153996a13ffdb05395e8724c7217a8448e9e", "shasum": "" }, "require": { @@ -2342,20 +2342,20 @@ ], "description": "Symfony ExpressionLanguage Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-01-16T20:31:39+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "a633d422a09242064ba24e44a6e1494c5126de86" + "reference": "8d2318b73e0a1bc75baa699d00ebe2ae8b595a39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a633d422a09242064ba24e44a6e1494c5126de86", - "reference": "a633d422a09242064ba24e44a6e1494c5126de86", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8d2318b73e0a1bc75baa699d00ebe2ae8b595a39", + "reference": "8d2318b73e0a1bc75baa699d00ebe2ae8b595a39", "shasum": "" }, "require": { @@ -2396,20 +2396,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2019-01-05T16:37:49+00:00" + "time": "2019-01-29T09:49:29+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "83de6543328917c18d5498eeb6bb6d36f7aab31b" + "reference": "d56b1706abaa771eb6acd894c6787cb88f1dc97d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/83de6543328917c18d5498eeb6bb6d36f7aab31b", - "reference": "83de6543328917c18d5498eeb6bb6d36f7aab31b", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/d56b1706abaa771eb6acd894c6787cb88f1dc97d", + "reference": "d56b1706abaa771eb6acd894c6787cb88f1dc97d", "shasum": "" }, "require": { @@ -2485,7 +2485,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2019-01-06T16:19:23+00:00" + "time": "2019-02-03T12:47:33+00:00" }, { "name": "symfony/polyfill-ctype", @@ -2716,16 +2716,16 @@ }, { "name": "symfony/translation", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0" + "reference": "23fd7aac70d99a17a8e6473a41fec8fab3331050" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/939fb792d73f2ce80e6ae9019d205fc480f1c9a0", - "reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0", + "url": "https://api.github.com/repos/symfony/translation/zipball/23fd7aac70d99a17a8e6473a41fec8fab3331050", + "reference": "23fd7aac70d99a17a8e6473a41fec8fab3331050", "shasum": "" }, "require": { @@ -2785,20 +2785,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-01-27T23:11:39+00:00" }, { "name": "symfony/var-exporter", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "51bd782120fa2bfed89452f142d2a47c4b51101c" + "reference": "d8bf4424c232b55f4c1816037d3077a89258557e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/51bd782120fa2bfed89452f142d2a47c4b51101c", - "reference": "51bd782120fa2bfed89452f142d2a47c4b51101c", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/d8bf4424c232b55f4c1816037d3077a89258557e", + "reference": "d8bf4424c232b55f4c1816037d3077a89258557e", "shasum": "" }, "require": { @@ -2845,7 +2845,7 @@ "instantiate", "serialize" ], - "time": "2019-01-03T09:09:06+00:00" + "time": "2019-01-16T20:35:37+00:00" }, { "name": "tecnickcom/tcpdf", @@ -3118,6 +3118,57 @@ "time": "2016-01-20T08:20:44+00:00" }, { + "name": "league/flysystem-memory", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-memory.git", + "reference": "1cabecd08a8caec92a96a953c0d93b5ce83b07a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-memory/zipball/1cabecd08a8caec92a96a953c0d93b5ce83b07a2", + "reference": "1cabecd08a8caec92a96a953c0d93b5ce83b07a2", + "shasum": "" + }, + "require": { + "league/flysystem": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\Memory\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Leppanen", + "email": "chris.leppanen@gmail.com", + "role": "Developer" + } + ], + "description": "An in-memory adapter for Flysystem.", + "homepage": "https://github.com/thephpleague/flysystem-memory", + "keywords": [ + "Flysystem", + "adapter", + "memory" + ], + "time": "2016-06-04T03:57:11+00:00" + }, + { "name": "maximebf/debugbar", "version": "v1.15.0", "source": { @@ -3945,16 +3996,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.5.2", + "version": "7.5.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "7c89093bd00f7d5ddf0ab81dee04f801416b4944" + "reference": "2cb759721e53bc05f56487f628c6b9fbb6c18746" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7c89093bd00f7d5ddf0ab81dee04f801416b4944", - "reference": "7c89093bd00f7d5ddf0ab81dee04f801416b4944", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2cb759721e53bc05f56487f628c6b9fbb6c18746", + "reference": "2cb759721e53bc05f56487f628c6b9fbb6c18746", "shasum": "" }, "require": { @@ -4025,7 +4076,7 @@ "testing", "xunit" ], - "time": "2019-01-15T08:19:08+00:00" + "time": "2019-02-01T05:24:07+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -4138,23 +4189,23 @@ }, { "name": "sebastian/diff", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "366541b989927187c4ca70490a35615d3fef2dce" + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce", - "reference": "366541b989927187c4ca70490a35615d3fef2dce", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^7.0", + "phpunit/phpunit": "^7.5 || ^8.0", "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", @@ -4190,32 +4241,35 @@ "unidiff", "unified diff" ], - "time": "2018-06-10T07:54:39+00:00" + "time": "2019-02-04T06:01:07+00:00" }, { "name": "sebastian/environment", - "version": "4.0.2", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "4a43e9af57b4afa663077b9bc85255dbc6e8a2bd" + "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4a43e9af57b4afa663077b9bc85255dbc6e8a2bd", - "reference": "4a43e9af57b4afa663077b9bc85255dbc6e8a2bd", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6fda8ce1974b62b14935adc02a9ed38252eca656", + "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^7.4" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -4240,7 +4294,7 @@ "environment", "hhvm" ], - "time": "2019-01-28T15:26:03+00:00" + "time": "2019-02-01T05:27:49+00:00" }, { "name": "sebastian/exporter", @@ -4592,16 +4646,16 @@ }, { "name": "symfony/config", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "a7a7d0a0244cfc82f040729ccf769e6cf55a78fb" + "reference": "25a2e7abe0d97e70282537292e3df45cf6da7b98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/a7a7d0a0244cfc82f040729ccf769e6cf55a78fb", - "reference": "a7a7d0a0244cfc82f040729ccf769e6cf55a78fb", + "url": "https://api.github.com/repos/symfony/config/zipball/25a2e7abe0d97e70282537292e3df45cf6da7b98", + "reference": "25a2e7abe0d97e70282537292e3df45cf6da7b98", "shasum": "" }, "require": { @@ -4651,20 +4705,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-01-30T11:44:30+00:00" }, { "name": "symfony/console", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "b0a03c1bb0fcbe288629956cf2f1dd3f1dc97522" + "reference": "1f0ad51dfde4da8a6070f06adc58b4e37cbb37a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/b0a03c1bb0fcbe288629956cf2f1dd3f1dc97522", - "reference": "b0a03c1bb0fcbe288629956cf2f1dd3f1dc97522", + "url": "https://api.github.com/repos/symfony/console/zipball/1f0ad51dfde4da8a6070f06adc58b4e37cbb37a4", + "reference": "1f0ad51dfde4da8a6070f06adc58b4e37cbb37a4", "shasum": "" }, "require": { @@ -4676,6 +4730,9 @@ "symfony/dependency-injection": "<3.4", "symfony/process": "<3.3" }, + "provide": { + "psr/log-implementation": "1.0" + }, "require-dev": { "psr/log": "~1.0", "symfony/config": "~3.4|~4.0", @@ -4685,7 +4742,7 @@ "symfony/process": "~3.4|~4.0" }, "suggest": { - "psr/log-implementation": "For using the console logger", + "psr/log": "For using the console logger", "symfony/event-dispatcher": "", "symfony/lock": "", "symfony/process": "" @@ -4720,20 +4777,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-01-04T15:13:53+00:00" + "time": "2019-01-25T14:35:16+00:00" }, { "name": "symfony/filesystem", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "c2ffd9a93f2d6c5be2f68a0aa7953cc229f871f8" + "reference": "7c16ebc2629827d4ec915a52ac809768d060a4ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/c2ffd9a93f2d6c5be2f68a0aa7953cc229f871f8", - "reference": "c2ffd9a93f2d6c5be2f68a0aa7953cc229f871f8", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/7c16ebc2629827d4ec915a52ac809768d060a4ee", + "reference": "7c16ebc2629827d4ec915a52ac809768d060a4ee", "shasum": "" }, "require": { @@ -4770,20 +4827,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-01-16T20:35:37+00:00" }, { "name": "symfony/stopwatch", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "af62b35760fc92c8dbdce659b4eebdfe0e6a0472" + "reference": "b1a5f646d56a3290230dbc8edf2a0d62cda23f67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/af62b35760fc92c8dbdce659b4eebdfe0e6a0472", - "reference": "af62b35760fc92c8dbdce659b4eebdfe0e6a0472", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/b1a5f646d56a3290230dbc8edf2a0d62cda23f67", + "reference": "b1a5f646d56a3290230dbc8edf2a0d62cda23f67", "shasum": "" }, "require": { @@ -4820,20 +4877,20 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-01-16T20:31:39+00:00" }, { "name": "symfony/var-dumper", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "85bde661b178173d85c6f11ea9d03b61d1212bb2" + "reference": "223bda89f9be41cf7033eeaf11bc61a280489c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/85bde661b178173d85c6f11ea9d03b61d1212bb2", - "reference": "85bde661b178173d85c6f11ea9d03b61d1212bb2", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/223bda89f9be41cf7033eeaf11bc61a280489c17", + "reference": "223bda89f9be41cf7033eeaf11bc61a280489c17", "shasum": "" }, "require": { @@ -4896,20 +4953,20 @@ "debug", "dump" ], - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-01-30T11:44:30+00:00" }, { "name": "symfony/yaml", - "version": "v4.2.2", + "version": "v4.2.3", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "d0aa6c0ea484087927b49fd513383a7d36190ca6" + "reference": "d461670ee145092b7e2a56c1da7118f19cadadb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/d0aa6c0ea484087927b49fd513383a7d36190ca6", - "reference": "d0aa6c0ea484087927b49fd513383a7d36190ca6", + "url": "https://api.github.com/repos/symfony/yaml/zipball/d461670ee145092b7e2a56c1da7118f19cadadb0", + "reference": "d461670ee145092b7e2a56c1da7118f19cadadb0", "shasum": "" }, "require": { @@ -4955,7 +5012,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" + "time": "2019-01-16T20:35:37+00:00" }, { "name": "theseer/tokenizer", @@ -4999,7 +5056,7 @@ }, { "name": "wapmorgan/php-code-fixer", - "version": "dev-master", + "version": "2.0.16", "source": { "type": "git", "url": "https://github.com/wapmorgan/PhpCodeFixer.git", @@ -5052,6 +5109,53 @@ "time": "2019-01-16T18:52:43+00:00" }, { + "name": "wata727/pahout", + "version": "0.6.1", + "source": { + "type": "git", + "url": "https://github.com/wata727/pahout.git", + "reference": "74149b35333e00ed52df00de0eeda8ec977164e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wata727/pahout/zipball/74149b35333e00ed52df00de0eeda8ec977164e5", + "reference": "74149b35333e00ed52df00de0eeda8ec977164e5", + "shasum": "" + }, + "require": { + "ext-ast": "^0.1.7|^1.0.0", + "php": ">=7.1.0", + "psr/log": "~1.0", + "symfony/console": ">=3.3", + "symfony/yaml": ">=3.3" + }, + "require-dev": { + "phan/phan": "^1.1.0", + "phpunit/phpunit": "^6.2", + "squizlabs/php_codesniffer": "^3.0" + }, + "bin": [ + "bin/pahout" + ], + "type": "project", + "autoload": { + "psr-4": { + "Pahout\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kazuma Watanabe" + } + ], + "description": "A pair programming partner for writing better PHP", + "time": "2019-01-29T14:30:35+00:00" + }, + { "name": "webmozart/assert", "version": "1.4.0", "source": { @@ -5105,9 +5209,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "wapmorgan/php-code-fixer": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/resources/views/components/alert-success.phtml b/resources/views/components/alert-success.phtml new file mode 100644 index 0000000000..225d170e69 --- /dev/null +++ b/resources/views/components/alert-success.phtml @@ -0,0 +1 @@ +<div class="alert alert-success" role="alert" style="white-space: pre-wrap;"><?= $alert ?></div> diff --git a/tests/TestCase.php b/tests/TestCase.php index f3edfc970c..f20a691ef7 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -27,8 +27,10 @@ use Fisharebest\Webtrees\Services\UserService; use Illuminate\Cache\ArrayStore; use Illuminate\Cache\Repository; use Illuminate\Database\Capsule\Manager as DB; -use function basename; +use League\Flysystem\Filesystem; +use League\Flysystem\Memory\MemoryAdapter; use Symfony\Component\HttpFoundation\Request; +use function basename; /** * Base class for unit tests @@ -82,6 +84,7 @@ class TestCase extends \PHPUnit\Framework\TestCase app()->instance(UserInterface::class, new GuestUser()); app()->instance(Request::class, Request::createFromGlobals()); + app()->instance(Filesystem::class, new Filesystem(new MemoryAdapter())); app()->bind(ModuleThemeInterface::class, WebtreesTheme::class); @@ -106,9 +109,9 @@ class TestCase extends \PHPUnit\Framework\TestCase app('cache.array')->flush(); - Site::$preferences = []; - Tree::$trees = []; - GedcomRecord::$gedcom_record_cache = null; + Site::$preferences = []; + Tree::$trees = []; + GedcomRecord::$gedcom_record_cache = null; GedcomRecord::$pending_record_cache = null; Auth::logout(); diff --git a/tests/app/Http/Controllers/Admin/ControlPanelControllerTest.php b/tests/app/Http/Controllers/Admin/ControlPanelControllerTest.php index 7bba653cff..9b1263c9e7 100644 --- a/tests/app/Http/Controllers/Admin/ControlPanelControllerTest.php +++ b/tests/app/Http/Controllers/Admin/ControlPanelControllerTest.php @@ -17,6 +17,13 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\Controllers\Admin; +use Fisharebest\Webtrees\Services\HousekeepingService; +use Fisharebest\Webtrees\Services\ModuleService; +use Fisharebest\Webtrees\Services\TimeoutService; +use Fisharebest\Webtrees\Services\UpgradeService; +use Fisharebest\Webtrees\Services\UserService; +use Fisharebest\Webtrees\User; +use Illuminate\Support\Collection; use Symfony\Component\HttpFoundation\Response; /** @@ -33,8 +40,13 @@ class ControlPanelControllerTest extends \Fisharebest\Webtrees\TestCase */ public function testControlPanel(): void { - $controller = app()->make(ControlPanelController::class); - $response = app()->dispatch($controller, 'controlPanel'); + $controller = new ControlPanelController(); + $response = $controller->controlPanel( + new HousekeepingService(), + new UpgradeService(new TimeoutService(microtime(true))), + new ModuleService(), + new UserService() + ); $this->assertInstanceOf(Response::class, $response); } @@ -44,8 +56,8 @@ class ControlPanelControllerTest extends \Fisharebest\Webtrees\TestCase */ public function testControlPanelManager(): void { - $controller = app()->make(ControlPanelController::class); - $response = app()->dispatch($controller, 'controlPanelManager'); + $controller = new ControlPanelController(); + $response = $controller->controlPanelManager(); $this->assertInstanceOf(Response::class, $response); } diff --git a/tests/app/Http/Controllers/Admin/UpgradeControllerTest.php b/tests/app/Http/Controllers/Admin/UpgradeControllerTest.php index f439912af9..6c555549ee 100644 --- a/tests/app/Http/Controllers/Admin/UpgradeControllerTest.php +++ b/tests/app/Http/Controllers/Admin/UpgradeControllerTest.php @@ -19,6 +19,9 @@ namespace Fisharebest\Webtrees\Http\Controllers\Admin; use Fisharebest\Webtrees\Services\TimeoutService; use Fisharebest\Webtrees\Services\UpgradeService; +use Illuminate\Support\Collection; +use League\Flysystem\Filesystem; +use League\Flysystem\Memory\MemoryAdapter; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -36,14 +39,13 @@ class UpgradeControllerTest extends \Fisharebest\Webtrees\TestCase */ public function testWizard(): void { - $mock_timeout_service = $this->createMock(TimeoutService::class); - app()->instance(TimeoutService::class, $mock_timeout_service); + $controller = new UpgradeController( + new Filesystem(new MemoryAdapter()), + new TimeoutService(microtime(true)), + new UpgradeService(new TimeoutService(microtime(true))) + ); - $mock_upgrade_service = $this->createMock(UpgradeService::class); - app()->instance(UpgradeService::class, $mock_upgrade_service); - - $controller = app()->make(UpgradeController::class); - $response = app()->dispatch($controller, 'wizard'); + $response = $controller->wizard(new Request()); $this->assertInstanceOf(Response::class, $response); } @@ -53,15 +55,13 @@ class UpgradeControllerTest extends \Fisharebest\Webtrees\TestCase */ public function testStepCheck(): void { - $mock_timeout_service = $this->createMock(TimeoutService::class); - app()->instance(TimeoutService::class, $mock_timeout_service); - - $mock_upgrade_service = $this->createMock(UpgradeService::class); - app()->instance(UpgradeService::class, $mock_upgrade_service); + $controller = new UpgradeController( + new Filesystem(new MemoryAdapter()), + new TimeoutService(microtime(true)), + new UpgradeService(new TimeoutService(microtime(true))) + ); - app()->instance(Request::class, new Request(['step' => 'Check'])); - $controller = app()->make(UpgradeController::class); - $response = app()->dispatch($controller, 'step'); + $response = $controller->step(new Request(['step' => 'Check']), null); $this->assertInstanceOf(Response::class, $response); } @@ -71,15 +71,13 @@ class UpgradeControllerTest extends \Fisharebest\Webtrees\TestCase */ public function testStepPending(): void { - $mock_timeout_service = $this->createMock(TimeoutService::class); - app()->instance(TimeoutService::class, $mock_timeout_service); + $controller = new UpgradeController( + new Filesystem(new MemoryAdapter()), + new TimeoutService(microtime(true)), + new UpgradeService(new TimeoutService(microtime(true))) + ); - $mock_upgrade_service = $this->createMock(UpgradeService::class); - app()->instance(UpgradeService::class, $mock_upgrade_service); - - app()->instance(Request::class, new Request(['step' => 'Pending'])); - $controller = app()->make(UpgradeController::class); - $response = app()->dispatch($controller, 'step'); + $response = $controller->step(new Request(['step' => 'Pending']), null); $this->assertInstanceOf(Response::class, $response); } @@ -89,15 +87,14 @@ class UpgradeControllerTest extends \Fisharebest\Webtrees\TestCase */ public function testStepExport(): void { - $mock_timeout_service = $this->createMock(TimeoutService::class); - app()->instance(TimeoutService::class, $mock_timeout_service); + $tree = $this->importTree('demo.ged'); + $controller = new UpgradeController( + new Filesystem(new MemoryAdapter()), + new TimeoutService(microtime(true)), + new UpgradeService(new TimeoutService(microtime(true))) + ); - $mock_upgrade_service = $this->createMock(UpgradeService::class); - app()->instance(UpgradeService::class, $mock_upgrade_service); - - app()->instance(Request::class, new Request(['step' => 'Export'])); - $controller = app()->make(UpgradeController::class); - $response = app()->dispatch($controller, 'step'); + $response = $controller->step(new Request(['step' => 'Export']), $tree); $this->assertInstanceOf(Response::class, $response); } @@ -107,15 +104,15 @@ class UpgradeControllerTest extends \Fisharebest\Webtrees\TestCase */ public function testStepDownload(): void { - $mock_timeout_service = $this->createMock(TimeoutService::class); - app()->instance(TimeoutService::class, $mock_timeout_service); - $mock_upgrade_service = $this->createMock(UpgradeService::class); - app()->instance(UpgradeService::class, $mock_upgrade_service); + $mock_upgrade_service->method('downloadFile')->willReturn(123456); + $controller = new UpgradeController( + new Filesystem(new MemoryAdapter()), + new TimeoutService(microtime(true)), + $mock_upgrade_service + ); - app()->instance(Request::class, new Request(['step' => 'Download'])); - $controller = app()->make(UpgradeController::class); - $response = app()->dispatch($controller, 'step'); + $response = $controller->step(new Request(['step' => 'Download']), null); $this->assertInstanceOf(Response::class, $response); } @@ -125,15 +122,16 @@ class UpgradeControllerTest extends \Fisharebest\Webtrees\TestCase */ public function testStepUnzip(): void { - $mock_timeout_service = $this->createMock(TimeoutService::class); - app()->instance(TimeoutService::class, $mock_timeout_service); - $mock_upgrade_service = $this->createMock(UpgradeService::class); - app()->instance(UpgradeService::class, $mock_upgrade_service); + $mock_upgrade_service->method('webtreesZipContents')->willReturn(new Collection([])); - app()->instance(Request::class, new Request(['step' => 'Unzip'])); - $controller = app()->make(UpgradeController::class); - $response = app()->dispatch($controller, 'step'); + $controller = new UpgradeController( + new Filesystem(new MemoryAdapter()), + new TimeoutService(microtime(true)), + $mock_upgrade_service + ); + + $response = $controller->step(new Request(['step' => 'Unzip']), null); $this->assertInstanceOf(Response::class, $response); } @@ -143,15 +141,13 @@ class UpgradeControllerTest extends \Fisharebest\Webtrees\TestCase */ public function testStepCopy(): void { - $mock_timeout_service = $this->createMock(TimeoutService::class); - app()->instance(TimeoutService::class, $mock_timeout_service); - - $mock_upgrade_service = $this->createMock(UpgradeService::class); - app()->instance(UpgradeService::class, $mock_upgrade_service); + $controller = new UpgradeController( + new Filesystem(new MemoryAdapter()), + new TimeoutService(microtime(true)), + new UpgradeService(new TimeoutService(microtime(true))) + ); - app()->instance(Request::class, new Request(['step' => 'Copy'])); - $controller = app()->make(UpgradeController::class); - $response = app()->dispatch($controller, 'step'); + $response = $controller->step(new Request(['step' => 'Copy']), null); $this->assertInstanceOf(Response::class, $response); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index fb5ea487ca..54235b4537 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1302,17 +1302,17 @@ }, { "name": "league/flysystem", - "version": "1.0.49", - "version_normalized": "1.0.49.0", + "version": "1.0.50", + "version_normalized": "1.0.50.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "a63cc83d8a931b271be45148fa39ba7156782ffd" + "reference": "dab4e7624efa543a943be978008f439c333f2249" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a63cc83d8a931b271be45148fa39ba7156782ffd", - "reference": "a63cc83d8a931b271be45148fa39ba7156782ffd", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/dab4e7624efa543a943be978008f439c333f2249", + "reference": "dab4e7624efa543a943be978008f439c333f2249", "shasum": "" }, "require": { @@ -1342,7 +1342,7 @@ "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" }, - "time": "2018-11-23T23:41:29+00:00", + "time": "2019-02-01T08:50:36+00:00", "type": "library", "extra": { "branch-alias": { @@ -2093,17 +2093,17 @@ }, { "name": "symfony/cache", - "version": "v4.2.2", - "version_normalized": "4.2.2.0", + "version": "v4.2.3", + "version_normalized": "4.2.3.0", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "dd223d4bb9a2f9a4b4992851800b349739c40860" + "reference": "7c5b85bcc5f87dd7938123be12ce3323be6cde5a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/dd223d4bb9a2f9a4b4992851800b349739c40860", - "reference": "dd223d4bb9a2f9a4b4992851800b349739c40860", + "url": "https://api.github.com/repos/symfony/cache/zipball/7c5b85bcc5f87dd7938123be12ce3323be6cde5a", + "reference": "7c5b85bcc5f87dd7938123be12ce3323be6cde5a", "shasum": "" }, "require": { @@ -2133,7 +2133,7 @@ "symfony/dependency-injection": "~3.4|~4.1", "symfony/var-dumper": "^4.1.1" }, - "time": "2019-01-03T09:07:35+00:00", + "time": "2019-01-31T15:08:08+00:00", "type": "library", "extra": { "branch-alias": { @@ -2242,17 +2242,17 @@ }, { "name": "symfony/debug", - "version": "v4.2.2", - "version_normalized": "4.2.2.0", + "version": "v4.2.3", + "version_normalized": "4.2.3.0", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "64cb33c81e37d19b7715d4a6a4d49c1c382066dd" + "reference": "cf9b2e33f757deb884ce474e06d2647c1c769b65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/64cb33c81e37d19b7715d4a6a4d49c1c382066dd", - "reference": "64cb33c81e37d19b7715d4a6a4d49c1c382066dd", + "url": "https://api.github.com/repos/symfony/debug/zipball/cf9b2e33f757deb884ce474e06d2647c1c769b65", + "reference": "cf9b2e33f757deb884ce474e06d2647c1c769b65", "shasum": "" }, "require": { @@ -2265,7 +2265,7 @@ "require-dev": { "symfony/http-kernel": "~3.4|~4.0" }, - "time": "2019-01-03T09:07:35+00:00", + "time": "2019-01-25T14:35:16+00:00", "type": "library", "extra": { "branch-alias": { @@ -2300,17 +2300,17 @@ }, { "name": "symfony/event-dispatcher", - "version": "v4.2.2", - "version_normalized": "4.2.2.0", + "version": "v4.2.3", + "version_normalized": "4.2.3.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "887de6d34c86cf0cb6cbf910afb170cdb743cb5e" + "reference": "bd09ad265cd50b2b9d09d65ce6aba2d29bc81fe1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/887de6d34c86cf0cb6cbf910afb170cdb743cb5e", - "reference": "887de6d34c86cf0cb6cbf910afb170cdb743cb5e", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bd09ad265cd50b2b9d09d65ce6aba2d29bc81fe1", + "reference": "bd09ad265cd50b2b9d09d65ce6aba2d29bc81fe1", "shasum": "" }, "require": { @@ -2331,7 +2331,7 @@ "symfony/dependency-injection": "", "symfony/http-kernel": "" }, - "time": "2019-01-05T16:37:49+00:00", + "time": "2019-01-16T20:35:37+00:00", "type": "library", "extra": { "branch-alias": { @@ -2366,17 +2366,17 @@ }, { "name": "symfony/expression-language", - "version": "v4.2.2", - "version_normalized": "4.2.2.0", + "version": "v4.2.3", + "version_normalized": "4.2.3.0", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "78a427af5e08eba1b391ddfbcaebb6dc6ab715be" + "reference": "a69b153996a13ffdb05395e8724c7217a8448e9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/78a427af5e08eba1b391ddfbcaebb6dc6ab715be", - "reference": "78a427af5e08eba1b391ddfbcaebb6dc6ab715be", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/a69b153996a13ffdb05395e8724c7217a8448e9e", + "reference": "a69b153996a13ffdb05395e8724c7217a8448e9e", "shasum": "" }, "require": { @@ -2384,7 +2384,7 @@ "symfony/cache": "~3.4|~4.0", "symfony/contracts": "^1.0" }, - "time": "2019-01-03T09:07:35+00:00", + "time": "2019-01-16T20:31:39+00:00", "type": "library", "extra": { "branch-alias": { @@ -2419,17 +2419,17 @@ }, { "name": "symfony/http-foundation", - "version": "v4.2.2", - "version_normalized": "4.2.2.0", + "version": "v4.2.3", + "version_normalized": "4.2.3.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "a633d422a09242064ba24e44a6e1494c5126de86" + "reference": "8d2318b73e0a1bc75baa699d00ebe2ae8b595a39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a633d422a09242064ba24e44a6e1494c5126de86", - "reference": "a633d422a09242064ba24e44a6e1494c5126de86", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8d2318b73e0a1bc75baa699d00ebe2ae8b595a39", + "reference": "8d2318b73e0a1bc75baa699d00ebe2ae8b595a39", "shasum": "" }, "require": { @@ -2440,7 +2440,7 @@ "predis/predis": "~1.0", "symfony/expression-language": "~3.4|~4.0" }, - "time": "2019-01-05T16:37:49+00:00", + "time": "2019-01-29T09:49:29+00:00", "type": "library", "extra": { "branch-alias": { @@ -2475,17 +2475,17 @@ }, { "name": "symfony/http-kernel", - "version": "v4.2.2", - "version_normalized": "4.2.2.0", + "version": "v4.2.3", + "version_normalized": "4.2.3.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "83de6543328917c18d5498eeb6bb6d36f7aab31b" + "reference": "d56b1706abaa771eb6acd894c6787cb88f1dc97d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/83de6543328917c18d5498eeb6bb6d36f7aab31b", - "reference": "83de6543328917c18d5498eeb6bb6d36f7aab31b", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/d56b1706abaa771eb6acd894c6787cb88f1dc97d", + "reference": "d56b1706abaa771eb6acd894c6787cb88f1dc97d", "shasum": "" }, "require": { @@ -2531,7 +2531,7 @@ "symfony/dependency-injection": "", "symfony/var-dumper": "" }, - "time": "2019-01-06T16:19:23+00:00", + "time": "2019-02-03T12:47:33+00:00", "type": "library", "extra": { "branch-alias": { @@ -2801,17 +2801,17 @@ }, { "name": "symfony/translation", - "version": "v4.2.2", - "version_normalized": "4.2.2.0", + "version": "v4.2.3", + "version_normalized": "4.2.3.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0" + "reference": "23fd7aac70d99a17a8e6473a41fec8fab3331050" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/939fb792d73f2ce80e6ae9019d205fc480f1c9a0", - "reference": "939fb792d73f2ce80e6ae9019d205fc480f1c9a0", + "url": "https://api.github.com/repos/symfony/translation/zipball/23fd7aac70d99a17a8e6473a41fec8fab3331050", + "reference": "23fd7aac70d99a17a8e6473a41fec8fab3331050", "shasum": "" }, "require": { @@ -2841,7 +2841,7 @@ "symfony/config": "", "symfony/yaml": "" }, - "time": "2019-01-03T09:07:35+00:00", + "time": "2019-01-27T23:11:39+00:00", "type": "library", "extra": { "branch-alias": { @@ -2876,17 +2876,17 @@ }, { "name": "symfony/var-exporter", - "version": "v4.2.2", - "version_normalized": "4.2.2.0", + "version": "v4.2.3", + "version_normalized": "4.2.3.0", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "51bd782120fa2bfed89452f142d2a47c4b51101c" + "reference": "d8bf4424c232b55f4c1816037d3077a89258557e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/51bd782120fa2bfed89452f142d2a47c4b51101c", - "reference": "51bd782120fa2bfed89452f142d2a47c4b51101c", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/d8bf4424c232b55f4c1816037d3077a89258557e", + "reference": "d8bf4424c232b55f4c1816037d3077a89258557e", "shasum": "" }, "require": { @@ -2895,7 +2895,7 @@ "require-dev": { "symfony/var-dumper": "^4.1.1" }, - "time": "2019-01-03T09:09:06+00:00", + "time": "2019-01-16T20:35:37+00:00", "type": "library", "extra": { "branch-alias": { diff --git a/vendor/league/flysystem/LICENSE b/vendor/league/flysystem/LICENSE index 0d16ccc974..f2684c8417 100644 --- a/vendor/league/flysystem/LICENSE +++ b/vendor/league/flysystem/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2013-2018 Frank de Jonge +Copyright (c) 2013-2019 Frank de Jonge Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/league/flysystem/src/Adapter/Ftp.php b/vendor/league/flysystem/src/Adapter/Ftp.php index fd0660d2b4..a3ebaa75fd 100644 --- a/vendor/league/flysystem/src/Adapter/Ftp.php +++ b/vendor/league/flysystem/src/Adapter/Ftp.php @@ -380,13 +380,11 @@ class Ftp extends AbstractFtpAdapter */ public function getMetadata($path) { - $connection = $this->getConnection(); - if ($path === '') { return ['type' => 'dir', 'path' => '']; } - if (@ftp_chdir($connection, $path) === true) { + if (@ftp_chdir($this->getConnection(), $path) === true) { $this->setConnectionRoot(); return ['type' => 'dir', 'path' => $path]; diff --git a/vendor/league/flysystem/src/Adapter/Local.php b/vendor/league/flysystem/src/Adapter/Local.php index 1bdf51d81f..eea8cb6e70 100644 --- a/vendor/league/flysystem/src/Adapter/Local.php +++ b/vendor/league/flysystem/src/Adapter/Local.php @@ -106,6 +106,7 @@ class Local extends AbstractAdapter } umask($umask); + clearstatcache(false, $root); if ( ! is_dir($root)) { $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : ''; diff --git a/vendor/league/flysystem/src/Filesystem.php b/vendor/league/flysystem/src/Filesystem.php index 7e9881fb54..8b0f9bdadc 100644 --- a/vendor/league/flysystem/src/Filesystem.php +++ b/vendor/league/flysystem/src/Filesystem.php @@ -270,7 +270,8 @@ class Filesystem implements FilesystemInterface $directory = Util::normalizePath($directory); $contents = $this->getAdapter()->listContents($directory, $recursive); - return (new ContentListingFormatter($directory, $recursive))->formatListing($contents); + return (new ContentListingFormatter($directory, $recursive, $this->config->get('case_sensitive', true))) + ->formatListing($contents); } /** diff --git a/vendor/league/flysystem/src/Util/ContentListingFormatter.php b/vendor/league/flysystem/src/Util/ContentListingFormatter.php index 5a8c95a8d9..ae0d3b91d2 100644 --- a/vendor/league/flysystem/src/Util/ContentListingFormatter.php +++ b/vendor/league/flysystem/src/Util/ContentListingFormatter.php @@ -13,19 +13,26 @@ class ContentListingFormatter * @var string */ private $directory; + /** * @var bool */ private $recursive; /** + * @var bool + */ + private $caseSensitive; + + /** * @param string $directory * @param bool $recursive */ - public function __construct($directory, $recursive) + public function __construct($directory, $recursive, $caseSensitive = true) { - $this->directory = $directory; + $this->directory = rtrim($directory, '/'); $this->recursive = $recursive; + $this->caseSensitive = $caseSensitive; } /** @@ -37,14 +44,9 @@ class ContentListingFormatter */ public function formatListing(array $listing) { - $listing = array_values( - array_map( - [$this, 'addPathInfo'], - array_filter($listing, [$this, 'isEntryOutOfScope']) - ) - ); + $listing = array_filter(array_map([$this, 'addPathInfo'], $listing), [$this, 'isEntryOutOfScope']); - return $this->sortListing($listing); + return $this->sortListing(array_values($listing)); } private function addPathInfo(array $entry) @@ -85,7 +87,9 @@ class ContentListingFormatter return true; } - return strpos($entry['path'], $this->directory . '/') === 0; + return $this->caseSensitive + ? strpos($entry['path'], $this->directory . '/') === 0 + : stripos($entry['path'], $this->directory . '/') === 0; } /** @@ -97,7 +101,9 @@ class ContentListingFormatter */ private function isDirectChild(array $entry) { - return Util::dirname($entry['path']) === $this->directory; + return $this->caseSensitive + ? $entry['dirname'] === $this->directory + : strcasecmp($this->directory, $entry['dirname']) === 0; } /** diff --git a/vendor/symfony/cache/Adapter/AbstractAdapter.php b/vendor/symfony/cache/Adapter/AbstractAdapter.php index 571eb1468a..d93ae711bd 100644 --- a/vendor/symfony/cache/Adapter/AbstractAdapter.php +++ b/vendor/symfony/cache/Adapter/AbstractAdapter.php @@ -64,12 +64,12 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg null, CacheItem::class ); - $getId = \Closure::fromCallable(array($this, 'getId')); + $getId = \Closure::fromCallable([$this, 'getId']); $this->mergeByLifetime = \Closure::bind( function ($deferred, $namespace, &$expiredIds) use ($getId) { - $byLifetime = array(); + $byLifetime = []; $now = microtime(true); - $expiredIds = array(); + $expiredIds = []; foreach ($deferred as $key => $item) { $key = (string) $key; @@ -83,7 +83,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg unset($metadata[CacheItem::METADATA_TAGS]); } // For compactness, expiry and creation duration are packed in the key of an array, using magic numbers as separators - $byLifetime[$ttl][$getId($key)] = $metadata ? array("\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $item->value) : $item->value; + $byLifetime[$ttl][$getId($key)] = $metadata ? ["\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $item->value] : $item->value; } return $byLifetime; @@ -131,7 +131,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg return $apcu; } - public static function createConnection($dsn, array $options = array()) + public static function createConnection($dsn, array $options = []) { if (!\is_string($dsn)) { throw new InvalidArgumentException(sprintf('The %s() method expect argument #1 to be string, %s given.', __METHOD__, \gettype($dsn))); @@ -161,11 +161,11 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg $value = null; try { - foreach ($this->doFetch(array($id)) as $value) { + foreach ($this->doFetch([$id]) as $value) { $isHit = true; } } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to fetch key "{key}"', array('key' => $key, 'exception' => $e)); + CacheItem::log($this->logger, 'Failed to fetch key "{key}"', ['key' => $key, 'exception' => $e]); } return $f($key, $value, $isHit); @@ -174,12 +174,12 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg /** * {@inheritdoc} */ - public function getItems(array $keys = array()) + public function getItems(array $keys = []) { if ($this->deferred) { $this->commit(); } - $ids = array(); + $ids = []; foreach ($keys as $key) { $ids[] = $this->getId($key); @@ -187,8 +187,8 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg try { $items = $this->doFetch($ids); } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to fetch requested items', array('keys' => $keys, 'exception' => $e)); - $items = array(); + CacheItem::log($this->logger, 'Failed to fetch requested items', ['keys' => $keys, 'exception' => $e]); + $items = []; } $ids = array_combine($ids, $keys); @@ -229,7 +229,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg $ok = true; $byLifetime = $this->mergeByLifetime; $byLifetime = $byLifetime($this->deferred, $this->namespace, $expiredIds); - $retry = $this->deferred = array(); + $retry = $this->deferred = []; if ($expiredIds) { $this->doDelete($expiredIds); @@ -239,7 +239,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg $e = $this->doSave($values, $lifetime); } catch (\Exception $e) { } - if (true === $e || array() === $e) { + if (true === $e || [] === $e) { continue; } if (\is_array($e) || 1 === \count($values)) { @@ -247,7 +247,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg $ok = false; $v = $values[$id]; $type = \is_object($v) ? \get_class($v) : \gettype($v); - CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', array('key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null)); + CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null]); } } else { foreach ($values as $id => $v) { @@ -261,15 +261,15 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg foreach ($ids as $id) { try { $v = $byLifetime[$lifetime][$id]; - $e = $this->doSave(array($id => $v), $lifetime); + $e = $this->doSave([$id => $v], $lifetime); } catch (\Exception $e) { } - if (true === $e || array() === $e) { + if (true === $e || [] === $e) { continue; } $ok = false; $type = \is_object($v) ? \get_class($v) : \gettype($v); - CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', array('key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null)); + CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => substr($id, \strlen($this->namespace)), 'type' => $type, 'exception' => $e instanceof \Exception ? $e : null]); } } @@ -297,7 +297,7 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg yield $key => $f($key, $value, true); } } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to fetch requested items', array('keys' => array_values($keys), 'exception' => $e)); + CacheItem::log($this->logger, 'Failed to fetch requested items', ['keys' => array_values($keys), 'exception' => $e]); } foreach ($keys as $key) { diff --git a/vendor/symfony/cache/Adapter/AdapterInterface.php b/vendor/symfony/cache/Adapter/AdapterInterface.php index 41222c1ab5..85fe07684f 100644 --- a/vendor/symfony/cache/Adapter/AdapterInterface.php +++ b/vendor/symfony/cache/Adapter/AdapterInterface.php @@ -33,5 +33,5 @@ interface AdapterInterface extends CacheItemPoolInterface * * @return \Traversable|CacheItem[] */ - public function getItems(array $keys = array()); + public function getItems(array $keys = []); } diff --git a/vendor/symfony/cache/Adapter/ArrayAdapter.php b/vendor/symfony/cache/Adapter/ArrayAdapter.php index 97b6b7f780..bbb1f846e4 100644 --- a/vendor/symfony/cache/Adapter/ArrayAdapter.php +++ b/vendor/symfony/cache/Adapter/ArrayAdapter.php @@ -83,7 +83,7 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter /** * {@inheritdoc} */ - public function getItems(array $keys = array()) + public function getItems(array $keys = []) { foreach ($keys as $key) { if (!\is_string($key) || !isset($this->expiries[$key])) { diff --git a/vendor/symfony/cache/Adapter/ChainAdapter.php b/vendor/symfony/cache/Adapter/ChainAdapter.php index 0417a22cd1..80aa7c6d1b 100644 --- a/vendor/symfony/cache/Adapter/ChainAdapter.php +++ b/vendor/symfony/cache/Adapter/ChainAdapter.php @@ -33,7 +33,7 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa { use ContractsTrait; - private $adapters = array(); + private $adapters = []; private $adapterCount; private $syncItem; @@ -118,7 +118,7 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa public function getItem($key) { $syncItem = $this->syncItem; - $misses = array(); + $misses = []; foreach ($this->adapters as $i => $adapter) { $item = $adapter->getItem($key); @@ -140,15 +140,15 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} */ - public function getItems(array $keys = array()) + public function getItems(array $keys = []) { return $this->generateItems($this->adapters[0]->getItems($keys), 0); } private function generateItems($items, $adapterIndex) { - $missing = array(); - $misses = array(); + $missing = []; + $misses = []; $nextAdapterIndex = $adapterIndex + 1; $nextAdapter = isset($this->adapters[$nextAdapterIndex]) ? $this->adapters[$nextAdapterIndex] : null; diff --git a/vendor/symfony/cache/Adapter/NullAdapter.php b/vendor/symfony/cache/Adapter/NullAdapter.php index 3c88a6902a..f1bdd2bf71 100644 --- a/vendor/symfony/cache/Adapter/NullAdapter.php +++ b/vendor/symfony/cache/Adapter/NullAdapter.php @@ -42,7 +42,7 @@ class NullAdapter implements AdapterInterface, CacheInterface */ public function get(string $key, callable $callback, float $beta = null, array &$metadata = null) { - return $callback(($this->createCacheItem)()); + return $callback(($this->createCacheItem)($key)); } /** @@ -58,7 +58,7 @@ class NullAdapter implements AdapterInterface, CacheInterface /** * {@inheritdoc} */ - public function getItems(array $keys = array()) + public function getItems(array $keys = []) { return $this->generateItems($keys); } diff --git a/vendor/symfony/cache/Adapter/PdoAdapter.php b/vendor/symfony/cache/Adapter/PdoAdapter.php index eb35fb38a9..d118736aec 100644 --- a/vendor/symfony/cache/Adapter/PdoAdapter.php +++ b/vendor/symfony/cache/Adapter/PdoAdapter.php @@ -39,7 +39,7 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface * * db_time_col: The column where to store the timestamp [default: item_time] * * db_username: The username when lazy-connect [default: ''] * * db_password: The password when lazy-connect [default: ''] - * * db_connection_options: An array of driver-specific connection options [default: array()] + * * db_connection_options: An array of driver-specific connection options [default: []] * * @param \PDO|Connection|string $connOrDsn a \PDO or Connection instance or DSN string or null * @@ -47,7 +47,7 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface * @throws InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION * @throws InvalidArgumentException When namespace contains invalid characters */ - public function __construct($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = array(), MarshallerInterface $marshaller = null) + public function __construct($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], MarshallerInterface $marshaller = null) { $this->init($connOrDsn, $namespace, $defaultLifetime, $options, $marshaller); } diff --git a/vendor/symfony/cache/Adapter/PhpArrayAdapter.php b/vendor/symfony/cache/Adapter/PhpArrayAdapter.php index a145a361d1..129a9e7df4 100644 --- a/vendor/symfony/cache/Adapter/PhpArrayAdapter.php +++ b/vendor/symfony/cache/Adapter/PhpArrayAdapter.php @@ -149,7 +149,7 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte /** * {@inheritdoc} */ - public function getItems(array $keys = array()) + public function getItems(array $keys = []) { foreach ($keys as $key) { if (!\is_string($key)) { @@ -199,7 +199,7 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte public function deleteItems(array $keys) { $deleted = true; - $fallbackKeys = array(); + $fallbackKeys = []; foreach ($keys as $key) { if (!\is_string($key)) { @@ -258,7 +258,7 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte private function generateItems(array $keys): \Generator { $f = $this->createCacheItem; - $fallbackKeys = array(); + $fallbackKeys = []; foreach ($keys as $key) { if (isset($this->keys[$key])) { @@ -294,10 +294,10 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte { $e = new \ReflectionException("Class $class does not exist"); $trace = $e->getTrace(); - $autoloadFrame = array( + $autoloadFrame = [ 'function' => 'spl_autoload_call', - 'args' => array($class), - ); + 'args' => [$class], + ]; $i = 1 + array_search($autoloadFrame, $trace, true); if (isset($trace[$i]['function']) && !isset($trace[$i]['class'])) { diff --git a/vendor/symfony/cache/Adapter/ProxyAdapter.php b/vendor/symfony/cache/Adapter/ProxyAdapter.php index d6b888788d..f7536b1ee2 100644 --- a/vendor/symfony/cache/Adapter/ProxyAdapter.php +++ b/vendor/symfony/cache/Adapter/ProxyAdapter.php @@ -78,7 +78,7 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa } if ($metadata) { // For compactness, expiry and creation duration are packed in the key of an array, using magic numbers as separators - $item["\0*\0value"] = array("\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $item["\0*\0value"]); + $item["\0*\0value"] = ["\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - CacheItem::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $item["\0*\0value"]]; } $innerItem->set($item["\0*\0value"]); $innerItem->expiresAt(null !== $item["\0*\0expiry"] ? \DateTime::createFromFormat('U.u', sprintf('%.6f', $item["\0*\0expiry"])) : null); @@ -120,7 +120,7 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} */ - public function getItems(array $keys = array()) + public function getItems(array $keys = []) { if ($this->namespaceLen) { foreach ($keys as $i => $key) { diff --git a/vendor/symfony/cache/Adapter/TagAwareAdapter.php b/vendor/symfony/cache/Adapter/TagAwareAdapter.php index 4144ffea74..e54044b60a 100644 --- a/vendor/symfony/cache/Adapter/TagAwareAdapter.php +++ b/vendor/symfony/cache/Adapter/TagAwareAdapter.php @@ -30,13 +30,13 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac use ProxyTrait; use ContractsTrait; - private $deferred = array(); + private $deferred = []; private $createCacheItem; private $setCacheItemTags; private $getTagsByKey; private $invalidateTags; private $tags; - private $knownTagVersions = array(); + private $knownTagVersions = []; private $knownTagVersionsTtl; public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsPool = null, float $knownTagVersionsTtl = 0.15) @@ -82,9 +82,9 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac ); $this->getTagsByKey = \Closure::bind( function ($deferred) { - $tagsByKey = array(); + $tagsByKey = []; foreach ($deferred as $key => $item) { - $tagsByKey[$key] = $item->newMetadata[CacheItem::METADATA_TAGS] ?? array(); + $tagsByKey[$key] = $item->newMetadata[CacheItem::METADATA_TAGS] ?? []; } return $tagsByKey; @@ -113,8 +113,8 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac public function invalidateTags(array $tags) { $ok = true; - $tagsByKey = array(); - $invalidatedTags = array(); + $tagsByKey = []; + $invalidatedTags = []; foreach ($tags as $tag) { CacheItem::validateKey($tag); $invalidatedTags[$tag] = 0; @@ -131,7 +131,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac $f = $this->getTagsByKey; $tagsByKey = $f($items); - $this->deferred = array(); + $this->deferred = []; } $tagVersions = $this->getTagVersions($tagsByKey, $invalidatedTags); @@ -165,7 +165,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac return true; } - foreach ($this->getTagVersions(array($itemTags)) as $tag => $version) { + foreach ($this->getTagVersions([$itemTags]) as $tag => $version) { if ($itemTags[$tag] !== $version && 1 !== $itemTags[$tag] - $version) { return false; } @@ -179,7 +179,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac */ public function getItem($key) { - foreach ($this->getItems(array($key)) as $item) { + foreach ($this->getItems([$key]) as $item) { return $item; } } @@ -187,12 +187,12 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac /** * {@inheritdoc} */ - public function getItems(array $keys = array()) + public function getItems(array $keys = []) { if ($this->deferred) { $this->commit(); } - $tagKeys = array(); + $tagKeys = []; foreach ($keys as $key) { if ('' !== $key && \is_string($key)) { @@ -217,7 +217,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac */ public function clear() { - $this->deferred = array(); + $this->deferred = []; return $this->pool->clear(); } @@ -227,7 +227,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac */ public function deleteItem($key) { - return $this->deleteItems(array($key)); + return $this->deleteItems([$key]); } /** @@ -275,7 +275,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac */ public function commit() { - return $this->invalidateTags(array()); + return $this->invalidateTags([]); } public function __destruct() @@ -285,7 +285,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac private function generateItems($items, array $tagKeys) { - $bufferedItems = $itemTags = array(); + $bufferedItems = $itemTags = []; $f = $this->setCacheItemTags; foreach ($items as $key => $item) { @@ -299,7 +299,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac } unset($tagKeys[$key]); - $itemTags[$key] = $item->get() ?: array(); + $itemTags[$key] = $item->get() ?: []; if (!$tagKeys) { $tagVersions = $this->getTagVersions($itemTags); @@ -322,7 +322,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac } } - private function getTagVersions(array $tagsByKey, array &$invalidatedTags = array()) + private function getTagVersions(array $tagsByKey, array &$invalidatedTags = []) { $tagVersions = $invalidatedTags; @@ -331,7 +331,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac } if (!$tagVersions) { - return array(); + return []; } if (!$fetchTagVersions = 1 !== \func_num_args()) { @@ -345,7 +345,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac } $now = microtime(true); - $tags = array(); + $tags = []; foreach ($tagVersions as $tag => $version) { $tags[$tag.static::TAGS_PREFIX] = $tag; if ($fetchTagVersions || !isset($this->knownTagVersions[$tag])) { @@ -370,7 +370,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac if (isset($invalidatedTags[$tag])) { $invalidatedTags[$tag] = $version->set(++$tagVersions[$tag]); } - $this->knownTagVersions[$tag] = array($now, $tagVersions[$tag]); + $this->knownTagVersions[$tag] = [$now, $tagVersions[$tag]]; } return $tagVersions; diff --git a/vendor/symfony/cache/Adapter/TraceableAdapter.php b/vendor/symfony/cache/Adapter/TraceableAdapter.php index e1d96bb4ef..5c294d03fd 100644 --- a/vendor/symfony/cache/Adapter/TraceableAdapter.php +++ b/vendor/symfony/cache/Adapter/TraceableAdapter.php @@ -28,7 +28,7 @@ use Symfony\Contracts\Service\ResetInterface; class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInterface, ResettableInterface { protected $pool; - private $calls = array(); + private $calls = []; public function __construct(AdapterInterface $pool) { @@ -142,7 +142,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt /** * {@inheritdoc} */ - public function getItems(array $keys = array()) + public function getItems(array $keys = []) { $event = $this->start(__FUNCTION__); try { @@ -151,7 +151,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt $event->end = microtime(true); } $f = function () use ($result, $event) { - $event->result = array(); + $event->result = []; foreach ($result as $key => $item) { if ($event->result[$key] = $item->isHit()) { ++$event->hits; @@ -257,7 +257,7 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt public function clearCalls() { - $this->calls = array(); + $this->calls = []; } protected function start($name) diff --git a/vendor/symfony/cache/CacheItem.php b/vendor/symfony/cache/CacheItem.php index e0500756a4..92eb9c39df 100644 --- a/vendor/symfony/cache/CacheItem.php +++ b/vendor/symfony/cache/CacheItem.php @@ -28,8 +28,8 @@ final class CacheItem implements ItemInterface protected $isHit = false; protected $expiry; protected $defaultLifetime; - protected $metadata = array(); - protected $newMetadata = array(); + protected $metadata = []; + protected $newMetadata = []; protected $innerItem; protected $poolHash; protected $isTaggable = false; @@ -111,7 +111,7 @@ final class CacheItem implements ItemInterface throw new LogicException(sprintf('Cache item "%s" comes from a non tag-aware pool: you cannot tag it.', $this->key)); } if (!\is_iterable($tags)) { - $tags = array($tags); + $tags = [$tags]; } foreach ($tags as $tag) { if (!\is_string($tag)) { @@ -151,7 +151,7 @@ final class CacheItem implements ItemInterface { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the "getMetadata()" method instead.', __METHOD__), E_USER_DEPRECATED); - return $this->metadata[self::METADATA_TAGS] ?? array(); + return $this->metadata[self::METADATA_TAGS] ?? []; } /** @@ -183,12 +183,12 @@ final class CacheItem implements ItemInterface * * @internal */ - public static function log(LoggerInterface $logger = null, $message, $context = array()) + public static function log(LoggerInterface $logger = null, $message, $context = []) { if ($logger) { $logger->warning($message, $context); } else { - $replace = array(); + $replace = []; foreach ($context as $k => $v) { if (is_scalar($v)) { $replace['{'.$k.'}'] = $v; diff --git a/vendor/symfony/cache/DataCollector/CacheDataCollector.php b/vendor/symfony/cache/DataCollector/CacheDataCollector.php index 5f29bfe5f2..0f708f0859 100644 --- a/vendor/symfony/cache/DataCollector/CacheDataCollector.php +++ b/vendor/symfony/cache/DataCollector/CacheDataCollector.php @@ -27,7 +27,7 @@ class CacheDataCollector extends DataCollector implements LateDataCollectorInter /** * @var TraceableAdapter[] */ - private $instances = array(); + private $instances = []; /** * @param string $name @@ -43,8 +43,8 @@ class CacheDataCollector extends DataCollector implements LateDataCollectorInter */ public function collect(Request $request, Response $response, \Exception $exception = null) { - $empty = array('calls' => array(), 'config' => array(), 'options' => array(), 'statistics' => array()); - $this->data = array('instances' => $empty, 'total' => $empty); + $empty = ['calls' => [], 'config' => [], 'options' => [], 'statistics' => []]; + $this->data = ['instances' => $empty, 'total' => $empty]; foreach ($this->instances as $name => $instance) { $this->data['instances']['calls'][$name] = $instance->getCalls(); } @@ -55,7 +55,7 @@ class CacheDataCollector extends DataCollector implements LateDataCollectorInter public function reset() { - $this->data = array(); + $this->data = []; foreach ($this->instances as $instance) { $instance->clearCalls(); } @@ -106,9 +106,9 @@ class CacheDataCollector extends DataCollector implements LateDataCollectorInter private function calculateStatistics(): array { - $statistics = array(); + $statistics = []; foreach ($this->data['instances']['calls'] as $name => $calls) { - $statistics[$name] = array( + $statistics[$name] = [ 'calls' => 0, 'time' => 0, 'reads' => 0, @@ -116,7 +116,7 @@ class CacheDataCollector extends DataCollector implements LateDataCollectorInter 'deletes' => 0, 'hits' => 0, 'misses' => 0, - ); + ]; /** @var TraceableAdapterEvent $call */ foreach ($calls as $call) { ++$statistics[$name]['calls']; @@ -166,7 +166,7 @@ class CacheDataCollector extends DataCollector implements LateDataCollectorInter private function calculateTotalStatistics(): array { $statistics = $this->getStatistics(); - $totals = array( + $totals = [ 'calls' => 0, 'time' => 0, 'reads' => 0, @@ -174,7 +174,7 @@ class CacheDataCollector extends DataCollector implements LateDataCollectorInter 'deletes' => 0, 'hits' => 0, 'misses' => 0, - ); + ]; foreach ($statistics as $name => $values) { foreach ($totals as $key => $value) { $totals[$key] += $statistics[$name][$key]; diff --git a/vendor/symfony/cache/DependencyInjection/CacheCollectorPass.php b/vendor/symfony/cache/DependencyInjection/CacheCollectorPass.php index f93f97b88e..6193d34798 100644 --- a/vendor/symfony/cache/DependencyInjection/CacheCollectorPass.php +++ b/vendor/symfony/cache/DependencyInjection/CacheCollectorPass.php @@ -56,16 +56,16 @@ class CacheCollectorPass implements CompilerPassInterface $recorder = new Definition(is_subclass_of($definition->getClass(), TagAwareAdapterInterface::class) ? TraceableTagAwareAdapter::class : TraceableAdapter::class); $recorder->setTags($definition->getTags()); $recorder->setPublic($definition->isPublic()); - $recorder->setArguments(array(new Reference($innerId = $id.$this->cachePoolRecorderInnerSuffix))); + $recorder->setArguments([new Reference($innerId = $id.$this->cachePoolRecorderInnerSuffix)]); - $definition->setTags(array()); + $definition->setTags([]); $definition->setPublic(false); $container->setDefinition($innerId, $definition); $container->setDefinition($id, $recorder); // Tell the collector to add the new instance - $collectorDefinition->addMethodCall('addInstance', array($id, new Reference($id))); + $collectorDefinition->addMethodCall('addInstance', [$id, new Reference($id)]); $collectorDefinition->setPublic(false); } } diff --git a/vendor/symfony/cache/DependencyInjection/CachePoolClearerPass.php b/vendor/symfony/cache/DependencyInjection/CachePoolClearerPass.php index be315b636d..3ca89a36a5 100644 --- a/vendor/symfony/cache/DependencyInjection/CachePoolClearerPass.php +++ b/vendor/symfony/cache/DependencyInjection/CachePoolClearerPass.php @@ -36,7 +36,7 @@ class CachePoolClearerPass implements CompilerPassInterface foreach ($container->findTaggedServiceIds($this->cachePoolClearerTag) as $id => $attr) { $clearer = $container->getDefinition($id); - $pools = array(); + $pools = []; foreach ($clearer->getArgument(0) as $name => $ref) { if ($container->hasDefinition($ref)) { $pools[$name] = new Reference($ref); diff --git a/vendor/symfony/cache/DependencyInjection/CachePoolPass.php b/vendor/symfony/cache/DependencyInjection/CachePoolPass.php index 92e2017e6f..b1af39755e 100644 --- a/vendor/symfony/cache/DependencyInjection/CachePoolPass.php +++ b/vendor/symfony/cache/DependencyInjection/CachePoolPass.php @@ -54,15 +54,15 @@ class CachePoolPass implements CompilerPassInterface } $seed .= '.'.$container->getParameter('kernel.container_class'); - $pools = array(); - $clearers = array(); - $attributes = array( + $pools = []; + $clearers = []; + $attributes = [ 'provider', 'name', 'namespace', 'default_lifetime', 'reset', - ); + ]; foreach ($container->findTaggedServiceIds($this->cachePoolTag) as $id => $tags) { $adapter = $pool = $container->getDefinition($id); if ($pool->isAbstract()) { @@ -97,7 +97,7 @@ class CachePoolPass implements CompilerPassInterface // no-op } elseif ('reset' === $attr) { if ($tags[0][$attr]) { - $pool->addTag($this->kernelResetTag, array('method' => $tags[0][$attr])); + $pool->addTag($this->kernelResetTag, ['method' => $tags[0][$attr]]); } } elseif ('namespace' !== $attr || ArrayAdapter::class !== $adapter->getClass()) { $pool->replaceArgument($i++, $tags[0][$attr]); @@ -156,8 +156,8 @@ class CachePoolPass implements CompilerPassInterface if (!$container->hasDefinition($name = '.cache_connection.'.ContainerBuilder::hash($dsn))) { $definition = new Definition(AbstractAdapter::class); $definition->setPublic(false); - $definition->setFactory(array(AbstractAdapter::class, 'createConnection')); - $definition->setArguments(array($dsn, array('lazy' => true))); + $definition->setFactory([AbstractAdapter::class, 'createConnection']); + $definition->setArguments([$dsn, ['lazy' => true]]); $container->setDefinition($name, $definition); } } diff --git a/vendor/symfony/cache/DependencyInjection/CachePoolPrunerPass.php b/vendor/symfony/cache/DependencyInjection/CachePoolPrunerPass.php index 21266a871e..e5699623e5 100644 --- a/vendor/symfony/cache/DependencyInjection/CachePoolPrunerPass.php +++ b/vendor/symfony/cache/DependencyInjection/CachePoolPrunerPass.php @@ -41,7 +41,7 @@ class CachePoolPrunerPass implements CompilerPassInterface return; } - $services = array(); + $services = []; foreach ($container->findTaggedServiceIds($this->cachePoolTag) as $id => $tags) { $class = $container->getParameterBag()->resolveValue($container->getDefinition($id)->getClass()); diff --git a/vendor/symfony/cache/LockRegistry.php b/vendor/symfony/cache/LockRegistry.php index 0aadf33d61..e0318e900c 100644 --- a/vendor/symfony/cache/LockRegistry.php +++ b/vendor/symfony/cache/LockRegistry.php @@ -25,13 +25,13 @@ use Symfony\Contracts\Cache\ItemInterface; */ class LockRegistry { - private static $openedFiles = array(); - private static $lockedFiles = array(); + private static $openedFiles = []; + private static $lockedFiles = []; /** * The number of items in this list controls the max number of concurrent processes. */ - private static $files = array( + private static $files = [ __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'AbstractAdapter.php', __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'AdapterInterface.php', __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'ApcuAdapter.php', @@ -51,7 +51,7 @@ class LockRegistry __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'TagAwareAdapterInterface.php', __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'TraceableAdapter.php', __DIR__.\DIRECTORY_SEPARATOR.'Adapter'.\DIRECTORY_SEPARATOR.'TraceableTagAwareAdapter.php', - ); + ]; /** * Defines a set of existing files that will be used as keys to acquire locks. @@ -69,7 +69,7 @@ class LockRegistry fclose($file); } } - self::$openedFiles = self::$lockedFiles = array(); + self::$openedFiles = self::$lockedFiles = []; return $previousFiles; } diff --git a/vendor/symfony/cache/Marshaller/DefaultMarshaller.php b/vendor/symfony/cache/Marshaller/DefaultMarshaller.php index 16c02bb08f..9c1ef46015 100644 --- a/vendor/symfony/cache/Marshaller/DefaultMarshaller.php +++ b/vendor/symfony/cache/Marshaller/DefaultMarshaller.php @@ -37,7 +37,7 @@ class DefaultMarshaller implements MarshallerInterface */ public function marshall(array $values, ?array &$failed): array { - $serialized = $failed = array(); + $serialized = $failed = []; foreach ($values as $id => $value) { try { diff --git a/vendor/symfony/cache/Simple/AbstractCache.php b/vendor/symfony/cache/Simple/AbstractCache.php index 08456f588f..7a2a3cb36e 100644 --- a/vendor/symfony/cache/Simple/AbstractCache.php +++ b/vendor/symfony/cache/Simple/AbstractCache.php @@ -48,11 +48,11 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re $id = $this->getId($key); try { - foreach ($this->doFetch(array($id)) as $value) { + foreach ($this->doFetch([$id]) as $value) { return $value; } } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to fetch key "{key}"', array('key' => $key, 'exception' => $e)); + CacheItem::log($this->logger, 'Failed to fetch key "{key}"', ['key' => $key, 'exception' => $e]); } return $default; @@ -65,7 +65,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re { CacheItem::validateKey($key); - return $this->setMultiple(array($key => $value), $ttl); + return $this->setMultiple([$key => $value], $ttl); } /** @@ -78,7 +78,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re } elseif (!\is_array($keys)) { throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys))); } - $ids = array(); + $ids = []; foreach ($keys as $key) { $ids[] = $this->getId($key); @@ -86,8 +86,8 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re try { $values = $this->doFetch($ids); } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to fetch requested values', array('keys' => $keys, 'exception' => $e)); - $values = array(); + CacheItem::log($this->logger, 'Failed to fetch requested values', ['keys' => $keys, 'exception' => $e]); + $values = []; } $ids = array_combine($ids, $keys); @@ -102,7 +102,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re if (!\is_array($values) && !$values instanceof \Traversable) { throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); } - $valuesById = array(); + $valuesById = []; foreach ($values as $key => $value) { if (\is_int($key)) { @@ -118,14 +118,14 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re $e = $this->doSave($valuesById, $ttl); } catch (\Exception $e) { } - if (true === $e || array() === $e) { + if (true === $e || [] === $e) { return true; } - $keys = array(); + $keys = []; foreach (\is_array($e) ? $e : array_keys($valuesById) as $id) { $keys[] = substr($id, \strlen($this->namespace)); } - CacheItem::log($this->logger, 'Failed to save values', array('keys' => $keys, 'exception' => $e instanceof \Exception ? $e : null)); + CacheItem::log($this->logger, 'Failed to save values', ['keys' => $keys, 'exception' => $e instanceof \Exception ? $e : null]); return false; } @@ -171,7 +171,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re yield $key => $value; } } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to fetch requested values', array('keys' => array_values($keys), 'exception' => $e)); + CacheItem::log($this->logger, 'Failed to fetch requested values', ['keys' => array_values($keys), 'exception' => $e]); } foreach ($keys as $key) { diff --git a/vendor/symfony/cache/Simple/ArrayCache.php b/vendor/symfony/cache/Simple/ArrayCache.php index 6785943787..e36dacb829 100644 --- a/vendor/symfony/cache/Simple/ArrayCache.php +++ b/vendor/symfony/cache/Simple/ArrayCache.php @@ -104,7 +104,7 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte CacheItem::validateKey($key); } - return $this->setMultiple(array($key => $value), $ttl); + return $this->setMultiple([$key => $value], $ttl); } /** @@ -115,7 +115,7 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte if (!\is_array($values) && !$values instanceof \Traversable) { throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); } - $valuesArray = array(); + $valuesArray = []; foreach ($values as $key => $value) { if (!\is_int($key) && !(\is_string($key) && isset($this->expiries[$key]))) { diff --git a/vendor/symfony/cache/Simple/ChainCache.php b/vendor/symfony/cache/Simple/ChainCache.php index 922d0fff31..18e9462ba0 100644 --- a/vendor/symfony/cache/Simple/ChainCache.php +++ b/vendor/symfony/cache/Simple/ChainCache.php @@ -28,7 +28,7 @@ use Symfony\Contracts\Service\ResetInterface; class ChainCache implements CacheInterface, PruneableInterface, ResettableInterface { private $miss; - private $caches = array(); + private $caches = []; private $defaultLifetime; private $cacheCount; @@ -88,7 +88,7 @@ class ChainCache implements CacheInterface, PruneableInterface, ResettableInterf private function generateItems($values, $cacheIndex, $miss, $default) { - $missing = array(); + $missing = []; $nextCacheIndex = $cacheIndex + 1; $nextCache = isset($this->caches[$nextCacheIndex]) ? $this->caches[$nextCacheIndex] : null; @@ -202,7 +202,7 @@ class ChainCache implements CacheInterface, PruneableInterface, ResettableInterf if ($values instanceof \Traversable) { $valuesIterator = $values; $values = function () use ($valuesIterator, &$values) { - $generatedValues = array(); + $generatedValues = []; foreach ($valuesIterator as $key => $value) { yield $key => $value; diff --git a/vendor/symfony/cache/Simple/PdoCache.php b/vendor/symfony/cache/Simple/PdoCache.php index 076370c97e..521e9b8f2d 100644 --- a/vendor/symfony/cache/Simple/PdoCache.php +++ b/vendor/symfony/cache/Simple/PdoCache.php @@ -37,7 +37,7 @@ class PdoCache extends AbstractCache implements PruneableInterface * * db_time_col: The column where to store the timestamp [default: item_time] * * db_username: The username when lazy-connect [default: ''] * * db_password: The password when lazy-connect [default: ''] - * * db_connection_options: An array of driver-specific connection options [default: array()] + * * db_connection_options: An array of driver-specific connection options [default: []] * * @param \PDO|Connection|string $connOrDsn a \PDO or Connection instance or DSN string or null * @@ -45,7 +45,7 @@ class PdoCache extends AbstractCache implements PruneableInterface * @throws InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION * @throws InvalidArgumentException When namespace contains invalid characters */ - public function __construct($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = array(), MarshallerInterface $marshaller = null) + public function __construct($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], MarshallerInterface $marshaller = null) { $this->init($connOrDsn, $namespace, $defaultLifetime, $options, $marshaller); } diff --git a/vendor/symfony/cache/Simple/PhpArrayCache.php b/vendor/symfony/cache/Simple/PhpArrayCache.php index b913aee2b7..6ba8527885 100644 --- a/vendor/symfony/cache/Simple/PhpArrayCache.php +++ b/vendor/symfony/cache/Simple/PhpArrayCache.php @@ -147,7 +147,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt } $deleted = true; - $fallbackKeys = array(); + $fallbackKeys = []; foreach ($keys as $key) { if (!\is_string($key)) { @@ -196,7 +196,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt } $saved = true; - $fallbackValues = array(); + $fallbackValues = []; foreach ($values as $key => $value) { if (!\is_string($key) && !\is_int($key)) { @@ -219,7 +219,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt private function generateItems(array $keys, $default) { - $fallbackKeys = array(); + $fallbackKeys = []; foreach ($keys as $key) { if (isset($this->keys[$key])) { diff --git a/vendor/symfony/cache/Simple/Psr6Cache.php b/vendor/symfony/cache/Simple/Psr6Cache.php index 6330a4fadc..fceb9ba70f 100644 --- a/vendor/symfony/cache/Simple/Psr6Cache.php +++ b/vendor/symfony/cache/Simple/Psr6Cache.php @@ -147,14 +147,14 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa } catch (Psr6CacheException $e) { throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } - $values = array(); + $values = []; if (!$this->pool instanceof AdapterInterface) { foreach ($items as $key => $item) { $values[$key] = $item->isHit() ? $item->get() : $default; } - return $value; + return $values; } foreach ($items as $key => $item) { @@ -170,7 +170,7 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa unset($metadata[CacheItem::METADATA_TAGS]); if ($metadata) { - $values[$key] = array("\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - self::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $values[$key]); + $values[$key] = ["\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - self::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $values[$key]]; } } @@ -186,7 +186,7 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa if (!$valuesIsArray && !$values instanceof \Traversable) { throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values))); } - $items = array(); + $items = []; try { if (null !== $f = $this->createCacheItem) { @@ -195,7 +195,7 @@ class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterfa $items[$key] = $f($key, $value, true); } } elseif ($valuesIsArray) { - $items = array(); + $items = []; foreach ($values as $key => $value) { $items[] = (string) $key; } diff --git a/vendor/symfony/cache/Simple/TraceableCache.php b/vendor/symfony/cache/Simple/TraceableCache.php index d6ed40f443..2db335ac96 100644 --- a/vendor/symfony/cache/Simple/TraceableCache.php +++ b/vendor/symfony/cache/Simple/TraceableCache.php @@ -25,7 +25,7 @@ class TraceableCache implements CacheInterface, PruneableInterface, ResettableIn { private $pool; private $miss; - private $calls = array(); + private $calls = []; public function __construct(CacheInterface $pool) { @@ -100,7 +100,7 @@ class TraceableCache implements CacheInterface, PruneableInterface, ResettableIn public function setMultiple($values, $ttl = null) { $event = $this->start(__FUNCTION__); - $event->result['keys'] = array(); + $event->result['keys'] = []; if ($values instanceof \Traversable) { $values = function () use ($values, $event) { @@ -134,7 +134,7 @@ class TraceableCache implements CacheInterface, PruneableInterface, ResettableIn $event->end = microtime(true); } $f = function () use ($result, $event, $miss, $default) { - $event->result = array(); + $event->result = []; foreach ($result as $key => $value) { if ($event->result[$key] = $miss !== $value) { ++$event->hits; @@ -217,7 +217,7 @@ class TraceableCache implements CacheInterface, PruneableInterface, ResettableIn try { return $this->calls; } finally { - $this->calls = array(); + $this->calls = []; } } diff --git a/vendor/symfony/cache/Tests/Adapter/AbstractRedisAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/AbstractRedisAdapterTest.php index 147dfcd153..5fcec9a263 100644 --- a/vendor/symfony/cache/Tests/Adapter/AbstractRedisAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/AbstractRedisAdapterTest.php @@ -15,11 +15,11 @@ use Symfony\Component\Cache\Adapter\RedisAdapter; abstract class AbstractRedisAdapterTest extends AdapterTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testExpiration' => 'Testing expiration slows down the test suite', 'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite', 'testDefaultLifeTime' => 'Testing expiration slows down the test suite', - ); + ]; protected static $redis; diff --git a/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php b/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php index e473c7b084..8a7d147808 100644 --- a/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php +++ b/vendor/symfony/cache/Tests/Adapter/AdapterTestCase.php @@ -77,10 +77,10 @@ abstract class AdapterTestCase extends CachePoolTest $item = $cache->getItem('foo'); - $expected = array( + $expected = [ CacheItem::METADATA_EXPIRY => 9.5 + time(), CacheItem::METADATA_CTIME => 1000, - ); + ]; $this->assertEquals($expected, $item->getMetadata(), 'Item metadata should embed expiry and ctime.', .6); } @@ -139,11 +139,11 @@ abstract class AdapterTestCase extends CachePoolTest $item = $cache->getItem('foo'); $this->assertFalse($item->isHit()); - foreach ($cache->getItems(array('foo')) as $item) { + foreach ($cache->getItems(['foo']) as $item) { } $cache->save($item->set(new NotUnserializable())); - foreach ($cache->getItems(array('foo')) as $item) { + foreach ($cache->getItems(['foo']) as $item) { } $this->assertFalse($item->isHit()); } diff --git a/vendor/symfony/cache/Tests/Adapter/ApcuAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/ApcuAdapterTest.php index a17b42bce4..5cca73f561 100644 --- a/vendor/symfony/cache/Tests/Adapter/ApcuAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/ApcuAdapterTest.php @@ -16,11 +16,11 @@ use Symfony\Component\Cache\Adapter\ApcuAdapter; class ApcuAdapterTest extends AdapterTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testExpiration' => 'Testing expiration slows down the test suite', 'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite', 'testDefaultLifeTime' => 'Testing expiration slows down the test suite', - ); + ]; public function createCachePool($defaultLifetime = 0) { diff --git a/vendor/symfony/cache/Tests/Adapter/ArrayAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/ArrayAdapterTest.php index 7b65061cd1..5c72dc6e0b 100644 --- a/vendor/symfony/cache/Tests/Adapter/ArrayAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/ArrayAdapterTest.php @@ -18,11 +18,11 @@ use Symfony\Component\Cache\Adapter\ArrayAdapter; */ class ArrayAdapterTest extends AdapterTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testGetMetadata' => 'ArrayAdapter does not keep metadata.', 'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.', 'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayAdapter is not.', - ); + ]; public function createCachePool($defaultLifetime = 0) { diff --git a/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php index 09ba6e444c..61b039b57b 100644 --- a/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/ChainAdapterTest.php @@ -27,10 +27,10 @@ class ChainAdapterTest extends AdapterTestCase public function createCachePool($defaultLifetime = 0, $testMethod = null) { if ('testGetMetadata' === $testMethod) { - return new ChainAdapter(array(new FilesystemAdapter('', $defaultLifetime)), $defaultLifetime); + return new ChainAdapter([new FilesystemAdapter('', $defaultLifetime)], $defaultLifetime); } - return new ChainAdapter(array(new ArrayAdapter($defaultLifetime), new ExternalAdapter(), new FilesystemAdapter('', $defaultLifetime)), $defaultLifetime); + return new ChainAdapter([new ArrayAdapter($defaultLifetime), new ExternalAdapter(), new FilesystemAdapter('', $defaultLifetime)], $defaultLifetime); } /** @@ -39,7 +39,7 @@ class ChainAdapterTest extends AdapterTestCase */ public function testEmptyAdaptersException() { - new ChainAdapter(array()); + new ChainAdapter([]); } /** @@ -48,7 +48,7 @@ class ChainAdapterTest extends AdapterTestCase */ public function testInvalidAdapterException() { - new ChainAdapter(array(new \stdClass())); + new ChainAdapter([new \stdClass()]); } public function testPrune() @@ -57,18 +57,18 @@ class ChainAdapterTest extends AdapterTestCase $this->markTestSkipped($this->skippedTests[__FUNCTION__]); } - $cache = new ChainAdapter(array( + $cache = new ChainAdapter([ $this->getPruneableMock(), $this->getNonPruneableMock(), $this->getPruneableMock(), - )); + ]); $this->assertTrue($cache->prune()); - $cache = new ChainAdapter(array( + $cache = new ChainAdapter([ $this->getPruneableMock(), $this->getFailingPruneableMock(), $this->getPruneableMock(), - )); + ]); $this->assertFalse($cache->prune()); } diff --git a/vendor/symfony/cache/Tests/Adapter/DoctrineAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/DoctrineAdapterTest.php index 8d4dfe2858..8f520cb59a 100644 --- a/vendor/symfony/cache/Tests/Adapter/DoctrineAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/DoctrineAdapterTest.php @@ -19,11 +19,11 @@ use Symfony\Component\Cache\Tests\Fixtures\ArrayCache; */ class DoctrineAdapterTest extends AdapterTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayCache is not.', 'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayCache is not.', 'testNotUnserializable' => 'ArrayCache does not use serialize/unserialize', - ); + ]; public function createCachePool($defaultLifetime = 0) { diff --git a/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php index 7613afa7f9..fec985e6da 100644 --- a/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/MaxIdLengthAdapterTest.php @@ -19,15 +19,15 @@ class MaxIdLengthAdapterTest extends TestCase public function testLongKey() { $cache = $this->getMockBuilder(MaxIdLengthAdapter::class) - ->setConstructorArgs(array(str_repeat('-', 10))) - ->setMethods(array('doHave', 'doFetch', 'doDelete', 'doSave', 'doClear')) + ->setConstructorArgs([str_repeat('-', 10)]) + ->setMethods(['doHave', 'doFetch', 'doDelete', 'doSave', 'doClear']) ->getMock(); $cache->expects($this->exactly(2)) ->method('doHave') ->withConsecutive( - array($this->equalTo('----------:nWfzGiCgLczv3SSUzXL3kg:')), - array($this->equalTo('----------:---------------------------------------')) + [$this->equalTo('----------:nWfzGiCgLczv3SSUzXL3kg:')], + [$this->equalTo('----------:---------------------------------------')] ); $cache->hasItem(str_repeat('-', 40)); @@ -37,7 +37,7 @@ class MaxIdLengthAdapterTest extends TestCase public function testLongKeyVersioning() { $cache = $this->getMockBuilder(MaxIdLengthAdapter::class) - ->setConstructorArgs(array(str_repeat('-', 26))) + ->setConstructorArgs([str_repeat('-', 26)]) ->getMock(); $reflectionClass = new \ReflectionClass(AbstractAdapter::class); @@ -46,20 +46,20 @@ class MaxIdLengthAdapterTest extends TestCase $reflectionMethod->setAccessible(true); // No versioning enabled - $this->assertEquals('--------------------------:------------', $reflectionMethod->invokeArgs($cache, array(str_repeat('-', 12)))); - $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, array(str_repeat('-', 12))))); - $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, array(str_repeat('-', 23))))); - $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, array(str_repeat('-', 40))))); + $this->assertEquals('--------------------------:------------', $reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)])); + $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)]))); + $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 23)]))); + $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 40)]))); $reflectionProperty = $reflectionClass->getProperty('versioningIsEnabled'); $reflectionProperty->setAccessible(true); $reflectionProperty->setValue($cache, true); // Versioning enabled - $this->assertEquals('--------------------------:1/------------', $reflectionMethod->invokeArgs($cache, array(str_repeat('-', 12)))); - $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, array(str_repeat('-', 12))))); - $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, array(str_repeat('-', 23))))); - $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, array(str_repeat('-', 40))))); + $this->assertEquals('--------------------------:1/------------', $reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)])); + $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)]))); + $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 23)]))); + $this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 40)]))); } /** @@ -69,7 +69,7 @@ class MaxIdLengthAdapterTest extends TestCase public function testTooLongNamespace() { $cache = $this->getMockBuilder(MaxIdLengthAdapter::class) - ->setConstructorArgs(array(str_repeat('-', 40))) + ->setConstructorArgs([str_repeat('-', 40)]) ->getMock(); } } diff --git a/vendor/symfony/cache/Tests/Adapter/MemcachedAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/MemcachedAdapterTest.php index 4ebe4c8798..59f33f3aee 100644 --- a/vendor/symfony/cache/Tests/Adapter/MemcachedAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/MemcachedAdapterTest.php @@ -16,10 +16,10 @@ use Symfony\Component\Cache\Adapter\MemcachedAdapter; class MemcachedAdapterTest extends AdapterTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testHasItemReturnsFalseWhenDeferredItemIsExpired' => 'Testing expiration slows down the test suite', 'testDefaultLifeTime' => 'Testing expiration slows down the test suite', - ); + ]; protected static $client; @@ -28,7 +28,7 @@ class MemcachedAdapterTest extends AdapterTestCase if (!MemcachedAdapter::isSupported()) { self::markTestSkipped('Extension memcached >=2.2.0 required.'); } - self::$client = AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST'), array('binary_protocol' => false)); + self::$client = AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST'), ['binary_protocol' => false]); self::$client->get('foo'); $code = self::$client->getResultCode(); @@ -46,13 +46,13 @@ class MemcachedAdapterTest extends AdapterTestCase public function testOptions() { - $client = MemcachedAdapter::createConnection(array(), array( + $client = MemcachedAdapter::createConnection([], [ 'libketama_compatible' => false, 'distribution' => 'modula', 'compression' => true, 'serializer' => 'php', 'hash' => 'md5', - )); + ]); $this->assertSame(\Memcached::SERIALIZER_PHP, $client->getOption(\Memcached::OPT_SERIALIZER)); $this->assertSame(\Memcached::HASH_MD5, $client->getOption(\Memcached::OPT_HASH)); @@ -68,24 +68,24 @@ class MemcachedAdapterTest extends AdapterTestCase */ public function testBadOptions($name, $value) { - MemcachedAdapter::createConnection(array(), array($name => $value)); + MemcachedAdapter::createConnection([], [$name => $value]); } public function provideBadOptions() { - return array( - array('foo', 'bar'), - array('hash', 'zyx'), - array('serializer', 'zyx'), - array('distribution', 'zyx'), - ); + return [ + ['foo', 'bar'], + ['hash', 'zyx'], + ['serializer', 'zyx'], + ['distribution', 'zyx'], + ]; } public function testDefaultOptions() { $this->assertTrue(MemcachedAdapter::isSupported()); - $client = MemcachedAdapter::createConnection(array()); + $client = MemcachedAdapter::createConnection([]); $this->assertTrue($client->getOption(\Memcached::OPT_COMPRESSION)); $this->assertSame(1, $client->getOption(\Memcached::OPT_BINARY_PROTOCOL)); @@ -103,7 +103,7 @@ class MemcachedAdapterTest extends AdapterTestCase $this->markTestSkipped('Memcached::HAVE_JSON required'); } - new MemcachedAdapter(MemcachedAdapter::createConnection(array(), array('serializer' => 'json'))); + new MemcachedAdapter(MemcachedAdapter::createConnection([], ['serializer' => 'json'])); } /** @@ -112,54 +112,54 @@ class MemcachedAdapterTest extends AdapterTestCase public function testServersSetting($dsn, $host, $port) { $client1 = MemcachedAdapter::createConnection($dsn); - $client2 = MemcachedAdapter::createConnection(array($dsn)); - $client3 = MemcachedAdapter::createConnection(array(array($host, $port))); - $expect = array( + $client2 = MemcachedAdapter::createConnection([$dsn]); + $client3 = MemcachedAdapter::createConnection([[$host, $port]]); + $expect = [ 'host' => $host, 'port' => $port, - ); + ]; - $f = function ($s) { return array('host' => $s['host'], 'port' => $s['port']); }; - $this->assertSame(array($expect), array_map($f, $client1->getServerList())); - $this->assertSame(array($expect), array_map($f, $client2->getServerList())); - $this->assertSame(array($expect), array_map($f, $client3->getServerList())); + $f = function ($s) { return ['host' => $s['host'], 'port' => $s['port']]; }; + $this->assertSame([$expect], array_map($f, $client1->getServerList())); + $this->assertSame([$expect], array_map($f, $client2->getServerList())); + $this->assertSame([$expect], array_map($f, $client3->getServerList())); } public function provideServersSetting() { - yield array( + yield [ 'memcached://127.0.0.1/50', '127.0.0.1', 11211, - ); - yield array( + ]; + yield [ 'memcached://localhost:11222?weight=25', 'localhost', 11222, - ); + ]; if (filter_var(ini_get('memcached.use_sasl'), FILTER_VALIDATE_BOOLEAN)) { - yield array( + yield [ 'memcached://user:password@127.0.0.1?weight=50', '127.0.0.1', 11211, - ); + ]; } - yield array( + yield [ 'memcached:///var/run/memcached.sock?weight=25', '/var/run/memcached.sock', 0, - ); - yield array( + ]; + yield [ 'memcached:///var/local/run/memcached.socket?weight=25', '/var/local/run/memcached.socket', 0, - ); + ]; if (filter_var(ini_get('memcached.use_sasl'), FILTER_VALIDATE_BOOLEAN)) { - yield array( + yield [ 'memcached://user:password@/var/local/run/memcached.socket?weight=25', '/var/local/run/memcached.socket', 0, - ); + ]; } } @@ -181,16 +181,16 @@ class MemcachedAdapterTest extends AdapterTestCase self::markTestSkipped('Extension memcached required.'); } - yield array( + yield [ 'memcached://localhost:11222?retry_timeout=10', - array(\Memcached::OPT_RETRY_TIMEOUT => 8), - array(\Memcached::OPT_RETRY_TIMEOUT => 10), - ); - yield array( + [\Memcached::OPT_RETRY_TIMEOUT => 8], + [\Memcached::OPT_RETRY_TIMEOUT => 10], + ]; + yield [ 'memcached://localhost:11222?socket_recv_size=1&socket_send_size=2', - array(\Memcached::OPT_RETRY_TIMEOUT => 8), - array(\Memcached::OPT_SOCKET_RECV_SIZE => 1, \Memcached::OPT_SOCKET_SEND_SIZE => 2, \Memcached::OPT_RETRY_TIMEOUT => 8), - ); + [\Memcached::OPT_RETRY_TIMEOUT => 8], + [\Memcached::OPT_SOCKET_RECV_SIZE => 1, \Memcached::OPT_SOCKET_SEND_SIZE => 2, \Memcached::OPT_RETRY_TIMEOUT => 8], + ]; } public function testClear() @@ -203,40 +203,40 @@ class MemcachedAdapterTest extends AdapterTestCase $dsn = 'memcached:?host[localhost]&host[localhost:12345]&host[/some/memcached.sock:]=3'; $client = MemcachedAdapter::createConnection($dsn); - $expected = array( - 0 => array( + $expected = [ + 0 => [ 'host' => 'localhost', 'port' => 11211, 'type' => 'TCP', - ), - 1 => array( + ], + 1 => [ 'host' => 'localhost', 'port' => 12345, 'type' => 'TCP', - ), - 2 => array( + ], + 2 => [ 'host' => '/some/memcached.sock', 'port' => 0, 'type' => 'SOCKET', - ), - ); + ], + ]; $this->assertSame($expected, $client->getServerList()); $dsn = 'memcached://localhost?host[foo.bar]=3'; $client = MemcachedAdapter::createConnection($dsn); - $expected = array( - 0 => array( + $expected = [ + 0 => [ 'host' => 'localhost', 'port' => 11211, 'type' => 'TCP', - ), - 1 => array( + ], + 1 => [ 'host' => 'foo.bar', 'port' => 11211, 'type' => 'TCP', - ), - ); + ], + ]; $this->assertSame($expected, $client->getServerList()); } } diff --git a/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php index 73e5cad552..6c5710a7e4 100644 --- a/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/NullAdapterTest.php @@ -34,6 +34,19 @@ class NullAdapterTest extends TestCase $this->assertNull($item->get(), "Item's value must be null when isHit is false."); } + public function testGet() + { + $adapter = $this->createCachePool(); + + $fetched = []; + $item = $adapter->get('myKey', function ($item) use (&$fetched) { $fetched[] = $item; }); + $this->assertCount(1, $fetched); + $item = $fetched[0]; + $this->assertFalse($item->isHit()); + $this->assertNull($item->get(), "Item's value must be null when isHit is false."); + $this->assertSame('myKey', $item->getKey()); + } + public function testHasItem() { $this->assertFalse($this->createCachePool()->hasItem('key')); @@ -43,7 +56,7 @@ class NullAdapterTest extends TestCase { $adapter = $this->createCachePool(); - $keys = array('foo', 'bar', 'baz', 'biz'); + $keys = ['foo', 'bar', 'baz', 'biz']; /** @var CacheItemInterface[] $items */ $items = $adapter->getItems($keys); @@ -89,7 +102,7 @@ class NullAdapterTest extends TestCase public function testDeleteItems() { - $this->assertTrue($this->createCachePool()->deleteItems(array('key', 'foo', 'bar'))); + $this->assertTrue($this->createCachePool()->deleteItems(['key', 'foo', 'bar'])); } public function testSave() diff --git a/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php index eea89b7458..1c9fd5140c 100644 --- a/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PdoDbalAdapterTest.php @@ -32,7 +32,7 @@ class PdoDbalAdapterTest extends AdapterTestCase self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache'); - $pool = new PdoAdapter(DriverManager::getConnection(array('driver' => 'pdo_sqlite', 'path' => self::$dbFile))); + $pool = new PdoAdapter(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile])); } public static function tearDownAfterClass() @@ -42,6 +42,6 @@ class PdoDbalAdapterTest extends AdapterTestCase public function createCachePool($defaultLifetime = 0) { - return new PdoAdapter(DriverManager::getConnection(array('driver' => 'pdo_sqlite', 'path' => self::$dbFile)), '', $defaultLifetime); + return new PdoAdapter(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile]), '', $defaultLifetime); } } diff --git a/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php index 1a6898de58..cee80ac196 100644 --- a/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterTest.php @@ -21,7 +21,7 @@ use Symfony\Component\Cache\Adapter\PhpArrayAdapter; */ class PhpArrayAdapterTest extends AdapterTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testGet' => 'PhpArrayAdapter is read-only.', 'testBasicUsage' => 'PhpArrayAdapter is read-only.', 'testBasicUsageWithLongKey' => 'PhpArrayAdapter is read-only.', @@ -53,7 +53,7 @@ class PhpArrayAdapterTest extends AdapterTestCase 'testDefaultLifeTime' => 'PhpArrayAdapter does not allow configuring a default lifetime.', 'testPrune' => 'PhpArrayAdapter just proxies', - ); + ]; protected static $file; @@ -80,22 +80,22 @@ class PhpArrayAdapterTest extends AdapterTestCase public function testStore() { - $arrayWithRefs = array(); + $arrayWithRefs = []; $arrayWithRefs[0] = 123; $arrayWithRefs[1] = &$arrayWithRefs[0]; - $object = (object) array( + $object = (object) [ 'foo' => 'bar', 'foo2' => 'bar2', - ); + ]; - $expected = array( + $expected = [ 'null' => null, 'serializedString' => serialize($object), 'arrayWithRefs' => $arrayWithRefs, 'object' => $object, - 'arrayWithObject' => array('bar' => $object), - ); + 'arrayWithObject' => ['bar' => $object], + ]; $adapter = $this->createCachePool(); $adapter->warmUp($expected); @@ -107,29 +107,29 @@ class PhpArrayAdapterTest extends AdapterTestCase public function testStoredFile() { - $data = array( + $data = [ 'integer' => 42, 'float' => 42.42, 'boolean' => true, - 'array_simple' => array('foo', 'bar'), - 'array_associative' => array('foo' => 'bar', 'foo2' => 'bar2'), - ); - $expected = array( - array( + 'array_simple' => ['foo', 'bar'], + 'array_associative' => ['foo' => 'bar', 'foo2' => 'bar2'], + ]; + $expected = [ + [ 'integer' => 0, 'float' => 1, 'boolean' => 2, 'array_simple' => 3, 'array_associative' => 4, - ), - array( + ], + [ 0 => 42, 1 => 42.42, 2 => true, - 3 => array('foo', 'bar'), - 4 => array('foo' => 'bar', 'foo2' => 'bar2'), - ), - ); + 3 => ['foo', 'bar'], + 4 => ['foo' => 'bar', 'foo2' => 'bar2'], + ], + ]; $adapter = $this->createCachePool(); $adapter->warmUp($data); @@ -142,7 +142,7 @@ class PhpArrayAdapterTest extends AdapterTestCase class PhpArrayAdapterWrapper extends PhpArrayAdapter { - protected $data = array(); + protected $data = []; public function save(CacheItemInterface $item) { diff --git a/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php b/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php index 1a23198c2f..a7feced4ea 100644 --- a/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PhpArrayAdapterWithFallbackTest.php @@ -19,14 +19,14 @@ use Symfony\Component\Cache\Adapter\PhpArrayAdapter; */ class PhpArrayAdapterWithFallbackTest extends AdapterTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testGetItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testGetItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testHasItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testDeleteItemInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testDeleteItemsInvalidKeys' => 'PhpArrayAdapter does not throw exceptions on invalid key.', 'testPrune' => 'PhpArrayAdapter just proxies', - ); + ]; protected static $file; diff --git a/vendor/symfony/cache/Tests/Adapter/PhpFilesAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PhpFilesAdapterTest.php index 9fecd9724b..2d5ddf20b7 100644 --- a/vendor/symfony/cache/Tests/Adapter/PhpFilesAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PhpFilesAdapterTest.php @@ -19,9 +19,9 @@ use Symfony\Component\Cache\Adapter\PhpFilesAdapter; */ class PhpFilesAdapterTest extends AdapterTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testDefaultLifeTime' => 'PhpFilesAdapter does not allow configuring a default lifetime.', - ); + ]; public function createCachePool() { diff --git a/vendor/symfony/cache/Tests/Adapter/PredisAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PredisAdapterTest.php index c65515b54d..abe0a21094 100644 --- a/vendor/symfony/cache/Tests/Adapter/PredisAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PredisAdapterTest.php @@ -19,20 +19,20 @@ class PredisAdapterTest extends AbstractRedisAdapterTest public static function setupBeforeClass() { parent::setupBeforeClass(); - self::$redis = new \Predis\Client(array('host' => getenv('REDIS_HOST'))); + self::$redis = new \Predis\Client(['host' => getenv('REDIS_HOST')]); } public function testCreateConnection() { $redisHost = getenv('REDIS_HOST'); - $redis = RedisAdapter::createConnection('redis://'.$redisHost.'/1', array('class' => \Predis\Client::class, 'timeout' => 3)); + $redis = RedisAdapter::createConnection('redis://'.$redisHost.'/1', ['class' => \Predis\Client::class, 'timeout' => 3]); $this->assertInstanceOf(\Predis\Client::class, $redis); $connection = $redis->getConnection(); $this->assertInstanceOf(StreamConnection::class, $connection); - $params = array( + $params = [ 'scheme' => 'tcp', 'host' => 'localhost', 'port' => 6379, @@ -41,7 +41,7 @@ class PredisAdapterTest extends AbstractRedisAdapterTest 'read_write_timeout' => 0, 'tcp_nodelay' => true, 'database' => '1', - ); + ]; $this->assertSame($params, $connection->getParameters()->toArray()); } } diff --git a/vendor/symfony/cache/Tests/Adapter/PredisClusterAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PredisClusterAdapterTest.php index 38915397da..f723dc4468 100644 --- a/vendor/symfony/cache/Tests/Adapter/PredisClusterAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PredisClusterAdapterTest.php @@ -16,7 +16,7 @@ class PredisClusterAdapterTest extends AbstractRedisAdapterTest public static function setupBeforeClass() { parent::setupBeforeClass(); - self::$redis = new \Predis\Client(array(array('host' => getenv('REDIS_HOST')))); + self::$redis = new \Predis\Client([['host' => getenv('REDIS_HOST')]]); } public static function tearDownAfterClass() diff --git a/vendor/symfony/cache/Tests/Adapter/PredisRedisClusterAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/PredisRedisClusterAdapterTest.php index 9974e93635..c819c348d9 100644 --- a/vendor/symfony/cache/Tests/Adapter/PredisRedisClusterAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/PredisRedisClusterAdapterTest.php @@ -21,7 +21,7 @@ class PredisRedisClusterAdapterTest extends AbstractRedisAdapterTest self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.'); } - self::$redis = RedisAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).']', array('class' => \Predis\Client::class, 'redis_cluster' => true)); + self::$redis = RedisAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).']', ['class' => \Predis\Client::class, 'redis_cluster' => true]); } public static function tearDownAfterClass() diff --git a/vendor/symfony/cache/Tests/Adapter/ProxyAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/ProxyAdapterTest.php index fbbdac22a8..4e9970cd92 100644 --- a/vendor/symfony/cache/Tests/Adapter/ProxyAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/ProxyAdapterTest.php @@ -22,11 +22,11 @@ use Symfony\Component\Cache\CacheItem; */ class ProxyAdapterTest extends AdapterTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testDeferredSaveWithoutCommit' => 'Assumes a shared cache which ArrayAdapter is not.', 'testSaveWithoutExpire' => 'Assumes a shared cache which ArrayAdapter is not.', 'testPrune' => 'ProxyAdapter just proxies', - ); + ]; public function createCachePool($defaultLifetime = 0, $testMethod = null) { diff --git a/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php index 5208df67cb..c83abaf91b 100644 --- a/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/RedisAdapterTest.php @@ -20,7 +20,7 @@ class RedisAdapterTest extends AbstractRedisAdapterTest public static function setupBeforeClass() { parent::setupBeforeClass(); - self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'), array('lazy' => true)); + self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'), ['lazy' => true]); } public function createCachePool($defaultLifetime = 0) @@ -35,7 +35,7 @@ class RedisAdapterTest extends AbstractRedisAdapterTest { $redis = RedisAdapter::createConnection('redis:?host[h1]&host[h2]&host[/foo:]'); $this->assertInstanceOf(\RedisArray::class, $redis); - $this->assertSame(array('h1:6379', 'h2:6379', '/foo'), $redis->_hosts()); + $this->assertSame(['h1:6379', 'h2:6379', '/foo'], $redis->_hosts()); @$redis = null; // some versions of phpredis connect on destruct, let's silence the warning $redisHost = getenv('REDIS_HOST'); @@ -48,13 +48,13 @@ class RedisAdapterTest extends AbstractRedisAdapterTest $redis = RedisAdapter::createConnection('redis://'.$redisHost.'/2'); $this->assertSame(2, $redis->getDbNum()); - $redis = RedisAdapter::createConnection('redis://'.$redisHost, array('timeout' => 3)); + $redis = RedisAdapter::createConnection('redis://'.$redisHost, ['timeout' => 3]); $this->assertEquals(3, $redis->getTimeout()); $redis = RedisAdapter::createConnection('redis://'.$redisHost.'?timeout=4'); $this->assertEquals(4, $redis->getTimeout()); - $redis = RedisAdapter::createConnection('redis://'.$redisHost, array('read_timeout' => 5)); + $redis = RedisAdapter::createConnection('redis://'.$redisHost, ['read_timeout' => 5]); $this->assertEquals(5, $redis->getReadTimeout()); } @@ -70,11 +70,11 @@ class RedisAdapterTest extends AbstractRedisAdapterTest public function provideFailedCreateConnection() { - return array( - array('redis://localhost:1234'), - array('redis://foo@localhost'), - array('redis://localhost/123'), - ); + return [ + ['redis://localhost:1234'], + ['redis://foo@localhost'], + ['redis://localhost/123'], + ]; } /** @@ -89,9 +89,9 @@ class RedisAdapterTest extends AbstractRedisAdapterTest public function provideInvalidCreateConnection() { - return array( - array('foo://localhost'), - array('redis://'), - ); + return [ + ['foo://localhost'], + ['redis://'], + ]; } } diff --git a/vendor/symfony/cache/Tests/Adapter/RedisArrayAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/RedisArrayAdapterTest.php index bef3eb8872..749b039a03 100644 --- a/vendor/symfony/cache/Tests/Adapter/RedisArrayAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/RedisArrayAdapterTest.php @@ -19,6 +19,6 @@ class RedisArrayAdapterTest extends AbstractRedisAdapterTest if (!class_exists('RedisArray')) { self::markTestSkipped('The RedisArray class is required.'); } - self::$redis = new \RedisArray(array(getenv('REDIS_HOST')), array('lazy_connect' => true)); + self::$redis = new \RedisArray([getenv('REDIS_HOST')], ['lazy_connect' => true]); } } diff --git a/vendor/symfony/cache/Tests/Adapter/RedisClusterAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/RedisClusterAdapterTest.php index 344f1d0743..75dd2790cc 100644 --- a/vendor/symfony/cache/Tests/Adapter/RedisClusterAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/RedisClusterAdapterTest.php @@ -26,7 +26,7 @@ class RedisClusterAdapterTest extends AbstractRedisAdapterTest self::markTestSkipped('REDIS_CLUSTER_HOSTS env var is not defined.'); } - self::$redis = AbstractAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).']', array('lazy' => true, 'redis_cluster' => true)); + self::$redis = AbstractAdapter::createConnection('redis:?host['.str_replace(' ', ']&host[', $hosts).']', ['lazy' => true, 'redis_cluster' => true]); } public function createCachePool($defaultLifetime = 0) @@ -49,10 +49,10 @@ class RedisClusterAdapterTest extends AbstractRedisAdapterTest public function provideFailedCreateConnection() { - return array( - array('redis://localhost:1234?redis_cluster=1'), - array('redis://foo@localhost?redis_cluster=1'), - array('redis://localhost/123?redis_cluster=1'), - ); + return [ + ['redis://localhost:1234?redis_cluster=1'], + ['redis://foo@localhost?redis_cluster=1'], + ['redis://localhost/123?redis_cluster=1'], + ]; } } diff --git a/vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php index 089a4f33fa..3028af47c6 100644 --- a/vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/SimpleCacheAdapterTest.php @@ -20,9 +20,9 @@ use Symfony\Component\Cache\Simple\Psr6Cache; */ class SimpleCacheAdapterTest extends AdapterTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testPrune' => 'SimpleCache just proxies', - ); + ]; public function createCachePool($defaultLifetime = 0) { diff --git a/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php index ad37fbef7d..7b8895b700 100644 --- a/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/TagAwareAdapterTest.php @@ -57,7 +57,7 @@ class TagAwareAdapterTest extends AdapterTestCase $pool->save($i3->tag('foo')->tag('baz')); $pool->save($foo); - $pool->invalidateTags(array('bar')); + $pool->invalidateTags(['bar']); $this->assertFalse($pool->getItem('i0')->isHit()); $this->assertTrue($pool->getItem('i1')->isHit()); @@ -65,7 +65,7 @@ class TagAwareAdapterTest extends AdapterTestCase $this->assertTrue($pool->getItem('i3')->isHit()); $this->assertTrue($pool->getItem('foo')->isHit()); - $pool->invalidateTags(array('foo')); + $pool->invalidateTags(['foo']); $this->assertFalse($pool->getItem('i1')->isHit()); $this->assertFalse($pool->getItem('i3')->isHit()); @@ -86,7 +86,7 @@ class TagAwareAdapterTest extends AdapterTestCase $foo->tag('tag'); $pool1->saveDeferred($foo->set('foo')); - $pool1->invalidateTags(array('tag')); + $pool1->invalidateTags(['tag']); $pool2 = $this->createCachePool(); $foo = $pool2->getItem('foo'); @@ -104,7 +104,7 @@ class TagAwareAdapterTest extends AdapterTestCase $i = $pool->getItem('k'); $pool->save($i->tag('bar')); - $pool->invalidateTags(array('foo')); + $pool->invalidateTags(['foo']); $this->assertTrue($pool->getItem('k')->isHit()); } @@ -117,7 +117,7 @@ class TagAwareAdapterTest extends AdapterTestCase $pool->deleteItem('k'); $pool->save($pool->getItem('k')); - $pool->invalidateTags(array('foo')); + $pool->invalidateTags(['foo']); $this->assertTrue($pool->getItem('k')->isHit()); } @@ -127,11 +127,11 @@ class TagAwareAdapterTest extends AdapterTestCase $pool = $this->createCachePool(10); $item = $pool->getItem('foo'); - $item->tag(array('baz')); + $item->tag(['baz']); $item->expiresAfter(100); $pool->save($item); - $pool->invalidateTags(array('baz')); + $pool->invalidateTags(['baz']); $this->assertFalse($pool->getItem('foo')->isHit()); sleep(20); @@ -150,7 +150,7 @@ class TagAwareAdapterTest extends AdapterTestCase $pool->save($i->tag('foo')); $i = $pool->getItem('k'); - $this->assertSame(array('foo' => 'foo'), $i->getPreviousTags()); + $this->assertSame(['foo' => 'foo'], $i->getPreviousTags()); } public function testGetMetadata() @@ -161,7 +161,7 @@ class TagAwareAdapterTest extends AdapterTestCase $pool->save($i->tag('foo')); $i = $pool->getItem('k'); - $this->assertSame(array('foo' => 'foo'), $i->getMetadata()[CacheItem::METADATA_TAGS]); + $this->assertSame(['foo' => 'foo'], $i->getMetadata()[CacheItem::METADATA_TAGS]); } public function testPrune() diff --git a/vendor/symfony/cache/Tests/Adapter/TraceableAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/TraceableAdapterTest.php index 3755e88db5..35eba7d77b 100644 --- a/vendor/symfony/cache/Tests/Adapter/TraceableAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/TraceableAdapterTest.php @@ -19,9 +19,9 @@ use Symfony\Component\Cache\Adapter\TraceableAdapter; */ class TraceableAdapterTest extends AdapterTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testPrune' => 'TraceableAdapter just proxies', - ); + ]; public function createCachePool($defaultLifetime = 0) { @@ -37,7 +37,7 @@ class TraceableAdapterTest extends AdapterTestCase $call = $calls[0]; $this->assertSame('getItem', $call->name); - $this->assertSame(array('k' => false), $call->result); + $this->assertSame(['k' => false], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(1, $call->misses); $this->assertNotEmpty($call->start); @@ -61,7 +61,7 @@ class TraceableAdapterTest extends AdapterTestCase public function testGetItemsMissTrace() { $pool = $this->createCachePool(); - $arg = array('k0', 'k1'); + $arg = ['k0', 'k1']; $items = $pool->getItems($arg); foreach ($items as $item) { } @@ -70,7 +70,7 @@ class TraceableAdapterTest extends AdapterTestCase $call = $calls[0]; $this->assertSame('getItems', $call->name); - $this->assertSame(array('k0' => false, 'k1' => false), $call->result); + $this->assertSame(['k0' => false, 'k1' => false], $call->result); $this->assertSame(2, $call->misses); $this->assertNotEmpty($call->start); $this->assertNotEmpty($call->end); @@ -85,7 +85,7 @@ class TraceableAdapterTest extends AdapterTestCase $call = $calls[0]; $this->assertSame('hasItem', $call->name); - $this->assertSame(array('k' => false), $call->result); + $this->assertSame(['k' => false], $call->result); $this->assertNotEmpty($call->start); $this->assertNotEmpty($call->end); } @@ -101,7 +101,7 @@ class TraceableAdapterTest extends AdapterTestCase $call = $calls[2]; $this->assertSame('hasItem', $call->name); - $this->assertSame(array('k' => true), $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertNotEmpty($call->start); $this->assertNotEmpty($call->end); } @@ -115,7 +115,7 @@ class TraceableAdapterTest extends AdapterTestCase $call = $calls[0]; $this->assertSame('deleteItem', $call->name); - $this->assertSame(array('k' => true), $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); @@ -125,14 +125,14 @@ class TraceableAdapterTest extends AdapterTestCase public function testDeleteItemsTrace() { $pool = $this->createCachePool(); - $arg = array('k0', 'k1'); + $arg = ['k0', 'k1']; $pool->deleteItems($arg); $calls = $pool->getCalls(); $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('deleteItems', $call->name); - $this->assertSame(array('keys' => $arg, 'result' => true), $call->result); + $this->assertSame(['keys' => $arg, 'result' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); @@ -149,7 +149,7 @@ class TraceableAdapterTest extends AdapterTestCase $call = $calls[1]; $this->assertSame('save', $call->name); - $this->assertSame(array('k' => true), $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); @@ -166,7 +166,7 @@ class TraceableAdapterTest extends AdapterTestCase $call = $calls[1]; $this->assertSame('saveDeferred', $call->name); - $this->assertSame(array('k' => true), $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); diff --git a/vendor/symfony/cache/Tests/Adapter/TraceableTagAwareAdapterTest.php b/vendor/symfony/cache/Tests/Adapter/TraceableTagAwareAdapterTest.php index 9b50bfabe6..5cd4185cb0 100644 --- a/vendor/symfony/cache/Tests/Adapter/TraceableTagAwareAdapterTest.php +++ b/vendor/symfony/cache/Tests/Adapter/TraceableTagAwareAdapterTest.php @@ -23,7 +23,7 @@ class TraceableTagAwareAdapterTest extends TraceableAdapterTest public function testInvalidateTags() { $pool = new TraceableTagAwareAdapter(new TagAwareAdapter(new FilesystemAdapter())); - $pool->invalidateTags(array('foo')); + $pool->invalidateTags(['foo']); $calls = $pool->getCalls(); $this->assertCount(1, $calls); diff --git a/vendor/symfony/cache/Tests/CacheItemTest.php b/vendor/symfony/cache/Tests/CacheItemTest.php index 395c003bd3..0e3f4b9a73 100644 --- a/vendor/symfony/cache/Tests/CacheItemTest.php +++ b/vendor/symfony/cache/Tests/CacheItemTest.php @@ -33,23 +33,23 @@ class CacheItemTest extends TestCase public function provideInvalidKey() { - return array( - array(''), - array('{'), - array('}'), - array('('), - array(')'), - array('/'), - array('\\'), - array('@'), - array(':'), - array(true), - array(null), - array(1), - array(1.1), - array(array(array())), - array(new \Exception('foo')), - ); + return [ + [''], + ['{'], + ['}'], + ['('], + [')'], + ['/'], + ['\\'], + ['@'], + [':'], + [true], + [null], + [1], + [1.1], + [[[]]], + [new \Exception('foo')], + ]; } public function testTag() @@ -60,10 +60,10 @@ class CacheItemTest extends TestCase $r->setValue($item, true); $this->assertSame($item, $item->tag('foo')); - $this->assertSame($item, $item->tag(array('bar', 'baz'))); + $this->assertSame($item, $item->tag(['bar', 'baz'])); (\Closure::bind(function () use ($item) { - $this->assertSame(array('foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'), $item->newMetadata[CacheItem::METADATA_TAGS]); + $this->assertSame(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'], $item->newMetadata[CacheItem::METADATA_TAGS]); }, $this, CacheItem::class))(); } @@ -93,6 +93,6 @@ class CacheItemTest extends TestCase $r->setAccessible(true); $r->setValue($item, 'foo'); - $item->tag(array()); + $item->tag([]); } } diff --git a/vendor/symfony/cache/Tests/DependencyInjection/CacheCollectorPassTest.php b/vendor/symfony/cache/Tests/DependencyInjection/CacheCollectorPassTest.php index 421f5764de..7e77491de8 100644 --- a/vendor/symfony/cache/Tests/DependencyInjection/CacheCollectorPassTest.php +++ b/vendor/symfony/cache/Tests/DependencyInjection/CacheCollectorPassTest.php @@ -37,10 +37,10 @@ class CacheCollectorPassTest extends TestCase $collector = $container->register('data_collector.cache', CacheDataCollector::class); (new CacheCollectorPass())->process($container); - $this->assertEquals(array( - array('addInstance', array('fs', new Reference('fs'))), - array('addInstance', array('tagged_fs', new Reference('tagged_fs'))), - ), $collector->getMethodCalls()); + $this->assertEquals([ + ['addInstance', ['fs', new Reference('fs')]], + ['addInstance', ['tagged_fs', new Reference('tagged_fs')]], + ], $collector->getMethodCalls()); $this->assertSame(TraceableAdapter::class, $container->findDefinition('fs')->getClass()); $this->assertSame(TraceableTagAwareAdapter::class, $container->getDefinition('tagged_fs')->getClass()); diff --git a/vendor/symfony/cache/Tests/DependencyInjection/CachePoolClearerPassTest.php b/vendor/symfony/cache/Tests/DependencyInjection/CachePoolClearerPassTest.php index 6aa68c29cd..533aa14aff 100644 --- a/vendor/symfony/cache/Tests/DependencyInjection/CachePoolClearerPassTest.php +++ b/vendor/symfony/cache/Tests/DependencyInjection/CachePoolClearerPassTest.php @@ -34,18 +34,18 @@ class CachePoolClearerPassTest extends TestCase $publicPool = new Definition(); $publicPool->addArgument('namespace'); - $publicPool->addTag('cache.pool', array('clearer' => 'clearer_alias')); + $publicPool->addTag('cache.pool', ['clearer' => 'clearer_alias']); $container->setDefinition('public.pool', $publicPool); $publicPool = new Definition(); $publicPool->addArgument('namespace'); - $publicPool->addTag('cache.pool', array('clearer' => 'clearer_alias', 'name' => 'pool2')); + $publicPool->addTag('cache.pool', ['clearer' => 'clearer_alias', 'name' => 'pool2']); $container->setDefinition('public.pool2', $publicPool); $privatePool = new Definition(); $privatePool->setPublic(false); $privatePool->addArgument('namespace'); - $privatePool->addTag('cache.pool', array('clearer' => 'clearer_alias')); + $privatePool->addTag('cache.pool', ['clearer' => 'clearer_alias']); $container->setDefinition('private.pool', $privatePool); $clearer = new Definition(); @@ -55,18 +55,18 @@ class CachePoolClearerPassTest extends TestCase $pass = new RemoveUnusedDefinitionsPass(); foreach ($container->getCompiler()->getPassConfig()->getRemovingPasses() as $removingPass) { if ($removingPass instanceof RepeatedPass) { - $pass->setRepeatedPass(new RepeatedPass(array($pass))); + $pass->setRepeatedPass(new RepeatedPass([$pass])); break; } } - foreach (array(new CachePoolPass(), $pass, new CachePoolClearerPass()) as $pass) { + foreach ([new CachePoolPass(), $pass, new CachePoolClearerPass()] as $pass) { $pass->process($container); } - $expected = array(array( + $expected = [[ 'public.pool' => new Reference('public.pool'), 'pool2' => new Reference('public.pool2'), - )); + ]]; $this->assertEquals($expected, $clearer->getArguments()); $this->assertEquals($expected, $globalClearer->getArguments()); } diff --git a/vendor/symfony/cache/Tests/DependencyInjection/CachePoolPassTest.php b/vendor/symfony/cache/Tests/DependencyInjection/CachePoolPassTest.php index f757e79821..f307aa5386 100644 --- a/vendor/symfony/cache/Tests/DependencyInjection/CachePoolPassTest.php +++ b/vendor/symfony/cache/Tests/DependencyInjection/CachePoolPassTest.php @@ -71,10 +71,10 @@ class CachePoolPassTest extends TestCase $container->setParameter('kernel.container_class', 'app'); $container->setParameter('cache.prefix.seed', 'foo'); $cachePool = new Definition(); - $cachePool->addTag('cache.pool', array( + $cachePool->addTag('cache.pool', [ 'provider' => 'foobar', 'default_lifetime' => 3, - )); + ]); $cachePool->addArgument(null); $cachePool->addArgument(null); $cachePool->addArgument(null); @@ -94,10 +94,10 @@ class CachePoolPassTest extends TestCase $container->setParameter('kernel.container_class', 'app'); $container->setParameter('cache.prefix.seed', 'foo'); $cachePool = new Definition(); - $cachePool->addTag('cache.pool', array( + $cachePool->addTag('cache.pool', [ 'name' => 'foobar', 'provider' => 'foobar', - )); + ]); $cachePool->addArgument(null); $cachePool->addArgument(null); $cachePool->addArgument(null); @@ -122,7 +122,7 @@ class CachePoolPassTest extends TestCase $adapter->addTag('cache.pool'); $container->setDefinition('app.cache_adapter', $adapter); $cachePool = new ChildDefinition('app.cache_adapter'); - $cachePool->addTag('cache.pool', array('foobar' => 123)); + $cachePool->addTag('cache.pool', ['foobar' => 123]); $container->setDefinition('app.cache_pool', $cachePool); $this->cachePoolPass->process($container); diff --git a/vendor/symfony/cache/Tests/DependencyInjection/CachePoolPrunerPassTest.php b/vendor/symfony/cache/Tests/DependencyInjection/CachePoolPrunerPassTest.php index e4de6f6807..128ee243c6 100644 --- a/vendor/symfony/cache/Tests/DependencyInjection/CachePoolPrunerPassTest.php +++ b/vendor/symfony/cache/Tests/DependencyInjection/CachePoolPrunerPassTest.php @@ -24,17 +24,17 @@ class CachePoolPrunerPassTest extends TestCase public function testCompilerPassReplacesCommandArgument() { $container = new ContainerBuilder(); - $container->register('console.command.cache_pool_prune')->addArgument(array()); + $container->register('console.command.cache_pool_prune')->addArgument([]); $container->register('pool.foo', FilesystemAdapter::class)->addTag('cache.pool'); $container->register('pool.bar', PhpFilesAdapter::class)->addTag('cache.pool'); $pass = new CachePoolPrunerPass(); $pass->process($container); - $expected = array( + $expected = [ 'pool.foo' => new Reference('pool.foo'), 'pool.bar' => new Reference('pool.bar'), - ); + ]; $argument = $container->getDefinition('console.command.cache_pool_prune')->getArgument(0); $this->assertInstanceOf(IteratorArgument::class, $argument); @@ -63,7 +63,7 @@ class CachePoolPrunerPassTest extends TestCase public function testCompilerPassThrowsOnInvalidDefinitionClass() { $container = new ContainerBuilder(); - $container->register('console.command.cache_pool_prune')->addArgument(array()); + $container->register('console.command.cache_pool_prune')->addArgument([]); $container->register('pool.not-found', NotFound::class)->addTag('cache.pool'); $pass = new CachePoolPrunerPass(); diff --git a/vendor/symfony/cache/Tests/Fixtures/ArrayCache.php b/vendor/symfony/cache/Tests/Fixtures/ArrayCache.php index 27fb82de01..95b39d54bd 100644 --- a/vendor/symfony/cache/Tests/Fixtures/ArrayCache.php +++ b/vendor/symfony/cache/Tests/Fixtures/ArrayCache.php @@ -6,7 +6,7 @@ use Doctrine\Common\Cache\CacheProvider; class ArrayCache extends CacheProvider { - private $data = array(); + private $data = []; protected function doFetch($id) { @@ -26,7 +26,7 @@ class ArrayCache extends CacheProvider protected function doSave($id, $data, $lifeTime = 0) { - $this->data[$id] = array($data, $lifeTime ? microtime(true) + $lifeTime : false); + $this->data[$id] = [$data, $lifeTime ? microtime(true) + $lifeTime : false]; return true; } @@ -40,7 +40,7 @@ class ArrayCache extends CacheProvider protected function doFlush() { - $this->data = array(); + $this->data = []; return true; } diff --git a/vendor/symfony/cache/Tests/Fixtures/ExternalAdapter.php b/vendor/symfony/cache/Tests/Fixtures/ExternalAdapter.php index 493906ea0c..deb0b3bc34 100644 --- a/vendor/symfony/cache/Tests/Fixtures/ExternalAdapter.php +++ b/vendor/symfony/cache/Tests/Fixtures/ExternalAdapter.php @@ -24,9 +24,9 @@ class ExternalAdapter implements CacheItemPoolInterface { private $cache; - public function __construct() + public function __construct(int $defaultLifetime = 0) { - $this->cache = new ArrayAdapter(); + $this->cache = new ArrayAdapter($defaultLifetime); } public function getItem($key) @@ -34,7 +34,7 @@ class ExternalAdapter implements CacheItemPoolInterface return $this->cache->getItem($key); } - public function getItems(array $keys = array()) + public function getItems(array $keys = []) { return $this->cache->getItems($keys); } diff --git a/vendor/symfony/cache/Tests/LockRegistryTest.php b/vendor/symfony/cache/Tests/LockRegistryTest.php index 3f7d959570..0771347ed6 100644 --- a/vendor/symfony/cache/Tests/LockRegistryTest.php +++ b/vendor/symfony/cache/Tests/LockRegistryTest.php @@ -18,7 +18,7 @@ class LockRegistryTest extends TestCase { public function testFiles() { - $lockFiles = LockRegistry::setFiles(array()); + $lockFiles = LockRegistry::setFiles([]); LockRegistry::setFiles($lockFiles); $expected = array_map('realpath', glob(__DIR__.'/../Adapter/*')); $this->assertSame($expected, $lockFiles); diff --git a/vendor/symfony/cache/Tests/Marshaller/DefaultMarshallerTest.php b/vendor/symfony/cache/Tests/Marshaller/DefaultMarshallerTest.php index fc625d12fc..daa1fd19f4 100644 --- a/vendor/symfony/cache/Tests/Marshaller/DefaultMarshallerTest.php +++ b/vendor/symfony/cache/Tests/Marshaller/DefaultMarshallerTest.php @@ -19,14 +19,14 @@ class DefaultMarshallerTest extends TestCase public function testSerialize() { $marshaller = new DefaultMarshaller(); - $values = array( + $values = [ 'a' => 123, 'b' => function () {}, - ); + ]; - $expected = array('a' => \extension_loaded('igbinary') ? igbinary_serialize(123) : serialize(123)); + $expected = ['a' => \extension_loaded('igbinary') ? igbinary_serialize(123) : serialize(123)]; $this->assertSame($expected, $marshaller->marshall($values, $failed)); - $this->assertSame(array('b'), $failed); + $this->assertSame(['b'], $failed); } public function testNativeUnserialize() diff --git a/vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php b/vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php index 3e668fdd12..dd5e1509c1 100644 --- a/vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/AbstractRedisCacheTest.php @@ -15,11 +15,11 @@ use Symfony\Component\Cache\Simple\RedisCache; abstract class AbstractRedisCacheTest extends CacheTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testSetTtl' => 'Testing expiration slows down the test suite', 'testSetMultipleTtl' => 'Testing expiration slows down the test suite', 'testDefaultLifeTime' => 'Testing expiration slows down the test suite', - ); + ]; protected static $redis; diff --git a/vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php b/vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php index 3df32c1c5e..f37b95a093 100644 --- a/vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/ApcuCacheTest.php @@ -15,11 +15,11 @@ use Symfony\Component\Cache\Simple\ApcuCache; class ApcuCacheTest extends CacheTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testSetTtl' => 'Testing expiration slows down the test suite', 'testSetMultipleTtl' => 'Testing expiration slows down the test suite', 'testDefaultLifeTime' => 'Testing expiration slows down the test suite', - ); + ]; public function createSimpleCache($defaultLifetime = 0) { diff --git a/vendor/symfony/cache/Tests/Simple/CacheTestCase.php b/vendor/symfony/cache/Tests/Simple/CacheTestCase.php index 5b84d8b093..1a13cbaae8 100644 --- a/vendor/symfony/cache/Tests/Simple/CacheTestCase.php +++ b/vendor/symfony/cache/Tests/Simple/CacheTestCase.php @@ -28,7 +28,7 @@ abstract class CacheTestCase extends SimpleCacheTest public static function validKeys() { - return array_merge(parent::validKeys(), array(array("a\0b"))); + return array_merge(parent::validKeys(), [["a\0b"]]); } public function testDefaultLifeTime() @@ -64,9 +64,9 @@ abstract class CacheTestCase extends SimpleCacheTest $this->assertNull($cache->get('foo')); - $cache->setMultiple(array('foo' => new NotUnserializable())); + $cache->setMultiple(['foo' => new NotUnserializable()]); - foreach ($cache->getMultiple(array('foo')) as $value) { + foreach ($cache->getMultiple(['foo']) as $value) { } $this->assertNull($value); diff --git a/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php b/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php index ab28e3bce7..e6f7c7cc63 100644 --- a/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/ChainCacheTest.php @@ -24,7 +24,7 @@ class ChainCacheTest extends CacheTestCase { public function createSimpleCache($defaultLifetime = 0) { - return new ChainCache(array(new ArrayCache($defaultLifetime), new FilesystemCache('', $defaultLifetime)), $defaultLifetime); + return new ChainCache([new ArrayCache($defaultLifetime), new FilesystemCache('', $defaultLifetime)], $defaultLifetime); } /** @@ -33,7 +33,7 @@ class ChainCacheTest extends CacheTestCase */ public function testEmptyCachesException() { - new ChainCache(array()); + new ChainCache([]); } /** @@ -42,7 +42,7 @@ class ChainCacheTest extends CacheTestCase */ public function testInvalidCacheException() { - new ChainCache(array(new \stdClass())); + new ChainCache([new \stdClass()]); } public function testPrune() @@ -51,18 +51,18 @@ class ChainCacheTest extends CacheTestCase $this->markTestSkipped($this->skippedTests[__FUNCTION__]); } - $cache = new ChainCache(array( + $cache = new ChainCache([ $this->getPruneableMock(), $this->getNonPruneableMock(), $this->getPruneableMock(), - )); + ]); $this->assertTrue($cache->prune()); - $cache = new ChainCache(array( + $cache = new ChainCache([ $this->getPruneableMock(), $this->getFailingPruneableMock(), $this->getPruneableMock(), - )); + ]); $this->assertFalse($cache->prune()); } diff --git a/vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php b/vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php index 127c96858c..af4331d69b 100644 --- a/vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/DoctrineCacheTest.php @@ -19,10 +19,10 @@ use Symfony\Component\Cache\Tests\Fixtures\ArrayCache; */ class DoctrineCacheTest extends CacheTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testObjectDoesNotChangeInCache' => 'ArrayCache does not use serialize/unserialize', 'testNotUnserializable' => 'ArrayCache does not use serialize/unserialize', - ); + ]; public function createSimpleCache($defaultLifetime = 0) { diff --git a/vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php b/vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php index ee9e49d3dd..f83f0a2e34 100644 --- a/vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/MemcachedCacheTest.php @@ -16,11 +16,11 @@ use Symfony\Component\Cache\Simple\MemcachedCache; class MemcachedCacheTest extends CacheTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testSetTtl' => 'Testing expiration slows down the test suite', 'testSetMultipleTtl' => 'Testing expiration slows down the test suite', 'testDefaultLifeTime' => 'Testing expiration slows down the test suite', - ); + ]; protected static $client; @@ -40,29 +40,29 @@ class MemcachedCacheTest extends CacheTestCase public function createSimpleCache($defaultLifetime = 0) { - $client = $defaultLifetime ? AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST'), array('binary_protocol' => false)) : self::$client; + $client = $defaultLifetime ? AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST'), ['binary_protocol' => false]) : self::$client; return new MemcachedCache($client, str_replace('\\', '.', __CLASS__), $defaultLifetime); } public function testCreatePersistentConnectionShouldNotDupServerList() { - $instance = MemcachedCache::createConnection('memcached://'.getenv('MEMCACHED_HOST'), array('persistent_id' => 'persistent')); + $instance = MemcachedCache::createConnection('memcached://'.getenv('MEMCACHED_HOST'), ['persistent_id' => 'persistent']); $this->assertCount(1, $instance->getServerList()); - $instance = MemcachedCache::createConnection('memcached://'.getenv('MEMCACHED_HOST'), array('persistent_id' => 'persistent')); + $instance = MemcachedCache::createConnection('memcached://'.getenv('MEMCACHED_HOST'), ['persistent_id' => 'persistent']); $this->assertCount(1, $instance->getServerList()); } public function testOptions() { - $client = MemcachedCache::createConnection(array(), array( + $client = MemcachedCache::createConnection([], [ 'libketama_compatible' => false, 'distribution' => 'modula', 'compression' => true, 'serializer' => 'php', 'hash' => 'md5', - )); + ]); $this->assertSame(\Memcached::SERIALIZER_PHP, $client->getOption(\Memcached::OPT_SERIALIZER)); $this->assertSame(\Memcached::HASH_MD5, $client->getOption(\Memcached::OPT_HASH)); @@ -78,24 +78,24 @@ class MemcachedCacheTest extends CacheTestCase */ public function testBadOptions($name, $value) { - MemcachedCache::createConnection(array(), array($name => $value)); + MemcachedCache::createConnection([], [$name => $value]); } public function provideBadOptions() { - return array( - array('foo', 'bar'), - array('hash', 'zyx'), - array('serializer', 'zyx'), - array('distribution', 'zyx'), - ); + return [ + ['foo', 'bar'], + ['hash', 'zyx'], + ['serializer', 'zyx'], + ['distribution', 'zyx'], + ]; } public function testDefaultOptions() { $this->assertTrue(MemcachedCache::isSupported()); - $client = MemcachedCache::createConnection(array()); + $client = MemcachedCache::createConnection([]); $this->assertTrue($client->getOption(\Memcached::OPT_COMPRESSION)); $this->assertSame(1, $client->getOption(\Memcached::OPT_BINARY_PROTOCOL)); @@ -112,7 +112,7 @@ class MemcachedCacheTest extends CacheTestCase $this->markTestSkipped('Memcached::HAVE_JSON required'); } - new MemcachedCache(MemcachedCache::createConnection(array(), array('serializer' => 'json'))); + new MemcachedCache(MemcachedCache::createConnection([], ['serializer' => 'json'])); } /** @@ -121,54 +121,54 @@ class MemcachedCacheTest extends CacheTestCase public function testServersSetting($dsn, $host, $port) { $client1 = MemcachedCache::createConnection($dsn); - $client2 = MemcachedCache::createConnection(array($dsn)); - $client3 = MemcachedCache::createConnection(array(array($host, $port))); - $expect = array( + $client2 = MemcachedCache::createConnection([$dsn]); + $client3 = MemcachedCache::createConnection([[$host, $port]]); + $expect = [ 'host' => $host, 'port' => $port, - ); + ]; - $f = function ($s) { return array('host' => $s['host'], 'port' => $s['port']); }; - $this->assertSame(array($expect), array_map($f, $client1->getServerList())); - $this->assertSame(array($expect), array_map($f, $client2->getServerList())); - $this->assertSame(array($expect), array_map($f, $client3->getServerList())); + $f = function ($s) { return ['host' => $s['host'], 'port' => $s['port']]; }; + $this->assertSame([$expect], array_map($f, $client1->getServerList())); + $this->assertSame([$expect], array_map($f, $client2->getServerList())); + $this->assertSame([$expect], array_map($f, $client3->getServerList())); } public function provideServersSetting() { - yield array( + yield [ 'memcached://127.0.0.1/50', '127.0.0.1', 11211, - ); - yield array( + ]; + yield [ 'memcached://localhost:11222?weight=25', 'localhost', 11222, - ); + ]; if (filter_var(ini_get('memcached.use_sasl'), FILTER_VALIDATE_BOOLEAN)) { - yield array( + yield [ 'memcached://user:password@127.0.0.1?weight=50', '127.0.0.1', 11211, - ); + ]; } - yield array( + yield [ 'memcached:///var/run/memcached.sock?weight=25', '/var/run/memcached.sock', 0, - ); - yield array( + ]; + yield [ 'memcached:///var/local/run/memcached.socket?weight=25', '/var/local/run/memcached.socket', 0, - ); + ]; if (filter_var(ini_get('memcached.use_sasl'), FILTER_VALIDATE_BOOLEAN)) { - yield array( + yield [ 'memcached://user:password@/var/local/run/memcached.socket?weight=25', '/var/local/run/memcached.socket', 0, - ); + ]; } } } diff --git a/vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php b/vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php index 43cadf9034..13865a6098 100644 --- a/vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php +++ b/vendor/symfony/cache/Tests/Simple/MemcachedCacheTextModeTest.php @@ -18,7 +18,7 @@ class MemcachedCacheTextModeTest extends MemcachedCacheTest { public function createSimpleCache($defaultLifetime = 0) { - $client = AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST'), array('binary_protocol' => false)); + $client = AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST'), ['binary_protocol' => false]); return new MemcachedCache($client, str_replace('\\', '.', __CLASS__), $defaultLifetime); } diff --git a/vendor/symfony/cache/Tests/Simple/NullCacheTest.php b/vendor/symfony/cache/Tests/Simple/NullCacheTest.php index 7b760fd3bd..31f42c32b6 100644 --- a/vendor/symfony/cache/Tests/Simple/NullCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/NullCacheTest.php @@ -40,7 +40,7 @@ class NullCacheTest extends TestCase { $cache = $this->createCachePool(); - $keys = array('foo', 'bar', 'baz', 'biz'); + $keys = ['foo', 'bar', 'baz', 'biz']; $default = new \stdClass(); $items = $cache->getMultiple($keys, $default); @@ -75,7 +75,7 @@ class NullCacheTest extends TestCase public function testDeleteMultiple() { - $this->assertTrue($this->createCachePool()->deleteMultiple(array('key', 'foo', 'bar'))); + $this->assertTrue($this->createCachePool()->deleteMultiple(['key', 'foo', 'bar'])); } public function testSet() @@ -90,7 +90,7 @@ class NullCacheTest extends TestCase { $cache = $this->createCachePool(); - $this->assertFalse($cache->setMultiple(array('key' => 'val'))); + $this->assertFalse($cache->setMultiple(['key' => 'val'])); $this->assertNull($cache->get('key')); } } diff --git a/vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php b/vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php index 158e2c8924..ce1a9ae4f8 100644 --- a/vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/PdoDbalCacheTest.php @@ -32,7 +32,7 @@ class PdoDbalCacheTest extends CacheTestCase self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache'); - $pool = new PdoCache(DriverManager::getConnection(array('driver' => 'pdo_sqlite', 'path' => self::$dbFile))); + $pool = new PdoCache(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile])); $pool->createTable(); } @@ -43,6 +43,6 @@ class PdoDbalCacheTest extends CacheTestCase public function createSimpleCache($defaultLifetime = 0) { - return new PdoCache(DriverManager::getConnection(array('driver' => 'pdo_sqlite', 'path' => self::$dbFile)), '', $defaultLifetime); + return new PdoCache(DriverManager::getConnection(['driver' => 'pdo_sqlite', 'path' => self::$dbFile]), '', $defaultLifetime); } } diff --git a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php index 724744cb9a..ba4bde3139 100644 --- a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheTest.php @@ -20,7 +20,7 @@ use Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest; */ class PhpArrayCacheTest extends CacheTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testBasicUsageWithLongKey' => 'PhpArrayCache does no writes', 'testDelete' => 'PhpArrayCache does no writes', @@ -45,7 +45,7 @@ class PhpArrayCacheTest extends CacheTestCase 'testDefaultLifeTime' => 'PhpArrayCache does not allow configuring a default lifetime.', 'testPrune' => 'PhpArrayCache just proxies', - ); + ]; protected static $file; @@ -68,22 +68,22 @@ class PhpArrayCacheTest extends CacheTestCase public function testStore() { - $arrayWithRefs = array(); + $arrayWithRefs = []; $arrayWithRefs[0] = 123; $arrayWithRefs[1] = &$arrayWithRefs[0]; - $object = (object) array( + $object = (object) [ 'foo' => 'bar', 'foo2' => 'bar2', - ); + ]; - $expected = array( + $expected = [ 'null' => null, 'serializedString' => serialize($object), 'arrayWithRefs' => $arrayWithRefs, 'object' => $object, - 'arrayWithObject' => array('bar' => $object), - ); + 'arrayWithObject' => ['bar' => $object], + ]; $cache = new PhpArrayCache(self::$file, new NullCache()); $cache->warmUp($expected); @@ -95,29 +95,29 @@ class PhpArrayCacheTest extends CacheTestCase public function testStoredFile() { - $data = array( + $data = [ 'integer' => 42, 'float' => 42.42, 'boolean' => true, - 'array_simple' => array('foo', 'bar'), - 'array_associative' => array('foo' => 'bar', 'foo2' => 'bar2'), - ); - $expected = array( - array( + 'array_simple' => ['foo', 'bar'], + 'array_associative' => ['foo' => 'bar', 'foo2' => 'bar2'], + ]; + $expected = [ + [ 'integer' => 0, 'float' => 1, 'boolean' => 2, 'array_simple' => 3, 'array_associative' => 4, - ), - array( + ], + [ 0 => 42, 1 => 42.42, 2 => true, - 3 => array('foo', 'bar'), - 4 => array('foo' => 'bar', 'foo2' => 'bar2'), - ), - ); + 3 => ['foo', 'bar'], + 4 => ['foo' => 'bar', 'foo2' => 'bar2'], + ], + ]; $cache = new PhpArrayCache(self::$file, new NullCache()); $cache->warmUp($data); @@ -130,7 +130,7 @@ class PhpArrayCacheTest extends CacheTestCase class PhpArrayCacheWrapper extends PhpArrayCache { - protected $data = array(); + protected $data = []; public function set($key, $value, $ttl = null) { diff --git a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php index 4b6a94f709..abee5e7872 100644 --- a/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php +++ b/vendor/symfony/cache/Tests/Simple/PhpArrayCacheWithFallbackTest.php @@ -20,7 +20,7 @@ use Symfony\Component\Cache\Tests\Adapter\FilesystemAdapterTest; */ class PhpArrayCacheWithFallbackTest extends CacheTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testGetInvalidKeys' => 'PhpArrayCache does no validation', 'testGetMultipleInvalidKeys' => 'PhpArrayCache does no validation', 'testDeleteInvalidKeys' => 'PhpArrayCache does no validation', @@ -32,7 +32,7 @@ class PhpArrayCacheWithFallbackTest extends CacheTestCase 'testSetMultipleInvalidTtl' => 'PhpArrayCache does no validation', 'testHasInvalidKeys' => 'PhpArrayCache does no validation', 'testPrune' => 'PhpArrayCache just proxies', - ); + ]; protected static $file; diff --git a/vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php b/vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php index 38e5ee90b1..3a68dd3984 100644 --- a/vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/PhpFilesCacheTest.php @@ -19,9 +19,9 @@ use Symfony\Component\Cache\Simple\PhpFilesCache; */ class PhpFilesCacheTest extends CacheTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testDefaultLifeTime' => 'PhpFilesCache does not allow configuring a default lifetime.', - ); + ]; public function createSimpleCache() { diff --git a/vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php b/vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php index 78582894fb..65d48a978c 100644 --- a/vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/Psr6CacheTest.php @@ -11,20 +11,18 @@ namespace Symfony\Component\Cache\Tests\Simple; -use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Simple\Psr6Cache; -/** - * @group time-sensitive - */ -class Psr6CacheTest extends CacheTestCase +abstract class Psr6CacheTest extends CacheTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testPrune' => 'Psr6Cache just proxies', - ); + ]; public function createSimpleCache($defaultLifetime = 0) { - return new Psr6Cache(new FilesystemAdapter('', $defaultLifetime)); + return new Psr6Cache($this->createCacheItemPool($defaultLifetime)); } + + abstract protected function createCacheItemPool($defaultLifetime = 0); } diff --git a/vendor/symfony/cache/Tests/Simple/Psr6CacheWithAdapterTest.php b/vendor/symfony/cache/Tests/Simple/Psr6CacheWithAdapterTest.php new file mode 100644 index 0000000000..46da9354d6 --- /dev/null +++ b/vendor/symfony/cache/Tests/Simple/Psr6CacheWithAdapterTest.php @@ -0,0 +1,25 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Cache\Tests\Simple; + +use Symfony\Component\Cache\Adapter\FilesystemAdapter; + +/** + * @group time-sensitive + */ +class Psr6CacheWithAdapterTest extends Psr6CacheTest +{ + protected function createCacheItemPool($defaultLifetime = 0) + { + return new FilesystemAdapter('', $defaultLifetime); + } +} diff --git a/vendor/symfony/cache/Tests/Simple/Psr6CacheWithoutAdapterTest.php b/vendor/symfony/cache/Tests/Simple/Psr6CacheWithoutAdapterTest.php new file mode 100644 index 0000000000..a8c4164dcb --- /dev/null +++ b/vendor/symfony/cache/Tests/Simple/Psr6CacheWithoutAdapterTest.php @@ -0,0 +1,25 @@ +<?php + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien@symfony.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Cache\Tests\Simple; + +use Symfony\Component\Cache\Tests\Fixtures\ExternalAdapter; + +/** + * @group time-sensitive + */ +class Psr6CacheWithoutAdapterTest extends Psr6CacheTest +{ + protected function createCacheItemPool($defaultLifetime = 0) + { + return new ExternalAdapter($defaultLifetime); + } +} diff --git a/vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php b/vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php index 3c903c8a9b..bda39d990b 100644 --- a/vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/RedisArrayCacheTest.php @@ -19,6 +19,6 @@ class RedisArrayCacheTest extends AbstractRedisCacheTest if (!class_exists('RedisArray')) { self::markTestSkipped('The RedisArray class is required.'); } - self::$redis = new \RedisArray(array(getenv('REDIS_HOST')), array('lazy_connect' => true)); + self::$redis = new \RedisArray([getenv('REDIS_HOST')], ['lazy_connect' => true]); } } diff --git a/vendor/symfony/cache/Tests/Simple/RedisCacheTest.php b/vendor/symfony/cache/Tests/Simple/RedisCacheTest.php index d33421f9aa..407d916c73 100644 --- a/vendor/symfony/cache/Tests/Simple/RedisCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/RedisCacheTest.php @@ -33,13 +33,13 @@ class RedisCacheTest extends AbstractRedisCacheTest $redis = RedisCache::createConnection('redis://'.$redisHost.'/2'); $this->assertSame(2, $redis->getDbNum()); - $redis = RedisCache::createConnection('redis://'.$redisHost, array('timeout' => 3)); + $redis = RedisCache::createConnection('redis://'.$redisHost, ['timeout' => 3]); $this->assertEquals(3, $redis->getTimeout()); $redis = RedisCache::createConnection('redis://'.$redisHost.'?timeout=4'); $this->assertEquals(4, $redis->getTimeout()); - $redis = RedisCache::createConnection('redis://'.$redisHost, array('read_timeout' => 5)); + $redis = RedisCache::createConnection('redis://'.$redisHost, ['read_timeout' => 5]); $this->assertEquals(5, $redis->getReadTimeout()); } @@ -55,11 +55,11 @@ class RedisCacheTest extends AbstractRedisCacheTest public function provideFailedCreateConnection() { - return array( - array('redis://localhost:1234'), - array('redis://foo@localhost'), - array('redis://localhost/123'), - ); + return [ + ['redis://localhost:1234'], + ['redis://foo@localhost'], + ['redis://localhost/123'], + ]; } /** @@ -74,9 +74,9 @@ class RedisCacheTest extends AbstractRedisCacheTest public function provideInvalidCreateConnection() { - return array( - array('foo://localhost'), - array('redis://'), - ); + return [ + ['foo://localhost'], + ['redis://'], + ]; } } diff --git a/vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php b/vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php index 535f93da4b..e684caf36e 100644 --- a/vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php +++ b/vendor/symfony/cache/Tests/Simple/TraceableCacheTest.php @@ -19,9 +19,9 @@ use Symfony\Component\Cache\Simple\TraceableCache; */ class TraceableCacheTest extends CacheTestCase { - protected $skippedTests = array( + protected $skippedTests = [ 'testPrune' => 'TraceableCache just proxies', - ); + ]; public function createSimpleCache($defaultLifetime = 0) { @@ -37,7 +37,7 @@ class TraceableCacheTest extends CacheTestCase $call = $calls[0]; $this->assertSame('get', $call->name); - $this->assertSame(array('k' => false), $call->result); + $this->assertSame(['k' => false], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(1, $call->misses); $this->assertNotEmpty($call->start); @@ -61,7 +61,7 @@ class TraceableCacheTest extends CacheTestCase { $pool = $this->createSimpleCache(); $pool->set('k1', 123); - $values = $pool->getMultiple(array('k0', 'k1')); + $values = $pool->getMultiple(['k0', 'k1']); foreach ($values as $value) { } $calls = $pool->getCalls(); @@ -69,7 +69,7 @@ class TraceableCacheTest extends CacheTestCase $call = $calls[1]; $this->assertSame('getMultiple', $call->name); - $this->assertSame(array('k1' => true, 'k0' => false), $call->result); + $this->assertSame(['k1' => true, 'k0' => false], $call->result); $this->assertSame(1, $call->misses); $this->assertNotEmpty($call->start); $this->assertNotEmpty($call->end); @@ -84,7 +84,7 @@ class TraceableCacheTest extends CacheTestCase $call = $calls[0]; $this->assertSame('has', $call->name); - $this->assertSame(array('k' => false), $call->result); + $this->assertSame(['k' => false], $call->result); $this->assertNotEmpty($call->start); $this->assertNotEmpty($call->end); } @@ -99,7 +99,7 @@ class TraceableCacheTest extends CacheTestCase $call = $calls[1]; $this->assertSame('has', $call->name); - $this->assertSame(array('k' => true), $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertNotEmpty($call->start); $this->assertNotEmpty($call->end); } @@ -113,7 +113,7 @@ class TraceableCacheTest extends CacheTestCase $call = $calls[0]; $this->assertSame('delete', $call->name); - $this->assertSame(array('k' => true), $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); @@ -123,14 +123,14 @@ class TraceableCacheTest extends CacheTestCase public function testDeleteMultipleTrace() { $pool = $this->createSimpleCache(); - $arg = array('k0', 'k1'); + $arg = ['k0', 'k1']; $pool->deleteMultiple($arg); $calls = $pool->getCalls(); $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('deleteMultiple', $call->name); - $this->assertSame(array('keys' => $arg, 'result' => true), $call->result); + $this->assertSame(['keys' => $arg, 'result' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); @@ -146,7 +146,7 @@ class TraceableCacheTest extends CacheTestCase $call = $calls[0]; $this->assertSame('set', $call->name); - $this->assertSame(array('k' => true), $call->result); + $this->assertSame(['k' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); @@ -156,13 +156,13 @@ class TraceableCacheTest extends CacheTestCase public function testSetMultipleTrace() { $pool = $this->createSimpleCache(); - $pool->setMultiple(array('k' => 'foo')); + $pool->setMultiple(['k' => 'foo']); $calls = $pool->getCalls(); $this->assertCount(1, $calls); $call = $calls[0]; $this->assertSame('setMultiple', $call->name); - $this->assertSame(array('keys' => array('k'), 'result' => true), $call->result); + $this->assertSame(['keys' => ['k'], 'result' => true], $call->result); $this->assertSame(0, $call->hits); $this->assertSame(0, $call->misses); $this->assertNotEmpty($call->start); diff --git a/vendor/symfony/cache/Traits/AbstractTrait.php b/vendor/symfony/cache/Traits/AbstractTrait.php index 01351f11c9..2553ea75cb 100644 --- a/vendor/symfony/cache/Traits/AbstractTrait.php +++ b/vendor/symfony/cache/Traits/AbstractTrait.php @@ -26,8 +26,8 @@ trait AbstractTrait private $namespace; private $namespaceVersion = ''; private $versioningIsEnabled = false; - private $deferred = array(); - private $ids = array(); + private $deferred = []; + private $ids = []; /** * @var int|null The maximum length to enforce for identifiers or null when no limit applies @@ -94,7 +94,7 @@ trait AbstractTrait try { return $this->doHave($id); } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to check if key "{key}" is cached', array('key' => $key, 'exception' => $e)); + CacheItem::log($this->logger, 'Failed to check if key "{key}" is cached', ['key' => $key, 'exception' => $e]); return false; } @@ -105,24 +105,24 @@ trait AbstractTrait */ public function clear() { - $this->deferred = array(); + $this->deferred = []; if ($cleared = $this->versioningIsEnabled) { $namespaceVersion = substr_replace(base64_encode(pack('V', mt_rand())), ':', 5); try { - $cleared = $this->doSave(array('/'.$this->namespace => $namespaceVersion), 0); + $cleared = $this->doSave(['/'.$this->namespace => $namespaceVersion], 0); } catch (\Exception $e) { $cleared = false; } - if ($cleared = true === $cleared || array() === $cleared) { + if ($cleared = true === $cleared || [] === $cleared) { $this->namespaceVersion = $namespaceVersion; - $this->ids = array(); + $this->ids = []; } } try { return $this->doClear($this->namespace) || $cleared; } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to clear the cache', array('exception' => $e)); + CacheItem::log($this->logger, 'Failed to clear the cache', ['exception' => $e]); return false; } @@ -133,7 +133,7 @@ trait AbstractTrait */ public function deleteItem($key) { - return $this->deleteItems(array($key)); + return $this->deleteItems([$key]); } /** @@ -141,7 +141,7 @@ trait AbstractTrait */ public function deleteItems(array $keys) { - $ids = array(); + $ids = []; foreach ($keys as $key) { $ids[$key] = $this->getId($key); @@ -161,12 +161,12 @@ trait AbstractTrait foreach ($ids as $key => $id) { try { $e = null; - if ($this->doDelete(array($id))) { + if ($this->doDelete([$id])) { continue; } } catch (\Exception $e) { } - CacheItem::log($this->logger, 'Failed to delete key "{key}"', array('key' => $key, 'exception' => $e)); + CacheItem::log($this->logger, 'Failed to delete key "{key}"', ['key' => $key, 'exception' => $e]); $ok = false; } @@ -190,7 +190,7 @@ trait AbstractTrait $wasEnabled = $this->versioningIsEnabled; $this->versioningIsEnabled = (bool) $enable; $this->namespaceVersion = ''; - $this->ids = array(); + $this->ids = []; return $wasEnabled; } @@ -204,7 +204,7 @@ trait AbstractTrait $this->commit(); } $this->namespaceVersion = ''; - $this->ids = array(); + $this->ids = []; } /** @@ -241,15 +241,15 @@ trait AbstractTrait private function getId($key) { if ($this->versioningIsEnabled && '' === $this->namespaceVersion) { - $this->ids = array(); + $this->ids = []; $this->namespaceVersion = '1/'; try { - foreach ($this->doFetch(array('/'.$this->namespace)) as $v) { + foreach ($this->doFetch(['/'.$this->namespace]) as $v) { $this->namespaceVersion = $v; } if ('1:' === $this->namespaceVersion) { $this->namespaceVersion = substr_replace(base64_encode(pack('V', time())), ':', 5); - $this->doSave(array('@'.$this->namespace => $this->namespaceVersion), 0); + $this->doSave(['@'.$this->namespace => $this->namespaceVersion], 0); } } catch (\Exception $e) { } diff --git a/vendor/symfony/cache/Traits/ApcuTrait.php b/vendor/symfony/cache/Traits/ApcuTrait.php index a93fc812a1..c86b043ae1 100644 --- a/vendor/symfony/cache/Traits/ApcuTrait.php +++ b/vendor/symfony/cache/Traits/ApcuTrait.php @@ -53,8 +53,8 @@ trait ApcuTrait { $unserializeCallbackHandler = ini_set('unserialize_callback_func', __CLASS__.'::handleUnserializeCallback'); try { - $values = array(); - foreach (apcu_fetch($ids, $ok) ?: array() as $k => $v) { + $values = []; + foreach (apcu_fetch($ids, $ok) ?: [] as $k => $v) { if (null !== $v || $ok) { $values[$k] = $v; } diff --git a/vendor/symfony/cache/Traits/ArrayTrait.php b/vendor/symfony/cache/Traits/ArrayTrait.php index 8268e40db4..e585c3d48c 100644 --- a/vendor/symfony/cache/Traits/ArrayTrait.php +++ b/vendor/symfony/cache/Traits/ArrayTrait.php @@ -24,8 +24,8 @@ trait ArrayTrait use LoggerAwareTrait; private $storeSerialized; - private $values = array(); - private $expiries = array(); + private $values = []; + private $expiries = []; /** * Returns all cached values, with cache miss as null. @@ -69,7 +69,7 @@ trait ArrayTrait */ public function clear() { - $this->values = $this->expiries = array(); + $this->values = $this->expiries = []; return true; } @@ -128,7 +128,7 @@ trait ArrayTrait $serialized = serialize($value); } catch (\Exception $e) { $type = \is_object($value) ? \get_class($value) : \gettype($value); - CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', array('key' => $key, 'type' => $type, 'exception' => $e)); + CacheItem::log($this->logger, 'Failed to save key "{key}" ({type})', ['key' => $key, 'type' => $type, 'exception' => $e]); return; } @@ -150,7 +150,7 @@ trait ArrayTrait try { $value = unserialize($value); } catch (\Exception $e) { - CacheItem::log($this->logger, 'Failed to unserialize key "{key}"', array('key' => $key, 'exception' => $e)); + CacheItem::log($this->logger, 'Failed to unserialize key "{key}"', ['key' => $key, 'exception' => $e]); $value = false; } if (false === $value) { diff --git a/vendor/symfony/cache/Traits/ContractsTrait.php b/vendor/symfony/cache/Traits/ContractsTrait.php index f755e65fc3..8b1eb5a244 100644 --- a/vendor/symfony/cache/Traits/ContractsTrait.php +++ b/vendor/symfony/cache/Traits/ContractsTrait.php @@ -30,7 +30,7 @@ trait ContractsTrait doGet as private contractsGet; } - private $callbackWrapper = array(LockRegistry::class, 'compute'); + private $callbackWrapper = [LockRegistry::class, 'compute']; /** * Wraps the callback passed to ->get() in a callable. diff --git a/vendor/symfony/cache/Traits/FilesystemTrait.php b/vendor/symfony/cache/Traits/FilesystemTrait.php index 52dcf985dd..9c444f9b04 100644 --- a/vendor/symfony/cache/Traits/FilesystemTrait.php +++ b/vendor/symfony/cache/Traits/FilesystemTrait.php @@ -54,7 +54,7 @@ trait FilesystemTrait */ protected function doFetch(array $ids) { - $values = array(); + $values = []; $now = time(); foreach ($ids as $id) { @@ -85,7 +85,7 @@ trait FilesystemTrait { $file = $this->getFile($id); - return file_exists($file) && (@filemtime($file) > time() || $this->doFetch(array($id))); + return file_exists($file) && (@filemtime($file) > time() || $this->doFetch([$id])); } /** diff --git a/vendor/symfony/cache/Traits/MemcachedTrait.php b/vendor/symfony/cache/Traits/MemcachedTrait.php index 1e1718a412..b83d695937 100644 --- a/vendor/symfony/cache/Traits/MemcachedTrait.php +++ b/vendor/symfony/cache/Traits/MemcachedTrait.php @@ -24,12 +24,12 @@ use Symfony\Component\Cache\Marshaller\MarshallerInterface; */ trait MemcachedTrait { - private static $defaultClientOptions = array( + private static $defaultClientOptions = [ 'persistent_id' => null, 'username' => null, 'password' => null, 'serializer' => 'php', - ); + ]; private $marshaller; private $client; @@ -68,7 +68,7 @@ trait MemcachedTrait * * Examples for servers: * - 'memcached://user:pass@localhost?weight=33' - * - array(array('localhost', 11211, 33)) + * - [['localhost', 11211, 33]] * * @param array[]|string|string[] $servers An array of servers, a DSN, or an array of DSNs * @param array $options An array of options @@ -77,10 +77,10 @@ trait MemcachedTrait * * @throws \ErrorException When invalid options or servers are provided */ - public static function createConnection($servers, array $options = array()) + public static function createConnection($servers, array $options = []) { if (\is_string($servers)) { - $servers = array($servers); + $servers = [$servers]; } elseif (!\is_array($servers)) { throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, %s given.', \gettype($servers))); } @@ -104,7 +104,7 @@ trait MemcachedTrait } $params = preg_replace_callback('#^memcached:(//)?(?:([^@]*+)@)?#', function ($m) use (&$username, &$password) { if (!empty($m[2])) { - list($username, $password) = explode(':', $m[2], 2) + array(1 => null); + list($username, $password) = explode(':', $m[2], 2) + [1 => null]; } return 'file:'.($m[1] ?? ''); @@ -112,7 +112,7 @@ trait MemcachedTrait if (false === $params = parse_url($params)) { throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s', $dsn)); } - $query = $hosts = array(); + $query = $hosts = []; if (isset($params['query'])) { parse_str($params['query'], $query); @@ -122,9 +122,9 @@ trait MemcachedTrait } foreach ($hosts as $host => $weight) { if (false === $port = strrpos($host, ':')) { - $hosts[$host] = array($host, 11211, (int) $weight); + $hosts[$host] = [$host, 11211, (int) $weight]; } else { - $hosts[$host] = array(substr($host, 0, $port), (int) substr($host, 1 + $port), (int) $weight); + $hosts[$host] = [substr($host, 0, $port), (int) substr($host, 1 + $port), (int) $weight]; } } $hosts = array_values($hosts); @@ -143,17 +143,17 @@ trait MemcachedTrait $params['weight'] = $m[1]; $params['path'] = substr($params['path'], 0, -\strlen($m[0])); } - $params += array( + $params += [ 'host' => isset($params['host']) ? $params['host'] : $params['path'], 'port' => isset($params['host']) ? 11211 : null, 'weight' => 0, - ); + ]; if ($query) { $params += $query; $options = $query + $options; } - $servers[$i] = array($params['host'], $params['port'], $params['weight']); + $servers[$i] = [$params['host'], $params['port'], $params['weight']]; if ($hosts) { $servers = array_merge($servers, $hosts); @@ -185,12 +185,12 @@ trait MemcachedTrait // set client's servers, taking care of persistent connections if (!$client->isPristine()) { - $oldServers = array(); + $oldServers = []; foreach ($client->getServerList() as $server) { - $oldServers[] = array($server['host'], $server['port']); + $oldServers[] = [$server['host'], $server['port']]; } - $newServers = array(); + $newServers = []; foreach ($servers as $server) { if (1 < \count($server)) { $server = array_values($server); @@ -234,7 +234,7 @@ trait MemcachedTrait $lifetime += time(); } - $encodedValues = array(); + $encodedValues = []; foreach ($values as $key => $value) { $encodedValues[rawurlencode($key)] = $value; } @@ -252,7 +252,7 @@ trait MemcachedTrait $encodedResult = $this->checkResultCode($this->getClient()->getMulti($encodedIds)); - $result = array(); + $result = []; foreach ($encodedResult as $key => $value) { $result[rawurldecode($key)] = $this->marshaller->unmarshall($value); } diff --git a/vendor/symfony/cache/Traits/PdoTrait.php b/vendor/symfony/cache/Traits/PdoTrait.php index ea4feee4ac..ec34e72fb5 100644 --- a/vendor/symfony/cache/Traits/PdoTrait.php +++ b/vendor/symfony/cache/Traits/PdoTrait.php @@ -37,7 +37,7 @@ trait PdoTrait private $timeCol = 'item_time'; private $username = ''; private $password = ''; - private $connectionOptions = array(); + private $connectionOptions = []; private $namespace; private function init($connOrDsn, $namespace, $defaultLifetime, array $options, ?MarshallerInterface $marshaller) @@ -90,24 +90,24 @@ trait PdoTrait $conn = $this->getConnection(); if ($conn instanceof Connection) { - $types = array( + $types = [ 'mysql' => 'binary', 'sqlite' => 'text', 'pgsql' => 'string', 'oci' => 'string', 'sqlsrv' => 'string', - ); + ]; if (!isset($types[$this->driver])) { throw new \DomainException(sprintf('Creating the cache table is currently not implemented for PDO driver "%s".', $this->driver)); } $schema = new Schema(); $table = $schema->createTable($this->table); - $table->addColumn($this->idCol, $types[$this->driver], array('length' => 255)); - $table->addColumn($this->dataCol, 'blob', array('length' => 16777215)); - $table->addColumn($this->lifetimeCol, 'integer', array('unsigned' => true, 'notnull' => false)); - $table->addColumn($this->timeCol, 'integer', array('unsigned' => true)); - $table->setPrimaryKey(array($this->idCol)); + $table->addColumn($this->idCol, $types[$this->driver], ['length' => 255]); + $table->addColumn($this->dataCol, 'blob', ['length' => 16777215]); + $table->addColumn($this->lifetimeCol, 'integer', ['unsigned' => true, 'notnull' => false]); + $table->addColumn($this->timeCol, 'integer', ['unsigned' => true]); + $table->setPrimaryKey([$this->idCol]); foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) { $conn->exec($sql); @@ -165,8 +165,11 @@ trait PdoTrait if ('' !== $this->namespace) { $delete->bindValue(':namespace', sprintf('%s%%', $this->namespace), \PDO::PARAM_STR); } - - return $delete->execute(); + try { + return $delete->execute(); + } catch (TableNotFoundException $e) { + return true; + } } /** @@ -175,7 +178,7 @@ trait PdoTrait protected function doFetch(array $ids) { $now = time(); - $expired = array(); + $expired = []; $sql = str_pad('', (\count($ids) << 1) - 1, '?,'); $sql = "SELECT $this->idCol, CASE WHEN $this->lifetimeCol IS NULL OR $this->lifetimeCol + $this->timeCol > ? THEN $this->dataCol ELSE NULL END FROM $this->table WHERE $this->idCol IN ($sql)"; @@ -309,7 +312,7 @@ trait PdoTrait try { $stmt = $conn->prepare($sql); } catch (TableNotFoundException $e) { - if (!$conn->isTransactionActive() || \in_array($this->driver, array('pgsql', 'sqlite', 'sqlsrv'), true)) { + if (!$conn->isTransactionActive() || \in_array($this->driver, ['pgsql', 'sqlite', 'sqlsrv'], true)) { $this->createTable(); } $stmt = $conn->prepare($sql); @@ -340,8 +343,14 @@ trait PdoTrait } foreach ($values as $id => $data) { - $stmt->execute(); - + try { + $stmt->execute(); + } catch (TableNotFoundException $e) { + if (!$conn->isTransactionActive() || \in_array($this->driver, ['pgsql', 'sqlite', 'sqlsrv'], true)) { + $this->createTable(); + } + $stmt->execute(); + } if (null === $driver && !$stmt->rowCount()) { try { $insertStmt->execute(); diff --git a/vendor/symfony/cache/Traits/PhpArrayTrait.php b/vendor/symfony/cache/Traits/PhpArrayTrait.php index 587da5a498..0bec18a07a 100644 --- a/vendor/symfony/cache/Traits/PhpArrayTrait.php +++ b/vendor/symfony/cache/Traits/PhpArrayTrait.php @@ -57,13 +57,13 @@ trait PhpArrayTrait } $dumpedValues = ''; - $dumpedMap = array(); + $dumpedMap = []; $dump = <<<'EOF' <?php // This file has been auto-generated by the Symfony Cache Component. -return array(array( +return [[ EOF; @@ -106,7 +106,7 @@ EOF; $dump .= var_export($key, true)." => {$id},\n"; } - $dump .= "\n), array(\n\n{$dumpedValues}\n));\n"; + $dump .= "\n], [\n\n{$dumpedValues}\n]];\n"; $tmpFile = uniqid($this->file, true); @@ -124,7 +124,7 @@ EOF; */ public function clear() { - $this->keys = $this->values = array(); + $this->keys = $this->values = []; $cleared = @unlink($this->file) || !file_exists($this->file); @@ -137,14 +137,14 @@ EOF; private function initialize() { if (!file_exists($this->file)) { - $this->keys = $this->values = array(); + $this->keys = $this->values = []; return; } - $values = (include $this->file) ?: array(array(), array()); + $values = (include $this->file) ?: [[], []]; if (2 !== \count($values) || !isset($values[0], $values[1])) { - $this->keys = $this->values = array(); + $this->keys = $this->values = []; } else { list($this->keys, $this->values) = $values; } diff --git a/vendor/symfony/cache/Traits/PhpFilesTrait.php b/vendor/symfony/cache/Traits/PhpFilesTrait.php index 636ad3d99b..b57addb54f 100644 --- a/vendor/symfony/cache/Traits/PhpFilesTrait.php +++ b/vendor/symfony/cache/Traits/PhpFilesTrait.php @@ -31,8 +31,8 @@ trait PhpFilesTrait private $includeHandler; private $appendOnly; - private $values = array(); - private $files = array(); + private $values = []; + private $files = []; private static $startTime; @@ -78,13 +78,13 @@ trait PhpFilesTrait { if ($this->appendOnly) { $now = 0; - $missingIds = array(); + $missingIds = []; } else { $now = time(); $missingIds = $ids; - $ids = array(); + $ids = []; } - $values = array(); + $values = []; begin: foreach ($ids as $id) { @@ -124,7 +124,7 @@ trait PhpFilesTrait } $ids = $missingIds; - $missingIds = array(); + $missingIds = []; goto begin; } @@ -195,7 +195,7 @@ trait PhpFilesTrait $file = $this->files[$key] = $this->getFile($key, true); // Since OPcache only compiles files older than the script execution start, set the file's mtime in the past - $ok = $this->write($file, "<?php return array({$expiry}, {$value});\n", self::$startTime - 10) && $ok; + $ok = $this->write($file, "<?php return [{$expiry}, {$value}];\n", self::$startTime - 10) && $ok; if ($allowCompile) { @opcache_invalidate($file, true); @@ -215,7 +215,7 @@ trait PhpFilesTrait */ protected function doClear($namespace) { - $this->values = array(); + $this->values = []; return $this->doCommonClear($namespace); } diff --git a/vendor/symfony/cache/Traits/RedisTrait.php b/vendor/symfony/cache/Traits/RedisTrait.php index a7224d216f..0276c4fb6d 100644 --- a/vendor/symfony/cache/Traits/RedisTrait.php +++ b/vendor/symfony/cache/Traits/RedisTrait.php @@ -27,7 +27,7 @@ use Symfony\Component\Cache\Marshaller\MarshallerInterface; */ trait RedisTrait { - private static $defaultConnectionOptions = array( + private static $defaultConnectionOptions = [ 'class' => null, 'persistent' => 0, 'persistent_id' => null, @@ -40,7 +40,7 @@ trait RedisTrait 'redis_cluster' => false, 'dbindex' => 0, 'failover' => 'none', - ); + ]; private $redis; private $marshaller; @@ -78,7 +78,7 @@ trait RedisTrait * * @return \Redis|\RedisCluster|\Predis\Client According to the "class" option */ - public static function createConnection($dsn, array $options = array()) + public static function createConnection($dsn, array $options = []) { if (0 !== strpos($dsn, 'redis:')) { throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s does not start with "redis:".', $dsn)); @@ -100,7 +100,7 @@ trait RedisTrait throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s', $dsn)); } - $query = $hosts = array(); + $query = $hosts = []; if (isset($params['query'])) { parse_str($params['query'], $query); @@ -114,11 +114,11 @@ trait RedisTrait parse_str($parameters, $parameters); } if (false === $i = strrpos($host, ':')) { - $hosts[$host] = array('scheme' => 'tcp', 'host' => $host, 'port' => 6379) + $parameters; + $hosts[$host] = ['scheme' => 'tcp', 'host' => $host, 'port' => 6379] + $parameters; } elseif ($port = (int) substr($host, 1 + $i)) { - $hosts[$host] = array('scheme' => 'tcp', 'host' => substr($host, 0, $i), 'port' => $port) + $parameters; + $hosts[$host] = ['scheme' => 'tcp', 'host' => substr($host, 0, $i), 'port' => $port] + $parameters; } else { - $hosts[$host] = array('scheme' => 'unix', 'path' => substr($host, 0, $i)) + $parameters; + $hosts[$host] = ['scheme' => 'unix', 'path' => substr($host, 0, $i)] + $parameters; } } $hosts = array_values($hosts); @@ -132,9 +132,9 @@ trait RedisTrait } if (isset($params['host'])) { - array_unshift($hosts, array('scheme' => 'tcp', 'host' => $params['host'], 'port' => $params['port'] ?? 6379)); + array_unshift($hosts, ['scheme' => 'tcp', 'host' => $params['host'], 'port' => $params['port'] ?? 6379]); } else { - array_unshift($hosts, array('scheme' => 'unix', 'path' => $params['path'])); + array_unshift($hosts, ['scheme' => 'unix', 'path' => $params['path']]); } } @@ -156,7 +156,7 @@ trait RedisTrait $initializer = function ($redis) use ($connect, $params, $dsn, $auth, $hosts) { try { - @$redis->{$connect}($hosts[0]['host'], $hosts[0]['port'], $params['timeout'], (string) $params['persistent_id'], $params['retry_interval']); + @$redis->{$connect}($hosts[0]['host'] ?? $hosts[0]['path'], $hosts[0]['port'] ?? null, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval']); } catch (\RedisException $e) { throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s', $e->getMessage(), $dsn)); } @@ -243,13 +243,13 @@ trait RedisTrait if ($params['redis_cluster']) { $params['cluster'] = 'redis'; } - $params += array('parameters' => array()); - $params['parameters'] += array( + $params += ['parameters' => []]; + $params['parameters'] += [ 'persistent' => $params['persistent'], 'timeout' => $params['timeout'], 'read_write_timeout' => $params['read_timeout'], 'tcp_nodelay' => true, - ); + ]; if ($params['dbindex']) { $params['parameters']['database'] = $params['dbindex']; } @@ -258,9 +258,9 @@ trait RedisTrait } if (1 === \count($hosts) && !$params['redis_cluster']) { $hosts = $hosts[0]; - } elseif (\in_array($params['failover'], array('slaves', 'distribute'), true) && !isset($params['replication'])) { + } elseif (\in_array($params['failover'], ['slaves', 'distribute'], true) && !isset($params['replication'])) { $params['replication'] = true; - $hosts[0] += array('alias' => 'master'); + $hosts[0] += ['alias' => 'master']; } $redis = new $class($hosts, array_diff_key($params, self::$defaultConnectionOptions)); @@ -279,15 +279,15 @@ trait RedisTrait protected function doFetch(array $ids) { if (!$ids) { - return array(); + return []; } - $result = array(); + $result = []; if ($this->redis instanceof \Predis\Client) { $values = $this->pipeline(function () use ($ids) { foreach ($ids as $id) { - yield 'get' => array($id); + yield 'get' => [$id]; } }); } else { @@ -317,26 +317,26 @@ trait RedisTrait protected function doClear($namespace) { $cleared = true; - $hosts = array($this->redis); - $evalArgs = array(array($namespace), 0); + $hosts = [$this->redis]; + $evalArgs = [[$namespace], 0]; if ($this->redis instanceof \Predis\Client) { - $evalArgs = array(0, $namespace); + $evalArgs = [0, $namespace]; $connection = $this->redis->getConnection(); if ($connection instanceof ClusterInterface && $connection instanceof \Traversable) { - $hosts = array(); + $hosts = []; foreach ($connection as $c) { $hosts[] = new \Predis\Client($c); } } } elseif ($this->redis instanceof \RedisArray) { - $hosts = array(); + $hosts = []; foreach ($this->redis->_hosts() as $host) { $hosts[] = $this->redis->_instance($host); } } elseif ($this->redis instanceof RedisClusterProxy || $this->redis instanceof \RedisCluster) { - $hosts = array(); + $hosts = []; foreach ($this->redis->_masters() as $host) { $hosts[] = $h = new \Redis(); $h->connect($host[0], $host[1]); @@ -388,7 +388,7 @@ trait RedisTrait if ($this->redis instanceof \Predis\Client) { $this->pipeline(function () use ($ids) { foreach ($ids as $id) { - yield 'del' => array($id); + yield 'del' => [$id]; } })->rewind(); } else { @@ -410,9 +410,9 @@ trait RedisTrait $results = $this->pipeline(function () use ($values, $lifetime) { foreach ($values as $id => $value) { if (0 >= $lifetime) { - yield 'set' => array($id, $value); + yield 'set' => [$id, $value]; } else { - yield 'setEx' => array($id, $lifetime, $value); + yield 'setEx' => [$id, $lifetime, $value]; } } }); @@ -427,13 +427,13 @@ trait RedisTrait private function pipeline(\Closure $generator) { - $ids = array(); + $ids = []; if ($this->redis instanceof RedisClusterProxy || $this->redis instanceof \RedisCluster || ($this->redis instanceof \Predis\Client && $this->redis->getConnection() instanceof RedisCluster)) { // phpredis & predis don't support pipelining with RedisCluster // see https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#pipelining // see https://github.com/nrk/predis/issues/267#issuecomment-123781423 - $results = array(); + $results = []; foreach ($generator() as $command => $args) { $results[] = $this->redis->{$command}(...$args); $ids[] = $args[0]; @@ -446,14 +446,14 @@ trait RedisTrait } }); } elseif ($this->redis instanceof \RedisArray) { - $connections = $results = $ids = array(); + $connections = $results = $ids = []; foreach ($generator() as $command => $args) { if (!isset($connections[$h = $this->redis->_target($args[0])])) { - $connections[$h] = array($this->redis->_instance($h), -1); + $connections[$h] = [$this->redis->_instance($h), -1]; $connections[$h][0]->multi(\Redis::PIPELINE); } $connections[$h][0]->{$command}(...$args); - $results[] = array($h, ++$connections[$h][1]); + $results[] = [$h, ++$connections[$h][1]]; $ids[] = $args[0]; } foreach ($connections as $h => $c) { diff --git a/vendor/symfony/debug/BufferingLogger.php b/vendor/symfony/debug/BufferingLogger.php index a2ed75b9dc..e7db3a4ce4 100644 --- a/vendor/symfony/debug/BufferingLogger.php +++ b/vendor/symfony/debug/BufferingLogger.php @@ -20,17 +20,17 @@ use Psr\Log\AbstractLogger; */ class BufferingLogger extends AbstractLogger { - private $logs = array(); + private $logs = []; - public function log($level, $message, array $context = array()) + public function log($level, $message, array $context = []) { - $this->logs[] = array($level, $message, $context); + $this->logs[] = [$level, $message, $context]; } public function cleanLogs() { $logs = $this->logs; - $this->logs = array(); + $this->logs = []; return $logs; } diff --git a/vendor/symfony/debug/Debug.php b/vendor/symfony/debug/Debug.php index a31d71e6aa..5d2d55cf9f 100644 --- a/vendor/symfony/debug/Debug.php +++ b/vendor/symfony/debug/Debug.php @@ -42,7 +42,7 @@ class Debug error_reporting(E_ALL); } - if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) { + if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) { ini_set('display_errors', 0); ExceptionHandler::register(); } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) { diff --git a/vendor/symfony/debug/DebugClassLoader.php b/vendor/symfony/debug/DebugClassLoader.php index 19e80af78f..35f1f55bef 100644 --- a/vendor/symfony/debug/DebugClassLoader.php +++ b/vendor/symfony/debug/DebugClassLoader.php @@ -29,16 +29,16 @@ class DebugClassLoader { private $classLoader; private $isFinder; - private $loaded = array(); + private $loaded = []; private static $caseCheck; - private static $checkedClasses = array(); - private static $final = array(); - private static $finalMethods = array(); - private static $deprecated = array(); - private static $internal = array(); - private static $internalMethods = array(); - private static $annotatedParameters = array(); - private static $darwinCache = array('/' => array('/', array())); + private static $checkedClasses = []; + private static $final = []; + private static $finalMethods = []; + private static $deprecated = []; + private static $internal = []; + private static $internalMethods = []; + private static $annotatedParameters = []; + private static $darwinCache = ['/' => ['/', []]]; public function __construct(callable $classLoader) { @@ -98,7 +98,7 @@ class DebugClassLoader foreach ($functions as $function) { if (!\is_array($function) || !$function[0] instanceof self) { - $function = array(new static($function), 'loadClass'); + $function = [new static($function), 'loadClass']; } spl_autoload_register($function); @@ -128,6 +128,14 @@ class DebugClassLoader } /** + * @return string|null + */ + public function findFile($class) + { + return $this->isFinder ? $this->classLoader[0]->findFile($class) ?: null : null; + } + + /** * Loads the given class or interface. * * @param string $class The name of the class @@ -211,7 +219,7 @@ class DebugClassLoader public function checkAnnotations(\ReflectionClass $refl, $class) { - $deprecations = array(); + $deprecations = []; // Don't trigger deprecations for classes in the same vendor if (2 > $len = 1 + (\strpos($class, '\\') ?: \strpos($class, '_'))) { @@ -223,9 +231,9 @@ class DebugClassLoader // Detect annotations on the class if (false !== $doc = $refl->getDocComment()) { - foreach (array('final', 'deprecated', 'internal') as $annotation) { - if (false !== \strpos($doc, $annotation) && preg_match('#\n \* @'.$annotation.'(?:( .+?)\.?)?\r?\n \*(?: @|/$)#s', $doc, $notice)) { - self::${$annotation}[$class] = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; + foreach (['final', 'deprecated', 'internal'] as $annotation) { + if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) { + self::${$annotation}[$class] = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : ''; } } } @@ -265,11 +273,11 @@ class DebugClassLoader } // Inherit @final, @internal and @param annotations for methods - self::$finalMethods[$class] = array(); - self::$internalMethods[$class] = array(); - self::$annotatedParameters[$class] = array(); + self::$finalMethods[$class] = []; + self::$internalMethods[$class] = []; + self::$annotatedParameters[$class] = []; foreach ($parentAndOwnInterfaces as $use) { - foreach (array('finalMethods', 'internalMethods', 'annotatedParameters') as $property) { + foreach (['finalMethods', 'internalMethods', 'annotatedParameters'] as $property) { if (isset(self::${$property}[$use])) { self::${$property}[$class] = self::${$property}[$class] ? self::${$property}[$use] + self::${$property}[$class] : self::${$property}[$use]; } @@ -297,7 +305,7 @@ class DebugClassLoader $doc = $method->getDocComment(); if (isset(self::$annotatedParameters[$class][$method->name])) { - $definedParameters = array(); + $definedParameters = []; foreach ($method->getParameters() as $parameter) { $definedParameters[$parameter->name] = true; } @@ -315,10 +323,10 @@ class DebugClassLoader $finalOrInternal = false; - foreach (array('final', 'internal') as $annotation) { + foreach (['final', 'internal'] as $annotation) { if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) { - $message = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; - self::${$annotation.'Methods'}[$class][$method->name] = array($class, $message); + $message = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : ''; + self::${$annotation.'Methods'}[$class][$method->name] = [$class, $message]; $finalOrInternal = true; } } @@ -330,7 +338,7 @@ class DebugClassLoader continue; } if (!isset(self::$annotatedParameters[$class][$method->name])) { - $definedParameters = array(); + $definedParameters = []; foreach ($method->getParameters() as $parameter) { $definedParameters[$parameter->name] = true; } @@ -376,7 +384,7 @@ class DebugClassLoader if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true) && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false) ) { - return array(substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)); + return [substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)]; } } @@ -406,7 +414,7 @@ class DebugClassLoader $k = $kDir; $i = \strlen($dir) - 1; while (!isset(self::$darwinCache[$k])) { - self::$darwinCache[$k] = array($dir, array()); + self::$darwinCache[$k] = [$dir, []]; self::$darwinCache[$dir] = &self::$darwinCache[$k]; while ('/' !== $dir[--$i]) { diff --git a/vendor/symfony/debug/ErrorHandler.php b/vendor/symfony/debug/ErrorHandler.php index 2eb058ebe1..b47e402116 100644 --- a/vendor/symfony/debug/ErrorHandler.php +++ b/vendor/symfony/debug/ErrorHandler.php @@ -48,7 +48,7 @@ use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler; */ class ErrorHandler { - private $levels = array( + private $levels = [ E_DEPRECATED => 'Deprecated', E_USER_DEPRECATED => 'User Deprecated', E_NOTICE => 'Notice', @@ -64,25 +64,25 @@ class ErrorHandler E_PARSE => 'Parse Error', E_ERROR => 'Error', E_CORE_ERROR => 'Core Error', - ); + ]; - private $loggers = array( - E_DEPRECATED => array(null, LogLevel::INFO), - E_USER_DEPRECATED => array(null, LogLevel::INFO), - E_NOTICE => array(null, LogLevel::WARNING), - E_USER_NOTICE => array(null, LogLevel::WARNING), - E_STRICT => array(null, LogLevel::WARNING), - E_WARNING => array(null, LogLevel::WARNING), - E_USER_WARNING => array(null, LogLevel::WARNING), - E_COMPILE_WARNING => array(null, LogLevel::WARNING), - E_CORE_WARNING => array(null, LogLevel::WARNING), - E_USER_ERROR => array(null, LogLevel::CRITICAL), - E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL), - E_COMPILE_ERROR => array(null, LogLevel::CRITICAL), - E_PARSE => array(null, LogLevel::CRITICAL), - E_ERROR => array(null, LogLevel::CRITICAL), - E_CORE_ERROR => array(null, LogLevel::CRITICAL), - ); + private $loggers = [ + E_DEPRECATED => [null, LogLevel::INFO], + E_USER_DEPRECATED => [null, LogLevel::INFO], + E_NOTICE => [null, LogLevel::WARNING], + E_USER_NOTICE => [null, LogLevel::WARNING], + E_STRICT => [null, LogLevel::WARNING], + E_WARNING => [null, LogLevel::WARNING], + E_USER_WARNING => [null, LogLevel::WARNING], + E_COMPILE_WARNING => [null, LogLevel::WARNING], + E_CORE_WARNING => [null, LogLevel::WARNING], + E_USER_ERROR => [null, LogLevel::CRITICAL], + E_RECOVERABLE_ERROR => [null, LogLevel::CRITICAL], + E_COMPILE_ERROR => [null, LogLevel::CRITICAL], + E_PARSE => [null, LogLevel::CRITICAL], + E_ERROR => [null, LogLevel::CRITICAL], + E_CORE_ERROR => [null, LogLevel::CRITICAL], + ]; private $thrownErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED private $scopedErrors = 0x1FFF; // E_ALL - E_DEPRECATED - E_USER_DEPRECATED @@ -98,7 +98,7 @@ class ErrorHandler private static $reservedMemory; private static $toStringException = null; - private static $silencedErrorCache = array(); + private static $silencedErrorCache = []; private static $silencedErrorCount = 0; private static $exitCode = 0; @@ -121,10 +121,10 @@ class ErrorHandler $handler = new static(); } - if (null === $prev = set_error_handler(array($handler, 'handleError'))) { + if (null === $prev = set_error_handler([$handler, 'handleError'])) { restore_error_handler(); // Specifying the error types earlier would expose us to https://bugs.php.net/63206 - set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors); + set_error_handler([$handler, 'handleError'], $handler->thrownErrors | $handler->loggedErrors); $handler->isRoot = true; } @@ -138,12 +138,12 @@ class ErrorHandler } else { $handlerIsRegistered = true; } - if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) { + if (\is_array($prev = set_exception_handler([$handler, 'handleException'])) && $prev[0] instanceof self) { restore_exception_handler(); if (!$handlerIsRegistered) { $handler = $prev[0]; } elseif ($handler !== $prev[0] && $replace) { - set_exception_handler(array($handler, 'handleException')); + set_exception_handler([$handler, 'handleException']); $p = $prev[0]->setExceptionHandler(null); $handler->setExceptionHandler($p); $prev[0]->setExceptionHandler($p); @@ -176,12 +176,12 @@ class ErrorHandler */ public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $replace = false) { - $loggers = array(); + $loggers = []; if (\is_array($levels)) { foreach ($levels as $type => $logLevel) { if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) { - $loggers[$type] = array($logger, $logLevel); + $loggers[$type] = [$logger, $logLevel]; } } } else { @@ -212,14 +212,14 @@ class ErrorHandler { $prevLogged = $this->loggedErrors; $prev = $this->loggers; - $flush = array(); + $flush = []; foreach ($loggers as $type => $log) { if (!isset($prev[$type])) { throw new \InvalidArgumentException('Unknown error type: '.$type); } if (!\is_array($log)) { - $log = array($log); + $log = [$log]; } elseif (!array_key_exists(0, $log)) { throw new \InvalidArgumentException('No logger provided'); } @@ -356,9 +356,9 @@ class ErrorHandler if ($handler === $this) { restore_error_handler(); if ($this->isRoot) { - set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors); + set_error_handler([$this, 'handleError'], $this->thrownErrors | $this->loggedErrors); } else { - set_error_handler(array($this, 'handleError')); + set_error_handler([$this, 'handleError']); } } } @@ -395,9 +395,9 @@ class ErrorHandler $scope = $this->scopedErrors & $type; if (4 < $numArgs = \func_num_args()) { - $context = $scope ? (func_get_arg(4) ?: array()) : array(); + $context = $scope ? (func_get_arg(4) ?: []) : []; } else { - $context = array(); + $context = []; } if (isset($context['GLOBALS']) && $scope) { @@ -417,19 +417,19 @@ class ErrorHandler self::$toStringException = null; } elseif (!$throw && !($type & $level)) { if (!isset(self::$silencedErrorCache[$id = $file.':'.$line])) { - $lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 5), $type, $file, $line, false) : array(); - $errorAsException = new SilencedErrorContext($type, $file, $line, isset($lightTrace[1]) ? array($lightTrace[0]) : $lightTrace); + $lightTrace = $this->tracedErrors & $type ? $this->cleanTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 5), $type, $file, $line, false) : []; + $errorAsException = new SilencedErrorContext($type, $file, $line, isset($lightTrace[1]) ? [$lightTrace[0]] : $lightTrace); } elseif (isset(self::$silencedErrorCache[$id][$message])) { $lightTrace = null; $errorAsException = self::$silencedErrorCache[$id][$message]; ++$errorAsException->count; } else { - $lightTrace = array(); + $lightTrace = []; $errorAsException = null; } if (100 < ++self::$silencedErrorCount) { - self::$silencedErrorCache = $lightTrace = array(); + self::$silencedErrorCache = $lightTrace = []; self::$silencedErrorCount = 1; } if ($errorAsException) { @@ -446,8 +446,8 @@ class ErrorHandler $lightTrace = $this->cleanTrace($backtrace, $type, $file, $line, $throw); $this->traceReflector->setValue($errorAsException, $lightTrace); } else { - $this->traceReflector->setValue($errorAsException, array()); - $backtrace = array(); + $this->traceReflector->setValue($errorAsException, []); + $backtrace = []; } } @@ -493,9 +493,13 @@ class ErrorHandler try { $this->isRecursive = true; $level = ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG; - $this->loggers[$type][0]->log($level, $logMessage, $errorAsException ? array('exception' => $errorAsException) : array()); + $this->loggers[$type][0]->log($level, $logMessage, $errorAsException ? ['exception' => $errorAsException] : []); } finally { $this->isRecursive = false; + + if (!\defined('HHVM_VERSION')) { + set_error_handler([$this, __FUNCTION__]); + } } } @@ -527,12 +531,12 @@ class ErrorHandler } if ($exception instanceof FatalErrorException) { if ($exception instanceof FatalThrowableError) { - $error = array( + $error = [ 'type' => $type, 'message' => $message, 'file' => $exception->getFile(), 'line' => $exception->getLine(), - ); + ]; } else { $message = 'Fatal '.$message; } @@ -544,7 +548,7 @@ class ErrorHandler } if ($this->loggedErrors & $type) { try { - $this->loggers[$type][0]->log($this->loggers[$type][1], $message, array('exception' => $exception)); + $this->loggers[$type][0]->log($this->loggers[$type][1], $message, ['exception' => $exception]); } catch (\Throwable $handlerException) { } } @@ -586,7 +590,7 @@ class ErrorHandler } $handler = self::$reservedMemory = null; - $handlers = array(); + $handlers = []; $previousHandler = null; $sameHandlerLimit = 10; @@ -617,7 +621,7 @@ class ErrorHandler $handler[0]->setExceptionHandler($h); } $handler = $handler[0]; - $handlers = array(); + $handlers = []; if ($exit = null === $error) { $error = error_get_last(); @@ -661,11 +665,11 @@ class ErrorHandler */ protected function getFatalErrorHandlers() { - return array( + return [ new UndefinedFunctionFatalErrorHandler(), new UndefinedMethodFatalErrorHandler(), new ClassNotFoundFatalErrorHandler(), - ); + ]; } /** diff --git a/vendor/symfony/debug/Exception/FatalErrorException.php b/vendor/symfony/debug/Exception/FatalErrorException.php index 8305d39218..93880fbc32 100644 --- a/vendor/symfony/debug/Exception/FatalErrorException.php +++ b/vendor/symfony/debug/Exception/FatalErrorException.php @@ -61,7 +61,7 @@ class FatalErrorException extends \ErrorException unset($frame); $trace = array_reverse($trace); } else { - $trace = array(); + $trace = []; } $this->setTrace($trace); diff --git a/vendor/symfony/debug/Exception/FlattenException.php b/vendor/symfony/debug/Exception/FlattenException.php index f85522ce62..d016bb2fb4 100644 --- a/vendor/symfony/debug/Exception/FlattenException.php +++ b/vendor/symfony/debug/Exception/FlattenException.php @@ -33,12 +33,12 @@ class FlattenException private $file; private $line; - public static function create(\Exception $exception, $statusCode = null, array $headers = array()) + public static function create(\Exception $exception, $statusCode = null, array $headers = []) { return static::createFromThrowable($exception, $statusCode, $headers); } - public static function createFromThrowable(\Throwable $exception, ?int $statusCode = null, array $headers = array()): self + public static function createFromThrowable(\Throwable $exception, ?int $statusCode = null, array $headers = []): self { $e = new static(); $e->setMessage($exception->getMessage()); @@ -73,13 +73,13 @@ class FlattenException public function toArray() { - $exceptions = array(); - foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) { - $exceptions[] = array( + $exceptions = []; + foreach (array_merge([$this], $this->getAllPrevious()) as $exception) { + $exceptions[] = [ 'message' => $exception->getMessage(), 'class' => $exception->getClass(), 'trace' => $exception->getTrace(), - ); + ]; } return $exceptions; @@ -213,7 +213,7 @@ class FlattenException public function getAllPrevious() { - $exceptions = array(); + $exceptions = []; $e = $this; while ($e = $e->getPrevious()) { $exceptions[] = $e; @@ -247,8 +247,8 @@ class FlattenException */ public function setTrace($trace, $file, $line) { - $this->trace = array(); - $this->trace[] = array( + $this->trace = []; + $this->trace[] = [ 'namespace' => '', 'short_class' => '', 'class' => '', @@ -256,8 +256,8 @@ class FlattenException 'function' => '', 'file' => $file, 'line' => $line, - 'args' => array(), - ); + 'args' => [], + ]; foreach ($trace as $entry) { $class = ''; $namespace = ''; @@ -267,7 +267,7 @@ class FlattenException $namespace = implode('\\', $parts); } - $this->trace[] = array( + $this->trace[] = [ 'namespace' => $namespace, 'short_class' => $class, 'class' => isset($entry['class']) ? $entry['class'] : '', @@ -275,8 +275,8 @@ class FlattenException 'function' => isset($entry['function']) ? $entry['function'] : null, 'file' => isset($entry['file']) ? $entry['file'] : null, 'line' => isset($entry['line']) ? $entry['line'] : null, - 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(), - ); + 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : [], + ]; } return $this; @@ -284,34 +284,34 @@ class FlattenException private function flattenArgs($args, $level = 0, &$count = 0) { - $result = array(); + $result = []; foreach ($args as $key => $value) { if (++$count > 1e4) { - return array('array', '*SKIPPED over 10000 entries*'); + return ['array', '*SKIPPED over 10000 entries*']; } if ($value instanceof \__PHP_Incomplete_Class) { // is_object() returns false on PHP<=7.1 - $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value)); + $result[$key] = ['incomplete-object', $this->getClassNameFromIncomplete($value)]; } elseif (\is_object($value)) { - $result[$key] = array('object', \get_class($value)); + $result[$key] = ['object', \get_class($value)]; } elseif (\is_array($value)) { if ($level > 10) { - $result[$key] = array('array', '*DEEP NESTED ARRAY*'); + $result[$key] = ['array', '*DEEP NESTED ARRAY*']; } else { - $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count)); + $result[$key] = ['array', $this->flattenArgs($value, $level + 1, $count)]; } } elseif (null === $value) { - $result[$key] = array('null', null); + $result[$key] = ['null', null]; } elseif (\is_bool($value)) { - $result[$key] = array('boolean', $value); + $result[$key] = ['boolean', $value]; } elseif (\is_int($value)) { - $result[$key] = array('integer', $value); + $result[$key] = ['integer', $value]; } elseif (\is_float($value)) { - $result[$key] = array('float', $value); + $result[$key] = ['float', $value]; } elseif (\is_resource($value)) { - $result[$key] = array('resource', get_resource_type($value)); + $result[$key] = ['resource', get_resource_type($value)]; } else { - $result[$key] = array('string', (string) $value); + $result[$key] = ['string', (string) $value]; } } diff --git a/vendor/symfony/debug/Exception/SilencedErrorContext.php b/vendor/symfony/debug/Exception/SilencedErrorContext.php index 6f84617c46..236c56ed0e 100644 --- a/vendor/symfony/debug/Exception/SilencedErrorContext.php +++ b/vendor/symfony/debug/Exception/SilencedErrorContext.php @@ -25,7 +25,7 @@ class SilencedErrorContext implements \JsonSerializable private $line; private $trace; - public function __construct(int $severity, string $file, int $line, array $trace = array(), int $count = 1) + public function __construct(int $severity, string $file, int $line, array $trace = [], int $count = 1) { $this->severity = $severity; $this->file = $file; @@ -56,12 +56,12 @@ class SilencedErrorContext implements \JsonSerializable public function JsonSerialize() { - return array( + return [ 'severity' => $this->severity, 'file' => $this->file, 'line' => $this->line, 'trace' => $this->trace, 'count' => $this->count, - ); + ]; } } diff --git a/vendor/symfony/debug/ExceptionHandler.php b/vendor/symfony/debug/ExceptionHandler.php index 2483a57ab7..5457a0d792 100644 --- a/vendor/symfony/debug/ExceptionHandler.php +++ b/vendor/symfony/debug/ExceptionHandler.php @@ -56,10 +56,10 @@ class ExceptionHandler { $handler = new static($debug, $charset, $fileLinkFormat); - $prev = set_exception_handler(array($handler, 'handle')); + $prev = set_exception_handler([$handler, 'handle']); if (\is_array($prev) && $prev[0] instanceof ErrorHandler) { restore_exception_handler(); - $prev[0]->setExceptionHandler(array($handler, 'handle')); + $prev[0]->setExceptionHandler([$handler, 'handle']); } return $handler; @@ -378,7 +378,7 @@ EOF; if (\is_string($fmt)) { $i = strpos($f = $fmt, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f); - $fmt = array(substr($f, 0, $i)) + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); + $fmt = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); for ($i = 1; isset($fmt[$i]); ++$i) { if (0 === strpos($path, $k = $fmt[$i++])) { @@ -387,7 +387,7 @@ EOF; } } - $link = strtr($fmt[0], array('%f' => $path, '%l' => $line)); + $link = strtr($fmt[0], ['%f' => $path, '%l' => $line]); } else { $link = $fmt->format($path, $line); } @@ -404,7 +404,7 @@ EOF; */ private function formatArgs(array $args) { - $result = array(); + $result = []; foreach ($args as $key => $item) { if ('object' === $item[0]) { $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1])); diff --git a/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php index 4ccd16fe30..30c5665e60 100644 --- a/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php +++ b/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php @@ -40,7 +40,7 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface return; } - foreach (array('class', 'interface', 'trait') as $typeName) { + foreach (['class', 'interface', 'trait'] as $typeName) { $prefix = ucfirst($typeName).' \''; $prefixLen = \strlen($prefix); if (0 !== strpos($error['message'], $prefix)) { @@ -86,11 +86,11 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface private function getClassCandidates(string $class): array { if (!\is_array($functions = spl_autoload_functions())) { - return array(); + return []; } // find Symfony and Composer autoloaders - $classes = array(); + $classes = []; foreach ($functions as $function) { if (!\is_array($function)) { @@ -127,10 +127,10 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface private function findClassInPath(string $path, string $class, string $prefix): array { if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) { - return array(); + return []; } - $classes = array(); + $classes = []; $filename = $class.'.php'; foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) { @@ -143,9 +143,9 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface private function convertFileToClass(string $path, string $file, string $prefix): ?string { - $candidates = array( + $candidates = [ // namespaced class - $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file), + $namespacedClass = str_replace([$path.\DIRECTORY_SEPARATOR, '.php', '/'], ['', '', '\\'], $file), // namespaced class (with target dir) $prefix.$namespacedClass, // namespaced class (with target dir and separator) @@ -156,7 +156,7 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface str_replace('\\', '_', $prefix.$namespacedClass), // PEAR class (with target dir and separator) str_replace('\\', '_', $prefix.'\\'.$namespacedClass), - ); + ]; if ($prefix) { $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); }); diff --git a/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php index db24180377..9eddeba5a6 100644 --- a/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php +++ b/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php @@ -53,7 +53,7 @@ class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName); } - $candidates = array(); + $candidates = []; foreach (get_defined_functions() as $type => $definedFunctionNames) { foreach ($definedFunctionNames as $definedFunctionName) { if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) { diff --git a/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php index 618a2c208b..1318cb13ba 100644 --- a/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php +++ b/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php @@ -41,7 +41,7 @@ class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface return new UndefinedMethodException($message, $exception); } - $candidates = array(); + $candidates = []; foreach ($methods as $definedMethodName) { $lev = levenshtein($methodName, $definedMethodName); if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) { diff --git a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php index c7e03fbef8..fc68b86460 100644 --- a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php +++ b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php @@ -27,14 +27,14 @@ class DebugClassLoaderTest extends TestCase { $this->errorReporting = error_reporting(E_ALL); $this->loader = new ClassLoader(); - spl_autoload_register(array($this->loader, 'loadClass'), true, true); + spl_autoload_register([$this->loader, 'loadClass'], true, true); DebugClassLoader::enable(); } protected function tearDown() { DebugClassLoader::disable(); - spl_autoload_unregister(array($this->loader, 'loadClass')); + spl_autoload_unregister([$this->loader, 'loadClass']); error_reporting($this->errorReporting); } @@ -136,20 +136,20 @@ class DebugClassLoaderTest extends TestCase $lastError = error_get_last(); unset($lastError['file'], $lastError['line']); - $xError = array( + $xError = [ 'type' => E_USER_DEPRECATED, 'message' => 'The "Test\Symfony\Component\Debug\Tests\\'.$class.'" class '.$type.' "Symfony\Component\Debug\Tests\Fixtures\\'.$super.'" that is deprecated but this is a test deprecation notice.', - ); + ]; $this->assertSame($xError, $lastError); } public function provideDeprecatedSuper() { - return array( - array('DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'), - array('DeprecatedParentClass', 'DeprecatedClass', 'extends'), - ); + return [ + ['DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'], + ['DeprecatedParentClass', 'DeprecatedClass', 'extends'], + ]; } public function testInterfaceExtendsDeprecatedInterface() @@ -166,10 +166,10 @@ class DebugClassLoaderTest extends TestCase $lastError = error_get_last(); unset($lastError['file'], $lastError['line']); - $xError = array( + $xError = [ 'type' => E_USER_NOTICE, 'message' => '', - ); + ]; $this->assertSame($xError, $lastError); } @@ -188,39 +188,46 @@ class DebugClassLoaderTest extends TestCase $lastError = error_get_last(); unset($lastError['file'], $lastError['line']); - $xError = array( + $xError = [ 'type' => E_USER_NOTICE, 'message' => '', - ); + ]; $this->assertSame($xError, $lastError); } public function testExtendedFinalClass() { - set_error_handler(function () { return false; }); - $e = error_reporting(0); - trigger_error('', E_USER_NOTICE); + $deprecations = []; + set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); + $e = error_reporting(E_USER_DEPRECATED); + + require __DIR__.'/Fixtures/FinalClasses.php'; - class_exists('Test\\'.__NAMESPACE__.'\\ExtendsFinalClass', true); + $i = 1; + while(class_exists($finalClass = __NAMESPACE__.'\\Fixtures\\FinalClass'.$i++, false)) { + spl_autoload_call($finalClass); + class_exists('Test\\'.__NAMESPACE__.'\\Extends'.substr($finalClass, strrpos($finalClass, '\\') + 1), true); + } error_reporting($e); restore_error_handler(); - $lastError = error_get_last(); - unset($lastError['file'], $lastError['line']); - - $xError = array( - 'type' => E_USER_DEPRECATED, - 'message' => 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass".', - ); - - $this->assertSame($xError, $lastError); + $this->assertSame([ + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass1" class is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass1".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass2" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass2".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass3" class is considered final comment with @@@ and ***. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass3".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass4" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass4".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass5" class is considered final multiline comment. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass5".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass6" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass6".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass7" class is considered final another multiline comment... It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass7".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass8" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass8".', + ], $deprecations); } public function testExtendedFinalMethod() { - $deprecations = array(); + $deprecations = []; set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); $e = error_reporting(E_USER_DEPRECATED); @@ -229,10 +236,10 @@ class DebugClassLoaderTest extends TestCase error_reporting($e); restore_error_handler(); - $xError = array( + $xError = [ 'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".', 'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod2()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".', - ); + ]; $this->assertSame($xError, $deprecations); } @@ -251,12 +258,12 @@ class DebugClassLoaderTest extends TestCase $lastError = error_get_last(); unset($lastError['file'], $lastError['line']); - $this->assertSame(array('type' => E_USER_NOTICE, 'message' => ''), $lastError); + $this->assertSame(['type' => E_USER_NOTICE, 'message' => ''], $lastError); } public function testInternalsUse() { - $deprecations = array(); + $deprecations = []; set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); $e = error_reporting(E_USER_DEPRECATED); @@ -265,17 +272,17 @@ class DebugClassLoaderTest extends TestCase error_reporting($e); restore_error_handler(); - $this->assertSame($deprecations, array( + $this->assertSame($deprecations, [ 'The "Symfony\Component\Debug\Tests\Fixtures\InternalInterface" interface is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".', 'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass" class is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".', 'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait" trait is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".', 'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass::internalMethod()" method is considered internal. It may change without further notice. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".', - )); + ]); } public function testExtendedMethodDefinesNewParameters() { - $deprecations = array(); + $deprecations = []; set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); $e = error_reporting(E_USER_DEPRECATED); @@ -284,16 +291,16 @@ class DebugClassLoaderTest extends TestCase error_reporting($e); restore_error_handler(); - $this->assertSame(array( + $this->assertSame([ 'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::quzMethod()" method will require a new "Quz $quz" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\ClassWithAnnotatedParameters", not defining it is deprecated.', 'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::whereAmI()" method will require a new "bool $matrix" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\InterfaceWithAnnotatedParameters", not defining it is deprecated.', 'The "Symfony\Component\Debug\Tests\Fixtures\SubClassWithAnnotatedParameters::isSymfony()" method will require a new "true $yes" argument in the next major version of its parent class "Symfony\Component\Debug\Tests\Fixtures\ClassWithAnnotatedParameters", not defining it is deprecated.', - ), $deprecations); + ], $deprecations); } public function testUseTraitWithInternalMethod() { - $deprecations = array(); + $deprecations = []; set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); $e = error_reporting(E_USER_DEPRECATED); @@ -302,7 +309,7 @@ class DebugClassLoaderTest extends TestCase error_reporting($e); restore_error_handler(); - $this->assertSame(array(), $deprecations); + $this->assertSame([], $deprecations); } } @@ -314,7 +321,7 @@ class ClassLoader public function getClassMap() { - return array(__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php'); + return [__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php']; } public function findFile($class) @@ -343,8 +350,9 @@ class ClassLoader eval('namespace Test\\'.__NAMESPACE__.'; class NonDeprecatedInterfaceClass implements \\'.__NAMESPACE__.'\Fixtures\NonDeprecatedInterface {}'); } elseif ('Test\\'.__NAMESPACE__.'\Float' === $class) { eval('namespace Test\\'.__NAMESPACE__.'; class Float {}'); - } elseif ('Test\\'.__NAMESPACE__.'\ExtendsFinalClass' === $class) { - eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsFinalClass extends \\'.__NAMESPACE__.'\Fixtures\FinalClass {}'); + } elseif (0 === strpos($class, 'Test\\'.__NAMESPACE__.'\ExtendsFinalClass')) { + $classShortName = substr($class, strrpos($class, '\\') + 1); + eval('namespace Test\\'.__NAMESPACE__.'; class '.$classShortName.' extends \\'.__NAMESPACE__.'\Fixtures\\'.substr($classShortName, 7).' {}'); } elseif ('Test\\'.__NAMESPACE__.'\ExtendsAnnotatedClass' === $class) { eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsAnnotatedClass extends \\'.__NAMESPACE__.'\Fixtures\AnnotatedClass { public function deprecatedMethod() { } diff --git a/vendor/symfony/debug/Tests/ErrorHandlerTest.php b/vendor/symfony/debug/Tests/ErrorHandlerTest.php index 15e476381a..f320584055 100644 --- a/vendor/symfony/debug/Tests/ErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/ErrorHandlerTest.php @@ -12,10 +12,13 @@ namespace Symfony\Component\Debug\Tests; use PHPUnit\Framework\TestCase; +use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; +use Psr\Log\NullLogger; use Symfony\Component\Debug\BufferingLogger; use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\Debug\Exception\SilencedErrorContext; +use Symfony\Component\Debug\Tests\Fixtures\LoggerThatSetAnErrorHandler; /** * ErrorHandlerTest. @@ -38,13 +41,13 @@ class ErrorHandlerTest extends TestCase $this->assertSame($handler, ErrorHandler::register($newHandler, false)); $h = set_error_handler('var_dump'); restore_error_handler(); - $this->assertSame(array($handler, 'handleError'), $h); + $this->assertSame([$handler, 'handleError'], $h); try { $this->assertSame($newHandler, ErrorHandler::register($newHandler, true)); $h = set_error_handler('var_dump'); restore_error_handler(); - $this->assertSame(array($newHandler, 'handleError'), $h); + $this->assertSame([$newHandler, 'handleError'], $h); } catch (\Exception $e) { } @@ -74,12 +77,12 @@ class ErrorHandlerTest extends TestCase try { @trigger_error('Hello', E_USER_WARNING); - $expected = array( + $expected = [ 'type' => E_USER_WARNING, 'message' => 'Hello', 'file' => __FILE__, 'line' => __LINE__ - 5, - ); + ]; $this->assertSame($expected, error_get_last()); } catch (\Exception $e) { restore_error_handler(); @@ -145,26 +148,26 @@ class ErrorHandlerTest extends TestCase $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $handler->setDefaultLogger($logger, E_NOTICE); - $handler->setDefaultLogger($logger, array(E_USER_NOTICE => LogLevel::CRITICAL)); + $handler->setDefaultLogger($logger, [E_USER_NOTICE => LogLevel::CRITICAL]); - $loggers = array( - E_DEPRECATED => array(null, LogLevel::INFO), - E_USER_DEPRECATED => array(null, LogLevel::INFO), - E_NOTICE => array($logger, LogLevel::WARNING), - E_USER_NOTICE => array($logger, LogLevel::CRITICAL), - E_STRICT => array(null, LogLevel::WARNING), - E_WARNING => array(null, LogLevel::WARNING), - E_USER_WARNING => array(null, LogLevel::WARNING), - E_COMPILE_WARNING => array(null, LogLevel::WARNING), - E_CORE_WARNING => array(null, LogLevel::WARNING), - E_USER_ERROR => array(null, LogLevel::CRITICAL), - E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL), - E_COMPILE_ERROR => array(null, LogLevel::CRITICAL), - E_PARSE => array(null, LogLevel::CRITICAL), - E_ERROR => array(null, LogLevel::CRITICAL), - E_CORE_ERROR => array(null, LogLevel::CRITICAL), - ); - $this->assertSame($loggers, $handler->setLoggers(array())); + $loggers = [ + E_DEPRECATED => [null, LogLevel::INFO], + E_USER_DEPRECATED => [null, LogLevel::INFO], + E_NOTICE => [$logger, LogLevel::WARNING], + E_USER_NOTICE => [$logger, LogLevel::CRITICAL], + E_STRICT => [null, LogLevel::WARNING], + E_WARNING => [null, LogLevel::WARNING], + E_USER_WARNING => [null, LogLevel::WARNING], + E_COMPILE_WARNING => [null, LogLevel::WARNING], + E_CORE_WARNING => [null, LogLevel::WARNING], + E_USER_ERROR => [null, LogLevel::CRITICAL], + E_RECOVERABLE_ERROR => [null, LogLevel::CRITICAL], + E_COMPILE_ERROR => [null, LogLevel::CRITICAL], + E_PARSE => [null, LogLevel::CRITICAL], + E_ERROR => [null, LogLevel::CRITICAL], + E_CORE_ERROR => [null, LogLevel::CRITICAL], + ]; + $this->assertSame($loggers, $handler->setLoggers([])); } finally { restore_error_handler(); restore_exception_handler(); @@ -176,14 +179,14 @@ class ErrorHandlerTest extends TestCase try { $handler = ErrorHandler::register(); $handler->throwAt(0, true); - $this->assertFalse($handler->handleError(0, 'foo', 'foo.php', 12, array())); + $this->assertFalse($handler->handleError(0, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); $handler = ErrorHandler::register(); $handler->throwAt(3, true); - $this->assertFalse($handler->handleError(4, 'foo', 'foo.php', 12, array())); + $this->assertFalse($handler->handleError(4, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); @@ -191,7 +194,7 @@ class ErrorHandlerTest extends TestCase $handler = ErrorHandler::register(); $handler->throwAt(3, true); try { - $handler->handleError(4, 'foo', 'foo.php', 12, array()); + $handler->handleError(4, 'foo', 'foo.php', 12, []); } catch (\ErrorException $e) { $this->assertSame('Parse Error: foo', $e->getMessage()); $this->assertSame(4, $e->getSeverity()); @@ -204,14 +207,14 @@ class ErrorHandlerTest extends TestCase $handler = ErrorHandler::register(); $handler->throwAt(E_USER_DEPRECATED, true); - $this->assertFalse($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array())); + $this->assertFalse($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); $handler = ErrorHandler::register(); $handler->throwAt(E_DEPRECATED, true); - $this->assertFalse($handler->handleError(E_DEPRECATED, 'foo', 'foo.php', 12, array())); + $this->assertFalse($handler->handleError(E_DEPRECATED, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); @@ -236,7 +239,7 @@ class ErrorHandlerTest extends TestCase $handler = ErrorHandler::register(); $handler->setDefaultLogger($logger, E_USER_DEPRECATED); - $this->assertTrue($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, array())); + $this->assertTrue($handler->handleError(E_USER_DEPRECATED, 'foo', 'foo.php', 12, [])); restore_error_handler(); restore_exception_handler(); @@ -320,7 +323,9 @@ class ErrorHandlerTest extends TestCase $handler = new ErrorHandler(); $handler->setDefaultLogger($logger); - @$handler->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, array()); + @$handler->handleError(E_USER_DEPRECATED, 'Foo deprecation', __FILE__, __LINE__, []); + + restore_error_handler(); } public function testHandleException() @@ -369,27 +374,27 @@ class ErrorHandlerTest extends TestCase $bootLogger = new BufferingLogger(); $handler = new ErrorHandler($bootLogger); - $loggers = array( - E_DEPRECATED => array($bootLogger, LogLevel::INFO), - E_USER_DEPRECATED => array($bootLogger, LogLevel::INFO), - E_NOTICE => array($bootLogger, LogLevel::WARNING), - E_USER_NOTICE => array($bootLogger, LogLevel::WARNING), - E_STRICT => array($bootLogger, LogLevel::WARNING), - E_WARNING => array($bootLogger, LogLevel::WARNING), - E_USER_WARNING => array($bootLogger, LogLevel::WARNING), - E_COMPILE_WARNING => array($bootLogger, LogLevel::WARNING), - E_CORE_WARNING => array($bootLogger, LogLevel::WARNING), - E_USER_ERROR => array($bootLogger, LogLevel::CRITICAL), - E_RECOVERABLE_ERROR => array($bootLogger, LogLevel::CRITICAL), - E_COMPILE_ERROR => array($bootLogger, LogLevel::CRITICAL), - E_PARSE => array($bootLogger, LogLevel::CRITICAL), - E_ERROR => array($bootLogger, LogLevel::CRITICAL), - E_CORE_ERROR => array($bootLogger, LogLevel::CRITICAL), - ); + $loggers = [ + E_DEPRECATED => [$bootLogger, LogLevel::INFO], + E_USER_DEPRECATED => [$bootLogger, LogLevel::INFO], + E_NOTICE => [$bootLogger, LogLevel::WARNING], + E_USER_NOTICE => [$bootLogger, LogLevel::WARNING], + E_STRICT => [$bootLogger, LogLevel::WARNING], + E_WARNING => [$bootLogger, LogLevel::WARNING], + E_USER_WARNING => [$bootLogger, LogLevel::WARNING], + E_COMPILE_WARNING => [$bootLogger, LogLevel::WARNING], + E_CORE_WARNING => [$bootLogger, LogLevel::WARNING], + E_USER_ERROR => [$bootLogger, LogLevel::CRITICAL], + E_RECOVERABLE_ERROR => [$bootLogger, LogLevel::CRITICAL], + E_COMPILE_ERROR => [$bootLogger, LogLevel::CRITICAL], + E_PARSE => [$bootLogger, LogLevel::CRITICAL], + E_ERROR => [$bootLogger, LogLevel::CRITICAL], + E_CORE_ERROR => [$bootLogger, LogLevel::CRITICAL], + ]; - $this->assertSame($loggers, $handler->setLoggers(array())); + $this->assertSame($loggers, $handler->setLoggers([])); - $handler->handleError(E_DEPRECATED, 'Foo message', __FILE__, 123, array()); + $handler->handleError(E_DEPRECATED, 'Foo message', __FILE__, 123, []); $logs = $bootLogger->cleanLogs(); @@ -405,14 +410,14 @@ class ErrorHandlerTest extends TestCase $this->assertSame(123, $exception->getLine()); $this->assertSame(E_DEPRECATED, $exception->getSeverity()); - $bootLogger->log(LogLevel::WARNING, 'Foo message', array('exception' => $exception)); + $bootLogger->log(LogLevel::WARNING, 'Foo message', ['exception' => $exception]); $mockLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $mockLogger->expects($this->once()) ->method('log') - ->with(LogLevel::WARNING, 'Foo message', array('exception' => $exception)); + ->with(LogLevel::WARNING, 'Foo message', ['exception' => $exception]); - $handler->setLoggers(array(E_DEPRECATED => array($mockLogger, LogLevel::WARNING))); + $handler->setLoggers([E_DEPRECATED => [$mockLogger, LogLevel::WARNING]]); } public function testSettingLoggerWhenExceptionIsBuffered() @@ -425,7 +430,7 @@ class ErrorHandlerTest extends TestCase $mockLogger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $mockLogger->expects($this->once()) ->method('log') - ->with(LogLevel::CRITICAL, 'Uncaught Exception: Foo message', array('exception' => $exception)); + ->with(LogLevel::CRITICAL, 'Uncaught Exception: Foo message', ['exception' => $exception]); $handler->setExceptionHandler(function () use ($handler, $mockLogger) { $handler->setDefaultLogger($mockLogger); @@ -439,12 +444,12 @@ class ErrorHandlerTest extends TestCase try { $handler = ErrorHandler::register(); - $error = array( + $error = [ 'type' => E_PARSE, 'message' => 'foo', 'file' => 'bar', 'line' => 123, - ); + ]; $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); @@ -501,4 +506,43 @@ class ErrorHandlerTest extends TestCase $handler->handleException(new \Exception()); } + + /** + * @dataProvider errorHandlerIsNotLostWhenLoggingProvider + */ + public function testErrorHandlerIsNotLostWhenLogging($customErrorHandlerHasBeenPreviouslyDefined, LoggerInterface $logger) + { + try { + if ($customErrorHandlerHasBeenPreviouslyDefined) { + set_error_handler('count'); + } + + $handler = ErrorHandler::register(); + $handler->setDefaultLogger($logger); + + @trigger_error('foo', E_USER_DEPRECATED); + @trigger_error('bar', E_USER_DEPRECATED); + + $this->assertSame([$handler, 'handleError'], set_error_handler('var_dump')); + + restore_error_handler(); + + if ($customErrorHandlerHasBeenPreviouslyDefined) { + restore_error_handler(); + } + } finally { + restore_error_handler(); + restore_exception_handler(); + } + } + + public function errorHandlerIsNotLostWhenLoggingProvider() + { + return [ + [false, new NullLogger()], + [true, new NullLogger()], + [false, new LoggerThatSetAnErrorHandler()], + [true, new LoggerThatSetAnErrorHandler()], + ]; + } } diff --git a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php index 5b77b999a7..eb884b51c1 100644 --- a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php +++ b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php @@ -61,7 +61,7 @@ class FlattenExceptionTest extends TestCase $flattened = FlattenException::create(new ConflictHttpException()); $this->assertEquals('409', $flattened->getStatusCode()); - $flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST'))); + $flattened = FlattenException::create(new MethodNotAllowedHttpException(['POST'])); $this->assertEquals('405', $flattened->getStatusCode()); $flattened = FlattenException::create(new AccessDeniedHttpException()); @@ -96,23 +96,23 @@ class FlattenExceptionTest extends TestCase public function testHeadersForHttpException() { - $flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST'))); - $this->assertEquals(array('Allow' => 'POST'), $flattened->getHeaders()); + $flattened = FlattenException::create(new MethodNotAllowedHttpException(['POST'])); + $this->assertEquals(['Allow' => 'POST'], $flattened->getHeaders()); $flattened = FlattenException::create(new UnauthorizedHttpException('Basic realm="My Realm"')); - $this->assertEquals(array('WWW-Authenticate' => 'Basic realm="My Realm"'), $flattened->getHeaders()); + $this->assertEquals(['WWW-Authenticate' => 'Basic realm="My Realm"'], $flattened->getHeaders()); $flattened = FlattenException::create(new ServiceUnavailableHttpException('Fri, 31 Dec 1999 23:59:59 GMT')); - $this->assertEquals(array('Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'), $flattened->getHeaders()); + $this->assertEquals(['Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'], $flattened->getHeaders()); $flattened = FlattenException::create(new ServiceUnavailableHttpException(120)); - $this->assertEquals(array('Retry-After' => 120), $flattened->getHeaders()); + $this->assertEquals(['Retry-After' => 120], $flattened->getHeaders()); $flattened = FlattenException::create(new TooManyRequestsHttpException('Fri, 31 Dec 1999 23:59:59 GMT')); - $this->assertEquals(array('Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'), $flattened->getHeaders()); + $this->assertEquals(['Retry-After' => 'Fri, 31 Dec 1999 23:59:59 GMT'], $flattened->getHeaders()); $flattened = FlattenException::create(new TooManyRequestsHttpException(120)); - $this->assertEquals(array('Retry-After' => 120), $flattened->getHeaders()); + $this->assertEquals(['Retry-After' => 120], $flattened->getHeaders()); } /** @@ -162,7 +162,7 @@ class FlattenExceptionTest extends TestCase $this->assertSame($flattened2, $flattened->getPrevious()); - $this->assertSame(array($flattened2), $flattened->getAllPrevious()); + $this->assertSame([$flattened2], $flattened->getAllPrevious()); } public function testPreviousError() @@ -200,18 +200,18 @@ class FlattenExceptionTest extends TestCase public function testToArray(\Throwable $exception, string $expectedClass) { $flattened = FlattenException::createFromThrowable($exception); - $flattened->setTrace(array(), 'foo.php', 123); + $flattened->setTrace([], 'foo.php', 123); - $this->assertEquals(array( - array( + $this->assertEquals([ + [ 'message' => 'test', 'class' => $expectedClass, - 'trace' => array(array( + 'trace' => [[ 'namespace' => '', 'short_class' => '', 'class' => '', 'type' => '', 'function' => '', 'file' => 'foo.php', 'line' => 123, - 'args' => array(), - )), - ), - ), $flattened->toArray()); + 'args' => [], + ]], + ], + ], $flattened->toArray()); } public function testCreate() @@ -229,10 +229,10 @@ class FlattenExceptionTest extends TestCase public function flattenDataProvider() { - return array( - array(new \Exception('test', 123), 'Exception'), - array(new \Error('test', 123), 'Error'), - ); + return [ + [new \Exception('test', 123), 'Exception'], + [new \Error('test', 123), 'Error'], + ]; } public function testArguments() @@ -242,15 +242,15 @@ class FlattenExceptionTest extends TestCase $incomplete = unserialize('O:14:"BogusTestClass":0:{}'); - $exception = $this->createException(array( - (object) array('foo' => 1), + $exception = $this->createException([ + (object) ['foo' => 1], new NotFoundHttpException(), $incomplete, $dh, $fh, function () {}, - array(1, 2), - array('foo' => 123), + [1, 2], + ['foo' => 123], null, true, false, @@ -260,7 +260,7 @@ class FlattenExceptionTest extends TestCase '', INF, NAN, - )); + ]); $flattened = FlattenException::create($exception); $trace = $flattened->getTrace(); @@ -271,26 +271,26 @@ class FlattenExceptionTest extends TestCase fclose($fh); $i = 0; - $this->assertSame(array('object', 'stdClass'), $array[$i++]); - $this->assertSame(array('object', 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'), $array[$i++]); - $this->assertSame(array('incomplete-object', 'BogusTestClass'), $array[$i++]); - $this->assertSame(array('resource', 'stream'), $array[$i++]); - $this->assertSame(array('resource', 'stream'), $array[$i++]); + $this->assertSame(['object', 'stdClass'], $array[$i++]); + $this->assertSame(['object', 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'], $array[$i++]); + $this->assertSame(['incomplete-object', 'BogusTestClass'], $array[$i++]); + $this->assertSame(['resource', 'stream'], $array[$i++]); + $this->assertSame(['resource', 'stream'], $array[$i++]); $args = $array[$i++]; $this->assertSame($args[0], 'object'); $this->assertTrue('Closure' === $args[1] || is_subclass_of($args[1], '\Closure'), 'Expect object class name to be Closure or a subclass of Closure.'); - $this->assertSame(array('array', array(array('integer', 1), array('integer', 2))), $array[$i++]); - $this->assertSame(array('array', array('foo' => array('integer', 123))), $array[$i++]); - $this->assertSame(array('null', null), $array[$i++]); - $this->assertSame(array('boolean', true), $array[$i++]); - $this->assertSame(array('boolean', false), $array[$i++]); - $this->assertSame(array('integer', 0), $array[$i++]); - $this->assertSame(array('float', 0.0), $array[$i++]); - $this->assertSame(array('string', '0'), $array[$i++]); - $this->assertSame(array('string', ''), $array[$i++]); - $this->assertSame(array('float', INF), $array[$i++]); + $this->assertSame(['array', [['integer', 1], ['integer', 2]]], $array[$i++]); + $this->assertSame(['array', ['foo' => ['integer', 123]]], $array[$i++]); + $this->assertSame(['null', null], $array[$i++]); + $this->assertSame(['boolean', true], $array[$i++]); + $this->assertSame(['boolean', false], $array[$i++]); + $this->assertSame(['integer', 0], $array[$i++]); + $this->assertSame(['float', 0.0], $array[$i++]); + $this->assertSame(['string', '0'], $array[$i++]); + $this->assertSame(['string', ''], $array[$i++]); + $this->assertSame(['float', INF], $array[$i++]); // assertEquals() does not like NAN values. $this->assertEquals($array[$i][0], 'float'); @@ -300,7 +300,7 @@ class FlattenExceptionTest extends TestCase public function testRecursionInArguments() { $a = null; - $a = array('foo', array(2, &$a)); + $a = ['foo', [2, &$a]]; $exception = $this->createException($a); $flattened = FlattenException::create($exception); @@ -310,7 +310,7 @@ class FlattenExceptionTest extends TestCase public function testTooBigArray() { - $a = array(); + $a = []; for ($i = 0; $i < 20; ++$i) { for ($j = 0; $j < 50; ++$j) { for ($k = 0; $k < 10; ++$k) { @@ -325,7 +325,7 @@ class FlattenExceptionTest extends TestCase $flattened = FlattenException::create($exception); $trace = $flattened->getTrace(); - $this->assertSame($trace[1]['args'][0], array('array', array('array', '*SKIPPED over 10000 entries*'))); + $this->assertSame($trace[1]['args'][0], ['array', ['array', '*SKIPPED over 10000 entries*']]); $serializeTrace = serialize($trace); diff --git a/vendor/symfony/debug/Tests/ExceptionHandlerTest.php b/vendor/symfony/debug/Tests/ExceptionHandlerTest.php index 6ff6a74f4f..e166136cbb 100644 --- a/vendor/symfony/debug/Tests/ExceptionHandlerTest.php +++ b/vendor/symfony/debug/Tests/ExceptionHandlerTest.php @@ -62,10 +62,10 @@ class ExceptionHandlerTest extends TestCase $this->assertContains('Sorry, the page you are looking for could not be found.', $response); - $expectedHeaders = array( - array('HTTP/1.0 404', true, null), - array('Content-Type: text/html; charset=iso8859-1', true, null), - ); + $expectedHeaders = [ + ['HTTP/1.0 404', true, null], + ['Content-Type: text/html; charset=iso8859-1', true, null], + ]; $this->assertSame($expectedHeaders, testHeader()); } @@ -75,14 +75,14 @@ class ExceptionHandlerTest extends TestCase $handler = new ExceptionHandler(false, 'iso8859-1'); ob_start(); - $handler->sendPhpResponse(new MethodNotAllowedHttpException(array('POST'))); + $handler->sendPhpResponse(new MethodNotAllowedHttpException(['POST'])); $response = ob_get_clean(); - $expectedHeaders = array( - array('HTTP/1.0 405', true, null), - array('Allow: POST', false, null), - array('Content-Type: text/html; charset=iso8859-1', true, null), - ); + $expectedHeaders = [ + ['HTTP/1.0 405', true, null], + ['Allow: POST', false, null], + ['Content-Type: text/html; charset=iso8859-1', true, null], + ]; $this->assertSame($expectedHeaders, testHeader()); } @@ -101,7 +101,7 @@ class ExceptionHandlerTest extends TestCase { $exception = new \Exception('foo'); - $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(array('sendPhpResponse'))->getMock(); + $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(['sendPhpResponse'])->getMock(); $handler ->expects($this->exactly(2)) ->method('sendPhpResponse'); @@ -119,7 +119,7 @@ class ExceptionHandlerTest extends TestCase { $exception = new OutOfMemoryException('foo', 0, E_ERROR, __FILE__, __LINE__); - $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(array('sendPhpResponse'))->getMock(); + $handler = $this->getMockBuilder('Symfony\Component\Debug\ExceptionHandler')->setMethods(['sendPhpResponse'])->getMock(); $handler ->expects($this->once()) ->method('sendPhpResponse'); diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php index 5cdac2f12a..8e615ac640 100644 --- a/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php @@ -72,85 +72,85 @@ class ClassNotFoundFatalErrorHandlerTest extends TestCase $autoloader = new ComposerClassLoader(); $autoloader->add('Symfony\Component\Debug\Exception\\', realpath(__DIR__.'/../../Exception')); - $debugClassLoader = new DebugClassLoader(array($autoloader, 'loadClass')); + $debugClassLoader = new DebugClassLoader([$autoloader, 'loadClass']); - return array( - array( - array( + return [ + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'WhizBangFactory\' not found', - ), + ], "Attempted to load class \"WhizBangFactory\" from the global namespace.\nDid you forget a \"use\" statement?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\WhizBangFactory\' not found', - ), + ], "Attempted to load class \"WhizBangFactory\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'UndefinedFunctionException\' not found', - ), + ], "Attempted to load class \"UndefinedFunctionException\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'PEARClass\' not found', - ), + ], "Attempted to load class \"PEARClass\" from the global namespace.\nDid you forget a \"use\" statement for \"Symfony_Component_Debug_Tests_Fixtures_PEARClass\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', - ), + ], "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', - ), + ], "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", - array($autoloader, 'loadClass'), - ), - array( - array( + [$autoloader, 'loadClass'], + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', - ), + ], "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\Bar\".\nDid you forget a \"use\" statement for \"Symfony\Component\Debug\Exception\UndefinedFunctionException\"?", - array($debugClassLoader, 'loadClass'), - ), - array( - array( + [$debugClassLoader, 'loadClass'], + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found', - ), + ], "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?", function ($className) { /* do nothing here */ }, - ), - ); + ], + ]; } public function testCannotRedeclareClass() @@ -161,12 +161,12 @@ class ClassNotFoundFatalErrorHandlerTest extends TestCase require_once __DIR__.'/../FIXTURES2/REQUIREDTWICE.PHP'; - $error = array( + $error = [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\RequiredTwice\' not found', - ); + ]; $handler = new ClassNotFoundFatalErrorHandler(); $exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line'])); diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php index 60153fc5ec..de9994e447 100644 --- a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php @@ -35,44 +35,44 @@ class UndefinedFunctionFatalErrorHandlerTest extends TestCase public function provideUndefinedFunctionData() { - return array( - array( - array( + return [ + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined function test_namespaced_function()', - ), + ], "Attempted to call function \"test_namespaced_function\" from the global namespace.\nDid you mean to call \"\\symfony\\component\\debug\\tests\\fatalerrorhandler\\test_namespaced_function\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined function Foo\\Bar\\Baz\\test_namespaced_function()', - ), + ], "Attempted to call function \"test_namespaced_function\" from namespace \"Foo\\Bar\\Baz\".\nDid you mean to call \"\\symfony\\component\\debug\\tests\\fatalerrorhandler\\test_namespaced_function\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined function foo()', - ), + ], 'Attempted to call function "foo" from the global namespace.', - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined function Foo\\Bar\\Baz\\foo()', - ), + ], 'Attempted to call function "foo" from namespace "Foo\Bar\Baz".', - ), - ); + ], + ]; } } diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php index a2647f57f2..268a841351 100644 --- a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php @@ -34,43 +34,43 @@ class UndefinedMethodFatalErrorHandlerTest extends TestCase public function provideUndefinedMethodData() { - return array( - array( - array( + return [ + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined method SplObjectStorage::what()', - ), + ], 'Attempted to call an undefined method named "what" of class "SplObjectStorage".', - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined method SplObjectStorage::walid()', - ), + ], "Attempted to call an undefined method named \"walid\" of class \"SplObjectStorage\".\nDid you mean to call \"valid\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Call to undefined method SplObjectStorage::offsetFet()', - ), + ], "Attempted to call an undefined method named \"offsetFet\" of class \"SplObjectStorage\".\nDid you mean to call e.g. \"offsetGet\", \"offsetSet\" or \"offsetUnset\"?", - ), - array( - array( + ], + [ + [ 'type' => 1, 'message' => 'Call to undefined method class@anonymous::test()', 'file' => '/home/possum/work/symfony/test.php', 'line' => 11, - ), + ], 'Attempted to call an undefined method named "test" of class "class@anonymous".', - ), - ); + ], + ]; } } diff --git a/vendor/symfony/debug/Tests/Fixtures/FinalClass.php b/vendor/symfony/debug/Tests/Fixtures/FinalClass.php deleted file mode 100644 index f4c69b8532..0000000000 --- a/vendor/symfony/debug/Tests/Fixtures/FinalClass.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace Symfony\Component\Debug\Tests\Fixtures; - -/** - * @final - */ -class FinalClass -{ -} diff --git a/vendor/symfony/debug/Tests/Fixtures/FinalClasses.php b/vendor/symfony/debug/Tests/Fixtures/FinalClasses.php new file mode 100644 index 0000000000..0f51f9f46f --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/FinalClasses.php @@ -0,0 +1,84 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +/** + * @final since version 3.3. + */ +class FinalClass1 +{ + // simple comment +} + +/** + * @final + */ +class FinalClass2 +{ + // no comment +} + +/** + * @final comment with @@@ and *** + * + * @author John Doe + */ +class FinalClass3 +{ + // with comment and a tag after +} + +/** + * @final + * @author John Doe + */ +class FinalClass4 +{ + // without comment and a tag after +} + +/** + * @author John Doe + * + * + * @final multiline + * comment + */ +class FinalClass5 +{ + // with comment and a tag before +} + +/** + * @author John Doe + * + * @final + */ +class FinalClass6 +{ + // without comment and a tag before +} + +/** + * @author John Doe + * + * @final another + * + * multiline comment... + * + * @return string + */ +class FinalClass7 +{ + // with comment and a tag before and after +} + +/** + * @author John Doe + * @final + * @return string + */ +class FinalClass8 +{ + // without comment and a tag before and after +} diff --git a/vendor/symfony/debug/Tests/Fixtures/LoggerThatSetAnErrorHandler.php b/vendor/symfony/debug/Tests/Fixtures/LoggerThatSetAnErrorHandler.php new file mode 100644 index 0000000000..7545039cf8 --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/LoggerThatSetAnErrorHandler.php @@ -0,0 +1,14 @@ +<?php + +namespace Symfony\Component\Debug\Tests\Fixtures; + +use Psr\Log\AbstractLogger; + +class LoggerThatSetAnErrorHandler extends AbstractLogger +{ + public function log($level, $message, array $context = []) + { + set_error_handler('is_string'); + restore_error_handler(); + } +} diff --git a/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php b/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php index 40a5fb7f8c..24ac8926d2 100644 --- a/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php +++ b/vendor/symfony/debug/Tests/Fixtures/ToStringThrower.php @@ -18,7 +18,7 @@ class ToStringThrower } catch (\Exception $e) { // Using user_error() here is on purpose so we do not forget // that this alias also should work alongside with trigger_error(). - return user_error($e, E_USER_ERROR); + return trigger_error($e, E_USER_ERROR); } } } diff --git a/vendor/symfony/debug/Tests/HeaderMock.php b/vendor/symfony/debug/Tests/HeaderMock.php index 3d8d84c5a4..d7564db485 100644 --- a/vendor/symfony/debug/Tests/HeaderMock.php +++ b/vendor/symfony/debug/Tests/HeaderMock.php @@ -25,11 +25,11 @@ namespace Symfony\Component\Debug\Tests; function testHeader() { - static $headers = array(); + static $headers = []; if (!$h = \func_get_args()) { $h = $headers; - $headers = array(); + $headers = []; return $h; } diff --git a/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt b/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt index 3f45595430..b743d93ad7 100644 --- a/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt +++ b/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt @@ -14,7 +14,7 @@ require $vendor.'/vendor/autoload.php'; if (true) { class TestLogger extends \Psr\Log\AbstractLogger { - public function log($level, $message, array $context = array()) + public function log($level, $message, array $context = []) { echo $message, "\n"; } diff --git a/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt b/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt index 2b74e5c685..b3f0e0eb09 100644 --- a/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt +++ b/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt @@ -17,9 +17,9 @@ ini_set('display_errors', 0); $eHandler = set_error_handler('var_dump'); $xHandler = set_exception_handler('var_dump'); -var_dump(array( +var_dump([ $eHandler[0] === $xHandler[0] ? 'Error and exception handlers do match' : 'Error and exception handlers are different', -)); +]); $eHandler[0]->setExceptionHandler('print_r'); diff --git a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php index d421941fc2..513d87c7e8 100644 --- a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php +++ b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php @@ -39,8 +39,8 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface $this->dispatcher = $dispatcher; $this->stopwatch = $stopwatch; $this->logger = $logger; - $this->wrappedListeners = array(); - $this->orphanedEvents = array(); + $this->wrappedListeners = []; + $this->orphanedEvents = []; } /** @@ -164,10 +164,10 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface public function getCalledListeners() { if (null === $this->callStack) { - return array(); + return []; } - $called = array(); + $called = []; foreach ($this->callStack as $listener) { list($eventName) = $this->callStack->getInfo(); @@ -186,14 +186,14 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface $allListeners = $this->getListeners(); } catch (\Exception $e) { if (null !== $this->logger) { - $this->logger->info('An exception was thrown while getting the uncalled listeners.', array('exception' => $e)); + $this->logger->info('An exception was thrown while getting the uncalled listeners.', ['exception' => $e]); } // unable to retrieve the uncalled listeners - return array(); + return []; } - $notCalled = array(); + $notCalled = []; foreach ($allListeners as $eventName => $listeners) { foreach ($listeners as $listener) { $called = false; @@ -216,7 +216,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface } } - uasort($notCalled, array($this, 'sortNotCalledListeners')); + uasort($notCalled, [$this, 'sortNotCalledListeners']); return $notCalled; } @@ -229,7 +229,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface public function reset() { $this->callStack = null; - $this->orphanedEvents = array(); + $this->orphanedEvents = []; } /** @@ -279,7 +279,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface $this->wrappedListeners[$eventName][] = $wrappedListener; $this->dispatcher->removeListener($eventName, $listener); $this->dispatcher->addListener($eventName, $wrappedListener, $priority); - $this->callStack->attach($wrappedListener, array($eventName)); + $this->callStack->attach($wrappedListener, [$eventName]); } } @@ -297,7 +297,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface $this->dispatcher->addListener($eventName, $listener->getWrappedListener(), $priority); if (null !== $this->logger) { - $context = array('event' => $eventName, 'listener' => $listener->getPretty()); + $context = ['event' => $eventName, 'listener' => $listener->getPretty()]; } if ($listener->wasCalled()) { diff --git a/vendor/symfony/event-dispatcher/Debug/WrappedListener.php b/vendor/symfony/event-dispatcher/Debug/WrappedListener.php index 6acaa38ef8..5c9249de28 100644 --- a/vendor/symfony/event-dispatcher/Debug/WrappedListener.php +++ b/vendor/symfony/event-dispatcher/Debug/WrappedListener.php @@ -94,12 +94,12 @@ class WrappedListener $this->stub = self::$hasClassStub ? new ClassStub($this->pretty.'()', $this->listener) : $this->pretty.'()'; } - return array( + return [ 'event' => $eventName, 'priority' => null !== $this->dispatcher ? $this->dispatcher->getListenerPriority($eventName, $this->listener) : null, 'pretty' => $this->pretty, 'stub' => $this->stub, - ); + ]; } public function __invoke(Event $event, $eventName, EventDispatcherInterface $dispatcher) diff --git a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php index 4c8db4c695..674890aa53 100644 --- a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php +++ b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php @@ -28,7 +28,7 @@ class RegisterListenersPass implements CompilerPassInterface protected $listenerTag; protected $subscriberTag; - private $hotPathEvents = array(); + private $hotPathEvents = []; private $hotPathTagName; public function __construct(string $dispatcherService = 'event_dispatcher', string $listenerTag = 'kernel.event_listener', string $subscriberTag = 'kernel.event_subscriber') @@ -63,10 +63,10 @@ class RegisterListenersPass implements CompilerPassInterface } if (!isset($event['method'])) { - $event['method'] = 'on'.preg_replace_callback(array( + $event['method'] = 'on'.preg_replace_callback([ '/(?<=\b)[a-z]/i', '/[^a-z0-9]/i', - ), function ($matches) { return strtoupper($matches[0]); }, $event['event']); + ], function ($matches) { return strtoupper($matches[0]); }, $event['event']); $event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']); if (null !== ($class = $container->getDefinition($id)->getClass()) && ($r = $container->getReflectionClass($class, false)) && !$r->hasMethod($event['method']) && $r->hasMethod('__invoke')) { @@ -74,7 +74,7 @@ class RegisterListenersPass implements CompilerPassInterface } } - $definition->addMethodCall('addListener', array($event['event'], array(new ServiceClosureArgument(new Reference($id)), $event['method']), $priority)); + $definition->addMethodCall('addListener', [$event['event'], [new ServiceClosureArgument(new Reference($id)), $event['method']], $priority]); if (isset($this->hotPathEvents[$event['event']])) { $container->getDefinition($id)->addTag($this->hotPathTagName); @@ -101,14 +101,14 @@ class RegisterListenersPass implements CompilerPassInterface ExtractingEventDispatcher::$subscriber = $class; $extractingDispatcher->addSubscriber($extractingDispatcher); foreach ($extractingDispatcher->listeners as $args) { - $args[1] = array(new ServiceClosureArgument(new Reference($id)), $args[1]); + $args[1] = [new ServiceClosureArgument(new Reference($id)), $args[1]]; $definition->addMethodCall('addListener', $args); if (isset($this->hotPathEvents[$args[0]])) { $container->getDefinition($id)->addTag('container.hot_path'); } } - $extractingDispatcher->listeners = array(); + $extractingDispatcher->listeners = []; } } } @@ -118,18 +118,18 @@ class RegisterListenersPass implements CompilerPassInterface */ class ExtractingEventDispatcher extends EventDispatcher implements EventSubscriberInterface { - public $listeners = array(); + public $listeners = []; public static $subscriber; public function addListener($eventName, $listener, $priority = 0) { - $this->listeners[] = array($eventName, $listener[1], $priority); + $this->listeners[] = [$eventName, $listener[1], $priority]; } public static function getSubscribedEvents() { - $callback = array(self::$subscriber, 'getSubscribedEvents'); + $callback = [self::$subscriber, 'getSubscribedEvents']; return $callback(); } diff --git a/vendor/symfony/event-dispatcher/EventDispatcher.php b/vendor/symfony/event-dispatcher/EventDispatcher.php index 4c90ce5bd5..afc443b283 100644 --- a/vendor/symfony/event-dispatcher/EventDispatcher.php +++ b/vendor/symfony/event-dispatcher/EventDispatcher.php @@ -28,8 +28,8 @@ namespace Symfony\Component\EventDispatcher; */ class EventDispatcher implements EventDispatcherInterface { - private $listeners = array(); - private $sorted = array(); + private $listeners = []; + private $sorted = []; /** * {@inheritdoc} @@ -54,7 +54,7 @@ class EventDispatcher implements EventDispatcherInterface { if (null !== $eventName) { if (empty($this->listeners[$eventName])) { - return array(); + return []; } if (!isset($this->sorted[$eventName])) { @@ -166,12 +166,12 @@ class EventDispatcher implements EventDispatcherInterface { foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { if (\is_string($params)) { - $this->addListener($eventName, array($subscriber, $params)); + $this->addListener($eventName, [$subscriber, $params]); } elseif (\is_string($params[0])) { - $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0); + $this->addListener($eventName, [$subscriber, $params[0]], isset($params[1]) ? $params[1] : 0); } else { foreach ($params as $listener) { - $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0); + $this->addListener($eventName, [$subscriber, $listener[0]], isset($listener[1]) ? $listener[1] : 0); } } } @@ -185,10 +185,10 @@ class EventDispatcher implements EventDispatcherInterface foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { if (\is_array($params) && \is_array($params[0])) { foreach ($params as $listener) { - $this->removeListener($eventName, array($subscriber, $listener[0])); + $this->removeListener($eventName, [$subscriber, $listener[0]]); } } else { - $this->removeListener($eventName, array($subscriber, \is_string($params) ? $params : $params[0])); + $this->removeListener($eventName, [$subscriber, \is_string($params) ? $params : $params[0]]); } } } @@ -221,7 +221,7 @@ class EventDispatcher implements EventDispatcherInterface private function sortListeners($eventName) { krsort($this->listeners[$eventName]); - $this->sorted[$eventName] = array(); + $this->sorted[$eventName] = []; foreach ($this->listeners[$eventName] as $priority => $listeners) { foreach ($listeners as $k => $listener) { diff --git a/vendor/symfony/event-dispatcher/EventSubscriberInterface.php b/vendor/symfony/event-dispatcher/EventSubscriberInterface.php index 6e1976b86a..824f21599c 100644 --- a/vendor/symfony/event-dispatcher/EventSubscriberInterface.php +++ b/vendor/symfony/event-dispatcher/EventSubscriberInterface.php @@ -36,9 +36,9 @@ interface EventSubscriberInterface * * For instance: * - * * array('eventName' => 'methodName') - * * array('eventName' => array('methodName', $priority)) - * * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) + * * ['eventName' => 'methodName'] + * * ['eventName' => ['methodName', $priority]] + * * ['eventName' => [['methodName1', $priority], ['methodName2']]] * * @return array The event names to listen to */ diff --git a/vendor/symfony/event-dispatcher/GenericEvent.php b/vendor/symfony/event-dispatcher/GenericEvent.php index f0be7e18ff..a9a0a5dfa5 100644 --- a/vendor/symfony/event-dispatcher/GenericEvent.php +++ b/vendor/symfony/event-dispatcher/GenericEvent.php @@ -29,7 +29,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate * @param mixed $subject The subject of the event, usually an object or a callable * @param array $arguments Arguments to store in the event */ - public function __construct($subject = null, array $arguments = array()) + public function __construct($subject = null, array $arguments = []) { $this->subject = $subject; $this->arguments = $arguments; @@ -95,7 +95,7 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate * * @return $this */ - public function setArguments(array $args = array()) + public function setArguments(array $args = []) { $this->arguments = $args; diff --git a/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php index 6d377d11fe..b157659dc0 100644 --- a/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php +++ b/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php @@ -47,15 +47,15 @@ abstract class AbstractEventDispatcherTest extends TestCase public function testInitialState() { - $this->assertEquals(array(), $this->dispatcher->getListeners()); + $this->assertEquals([], $this->dispatcher->getListeners()); $this->assertFalse($this->dispatcher->hasListeners(self::preFoo)); $this->assertFalse($this->dispatcher->hasListeners(self::postFoo)); } public function testAddListener() { - $this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo')); - $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo')); + $this->dispatcher->addListener('pre.foo', [$this->listener, 'preFoo']); + $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo']); $this->assertTrue($this->dispatcher->hasListeners()); $this->assertTrue($this->dispatcher->hasListeners(self::preFoo)); $this->assertTrue($this->dispatcher->hasListeners(self::postFoo)); @@ -73,15 +73,15 @@ abstract class AbstractEventDispatcherTest extends TestCase $listener2->name = '2'; $listener3->name = '3'; - $this->dispatcher->addListener('pre.foo', array($listener1, 'preFoo'), -10); - $this->dispatcher->addListener('pre.foo', array($listener2, 'preFoo'), 10); - $this->dispatcher->addListener('pre.foo', array($listener3, 'preFoo')); + $this->dispatcher->addListener('pre.foo', [$listener1, 'preFoo'], -10); + $this->dispatcher->addListener('pre.foo', [$listener2, 'preFoo'], 10); + $this->dispatcher->addListener('pre.foo', [$listener3, 'preFoo']); - $expected = array( - array($listener2, 'preFoo'), - array($listener3, 'preFoo'), - array($listener1, 'preFoo'), - ); + $expected = [ + [$listener2, 'preFoo'], + [$listener3, 'preFoo'], + [$listener1, 'preFoo'], + ]; $this->assertSame($expected, $this->dispatcher->getListeners('pre.foo')); } @@ -102,10 +102,10 @@ abstract class AbstractEventDispatcherTest extends TestCase $this->dispatcher->addListener('post.foo', $listener5); $this->dispatcher->addListener('post.foo', $listener6, 10); - $expected = array( - 'pre.foo' => array($listener3, $listener2, $listener1), - 'post.foo' => array($listener6, $listener5, $listener4), - ); + $expected = [ + 'pre.foo' => [$listener3, $listener2, $listener1], + 'post.foo' => [$listener6, $listener5, $listener4], + ]; $this->assertSame($expected, $this->dispatcher->getListeners()); } @@ -126,8 +126,8 @@ abstract class AbstractEventDispatcherTest extends TestCase public function testDispatch() { - $this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo')); - $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo')); + $this->dispatcher->addListener('pre.foo', [$this->listener, 'preFoo']); + $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo']); $this->dispatcher->dispatch(self::preFoo); $this->assertTrue($this->listener->preFooInvoked); $this->assertFalse($this->listener->postFooInvoked); @@ -157,8 +157,8 @@ abstract class AbstractEventDispatcherTest extends TestCase // postFoo() stops the propagation, so only one listener should // be executed // Manually set priority to enforce $this->listener to be called first - $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'), 10); - $this->dispatcher->addListener('post.foo', array($otherListener, 'postFoo')); + $this->dispatcher->addListener('post.foo', [$this->listener, 'postFoo'], 10); + $this->dispatcher->addListener('post.foo', [$otherListener, 'postFoo']); $this->dispatcher->dispatch(self::postFoo); $this->assertTrue($this->listener->postFooInvoked); $this->assertFalse($otherListener->postFooInvoked); @@ -166,7 +166,7 @@ abstract class AbstractEventDispatcherTest extends TestCase public function testDispatchByPriority() { - $invoked = array(); + $invoked = []; $listener1 = function () use (&$invoked) { $invoked[] = '1'; }; @@ -180,7 +180,7 @@ abstract class AbstractEventDispatcherTest extends TestCase $this->dispatcher->addListener('pre.foo', $listener2); $this->dispatcher->addListener('pre.foo', $listener3, 10); $this->dispatcher->dispatch(self::preFoo); - $this->assertEquals(array('3', '2', '1'), $invoked); + $this->assertEquals(['3', '2', '1'], $invoked); } public function testRemoveListener() @@ -258,7 +258,7 @@ abstract class AbstractEventDispatcherTest extends TestCase public function testEventReceivesTheDispatcherInstanceAsArgument() { $listener = new TestWithDispatcher(); - $this->dispatcher->addListener('test', array($listener, 'foo')); + $this->dispatcher->addListener('test', [$listener, 'foo']); $this->assertNull($listener->name); $this->assertNull($listener->dispatcher); $this->dispatcher->dispatch('test'); @@ -295,7 +295,7 @@ abstract class AbstractEventDispatcherTest extends TestCase $listener = function () {}; $this->dispatcher->addListener('foo', $listener); $this->dispatcher->removeListener('foo', $listener); - $this->assertSame(array(), $this->dispatcher->getListeners()); + $this->assertSame([], $this->dispatcher->getListeners()); } public function testHasListenersWithoutEventsReturnsFalseAfterHasListenersWithEventHasBeenCalled() @@ -307,7 +307,7 @@ abstract class AbstractEventDispatcherTest extends TestCase public function testHasListenersIsLazy() { $called = 0; - $listener = array(function () use (&$called) { ++$called; }, 'onFoo'); + $listener = [function () use (&$called) { ++$called; }, 'onFoo']; $this->dispatcher->addListener('foo', $listener); $this->assertTrue($this->dispatcher->hasListeners()); $this->assertTrue($this->dispatcher->hasListeners('foo')); @@ -322,7 +322,7 @@ abstract class AbstractEventDispatcherTest extends TestCase return new TestWithDispatcher(); }; - $this->dispatcher->addListener('foo', array($factory, 'foo')); + $this->dispatcher->addListener('foo', [$factory, 'foo']); $this->assertSame(0, $called); $this->dispatcher->dispatch('foo', new Event()); $this->dispatcher->dispatch('foo', new Event()); @@ -334,14 +334,14 @@ abstract class AbstractEventDispatcherTest extends TestCase $test = new TestWithDispatcher(); $factory = function () use ($test) { return $test; }; - $this->dispatcher->addListener('foo', array($factory, 'foo')); + $this->dispatcher->addListener('foo', [$factory, 'foo']); $this->assertTrue($this->dispatcher->hasListeners('foo')); - $this->dispatcher->removeListener('foo', array($test, 'foo')); + $this->dispatcher->removeListener('foo', [$test, 'foo']); $this->assertFalse($this->dispatcher->hasListeners('foo')); - $this->dispatcher->addListener('foo', array($test, 'foo')); + $this->dispatcher->addListener('foo', [$test, 'foo']); $this->assertTrue($this->dispatcher->hasListeners('foo')); - $this->dispatcher->removeListener('foo', array($factory, 'foo')); + $this->dispatcher->removeListener('foo', [$factory, 'foo']); $this->assertFalse($this->dispatcher->hasListeners('foo')); } @@ -350,12 +350,12 @@ abstract class AbstractEventDispatcherTest extends TestCase $test = new TestWithDispatcher(); $factory = function () use ($test) { return $test; }; - $this->dispatcher->addListener('foo', array($factory, 'foo'), 3); - $this->assertSame(3, $this->dispatcher->getListenerPriority('foo', array($test, 'foo'))); - $this->dispatcher->removeListener('foo', array($factory, 'foo')); + $this->dispatcher->addListener('foo', [$factory, 'foo'], 3); + $this->assertSame(3, $this->dispatcher->getListenerPriority('foo', [$test, 'foo'])); + $this->dispatcher->removeListener('foo', [$factory, 'foo']); - $this->dispatcher->addListener('foo', array($test, 'foo'), 5); - $this->assertSame(5, $this->dispatcher->getListenerPriority('foo', array($factory, 'foo'))); + $this->dispatcher->addListener('foo', [$test, 'foo'], 5); + $this->assertSame(5, $this->dispatcher->getListenerPriority('foo', [$factory, 'foo'])); } public function testGetLazyListeners() @@ -363,12 +363,12 @@ abstract class AbstractEventDispatcherTest extends TestCase $test = new TestWithDispatcher(); $factory = function () use ($test) { return $test; }; - $this->dispatcher->addListener('foo', array($factory, 'foo'), 3); - $this->assertSame(array(array($test, 'foo')), $this->dispatcher->getListeners('foo')); + $this->dispatcher->addListener('foo', [$factory, 'foo'], 3); + $this->assertSame([[$test, 'foo']], $this->dispatcher->getListeners('foo')); - $this->dispatcher->removeListener('foo', array($test, 'foo')); - $this->dispatcher->addListener('bar', array($factory, 'foo'), 3); - $this->assertSame(array('bar' => array(array($test, 'foo'))), $this->dispatcher->getListeners()); + $this->dispatcher->removeListener('foo', [$test, 'foo']); + $this->dispatcher->addListener('bar', [$factory, 'foo'], 3); + $this->assertSame(['bar' => [[$test, 'foo']]], $this->dispatcher->getListeners()); } } @@ -415,7 +415,7 @@ class TestEventSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents() { - return array('pre.foo' => 'preFoo', 'post.foo' => 'postFoo'); + return ['pre.foo' => 'preFoo', 'post.foo' => 'postFoo']; } } @@ -423,10 +423,10 @@ class TestEventSubscriberWithPriorities implements EventSubscriberInterface { public static function getSubscribedEvents() { - return array( - 'pre.foo' => array('preFoo', 10), - 'post.foo' => array('postFoo'), - ); + return [ + 'pre.foo' => ['preFoo', 10], + 'post.foo' => ['postFoo'], + ]; } } @@ -434,9 +434,9 @@ class TestEventSubscriberWithMultipleListeners implements EventSubscriberInterfa { public static function getSubscribedEvents() { - return array('pre.foo' => array( - array('preFoo1'), - array('preFoo2', 10), - )); + return ['pre.foo' => [ + ['preFoo1'], + ['preFoo2', 10], + ]]; } } diff --git a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php index 0a2b32794d..9a3697a36f 100644 --- a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php +++ b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php @@ -98,7 +98,7 @@ class TraceableEventDispatcherTest extends TestCase $tdispatcher->addSubscriber($subscriber); $listeners = $dispatcher->getListeners('foo'); $this->assertCount(1, $listeners); - $this->assertSame(array($subscriber, 'call'), $listeners[0]); + $this->assertSame([$subscriber, 'call'], $listeners[0]); $tdispatcher->removeSubscriber($subscriber); $this->assertCount(0, $dispatcher->getListeners('foo')); @@ -112,16 +112,16 @@ class TraceableEventDispatcherTest extends TestCase $listeners = $tdispatcher->getNotCalledListeners(); $this->assertArrayHasKey('stub', $listeners[0]); unset($listeners[0]['stub']); - $this->assertEquals(array(), $tdispatcher->getCalledListeners()); - $this->assertEquals(array(array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); + $this->assertEquals([], $tdispatcher->getCalledListeners()); + $this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners); $tdispatcher->dispatch('foo'); $listeners = $tdispatcher->getCalledListeners(); $this->assertArrayHasKey('stub', $listeners[0]); unset($listeners[0]['stub']); - $this->assertEquals(array(array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); - $this->assertEquals(array(), $tdispatcher->getNotCalledListeners()); + $this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners); + $this->assertEquals([], $tdispatcher->getNotCalledListeners()); } public function testClearCalledListeners() @@ -135,8 +135,8 @@ class TraceableEventDispatcherTest extends TestCase $listeners = $tdispatcher->getNotCalledListeners(); $this->assertArrayHasKey('stub', $listeners[0]); unset($listeners[0]['stub']); - $this->assertEquals(array(), $tdispatcher->getCalledListeners()); - $this->assertEquals(array(array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners); + $this->assertEquals([], $tdispatcher->getCalledListeners()); + $this->assertEquals([['event' => 'foo', 'pretty' => 'closure', 'priority' => 5]], $listeners); } public function testDispatchAfterReset() @@ -178,7 +178,7 @@ class TraceableEventDispatcherTest extends TestCase $tdispatcher->dispatch('foo'); $events = $tdispatcher->getOrphanedEvents(); $this->assertCount(1, $events); - $this->assertEquals(array('foo'), $events); + $this->assertEquals(['foo'], $events); } public function testItDoesNotReturnHandledEvents() @@ -199,8 +199,8 @@ class TraceableEventDispatcherTest extends TestCase $tdispatcher->addListener('foo', $listener1 = function () {}); $tdispatcher->addListener('foo', $listener2 = function () {}); - $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure')); - $logger->expects($this->at(1))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure')); + $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']); + $logger->expects($this->at(1))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']); $tdispatcher->dispatch('foo'); } @@ -214,16 +214,16 @@ class TraceableEventDispatcherTest extends TestCase $tdispatcher->addListener('foo', $listener1 = function (Event $event) { $event->stopPropagation(); }); $tdispatcher->addListener('foo', $listener2 = function () {}); - $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', array('event' => 'foo', 'listener' => 'closure')); - $logger->expects($this->at(1))->method('debug')->with('Listener "{listener}" stopped propagation of the event "{event}".', array('event' => 'foo', 'listener' => 'closure')); - $logger->expects($this->at(2))->method('debug')->with('Listener "{listener}" was not called for event "{event}".', array('event' => 'foo', 'listener' => 'closure')); + $logger->expects($this->at(0))->method('debug')->with('Notified event "{event}" to listener "{listener}".', ['event' => 'foo', 'listener' => 'closure']); + $logger->expects($this->at(1))->method('debug')->with('Listener "{listener}" stopped propagation of the event "{event}".', ['event' => 'foo', 'listener' => 'closure']); + $logger->expects($this->at(2))->method('debug')->with('Listener "{listener}" was not called for event "{event}".', ['event' => 'foo', 'listener' => 'closure']); $tdispatcher->dispatch('foo'); } public function testDispatchCallListeners() { - $called = array(); + $called = []; $dispatcher = new EventDispatcher(); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); @@ -232,7 +232,7 @@ class TraceableEventDispatcherTest extends TestCase $tdispatcher->dispatch('foo'); - $this->assertSame(array('foo2', 'foo1'), $called); + $this->assertSame(['foo2', 'foo1'], $called); } public function testDispatchNested() @@ -300,6 +300,6 @@ class EventSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents() { - return array('foo' => 'call'); + return ['foo' => 'call']; } } diff --git a/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php b/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php index 3847a1553c..56792fe33a 100644 --- a/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php +++ b/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php @@ -30,16 +30,16 @@ class WrappedListenerTest extends TestCase public function provideListenersToDescribe() { - return array( - array(new FooListener(), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::__invoke'), - array(array(new FooListener(), 'listen'), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'), - array(array('Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic'), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'), - array('var_dump', 'var_dump'), - array(function () {}, 'closure'), - array(\Closure::fromCallable(array(new FooListener(), 'listen')), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'), - array(\Closure::fromCallable(array('Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic')), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'), - array(\Closure::fromCallable(function () {}), 'closure'), - ); + return [ + [new FooListener(), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::__invoke'], + [[new FooListener(), 'listen'], 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'], + [['Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic'], 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'], + ['var_dump', 'var_dump'], + [function () {}, 'closure'], + [\Closure::fromCallable([new FooListener(), 'listen']), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'], + [\Closure::fromCallable(['Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic']), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'], + [\Closure::fromCallable(function () {}), 'closure'], + ]; } } diff --git a/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php b/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php index a359bd7ec5..d665f426e0 100644 --- a/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php +++ b/vendor/symfony/event-dispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php @@ -38,9 +38,9 @@ class RegisterListenersPassTest extends TestCase public function testValidEventSubscriber() { - $services = array( - 'my_event_subscriber' => array(0 => array()), - ); + $services = [ + 'my_event_subscriber' => [0 => []], + ]; $builder = new ContainerBuilder(); $eventDispatcherDefinition = $builder->register('event_dispatcher'); @@ -50,16 +50,16 @@ class RegisterListenersPassTest extends TestCase $registerListenersPass = new RegisterListenersPass(); $registerListenersPass->process($builder); - $expectedCalls = array( - array( + $expectedCalls = [ + [ 'addListener', - array( + [ 'event', - array(new ServiceClosureArgument(new Reference('my_event_subscriber')), 'onEvent'), + [new ServiceClosureArgument(new Reference('my_event_subscriber')), 'onEvent'], 0, - ), - ), - ); + ], + ], + ]; $this->assertEquals($expectedCalls, $eventDispatcherDefinition->getMethodCalls()); } @@ -70,7 +70,7 @@ class RegisterListenersPassTest extends TestCase public function testAbstractEventListener() { $container = new ContainerBuilder(); - $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_listener', array()); + $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_listener', []); $container->register('event_dispatcher', 'stdClass'); $registerListenersPass = new RegisterListenersPass(); @@ -84,7 +84,7 @@ class RegisterListenersPassTest extends TestCase public function testAbstractEventSubscriber() { $container = new ContainerBuilder(); - $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_subscriber', array()); + $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_subscriber', []); $container->register('event_dispatcher', 'stdClass'); $registerListenersPass = new RegisterListenersPass(); @@ -96,23 +96,23 @@ class RegisterListenersPassTest extends TestCase $container = new ContainerBuilder(); $container->setParameter('subscriber.class', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService'); - $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', array()); + $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', []); $container->register('event_dispatcher', 'stdClass'); $registerListenersPass = new RegisterListenersPass(); $registerListenersPass->process($container); $definition = $container->getDefinition('event_dispatcher'); - $expectedCalls = array( - array( + $expectedCalls = [ + [ 'addListener', - array( + [ 'event', - array(new ServiceClosureArgument(new Reference('foo')), 'onEvent'), + [new ServiceClosureArgument(new Reference('foo')), 'onEvent'], 0, - ), - ), - ); + ], + ], + ]; $this->assertEquals($expectedCalls, $definition->getMethodCalls()); } @@ -120,10 +120,10 @@ class RegisterListenersPassTest extends TestCase { $container = new ContainerBuilder(); - $container->register('foo', SubscriberService::class)->addTag('kernel.event_subscriber', array()); + $container->register('foo', SubscriberService::class)->addTag('kernel.event_subscriber', []); $container->register('event_dispatcher', 'stdClass'); - (new RegisterListenersPass())->setHotPathEvents(array('event'))->process($container); + (new RegisterListenersPass())->setHotPathEvents(['event'])->process($container); $this->assertTrue($container->getDefinition('foo')->hasTag('container.hot_path')); } @@ -135,7 +135,7 @@ class RegisterListenersPassTest extends TestCase public function testEventSubscriberUnresolvableClassName() { $container = new ContainerBuilder(); - $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', array()); + $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', []); $container->register('event_dispatcher', 'stdClass'); $registerListenersPass = new RegisterListenersPass(); @@ -145,41 +145,41 @@ class RegisterListenersPassTest extends TestCase public function testInvokableEventListener() { $container = new ContainerBuilder(); - $container->register('foo', \stdClass::class)->addTag('kernel.event_listener', array('event' => 'foo.bar')); - $container->register('bar', InvokableListenerService::class)->addTag('kernel.event_listener', array('event' => 'foo.bar')); - $container->register('baz', InvokableListenerService::class)->addTag('kernel.event_listener', array('event' => 'event')); + $container->register('foo', \stdClass::class)->addTag('kernel.event_listener', ['event' => 'foo.bar']); + $container->register('bar', InvokableListenerService::class)->addTag('kernel.event_listener', ['event' => 'foo.bar']); + $container->register('baz', InvokableListenerService::class)->addTag('kernel.event_listener', ['event' => 'event']); $container->register('event_dispatcher', \stdClass::class); $registerListenersPass = new RegisterListenersPass(); $registerListenersPass->process($container); $definition = $container->getDefinition('event_dispatcher'); - $expectedCalls = array( - array( + $expectedCalls = [ + [ 'addListener', - array( + [ 'foo.bar', - array(new ServiceClosureArgument(new Reference('foo')), 'onFooBar'), + [new ServiceClosureArgument(new Reference('foo')), 'onFooBar'], 0, - ), - ), - array( + ], + ], + [ 'addListener', - array( + [ 'foo.bar', - array(new ServiceClosureArgument(new Reference('bar')), '__invoke'), + [new ServiceClosureArgument(new Reference('bar')), '__invoke'], 0, - ), - ), - array( + ], + ], + [ 'addListener', - array( + [ 'event', - array(new ServiceClosureArgument(new Reference('baz')), 'onEvent'), + [new ServiceClosureArgument(new Reference('baz')), 'onEvent'], 0, - ), - ), - ); + ], + ], + ]; $this->assertEquals($expectedCalls, $definition->getMethodCalls()); } } @@ -188,9 +188,9 @@ class SubscriberService implements \Symfony\Component\EventDispatcher\EventSubsc { public static function getSubscribedEvents() { - return array( + return [ 'event' => 'onEvent', - ); + ]; } } diff --git a/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php b/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php index b63f69df14..461f86161e 100644 --- a/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php +++ b/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php @@ -32,7 +32,7 @@ class GenericEventTest extends TestCase protected function setUp() { $this->subject = new \stdClass(); - $this->event = new GenericEvent($this->subject, array('name' => 'Event')); + $this->event = new GenericEvent($this->subject, ['name' => 'Event']); } /** @@ -46,7 +46,7 @@ class GenericEventTest extends TestCase public function testConstruct() { - $this->assertEquals($this->event, new GenericEvent($this->subject, array('name' => 'Event'))); + $this->assertEquals($this->event, new GenericEvent($this->subject, ['name' => 'Event'])); } /** @@ -55,20 +55,20 @@ class GenericEventTest extends TestCase public function testGetArguments() { // test getting all - $this->assertSame(array('name' => 'Event'), $this->event->getArguments()); + $this->assertSame(['name' => 'Event'], $this->event->getArguments()); } public function testSetArguments() { - $result = $this->event->setArguments(array('foo' => 'bar')); - $this->assertAttributeSame(array('foo' => 'bar'), 'arguments', $this->event); + $result = $this->event->setArguments(['foo' => 'bar']); + $this->assertAttributeSame(['foo' => 'bar'], 'arguments', $this->event); $this->assertSame($this->event, $result); } public function testSetArgument() { $result = $this->event->setArgument('foo2', 'bar2'); - $this->assertAttributeSame(array('name' => 'Event', 'foo2' => 'bar2'), 'arguments', $this->event); + $this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event); $this->assertEquals($this->event, $result); } @@ -99,13 +99,13 @@ class GenericEventTest extends TestCase public function testOffsetSet() { $this->event['foo2'] = 'bar2'; - $this->assertAttributeSame(array('name' => 'Event', 'foo2' => 'bar2'), 'arguments', $this->event); + $this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event); } public function testOffsetUnset() { unset($this->event['name']); - $this->assertAttributeSame(array(), 'arguments', $this->event); + $this->assertAttributeSame([], 'arguments', $this->event); } public function testOffsetIsset() @@ -127,10 +127,10 @@ class GenericEventTest extends TestCase public function testHasIterator() { - $data = array(); + $data = []; foreach ($this->event as $key => $value) { $data[$key] = $value; } - $this->assertEquals(array('name' => 'Event'), $data); + $this->assertEquals(['name' => 'Event'], $data); } } diff --git a/vendor/symfony/expression-language/Compiler.php b/vendor/symfony/expression-language/Compiler.php index 23222d40e9..604f04c6f0 100644 --- a/vendor/symfony/expression-language/Compiler.php +++ b/vendor/symfony/expression-language/Compiler.php @@ -127,7 +127,7 @@ class Compiler implements ResetInterface } elseif (\is_bool($value)) { $this->raw($value ? 'true' : 'false'); } elseif (\is_array($value)) { - $this->raw('array('); + $this->raw('['); $first = true; foreach ($value as $key => $value) { if (!$first) { @@ -138,7 +138,7 @@ class Compiler implements ResetInterface $this->raw(' => '); $this->repr($value); } - $this->raw(')'); + $this->raw(']'); } else { $this->string($value); } diff --git a/vendor/symfony/expression-language/ExpressionLanguage.php b/vendor/symfony/expression-language/ExpressionLanguage.php index 851fe00157..51a01689a6 100644 --- a/vendor/symfony/expression-language/ExpressionLanguage.php +++ b/vendor/symfony/expression-language/ExpressionLanguage.php @@ -26,13 +26,13 @@ class ExpressionLanguage private $parser; private $compiler; - protected $functions = array(); + protected $functions = []; /** * @param CacheItemPoolInterface $cache * @param ExpressionFunctionProviderInterface[] $providers */ - public function __construct(CacheItemPoolInterface $cache = null, array $providers = array()) + public function __construct(CacheItemPoolInterface $cache = null, array $providers = []) { $this->cache = $cache ?: new ArrayAdapter(); $this->registerFunctions(); @@ -49,7 +49,7 @@ class ExpressionLanguage * * @return string The compiled PHP source code */ - public function compile($expression, $names = array()) + public function compile($expression, $names = []) { return $this->getCompiler()->compile($this->parse($expression, $names)->getNodes())->getSource(); } @@ -62,7 +62,7 @@ class ExpressionLanguage * * @return mixed The result of the evaluation of the expression */ - public function evaluate($expression, $values = array()) + public function evaluate($expression, $values = []) { return $this->parse($expression, array_keys($values))->getNodes()->evaluate($this->functions, $values); } @@ -82,7 +82,7 @@ class ExpressionLanguage } asort($names); - $cacheKeyItems = array(); + $cacheKeyItems = []; foreach ($names as $nameKey => $name) { $cacheKeyItems[] = \is_int($nameKey) ? $name : $nameKey.':'.$name; @@ -118,7 +118,7 @@ class ExpressionLanguage throw new \LogicException('Registering functions after calling evaluate(), compile() or parse() is not supported.'); } - $this->functions[$name] = array('compiler' => $compiler, 'evaluator' => $evaluator); + $this->functions[$name] = ['compiler' => $compiler, 'evaluator' => $evaluator]; } public function addFunction(ExpressionFunction $function) diff --git a/vendor/symfony/expression-language/Lexer.php b/vendor/symfony/expression-language/Lexer.php index bd54e8913a..48b15ffe7c 100644 --- a/vendor/symfony/expression-language/Lexer.php +++ b/vendor/symfony/expression-language/Lexer.php @@ -29,10 +29,10 @@ class Lexer */ public function tokenize($expression) { - $expression = str_replace(array("\r", "\n", "\t", "\v", "\f"), ' ', $expression); + $expression = str_replace(["\r", "\n", "\t", "\v", "\f"], ' ', $expression); $cursor = 0; - $tokens = array(); - $brackets = array(); + $tokens = []; + $brackets = []; $end = \strlen($expression); while ($cursor < $end) { @@ -52,7 +52,7 @@ class Lexer $cursor += \strlen($match[0]); } elseif (false !== strpos('([{', $expression[$cursor])) { // opening bracket - $brackets[] = array($expression[$cursor], $cursor); + $brackets[] = [$expression[$cursor], $cursor]; $tokens[] = new Token(Token::PUNCTUATION_TYPE, $expression[$cursor], $cursor + 1); ++$cursor; diff --git a/vendor/symfony/expression-language/Node/ArgumentsNode.php b/vendor/symfony/expression-language/Node/ArgumentsNode.php index 1c78d8054b..e9849a448a 100644 --- a/vendor/symfony/expression-language/Node/ArgumentsNode.php +++ b/vendor/symfony/expression-language/Node/ArgumentsNode.php @@ -27,7 +27,7 @@ class ArgumentsNode extends ArrayNode public function toArray() { - $array = array(); + $array = []; foreach ($this->getKeyValuePairs() as $pair) { $array[] = $pair['value']; diff --git a/vendor/symfony/expression-language/Node/ArrayNode.php b/vendor/symfony/expression-language/Node/ArrayNode.php index e1a2f2e904..921319a744 100644 --- a/vendor/symfony/expression-language/Node/ArrayNode.php +++ b/vendor/symfony/expression-language/Node/ArrayNode.php @@ -41,14 +41,14 @@ class ArrayNode extends Node */ public function compile(Compiler $compiler) { - $compiler->raw('array('); + $compiler->raw('['); $this->compileArguments($compiler); - $compiler->raw(')'); + $compiler->raw(']'); } public function evaluate($functions, $values) { - $result = array(); + $result = []; foreach ($this->getKeyValuePairs() as $pair) { $result[$pair['key']->evaluate($functions, $values)] = $pair['value']->evaluate($functions, $values); } @@ -58,12 +58,12 @@ class ArrayNode extends Node public function toArray() { - $value = array(); + $value = []; foreach ($this->getKeyValuePairs() as $pair) { $value[$pair['key']->attributes['value']] = $pair['value']; } - $array = array(); + $array = []; if ($this->isHash($value)) { foreach ($value as $k => $v) { @@ -88,9 +88,9 @@ class ArrayNode extends Node protected function getKeyValuePairs() { - $pairs = array(); + $pairs = []; foreach (array_chunk($this->nodes, 2) as $pair) { - $pairs[] = array('key' => $pair[0], 'value' => $pair[1]); + $pairs[] = ['key' => $pair[0], 'value' => $pair[1]]; } return $pairs; diff --git a/vendor/symfony/expression-language/Node/BinaryNode.php b/vendor/symfony/expression-language/Node/BinaryNode.php index 48c6548fa8..0af4f16623 100644 --- a/vendor/symfony/expression-language/Node/BinaryNode.php +++ b/vendor/symfony/expression-language/Node/BinaryNode.php @@ -20,24 +20,24 @@ use Symfony\Component\ExpressionLanguage\Compiler; */ class BinaryNode extends Node { - private static $operators = array( + private static $operators = [ '~' => '.', 'and' => '&&', 'or' => '||', - ); + ]; - private static $functions = array( + private static $functions = [ '**' => 'pow', '..' => 'range', 'in' => 'in_array', 'not in' => '!in_array', - ); + ]; public function __construct(string $operator, Node $left, Node $right) { parent::__construct( - array('left' => $left, 'right' => $right), - array('operator' => $operator) + ['left' => $left, 'right' => $right], + ['operator' => $operator] ); } @@ -157,6 +157,6 @@ class BinaryNode extends Node public function toArray() { - return array('(', $this->nodes['left'], ' '.$this->attributes['operator'].' ', $this->nodes['right'], ')'); + return ['(', $this->nodes['left'], ' '.$this->attributes['operator'].' ', $this->nodes['right'], ')']; } } diff --git a/vendor/symfony/expression-language/Node/ConditionalNode.php b/vendor/symfony/expression-language/Node/ConditionalNode.php index 9db0f931aa..ca1b484bc0 100644 --- a/vendor/symfony/expression-language/Node/ConditionalNode.php +++ b/vendor/symfony/expression-language/Node/ConditionalNode.php @@ -23,7 +23,7 @@ class ConditionalNode extends Node public function __construct(Node $expr1, Node $expr2, Node $expr3) { parent::__construct( - array('expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3) + ['expr1' => $expr1, 'expr2' => $expr2, 'expr3' => $expr3] ); } @@ -51,6 +51,6 @@ class ConditionalNode extends Node public function toArray() { - return array('(', $this->nodes['expr1'], ' ? ', $this->nodes['expr2'], ' : ', $this->nodes['expr3'], ')'); + return ['(', $this->nodes['expr1'], ' ? ', $this->nodes['expr2'], ' : ', $this->nodes['expr3'], ')']; } } diff --git a/vendor/symfony/expression-language/Node/ConstantNode.php b/vendor/symfony/expression-language/Node/ConstantNode.php index de2c48f10d..0353f78510 100644 --- a/vendor/symfony/expression-language/Node/ConstantNode.php +++ b/vendor/symfony/expression-language/Node/ConstantNode.php @@ -26,8 +26,8 @@ class ConstantNode extends Node { $this->isIdentifier = $isIdentifier; parent::__construct( - array(), - array('value' => $value) + [], + ['value' => $value] ); } @@ -43,7 +43,7 @@ class ConstantNode extends Node public function toArray() { - $array = array(); + $array = []; $value = $this->attributes['value']; if ($this->isIdentifier) { diff --git a/vendor/symfony/expression-language/Node/FunctionNode.php b/vendor/symfony/expression-language/Node/FunctionNode.php index fd24e1300f..2a46191061 100644 --- a/vendor/symfony/expression-language/Node/FunctionNode.php +++ b/vendor/symfony/expression-language/Node/FunctionNode.php @@ -23,14 +23,14 @@ class FunctionNode extends Node public function __construct(string $name, Node $arguments) { parent::__construct( - array('arguments' => $arguments), - array('name' => $name) + ['arguments' => $arguments], + ['name' => $name] ); } public function compile(Compiler $compiler) { - $arguments = array(); + $arguments = []; foreach ($this->nodes['arguments']->nodes as $node) { $arguments[] = $compiler->subcompile($node); } @@ -42,7 +42,7 @@ class FunctionNode extends Node public function evaluate($functions, $values) { - $arguments = array($values); + $arguments = [$values]; foreach ($this->nodes['arguments']->nodes as $node) { $arguments[] = $node->evaluate($functions, $values); } @@ -52,7 +52,7 @@ class FunctionNode extends Node public function toArray() { - $array = array(); + $array = []; $array[] = $this->attributes['name']; foreach ($this->nodes['arguments']->nodes as $node) { diff --git a/vendor/symfony/expression-language/Node/GetAttrNode.php b/vendor/symfony/expression-language/Node/GetAttrNode.php index 86c5a405f0..a28b596113 100644 --- a/vendor/symfony/expression-language/Node/GetAttrNode.php +++ b/vendor/symfony/expression-language/Node/GetAttrNode.php @@ -27,8 +27,8 @@ class GetAttrNode extends Node public function __construct(Node $node, Node $attribute, ArrayNode $arguments, int $type) { parent::__construct( - array('node' => $node, 'attribute' => $attribute, 'arguments' => $arguments), - array('type' => $type) + ['node' => $node, 'attribute' => $attribute, 'arguments' => $arguments], + ['type' => $type] ); } @@ -82,7 +82,7 @@ class GetAttrNode extends Node if (!\is_object($obj)) { throw new \RuntimeException('Unable to get a property on a non-object.'); } - if (!\is_callable($toCall = array($obj, $this->nodes['attribute']->attributes['value']))) { + if (!\is_callable($toCall = [$obj, $this->nodes['attribute']->attributes['value']])) { throw new \RuntimeException(sprintf('Unable to call method "%s" of object "%s".', $this->nodes['attribute']->attributes['value'], \get_class($obj))); } @@ -102,13 +102,13 @@ class GetAttrNode extends Node { switch ($this->attributes['type']) { case self::PROPERTY_CALL: - return array($this->nodes['node'], '.', $this->nodes['attribute']); + return [$this->nodes['node'], '.', $this->nodes['attribute']]; case self::METHOD_CALL: - return array($this->nodes['node'], '.', $this->nodes['attribute'], '(', $this->nodes['arguments'], ')'); + return [$this->nodes['node'], '.', $this->nodes['attribute'], '(', $this->nodes['arguments'], ')']; case self::ARRAY_CALL: - return array($this->nodes['node'], '[', $this->nodes['attribute'], ']'); + return [$this->nodes['node'], '[', $this->nodes['attribute'], ']']; } } } diff --git a/vendor/symfony/expression-language/Node/NameNode.php b/vendor/symfony/expression-language/Node/NameNode.php index c084bd4793..1a3d994148 100644 --- a/vendor/symfony/expression-language/Node/NameNode.php +++ b/vendor/symfony/expression-language/Node/NameNode.php @@ -23,8 +23,8 @@ class NameNode extends Node public function __construct(string $name) { parent::__construct( - array(), - array('name' => $name) + [], + ['name' => $name] ); } @@ -40,6 +40,6 @@ class NameNode extends Node public function toArray() { - return array($this->attributes['name']); + return [$this->attributes['name']]; } } diff --git a/vendor/symfony/expression-language/Node/Node.php b/vendor/symfony/expression-language/Node/Node.php index c6eb9f0351..7923cb1d64 100644 --- a/vendor/symfony/expression-language/Node/Node.php +++ b/vendor/symfony/expression-language/Node/Node.php @@ -20,14 +20,14 @@ use Symfony\Component\ExpressionLanguage\Compiler; */ class Node { - public $nodes = array(); - public $attributes = array(); + public $nodes = []; + public $attributes = []; /** * @param array $nodes An array of nodes * @param array $attributes An array of attributes */ - public function __construct(array $nodes = array(), array $attributes = array()) + public function __construct(array $nodes = [], array $attributes = []) { $this->nodes = $nodes; $this->attributes = $attributes; @@ -35,12 +35,12 @@ class Node public function __toString() { - $attributes = array(); + $attributes = []; foreach ($this->attributes as $name => $value) { $attributes[] = sprintf('%s: %s', $name, str_replace("\n", '', var_export($value, true))); } - $repr = array(str_replace('Symfony\Component\ExpressionLanguage\Node\\', '', \get_class($this)).'('.implode(', ', $attributes)); + $repr = [str_replace('Symfony\Component\ExpressionLanguage\Node\\', '', \get_class($this)).'('.implode(', ', $attributes)]; if (\count($this->nodes)) { foreach ($this->nodes as $node) { @@ -66,7 +66,7 @@ class Node public function evaluate($functions, $values) { - $results = array(); + $results = []; foreach ($this->nodes as $node) { $results[] = $node->evaluate($functions, $values); } diff --git a/vendor/symfony/expression-language/Node/UnaryNode.php b/vendor/symfony/expression-language/Node/UnaryNode.php index 4a18e83a5d..abf2cc6bac 100644 --- a/vendor/symfony/expression-language/Node/UnaryNode.php +++ b/vendor/symfony/expression-language/Node/UnaryNode.php @@ -20,18 +20,18 @@ use Symfony\Component\ExpressionLanguage\Compiler; */ class UnaryNode extends Node { - private static $operators = array( + private static $operators = [ '!' => '!', 'not' => '!', '+' => '+', '-' => '-', - ); + ]; public function __construct(string $operator, Node $node) { parent::__construct( - array('node' => $node), - array('operator' => $operator) + ['node' => $node], + ['operator' => $operator] ); } @@ -61,6 +61,6 @@ class UnaryNode extends Node public function toArray(): array { - return array('(', $this->attributes['operator'].' ', $this->nodes['node'], ')'); + return ['(', $this->attributes['operator'].' ', $this->nodes['node'], ')']; } } diff --git a/vendor/symfony/expression-language/Parser.php b/vendor/symfony/expression-language/Parser.php index a3b31ce976..0930bac2ef 100644 --- a/vendor/symfony/expression-language/Parser.php +++ b/vendor/symfony/expression-language/Parser.php @@ -36,40 +36,40 @@ class Parser { $this->functions = $functions; - $this->unaryOperators = array( - 'not' => array('precedence' => 50), - '!' => array('precedence' => 50), - '-' => array('precedence' => 500), - '+' => array('precedence' => 500), - ); - $this->binaryOperators = array( - 'or' => array('precedence' => 10, 'associativity' => self::OPERATOR_LEFT), - '||' => array('precedence' => 10, 'associativity' => self::OPERATOR_LEFT), - 'and' => array('precedence' => 15, 'associativity' => self::OPERATOR_LEFT), - '&&' => array('precedence' => 15, 'associativity' => self::OPERATOR_LEFT), - '|' => array('precedence' => 16, 'associativity' => self::OPERATOR_LEFT), - '^' => array('precedence' => 17, 'associativity' => self::OPERATOR_LEFT), - '&' => array('precedence' => 18, 'associativity' => self::OPERATOR_LEFT), - '==' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '===' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '!=' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '!==' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '<' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '>' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '>=' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '<=' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - 'not in' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - 'in' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - 'matches' => array('precedence' => 20, 'associativity' => self::OPERATOR_LEFT), - '..' => array('precedence' => 25, 'associativity' => self::OPERATOR_LEFT), - '+' => array('precedence' => 30, 'associativity' => self::OPERATOR_LEFT), - '-' => array('precedence' => 30, 'associativity' => self::OPERATOR_LEFT), - '~' => array('precedence' => 40, 'associativity' => self::OPERATOR_LEFT), - '*' => array('precedence' => 60, 'associativity' => self::OPERATOR_LEFT), - '/' => array('precedence' => 60, 'associativity' => self::OPERATOR_LEFT), - '%' => array('precedence' => 60, 'associativity' => self::OPERATOR_LEFT), - '**' => array('precedence' => 200, 'associativity' => self::OPERATOR_RIGHT), - ); + $this->unaryOperators = [ + 'not' => ['precedence' => 50], + '!' => ['precedence' => 50], + '-' => ['precedence' => 500], + '+' => ['precedence' => 500], + ]; + $this->binaryOperators = [ + 'or' => ['precedence' => 10, 'associativity' => self::OPERATOR_LEFT], + '||' => ['precedence' => 10, 'associativity' => self::OPERATOR_LEFT], + 'and' => ['precedence' => 15, 'associativity' => self::OPERATOR_LEFT], + '&&' => ['precedence' => 15, 'associativity' => self::OPERATOR_LEFT], + '|' => ['precedence' => 16, 'associativity' => self::OPERATOR_LEFT], + '^' => ['precedence' => 17, 'associativity' => self::OPERATOR_LEFT], + '&' => ['precedence' => 18, 'associativity' => self::OPERATOR_LEFT], + '==' => ['precedence' => 20, 'associativity' => self::OPERATOR_LEFT], + '===' => ['precedence' => 20, 'associativity' => self::OPERATOR_LEFT], + '!=' => ['precedence' => 20, 'associativity' => self::OPERATOR_LEFT], + '!==' => ['precedence' => 20, 'associativity' => self::OPERATOR_LEFT], + '<' => ['precedence' => 20, 'associativity' => self::OPERATOR_LEFT], + '>' => ['precedence' => 20, 'associativity' => self::OPERATOR_LEFT], + '>=' => ['precedence' => 20, 'associativity' => self::OPERATOR_LEFT], + '<=' => ['precedence' => 20, 'associativity' => self::OPERATOR_LEFT], + 'not in' => ['precedence' => 20, 'associativity' => self::OPERATOR_LEFT], + 'in' => ['precedence' => 20, 'associativity' => self::OPERATOR_LEFT], + 'matches' => ['precedence' => 20, 'associativity' => self::OPERATOR_LEFT], + '..' => ['precedence' => 25, 'associativity' => self::OPERATOR_LEFT], + '+' => ['precedence' => 30, 'associativity' => self::OPERATOR_LEFT], + '-' => ['precedence' => 30, 'associativity' => self::OPERATOR_LEFT], + '~' => ['precedence' => 40, 'associativity' => self::OPERATOR_LEFT], + '*' => ['precedence' => 60, 'associativity' => self::OPERATOR_LEFT], + '/' => ['precedence' => 60, 'associativity' => self::OPERATOR_LEFT], + '%' => ['precedence' => 60, 'associativity' => self::OPERATOR_LEFT], + '**' => ['precedence' => 200, 'associativity' => self::OPERATOR_RIGHT], + ]; } /** @@ -92,7 +92,7 @@ class Parser * * @throws SyntaxError */ - public function parse(TokenStream $stream, $names = array()) + public function parse(TokenStream $stream, $names = []) { $this->stream = $stream; $this->names = $names; @@ -364,7 +364,7 @@ class Parser */ public function parseArguments() { - $args = array(); + $args = []; $this->stream->expect(Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); while (!$this->stream->current->test(Token::PUNCTUATION_TYPE, ')')) { if (!empty($args)) { diff --git a/vendor/symfony/expression-language/Resources/bin/generate_operator_regex.php b/vendor/symfony/expression-language/Resources/bin/generate_operator_regex.php index 74a100890d..e1196c7f51 100644 --- a/vendor/symfony/expression-language/Resources/bin/generate_operator_regex.php +++ b/vendor/symfony/expression-language/Resources/bin/generate_operator_regex.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -$operators = array('not', '!', 'or', '||', '&&', 'and', '|', '^', '&', '==', '===', '!=', '!==', '<', '>', '>=', '<=', 'not in', 'in', '..', '+', '-', '~', '*', '/', '%', 'matches', '**'); +$operators = ['not', '!', 'or', '||', '&&', 'and', '|', '^', '&', '==', '===', '!=', '!==', '<', '>', '>=', '<=', 'not in', 'in', '..', '+', '-', '~', '*', '/', '%', 'matches', '**']; $operators = array_combine($operators, array_map('strlen', $operators)); arsort($operators); -$regex = array(); +$regex = []; foreach ($operators as $operator => $length) { // an operator that ends with a character must be followed by // a whitespace or a parenthesis diff --git a/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php b/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php index 15a26d5f3f..f9c9dae42b 100644 --- a/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php +++ b/vendor/symfony/expression-language/Tests/ExpressionLanguageTest.php @@ -56,10 +56,10 @@ class ExpressionLanguageTest extends TestCase ->with($cacheItemMock) ; - $parsedExpression = $expressionLanguage->parse('1 + 1', array()); + $parsedExpression = $expressionLanguage->parse('1 + 1', []); $this->assertSame($savedParsedExpression, $parsedExpression); - $parsedExpression = $expressionLanguage->parse('1 + 1', array()); + $parsedExpression = $expressionLanguage->parse('1 + 1', []); $this->assertSame($savedParsedExpression, $parsedExpression); } @@ -74,7 +74,7 @@ class ExpressionLanguageTest extends TestCase public function testProviders() { - $expressionLanguage = new ExpressionLanguage(null, array(new TestProvider())); + $expressionLanguage = new ExpressionLanguage(null, [new TestProvider()]); $this->assertEquals('foo', $expressionLanguage->evaluate('identity("foo")')); $this->assertEquals('"foo"', $expressionLanguage->compile('identity("foo")')); $this->assertEquals('FOO', $expressionLanguage->evaluate('strtoupper("foo")')); @@ -112,38 +112,38 @@ class ExpressionLanguageTest extends TestCase public function testParseThrowsInsteadOfNotice() { $expressionLanguage = new ExpressionLanguage(); - $expressionLanguage->parse('node.', array('node')); + $expressionLanguage->parse('node.', ['node']); } public function shortCircuitProviderEvaluate() { - $object = $this->getMockBuilder('stdClass')->setMethods(array('foo'))->getMock(); + $object = $this->getMockBuilder('stdClass')->setMethods(['foo'])->getMock(); $object->expects($this->never())->method('foo'); - return array( - array('false and object.foo()', array('object' => $object), false), - array('false && object.foo()', array('object' => $object), false), - array('true || object.foo()', array('object' => $object), true), - array('true or object.foo()', array('object' => $object), true), - ); + return [ + ['false and object.foo()', ['object' => $object], false], + ['false && object.foo()', ['object' => $object], false], + ['true || object.foo()', ['object' => $object], true], + ['true or object.foo()', ['object' => $object], true], + ]; } public function shortCircuitProviderCompile() { - return array( - array('false and foo', array('foo' => 'foo'), false), - array('false && foo', array('foo' => 'foo'), false), - array('true || foo', array('foo' => 'foo'), true), - array('true or foo', array('foo' => 'foo'), true), - ); + return [ + ['false and foo', ['foo' => 'foo'], false], + ['false && foo', ['foo' => 'foo'], false], + ['true || foo', ['foo' => 'foo'], true], + ['true or foo', ['foo' => 'foo'], true], + ]; } public function testCachingForOverriddenVariableNames() { $expressionLanguage = new ExpressionLanguage(); $expression = 'a + b'; - $expressionLanguage->evaluate($expression, array('a' => 1, 'b' => 1)); - $result = $expressionLanguage->compile($expression, array('a', 'B' => 'b')); + $expressionLanguage->evaluate($expression, ['a' => 1, 'b' => 1]); + $result = $expressionLanguage->compile($expression, ['a', 'B' => 'b']); $this->assertSame('($a + $B)', $result); } @@ -151,7 +151,7 @@ class ExpressionLanguageTest extends TestCase { $expressionLanguage = new ExpressionLanguage(); $expression = '123 === a'; - $result = $expressionLanguage->compile($expression, array('a')); + $result = $expressionLanguage->compile($expression, ['a']); $this->assertSame('(123 === $a)', $result); } @@ -160,7 +160,7 @@ class ExpressionLanguageTest extends TestCase $cacheMock = $this->getMockBuilder('Psr\Cache\CacheItemPoolInterface')->getMock(); $cacheItemMock = $this->getMockBuilder('Psr\Cache\CacheItemInterface')->getMock(); $expressionLanguage = new ExpressionLanguage($cacheMock); - $savedParsedExpressions = array(); + $savedParsedExpressions = []; $cacheMock ->expects($this->exactly(2)) @@ -193,8 +193,8 @@ class ExpressionLanguageTest extends TestCase ; $expression = 'a + b'; - $expressionLanguage->compile($expression, array('a', 'B' => 'b')); - $expressionLanguage->compile($expression, array('B' => 'b', 'a')); + $expressionLanguage->compile($expression, ['a', 'B' => 'b']); + $expressionLanguage->compile($expression, ['B' => 'b', 'a']); } /** @@ -204,7 +204,7 @@ class ExpressionLanguageTest extends TestCase public function testRegisterAfterParse($registerCallback) { $el = new ExpressionLanguage(); - $el->parse('1 + 1', array()); + $el->parse('1 + 1', []); $registerCallback($el); } @@ -226,7 +226,7 @@ class ExpressionLanguageTest extends TestCase public function testCallBadCallable() { $el = new ExpressionLanguage(); - $el->evaluate('foo.myfunction()', array('foo' => new \stdClass())); + $el->evaluate('foo.myfunction()', ['foo' => new \stdClass()]); } /** @@ -242,22 +242,22 @@ class ExpressionLanguageTest extends TestCase public function getRegisterCallbacks() { - return array( - array( + return [ + [ function (ExpressionLanguage $el) { $el->register('fn', function () {}, function () {}); }, - ), - array( + ], + [ function (ExpressionLanguage $el) { $el->addFunction(new ExpressionFunction('fn', function () {}, function () {})); }, - ), - array( + ], + [ function (ExpressionLanguage $el) { $el->registerProvider(new TestProvider()); }, - ), - ); + ], + ]; } } diff --git a/vendor/symfony/expression-language/Tests/Fixtures/TestProvider.php b/vendor/symfony/expression-language/Tests/Fixtures/TestProvider.php index 20c5182bba..8405d4f975 100644 --- a/vendor/symfony/expression-language/Tests/Fixtures/TestProvider.php +++ b/vendor/symfony/expression-language/Tests/Fixtures/TestProvider.php @@ -19,7 +19,7 @@ class TestProvider implements ExpressionFunctionProviderInterface { public function getFunctions() { - return array( + return [ new ExpressionFunction('identity', function ($input) { return $input; }, function (array $values, $input) { @@ -31,7 +31,7 @@ class TestProvider implements ExpressionFunctionProviderInterface ExpressionFunction::fromPhp('\strtolower'), ExpressionFunction::fromPhp('Symfony\Component\ExpressionLanguage\Tests\Fixtures\fn_namespaced', 'fn_namespaced'), - ); + ]; } } diff --git a/vendor/symfony/expression-language/Tests/LexerTest.php b/vendor/symfony/expression-language/Tests/LexerTest.php index 16bf450862..ba35e7d19a 100644 --- a/vendor/symfony/expression-language/Tests/LexerTest.php +++ b/vendor/symfony/expression-language/Tests/LexerTest.php @@ -59,33 +59,33 @@ class LexerTest extends TestCase public function getTokenizeData() { - return array( - array( - array(new Token('name', 'a', 3)), + return [ + [ + [new Token('name', 'a', 3)], ' a ', - ), - array( - array(new Token('name', 'a', 1)), + ], + [ + [new Token('name', 'a', 1)], 'a', - ), - array( - array(new Token('string', 'foo', 1)), + ], + [ + [new Token('string', 'foo', 1)], '"foo"', - ), - array( - array(new Token('number', '3', 1)), + ], + [ + [new Token('number', '3', 1)], '3', - ), - array( - array(new Token('operator', '+', 1)), + ], + [ + [new Token('operator', '+', 1)], '+', - ), - array( - array(new Token('punctuation', '.', 1)), + ], + [ + [new Token('punctuation', '.', 1)], '.', - ), - array( - array( + ], + [ + [ new Token('punctuation', '(', 1), new Token('number', '3', 2), new Token('operator', '+', 4), @@ -101,21 +101,21 @@ class LexerTest extends TestCase new Token('punctuation', '[', 25), new Token('number', '4', 26), new Token('punctuation', ']', 27), - ), + ], '(3 + 5) ~ foo("bar").baz[4]', - ), - array( - array(new Token('operator', '..', 1)), + ], + [ + [new Token('operator', '..', 1)], '..', - ), - array( - array(new Token('string', '#foo', 1)), + ], + [ + [new Token('string', '#foo', 1)], "'#foo'", - ), - array( - array(new Token('string', '#foo', 1)), + ], + [ + [new Token('string', '#foo', 1)], '"#foo"', - ), - ); + ], + ]; } } diff --git a/vendor/symfony/expression-language/Tests/Node/AbstractNodeTest.php b/vendor/symfony/expression-language/Tests/Node/AbstractNodeTest.php index a6f80c2f69..297503746e 100644 --- a/vendor/symfony/expression-language/Tests/Node/AbstractNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/AbstractNodeTest.php @@ -19,7 +19,7 @@ abstract class AbstractNodeTest extends TestCase /** * @dataProvider getEvaluateData */ - public function testEvaluate($expected, $node, $variables = array(), $functions = array()) + public function testEvaluate($expected, $node, $variables = [], $functions = []) { $this->assertSame($expected, $node->evaluate($functions, $variables)); } @@ -29,7 +29,7 @@ abstract class AbstractNodeTest extends TestCase /** * @dataProvider getCompileData */ - public function testCompile($expected, $node, $functions = array()) + public function testCompile($expected, $node, $functions = []) { $compiler = new Compiler($functions); $node->compile($compiler); diff --git a/vendor/symfony/expression-language/Tests/Node/ArgumentsNodeTest.php b/vendor/symfony/expression-language/Tests/Node/ArgumentsNodeTest.php index 60a6d1ca2a..9d88b4ae75 100644 --- a/vendor/symfony/expression-language/Tests/Node/ArgumentsNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/ArgumentsNodeTest.php @@ -17,16 +17,16 @@ class ArgumentsNodeTest extends ArrayNodeTest { public function getCompileData() { - return array( - array('"a", "b"', $this->getArrayNode()), - ); + return [ + ['"a", "b"', $this->getArrayNode()], + ]; } public function getDumpData() { - return array( - array('"a", "b"', $this->getArrayNode()), - ); + return [ + ['"a", "b"', $this->getArrayNode()], + ]; } protected function createArrayNode() diff --git a/vendor/symfony/expression-language/Tests/Node/ArrayNodeTest.php b/vendor/symfony/expression-language/Tests/Node/ArrayNodeTest.php index 11a35d461c..3d03d837e9 100644 --- a/vendor/symfony/expression-language/Tests/Node/ArrayNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/ArrayNodeTest.php @@ -30,31 +30,31 @@ class ArrayNodeTest extends AbstractNodeTest public function getEvaluateData() { - return array( - array(array('b' => 'a', 'b'), $this->getArrayNode()), - ); + return [ + [['b' => 'a', 'b'], $this->getArrayNode()], + ]; } public function getCompileData() { - return array( - array('array("b" => "a", 0 => "b")', $this->getArrayNode()), - ); + return [ + ['["b" => "a", 0 => "b"]', $this->getArrayNode()], + ]; } public function getDumpData() { - yield array('{"b": "a", 0: "b"}', $this->getArrayNode()); + yield ['{"b": "a", 0: "b"}', $this->getArrayNode()]; $array = $this->createArrayNode(); $array->addElement(new ConstantNode('c'), new ConstantNode('a"b')); $array->addElement(new ConstantNode('d'), new ConstantNode('a\b')); - yield array('{"a\\"b": "c", "a\\\\b": "d"}', $array); + yield ['{"a\\"b": "c", "a\\\\b": "d"}', $array]; $array = $this->createArrayNode(); $array->addElement(new ConstantNode('c')); $array->addElement(new ConstantNode('d')); - yield array('["c", "d"]', $array); + yield ['["c", "d"]', $array]; } protected function getArrayNode() diff --git a/vendor/symfony/expression-language/Tests/Node/BinaryNodeTest.php b/vendor/symfony/expression-language/Tests/Node/BinaryNodeTest.php index f8456f8dbb..b45a1e57b9 100644 --- a/vendor/symfony/expression-language/Tests/Node/BinaryNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/BinaryNodeTest.php @@ -23,47 +23,47 @@ class BinaryNodeTest extends AbstractNodeTest $array->addElement(new ConstantNode('a')); $array->addElement(new ConstantNode('b')); - return array( - array(true, new BinaryNode('or', new ConstantNode(true), new ConstantNode(false))), - array(true, new BinaryNode('||', new ConstantNode(true), new ConstantNode(false))), - array(false, new BinaryNode('and', new ConstantNode(true), new ConstantNode(false))), - array(false, new BinaryNode('&&', new ConstantNode(true), new ConstantNode(false))), + return [ + [true, new BinaryNode('or', new ConstantNode(true), new ConstantNode(false))], + [true, new BinaryNode('||', new ConstantNode(true), new ConstantNode(false))], + [false, new BinaryNode('and', new ConstantNode(true), new ConstantNode(false))], + [false, new BinaryNode('&&', new ConstantNode(true), new ConstantNode(false))], - array(0, new BinaryNode('&', new ConstantNode(2), new ConstantNode(4))), - array(6, new BinaryNode('|', new ConstantNode(2), new ConstantNode(4))), - array(6, new BinaryNode('^', new ConstantNode(2), new ConstantNode(4))), + [0, new BinaryNode('&', new ConstantNode(2), new ConstantNode(4))], + [6, new BinaryNode('|', new ConstantNode(2), new ConstantNode(4))], + [6, new BinaryNode('^', new ConstantNode(2), new ConstantNode(4))], - array(true, new BinaryNode('<', new ConstantNode(1), new ConstantNode(2))), - array(true, new BinaryNode('<=', new ConstantNode(1), new ConstantNode(2))), - array(true, new BinaryNode('<=', new ConstantNode(1), new ConstantNode(1))), + [true, new BinaryNode('<', new ConstantNode(1), new ConstantNode(2))], + [true, new BinaryNode('<=', new ConstantNode(1), new ConstantNode(2))], + [true, new BinaryNode('<=', new ConstantNode(1), new ConstantNode(1))], - array(false, new BinaryNode('>', new ConstantNode(1), new ConstantNode(2))), - array(false, new BinaryNode('>=', new ConstantNode(1), new ConstantNode(2))), - array(true, new BinaryNode('>=', new ConstantNode(1), new ConstantNode(1))), + [false, new BinaryNode('>', new ConstantNode(1), new ConstantNode(2))], + [false, new BinaryNode('>=', new ConstantNode(1), new ConstantNode(2))], + [true, new BinaryNode('>=', new ConstantNode(1), new ConstantNode(1))], - array(true, new BinaryNode('===', new ConstantNode(true), new ConstantNode(true))), - array(false, new BinaryNode('!==', new ConstantNode(true), new ConstantNode(true))), + [true, new BinaryNode('===', new ConstantNode(true), new ConstantNode(true))], + [false, new BinaryNode('!==', new ConstantNode(true), new ConstantNode(true))], - array(false, new BinaryNode('==', new ConstantNode(2), new ConstantNode(1))), - array(true, new BinaryNode('!=', new ConstantNode(2), new ConstantNode(1))), + [false, new BinaryNode('==', new ConstantNode(2), new ConstantNode(1))], + [true, new BinaryNode('!=', new ConstantNode(2), new ConstantNode(1))], - array(-1, new BinaryNode('-', new ConstantNode(1), new ConstantNode(2))), - array(3, new BinaryNode('+', new ConstantNode(1), new ConstantNode(2))), - array(4, new BinaryNode('*', new ConstantNode(2), new ConstantNode(2))), - array(1, new BinaryNode('/', new ConstantNode(2), new ConstantNode(2))), - array(1, new BinaryNode('%', new ConstantNode(5), new ConstantNode(2))), - array(25, new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))), - array('ab', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))), + [-1, new BinaryNode('-', new ConstantNode(1), new ConstantNode(2))], + [3, new BinaryNode('+', new ConstantNode(1), new ConstantNode(2))], + [4, new BinaryNode('*', new ConstantNode(2), new ConstantNode(2))], + [1, new BinaryNode('/', new ConstantNode(2), new ConstantNode(2))], + [1, new BinaryNode('%', new ConstantNode(5), new ConstantNode(2))], + [25, new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))], + ['ab', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))], - array(true, new BinaryNode('in', new ConstantNode('a'), $array)), - array(false, new BinaryNode('in', new ConstantNode('c'), $array)), - array(true, new BinaryNode('not in', new ConstantNode('c'), $array)), - array(false, new BinaryNode('not in', new ConstantNode('a'), $array)), + [true, new BinaryNode('in', new ConstantNode('a'), $array)], + [false, new BinaryNode('in', new ConstantNode('c'), $array)], + [true, new BinaryNode('not in', new ConstantNode('c'), $array)], + [false, new BinaryNode('not in', new ConstantNode('a'), $array)], - array(array(1, 2, 3), new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))), + [[1, 2, 3], new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))], - array(1, new BinaryNode('matches', new ConstantNode('abc'), new ConstantNode('/^[a-z]+$/'))), - ); + [1, new BinaryNode('matches', new ConstantNode('abc'), new ConstantNode('/^[a-z]+$/'))], + ]; } public function getCompileData() @@ -72,47 +72,47 @@ class BinaryNodeTest extends AbstractNodeTest $array->addElement(new ConstantNode('a')); $array->addElement(new ConstantNode('b')); - return array( - array('(true || false)', new BinaryNode('or', new ConstantNode(true), new ConstantNode(false))), - array('(true || false)', new BinaryNode('||', new ConstantNode(true), new ConstantNode(false))), - array('(true && false)', new BinaryNode('and', new ConstantNode(true), new ConstantNode(false))), - array('(true && false)', new BinaryNode('&&', new ConstantNode(true), new ConstantNode(false))), + return [ + ['(true || false)', new BinaryNode('or', new ConstantNode(true), new ConstantNode(false))], + ['(true || false)', new BinaryNode('||', new ConstantNode(true), new ConstantNode(false))], + ['(true && false)', new BinaryNode('and', new ConstantNode(true), new ConstantNode(false))], + ['(true && false)', new BinaryNode('&&', new ConstantNode(true), new ConstantNode(false))], - array('(2 & 4)', new BinaryNode('&', new ConstantNode(2), new ConstantNode(4))), - array('(2 | 4)', new BinaryNode('|', new ConstantNode(2), new ConstantNode(4))), - array('(2 ^ 4)', new BinaryNode('^', new ConstantNode(2), new ConstantNode(4))), + ['(2 & 4)', new BinaryNode('&', new ConstantNode(2), new ConstantNode(4))], + ['(2 | 4)', new BinaryNode('|', new ConstantNode(2), new ConstantNode(4))], + ['(2 ^ 4)', new BinaryNode('^', new ConstantNode(2), new ConstantNode(4))], - array('(1 < 2)', new BinaryNode('<', new ConstantNode(1), new ConstantNode(2))), - array('(1 <= 2)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(2))), - array('(1 <= 1)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(1))), + ['(1 < 2)', new BinaryNode('<', new ConstantNode(1), new ConstantNode(2))], + ['(1 <= 2)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(2))], + ['(1 <= 1)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(1))], - array('(1 > 2)', new BinaryNode('>', new ConstantNode(1), new ConstantNode(2))), - array('(1 >= 2)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(2))), - array('(1 >= 1)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(1))), + ['(1 > 2)', new BinaryNode('>', new ConstantNode(1), new ConstantNode(2))], + ['(1 >= 2)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(2))], + ['(1 >= 1)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(1))], - array('(true === true)', new BinaryNode('===', new ConstantNode(true), new ConstantNode(true))), - array('(true !== true)', new BinaryNode('!==', new ConstantNode(true), new ConstantNode(true))), + ['(true === true)', new BinaryNode('===', new ConstantNode(true), new ConstantNode(true))], + ['(true !== true)', new BinaryNode('!==', new ConstantNode(true), new ConstantNode(true))], - array('(2 == 1)', new BinaryNode('==', new ConstantNode(2), new ConstantNode(1))), - array('(2 != 1)', new BinaryNode('!=', new ConstantNode(2), new ConstantNode(1))), + ['(2 == 1)', new BinaryNode('==', new ConstantNode(2), new ConstantNode(1))], + ['(2 != 1)', new BinaryNode('!=', new ConstantNode(2), new ConstantNode(1))], - array('(1 - 2)', new BinaryNode('-', new ConstantNode(1), new ConstantNode(2))), - array('(1 + 2)', new BinaryNode('+', new ConstantNode(1), new ConstantNode(2))), - array('(2 * 2)', new BinaryNode('*', new ConstantNode(2), new ConstantNode(2))), - array('(2 / 2)', new BinaryNode('/', new ConstantNode(2), new ConstantNode(2))), - array('(5 % 2)', new BinaryNode('%', new ConstantNode(5), new ConstantNode(2))), - array('pow(5, 2)', new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))), - array('("a" . "b")', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))), + ['(1 - 2)', new BinaryNode('-', new ConstantNode(1), new ConstantNode(2))], + ['(1 + 2)', new BinaryNode('+', new ConstantNode(1), new ConstantNode(2))], + ['(2 * 2)', new BinaryNode('*', new ConstantNode(2), new ConstantNode(2))], + ['(2 / 2)', new BinaryNode('/', new ConstantNode(2), new ConstantNode(2))], + ['(5 % 2)', new BinaryNode('%', new ConstantNode(5), new ConstantNode(2))], + ['pow(5, 2)', new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))], + ['("a" . "b")', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))], - array('in_array("a", array(0 => "a", 1 => "b"))', new BinaryNode('in', new ConstantNode('a'), $array)), - array('in_array("c", array(0 => "a", 1 => "b"))', new BinaryNode('in', new ConstantNode('c'), $array)), - array('!in_array("c", array(0 => "a", 1 => "b"))', new BinaryNode('not in', new ConstantNode('c'), $array)), - array('!in_array("a", array(0 => "a", 1 => "b"))', new BinaryNode('not in', new ConstantNode('a'), $array)), + ['in_array("a", [0 => "a", 1 => "b"])', new BinaryNode('in', new ConstantNode('a'), $array)], + ['in_array("c", [0 => "a", 1 => "b"])', new BinaryNode('in', new ConstantNode('c'), $array)], + ['!in_array("c", [0 => "a", 1 => "b"])', new BinaryNode('not in', new ConstantNode('c'), $array)], + ['!in_array("a", [0 => "a", 1 => "b"])', new BinaryNode('not in', new ConstantNode('a'), $array)], - array('range(1, 3)', new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))), + ['range(1, 3)', new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))], - array('preg_match("/^[a-z]+/i\$/", "abc")', new BinaryNode('matches', new ConstantNode('abc'), new ConstantNode('/^[a-z]+/i$/'))), - ); + ['preg_match("/^[a-z]+/i\$/", "abc")', new BinaryNode('matches', new ConstantNode('abc'), new ConstantNode('/^[a-z]+/i$/'))], + ]; } public function getDumpData() @@ -121,46 +121,46 @@ class BinaryNodeTest extends AbstractNodeTest $array->addElement(new ConstantNode('a')); $array->addElement(new ConstantNode('b')); - return array( - array('(true or false)', new BinaryNode('or', new ConstantNode(true), new ConstantNode(false))), - array('(true || false)', new BinaryNode('||', new ConstantNode(true), new ConstantNode(false))), - array('(true and false)', new BinaryNode('and', new ConstantNode(true), new ConstantNode(false))), - array('(true && false)', new BinaryNode('&&', new ConstantNode(true), new ConstantNode(false))), + return [ + ['(true or false)', new BinaryNode('or', new ConstantNode(true), new ConstantNode(false))], + ['(true || false)', new BinaryNode('||', new ConstantNode(true), new ConstantNode(false))], + ['(true and false)', new BinaryNode('and', new ConstantNode(true), new ConstantNode(false))], + ['(true && false)', new BinaryNode('&&', new ConstantNode(true), new ConstantNode(false))], - array('(2 & 4)', new BinaryNode('&', new ConstantNode(2), new ConstantNode(4))), - array('(2 | 4)', new BinaryNode('|', new ConstantNode(2), new ConstantNode(4))), - array('(2 ^ 4)', new BinaryNode('^', new ConstantNode(2), new ConstantNode(4))), + ['(2 & 4)', new BinaryNode('&', new ConstantNode(2), new ConstantNode(4))], + ['(2 | 4)', new BinaryNode('|', new ConstantNode(2), new ConstantNode(4))], + ['(2 ^ 4)', new BinaryNode('^', new ConstantNode(2), new ConstantNode(4))], - array('(1 < 2)', new BinaryNode('<', new ConstantNode(1), new ConstantNode(2))), - array('(1 <= 2)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(2))), - array('(1 <= 1)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(1))), + ['(1 < 2)', new BinaryNode('<', new ConstantNode(1), new ConstantNode(2))], + ['(1 <= 2)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(2))], + ['(1 <= 1)', new BinaryNode('<=', new ConstantNode(1), new ConstantNode(1))], - array('(1 > 2)', new BinaryNode('>', new ConstantNode(1), new ConstantNode(2))), - array('(1 >= 2)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(2))), - array('(1 >= 1)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(1))), + ['(1 > 2)', new BinaryNode('>', new ConstantNode(1), new ConstantNode(2))], + ['(1 >= 2)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(2))], + ['(1 >= 1)', new BinaryNode('>=', new ConstantNode(1), new ConstantNode(1))], - array('(true === true)', new BinaryNode('===', new ConstantNode(true), new ConstantNode(true))), - array('(true !== true)', new BinaryNode('!==', new ConstantNode(true), new ConstantNode(true))), + ['(true === true)', new BinaryNode('===', new ConstantNode(true), new ConstantNode(true))], + ['(true !== true)', new BinaryNode('!==', new ConstantNode(true), new ConstantNode(true))], - array('(2 == 1)', new BinaryNode('==', new ConstantNode(2), new ConstantNode(1))), - array('(2 != 1)', new BinaryNode('!=', new ConstantNode(2), new ConstantNode(1))), + ['(2 == 1)', new BinaryNode('==', new ConstantNode(2), new ConstantNode(1))], + ['(2 != 1)', new BinaryNode('!=', new ConstantNode(2), new ConstantNode(1))], - array('(1 - 2)', new BinaryNode('-', new ConstantNode(1), new ConstantNode(2))), - array('(1 + 2)', new BinaryNode('+', new ConstantNode(1), new ConstantNode(2))), - array('(2 * 2)', new BinaryNode('*', new ConstantNode(2), new ConstantNode(2))), - array('(2 / 2)', new BinaryNode('/', new ConstantNode(2), new ConstantNode(2))), - array('(5 % 2)', new BinaryNode('%', new ConstantNode(5), new ConstantNode(2))), - array('(5 ** 2)', new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))), - array('("a" ~ "b")', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))), + ['(1 - 2)', new BinaryNode('-', new ConstantNode(1), new ConstantNode(2))], + ['(1 + 2)', new BinaryNode('+', new ConstantNode(1), new ConstantNode(2))], + ['(2 * 2)', new BinaryNode('*', new ConstantNode(2), new ConstantNode(2))], + ['(2 / 2)', new BinaryNode('/', new ConstantNode(2), new ConstantNode(2))], + ['(5 % 2)', new BinaryNode('%', new ConstantNode(5), new ConstantNode(2))], + ['(5 ** 2)', new BinaryNode('**', new ConstantNode(5), new ConstantNode(2))], + ['("a" ~ "b")', new BinaryNode('~', new ConstantNode('a'), new ConstantNode('b'))], - array('("a" in ["a", "b"])', new BinaryNode('in', new ConstantNode('a'), $array)), - array('("c" in ["a", "b"])', new BinaryNode('in', new ConstantNode('c'), $array)), - array('("c" not in ["a", "b"])', new BinaryNode('not in', new ConstantNode('c'), $array)), - array('("a" not in ["a", "b"])', new BinaryNode('not in', new ConstantNode('a'), $array)), + ['("a" in ["a", "b"])', new BinaryNode('in', new ConstantNode('a'), $array)], + ['("c" in ["a", "b"])', new BinaryNode('in', new ConstantNode('c'), $array)], + ['("c" not in ["a", "b"])', new BinaryNode('not in', new ConstantNode('c'), $array)], + ['("a" not in ["a", "b"])', new BinaryNode('not in', new ConstantNode('a'), $array)], - array('(1 .. 3)', new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))), + ['(1 .. 3)', new BinaryNode('..', new ConstantNode(1), new ConstantNode(3))], - array('("abc" matches "/^[a-z]+/i$/")', new BinaryNode('matches', new ConstantNode('abc'), new ConstantNode('/^[a-z]+/i$/'))), - ); + ['("abc" matches "/^[a-z]+/i$/")', new BinaryNode('matches', new ConstantNode('abc'), new ConstantNode('/^[a-z]+/i$/'))], + ]; } } diff --git a/vendor/symfony/expression-language/Tests/Node/ConditionalNodeTest.php b/vendor/symfony/expression-language/Tests/Node/ConditionalNodeTest.php index cbf9e8d43c..13b7cbdec1 100644 --- a/vendor/symfony/expression-language/Tests/Node/ConditionalNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/ConditionalNodeTest.php @@ -18,25 +18,25 @@ class ConditionalNodeTest extends AbstractNodeTest { public function getEvaluateData() { - return array( - array(1, new ConditionalNode(new ConstantNode(true), new ConstantNode(1), new ConstantNode(2))), - array(2, new ConditionalNode(new ConstantNode(false), new ConstantNode(1), new ConstantNode(2))), - ); + return [ + [1, new ConditionalNode(new ConstantNode(true), new ConstantNode(1), new ConstantNode(2))], + [2, new ConditionalNode(new ConstantNode(false), new ConstantNode(1), new ConstantNode(2))], + ]; } public function getCompileData() { - return array( - array('((true) ? (1) : (2))', new ConditionalNode(new ConstantNode(true), new ConstantNode(1), new ConstantNode(2))), - array('((false) ? (1) : (2))', new ConditionalNode(new ConstantNode(false), new ConstantNode(1), new ConstantNode(2))), - ); + return [ + ['((true) ? (1) : (2))', new ConditionalNode(new ConstantNode(true), new ConstantNode(1), new ConstantNode(2))], + ['((false) ? (1) : (2))', new ConditionalNode(new ConstantNode(false), new ConstantNode(1), new ConstantNode(2))], + ]; } public function getDumpData() { - return array( - array('(true ? 1 : 2)', new ConditionalNode(new ConstantNode(true), new ConstantNode(1), new ConstantNode(2))), - array('(false ? 1 : 2)', new ConditionalNode(new ConstantNode(false), new ConstantNode(1), new ConstantNode(2))), - ); + return [ + ['(true ? 1 : 2)', new ConditionalNode(new ConstantNode(true), new ConstantNode(1), new ConstantNode(2))], + ['(false ? 1 : 2)', new ConditionalNode(new ConstantNode(false), new ConstantNode(1), new ConstantNode(2))], + ]; } } diff --git a/vendor/symfony/expression-language/Tests/Node/ConstantNodeTest.php b/vendor/symfony/expression-language/Tests/Node/ConstantNodeTest.php index af79a91c5c..fee9f5bff4 100644 --- a/vendor/symfony/expression-language/Tests/Node/ConstantNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/ConstantNodeTest.php @@ -17,44 +17,44 @@ class ConstantNodeTest extends AbstractNodeTest { public function getEvaluateData() { - return array( - array(false, new ConstantNode(false)), - array(true, new ConstantNode(true)), - array(null, new ConstantNode(null)), - array(3, new ConstantNode(3)), - array(3.3, new ConstantNode(3.3)), - array('foo', new ConstantNode('foo')), - array(array(1, 'b' => 'a'), new ConstantNode(array(1, 'b' => 'a'))), - ); + return [ + [false, new ConstantNode(false)], + [true, new ConstantNode(true)], + [null, new ConstantNode(null)], + [3, new ConstantNode(3)], + [3.3, new ConstantNode(3.3)], + ['foo', new ConstantNode('foo')], + [[1, 'b' => 'a'], new ConstantNode([1, 'b' => 'a'])], + ]; } public function getCompileData() { - return array( - array('false', new ConstantNode(false)), - array('true', new ConstantNode(true)), - array('null', new ConstantNode(null)), - array('3', new ConstantNode(3)), - array('3.3', new ConstantNode(3.3)), - array('"foo"', new ConstantNode('foo')), - array('array(0 => 1, "b" => "a")', new ConstantNode(array(1, 'b' => 'a'))), - ); + return [ + ['false', new ConstantNode(false)], + ['true', new ConstantNode(true)], + ['null', new ConstantNode(null)], + ['3', new ConstantNode(3)], + ['3.3', new ConstantNode(3.3)], + ['"foo"', new ConstantNode('foo')], + ['[0 => 1, "b" => "a"]', new ConstantNode([1, 'b' => 'a'])], + ]; } public function getDumpData() { - return array( - array('false', new ConstantNode(false)), - array('true', new ConstantNode(true)), - array('null', new ConstantNode(null)), - array('3', new ConstantNode(3)), - array('3.3', new ConstantNode(3.3)), - array('"foo"', new ConstantNode('foo')), - array('foo', new ConstantNode('foo', true)), - array('{0: 1, "b": "a", 1: true}', new ConstantNode(array(1, 'b' => 'a', true))), - array('{"a\\"b": "c", "a\\\\b": "d"}', new ConstantNode(array('a"b' => 'c', 'a\\b' => 'd'))), - array('["c", "d"]', new ConstantNode(array('c', 'd'))), - array('{"a": ["b"]}', new ConstantNode(array('a' => array('b')))), - ); + return [ + ['false', new ConstantNode(false)], + ['true', new ConstantNode(true)], + ['null', new ConstantNode(null)], + ['3', new ConstantNode(3)], + ['3.3', new ConstantNode(3.3)], + ['"foo"', new ConstantNode('foo')], + ['foo', new ConstantNode('foo', true)], + ['{0: 1, "b": "a", 1: true}', new ConstantNode([1, 'b' => 'a', true])], + ['{"a\\"b": "c", "a\\\\b": "d"}', new ConstantNode(['a"b' => 'c', 'a\\b' => 'd'])], + ['["c", "d"]', new ConstantNode(['c', 'd'])], + ['{"a": ["b"]}', new ConstantNode(['a' => ['b']])], + ]; } } diff --git a/vendor/symfony/expression-language/Tests/Node/FunctionNodeTest.php b/vendor/symfony/expression-language/Tests/Node/FunctionNodeTest.php index 3bddc5e564..c6cb02c1b9 100644 --- a/vendor/symfony/expression-language/Tests/Node/FunctionNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/FunctionNodeTest.php @@ -19,34 +19,34 @@ class FunctionNodeTest extends AbstractNodeTest { public function getEvaluateData() { - return array( - array('bar', new FunctionNode('foo', new Node(array(new ConstantNode('bar')))), array(), array('foo' => $this->getCallables())), - ); + return [ + ['bar', new FunctionNode('foo', new Node([new ConstantNode('bar')])), [], ['foo' => $this->getCallables()]], + ]; } public function getCompileData() { - return array( - array('foo("bar")', new FunctionNode('foo', new Node(array(new ConstantNode('bar')))), array('foo' => $this->getCallables())), - ); + return [ + ['foo("bar")', new FunctionNode('foo', new Node([new ConstantNode('bar')])), ['foo' => $this->getCallables()]], + ]; } public function getDumpData() { - return array( - array('foo("bar")', new FunctionNode('foo', new Node(array(new ConstantNode('bar')))), array('foo' => $this->getCallables())), - ); + return [ + ['foo("bar")', new FunctionNode('foo', new Node([new ConstantNode('bar')])), ['foo' => $this->getCallables()]], + ]; } protected function getCallables() { - return array( + return [ 'compiler' => function ($arg) { return sprintf('foo(%s)', $arg); }, 'evaluator' => function ($variables, $arg) { return $arg; }, - ); + ]; } } diff --git a/vendor/symfony/expression-language/Tests/Node/GetAttrNodeTest.php b/vendor/symfony/expression-language/Tests/Node/GetAttrNodeTest.php index 750acaf93e..c790f33acc 100644 --- a/vendor/symfony/expression-language/Tests/Node/GetAttrNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/GetAttrNodeTest.php @@ -20,41 +20,41 @@ class GetAttrNodeTest extends AbstractNodeTest { public function getEvaluateData() { - return array( - array('b', new GetAttrNode(new NameNode('foo'), new ConstantNode(0), $this->getArrayNode(), GetAttrNode::ARRAY_CALL), array('foo' => array('b' => 'a', 'b'))), - array('a', new GetAttrNode(new NameNode('foo'), new ConstantNode('b'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL), array('foo' => array('b' => 'a', 'b'))), + return [ + ['b', new GetAttrNode(new NameNode('foo'), new ConstantNode(0), $this->getArrayNode(), GetAttrNode::ARRAY_CALL), ['foo' => ['b' => 'a', 'b']]], + ['a', new GetAttrNode(new NameNode('foo'), new ConstantNode('b'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL), ['foo' => ['b' => 'a', 'b']]], - array('bar', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), array('foo' => new Obj())), + ['bar', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), ['foo' => new Obj()]], - array('baz', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), array('foo' => new Obj())), - array('a', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL), array('foo' => array('b' => 'a', 'b'), 'index' => 'b')), - ); + ['baz', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), ['foo' => new Obj()]], + ['a', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL), ['foo' => ['b' => 'a', 'b'], 'index' => 'b']], + ]; } public function getCompileData() { - return array( - array('$foo[0]', new GetAttrNode(new NameNode('foo'), new ConstantNode(0), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)), - array('$foo["b"]', new GetAttrNode(new NameNode('foo'), new ConstantNode('b'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)), + return [ + ['$foo[0]', new GetAttrNode(new NameNode('foo'), new ConstantNode(0), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)], + ['$foo["b"]', new GetAttrNode(new NameNode('foo'), new ConstantNode('b'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)], - array('$foo->foo', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), array('foo' => new Obj())), + ['$foo->foo', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), ['foo' => new Obj()]], - array('$foo->foo(array("b" => "a", 0 => "b"))', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), array('foo' => new Obj())), - array('$foo[$index]', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)), - ); + ['$foo->foo(["b" => "a", 0 => "b"])', new GetAttrNode(new NameNode('foo'), new ConstantNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), ['foo' => new Obj()]], + ['$foo[$index]', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)], + ]; } public function getDumpData() { - return array( - array('foo[0]', new GetAttrNode(new NameNode('foo'), new ConstantNode(0), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)), - array('foo["b"]', new GetAttrNode(new NameNode('foo'), new ConstantNode('b'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)), + return [ + ['foo[0]', new GetAttrNode(new NameNode('foo'), new ConstantNode(0), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)], + ['foo["b"]', new GetAttrNode(new NameNode('foo'), new ConstantNode('b'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)], - array('foo.foo', new GetAttrNode(new NameNode('foo'), new NameNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), array('foo' => new Obj())), + ['foo.foo', new GetAttrNode(new NameNode('foo'), new NameNode('foo'), $this->getArrayNode(), GetAttrNode::PROPERTY_CALL), ['foo' => new Obj()]], - array('foo.foo({"b": "a", 0: "b"})', new GetAttrNode(new NameNode('foo'), new NameNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), array('foo' => new Obj())), - array('foo[index]', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)), - ); + ['foo.foo({"b": "a", 0: "b"})', new GetAttrNode(new NameNode('foo'), new NameNode('foo'), $this->getArrayNode(), GetAttrNode::METHOD_CALL), ['foo' => new Obj()]], + ['foo[index]', new GetAttrNode(new NameNode('foo'), new NameNode('index'), $this->getArrayNode(), GetAttrNode::ARRAY_CALL)], + ]; } protected function getArrayNode() diff --git a/vendor/symfony/expression-language/Tests/Node/NameNodeTest.php b/vendor/symfony/expression-language/Tests/Node/NameNodeTest.php index 5fa2c37f29..a30c27b804 100644 --- a/vendor/symfony/expression-language/Tests/Node/NameNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/NameNodeTest.php @@ -17,22 +17,22 @@ class NameNodeTest extends AbstractNodeTest { public function getEvaluateData() { - return array( - array('bar', new NameNode('foo'), array('foo' => 'bar')), - ); + return [ + ['bar', new NameNode('foo'), ['foo' => 'bar']], + ]; } public function getCompileData() { - return array( - array('$foo', new NameNode('foo')), - ); + return [ + ['$foo', new NameNode('foo')], + ]; } public function getDumpData() { - return array( - array('foo', new NameNode('foo')), - ); + return [ + ['foo', new NameNode('foo')], + ]; } } diff --git a/vendor/symfony/expression-language/Tests/Node/NodeTest.php b/vendor/symfony/expression-language/Tests/Node/NodeTest.php index 140f152134..351da05144 100644 --- a/vendor/symfony/expression-language/Tests/Node/NodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/NodeTest.php @@ -19,7 +19,7 @@ class NodeTest extends TestCase { public function testToString() { - $node = new Node(array(new ConstantNode('foo'))); + $node = new Node([new ConstantNode('foo')]); $this->assertEquals(<<<'EOF' Node( @@ -31,7 +31,7 @@ EOF public function testSerialization() { - $node = new Node(array('foo' => 'bar'), array('bar' => 'foo')); + $node = new Node(['foo' => 'bar'], ['bar' => 'foo']); $serializedNode = serialize($node); $unserializedNode = unserialize($serializedNode); diff --git a/vendor/symfony/expression-language/Tests/Node/UnaryNodeTest.php b/vendor/symfony/expression-language/Tests/Node/UnaryNodeTest.php index ef072cb6ec..bac75d24dc 100644 --- a/vendor/symfony/expression-language/Tests/Node/UnaryNodeTest.php +++ b/vendor/symfony/expression-language/Tests/Node/UnaryNodeTest.php @@ -18,31 +18,31 @@ class UnaryNodeTest extends AbstractNodeTest { public function getEvaluateData() { - return array( - array(-1, new UnaryNode('-', new ConstantNode(1))), - array(3, new UnaryNode('+', new ConstantNode(3))), - array(false, new UnaryNode('!', new ConstantNode(true))), - array(false, new UnaryNode('not', new ConstantNode(true))), - ); + return [ + [-1, new UnaryNode('-', new ConstantNode(1))], + [3, new UnaryNode('+', new ConstantNode(3))], + [false, new UnaryNode('!', new ConstantNode(true))], + [false, new UnaryNode('not', new ConstantNode(true))], + ]; } public function getCompileData() { - return array( - array('(-1)', new UnaryNode('-', new ConstantNode(1))), - array('(+3)', new UnaryNode('+', new ConstantNode(3))), - array('(!true)', new UnaryNode('!', new ConstantNode(true))), - array('(!true)', new UnaryNode('not', new ConstantNode(true))), - ); + return [ + ['(-1)', new UnaryNode('-', new ConstantNode(1))], + ['(+3)', new UnaryNode('+', new ConstantNode(3))], + ['(!true)', new UnaryNode('!', new ConstantNode(true))], + ['(!true)', new UnaryNode('not', new ConstantNode(true))], + ]; } public function getDumpData() { - return array( - array('(- 1)', new UnaryNode('-', new ConstantNode(1))), - array('(+ 3)', new UnaryNode('+', new ConstantNode(3))), - array('(! true)', new UnaryNode('!', new ConstantNode(true))), - array('(not true)', new UnaryNode('not', new ConstantNode(true))), - ); + return [ + ['(- 1)', new UnaryNode('-', new ConstantNode(1))], + ['(+ 3)', new UnaryNode('+', new ConstantNode(3))], + ['(! true)', new UnaryNode('!', new ConstantNode(true))], + ['(not true)', new UnaryNode('not', new ConstantNode(true))], + ]; } } diff --git a/vendor/symfony/expression-language/Tests/ParserTest.php b/vendor/symfony/expression-language/Tests/ParserTest.php index 1e9ffba21e..d030600fe8 100644 --- a/vendor/symfony/expression-language/Tests/ParserTest.php +++ b/vendor/symfony/expression-language/Tests/ParserTest.php @@ -25,7 +25,7 @@ class ParserTest extends TestCase public function testParseWithInvalidName() { $lexer = new Lexer(); - $parser = new Parser(array()); + $parser = new Parser([]); $parser->parse($lexer->tokenize('foo')); } @@ -36,17 +36,17 @@ class ParserTest extends TestCase public function testParseWithZeroInNames() { $lexer = new Lexer(); - $parser = new Parser(array()); - $parser->parse($lexer->tokenize('foo'), array(0)); + $parser = new Parser([]); + $parser->parse($lexer->tokenize('foo'), [0]); } /** * @dataProvider getParseData */ - public function testParse($node, $expression, $names = array()) + public function testParse($node, $expression, $names = []) { $lexer = new Lexer(); - $parser = new Parser(array()); + $parser = new Parser([]); $this->assertEquals($node, $parser->parse($lexer->tokenize($expression), $names)); } @@ -57,63 +57,63 @@ class ParserTest extends TestCase $arguments->addElement(new Node\ConstantNode(2)); $arguments->addElement(new Node\ConstantNode(true)); - return array( - array( + return [ + [ new Node\NameNode('a'), 'a', - array('a'), - ), - array( + ['a'], + ], + [ new Node\ConstantNode('a'), '"a"', - ), - array( + ], + [ new Node\ConstantNode(3), '3', - ), - array( + ], + [ new Node\ConstantNode(false), 'false', - ), - array( + ], + [ new Node\ConstantNode(true), 'true', - ), - array( + ], + [ new Node\ConstantNode(null), 'null', - ), - array( + ], + [ new Node\UnaryNode('-', new Node\ConstantNode(3)), '-3', - ), - array( + ], + [ new Node\BinaryNode('-', new Node\ConstantNode(3), new Node\ConstantNode(3)), '3 - 3', - ), - array( + ], + [ new Node\BinaryNode('*', new Node\BinaryNode('-', new Node\ConstantNode(3), new Node\ConstantNode(3)), new Node\ConstantNode(2) ), '(3 - 3) * 2', - ), - array( + ], + [ new Node\GetAttrNode(new Node\NameNode('foo'), new Node\ConstantNode('bar', true), new Node\ArgumentsNode(), Node\GetAttrNode::PROPERTY_CALL), 'foo.bar', - array('foo'), - ), - array( + ['foo'], + ], + [ new Node\GetAttrNode(new Node\NameNode('foo'), new Node\ConstantNode('bar', true), new Node\ArgumentsNode(), Node\GetAttrNode::METHOD_CALL), 'foo.bar()', - array('foo'), - ), - array( + ['foo'], + ], + [ new Node\GetAttrNode(new Node\NameNode('foo'), new Node\ConstantNode('not', true), new Node\ArgumentsNode(), Node\GetAttrNode::METHOD_CALL), 'foo.not()', - array('foo'), - ), - array( + ['foo'], + ], + [ new Node\GetAttrNode( new Node\NameNode('foo'), new Node\ConstantNode('bar', true), @@ -121,24 +121,24 @@ class ParserTest extends TestCase Node\GetAttrNode::METHOD_CALL ), 'foo.bar("arg1", 2, true)', - array('foo'), - ), - array( + ['foo'], + ], + [ new Node\GetAttrNode(new Node\NameNode('foo'), new Node\ConstantNode(3), new Node\ArgumentsNode(), Node\GetAttrNode::ARRAY_CALL), 'foo[3]', - array('foo'), - ), - array( + ['foo'], + ], + [ new Node\ConditionalNode(new Node\ConstantNode(true), new Node\ConstantNode(true), new Node\ConstantNode(false)), 'true ? true : false', - ), - array( + ], + [ new Node\BinaryNode('matches', new Node\ConstantNode('foo'), new Node\ConstantNode('/foo/')), '"foo" matches "/foo/"', - ), + ], // chained calls - array( + [ $this->createGetAttrNode( $this->createGetAttrNode( $this->createGetAttrNode( @@ -147,15 +147,15 @@ class ParserTest extends TestCase 'baz', Node\GetAttrNode::PROPERTY_CALL), '3', Node\GetAttrNode::ARRAY_CALL), 'foo.bar().foo().baz[3]', - array('foo'), - ), + ['foo'], + ], - array( + [ new Node\NameNode('foo'), 'bar', - array('foo' => 'bar'), - ), - ); + ['foo' => 'bar'], + ], + ]; } private function createGetAttrNode($node, $item, $type) @@ -167,33 +167,33 @@ class ParserTest extends TestCase * @dataProvider getInvalidPostfixData * @expectedException \Symfony\Component\ExpressionLanguage\SyntaxError */ - public function testParseWithInvalidPostfixData($expr, $names = array()) + public function testParseWithInvalidPostfixData($expr, $names = []) { $lexer = new Lexer(); - $parser = new Parser(array()); + $parser = new Parser([]); $parser->parse($lexer->tokenize($expr), $names); } public function getInvalidPostfixData() { - return array( - array( + return [ + [ 'foo."#"', - array('foo'), - ), - array( + ['foo'], + ], + [ 'foo."bar"', - array('foo'), - ), - array( + ['foo'], + ], + [ 'foo.**', - array('foo'), - ), - array( + ['foo'], + ], + [ 'foo.123', - array('foo'), - ), - ); + ['foo'], + ], + ]; } /** @@ -203,8 +203,8 @@ class ParserTest extends TestCase public function testNameProposal() { $lexer = new Lexer(); - $parser = new Parser(array()); + $parser = new Parser([]); - $parser->parse($lexer->tokenize('foo > bar'), array('foo', 'baz')); + $parser->parse($lexer->tokenize('foo > bar'), ['foo', 'baz']); } } diff --git a/vendor/symfony/http-foundation/AcceptHeader.php b/vendor/symfony/http-foundation/AcceptHeader.php index c702371f81..3f5fbb8f3b 100644 --- a/vendor/symfony/http-foundation/AcceptHeader.php +++ b/vendor/symfony/http-foundation/AcceptHeader.php @@ -24,7 +24,7 @@ class AcceptHeader /** * @var AcceptHeaderItem[] */ - private $items = array(); + private $items = []; /** * @var bool diff --git a/vendor/symfony/http-foundation/AcceptHeaderItem.php b/vendor/symfony/http-foundation/AcceptHeaderItem.php index 2aaf59579f..954aac6014 100644 --- a/vendor/symfony/http-foundation/AcceptHeaderItem.php +++ b/vendor/symfony/http-foundation/AcceptHeaderItem.php @@ -21,9 +21,9 @@ class AcceptHeaderItem private $value; private $quality = 1.0; private $index = 0; - private $attributes = array(); + private $attributes = []; - public function __construct(string $value, array $attributes = array()) + public function __construct(string $value, array $attributes = []) { $this->value = $value; foreach ($attributes as $name => $value) { diff --git a/vendor/symfony/http-foundation/BinaryFileResponse.php b/vendor/symfony/http-foundation/BinaryFileResponse.php index 07ef800508..115f486f02 100644 --- a/vendor/symfony/http-foundation/BinaryFileResponse.php +++ b/vendor/symfony/http-foundation/BinaryFileResponse.php @@ -44,7 +44,7 @@ class BinaryFileResponse extends Response * @param bool $autoEtag Whether the ETag header should be automatically set * @param bool $autoLastModified Whether the Last-Modified header should be automatically set */ - public function __construct($file, int $status = 200, array $headers = array(), bool $public = true, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true) + public function __construct($file, int $status = 200, array $headers = [], bool $public = true, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true) { parent::__construct(null, $status, $headers); @@ -66,7 +66,7 @@ class BinaryFileResponse extends Response * * @return static */ - public static function create($file = null, $status = 200, $headers = array(), $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) + public static function create($file = null, $status = 200, $headers = [], $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true) { return new static($file, $status, $headers, $public, $contentDisposition, $autoEtag, $autoLastModified); } @@ -234,7 +234,7 @@ class BinaryFileResponse extends Response if (!$request->headers->has('If-Range') || $this->hasValidIfRangeHeader($request->headers->get('If-Range'))) { $range = $request->headers->get('Range'); - list($start, $end) = explode('-', substr($range, 6), 2) + array(0); + list($start, $end) = explode('-', substr($range, 6), 2) + [0]; $end = ('' === $end) ? $fileSize - 1 : (int) $end; @@ -300,7 +300,7 @@ class BinaryFileResponse extends Response fclose($out); fclose($file); - if ($this->deleteFileAfterSend) { + if ($this->deleteFileAfterSend && file_exists($this->file->getPathname())) { unlink($this->file->getPathname()); } diff --git a/vendor/symfony/http-foundation/Cookie.php b/vendor/symfony/http-foundation/Cookie.php index 7aab318ccd..0ba6037d7c 100644 --- a/vendor/symfony/http-foundation/Cookie.php +++ b/vendor/symfony/http-foundation/Cookie.php @@ -42,7 +42,7 @@ class Cookie */ public static function fromString($cookie, $decode = false) { - $data = array( + $data = [ 'expires' => 0, 'path' => '/', 'domain' => null, @@ -50,7 +50,7 @@ class Cookie 'httponly' => false, 'raw' => !$decode, 'samesite' => null, - ); + ]; $parts = HeaderUtils::split($cookie, ';='); $part = array_shift($parts); @@ -126,7 +126,7 @@ class Cookie $sameSite = strtolower($sameSite); } - if (!\in_array($sameSite, array(self::SAMESITE_LAX, self::SAMESITE_STRICT, null), true)) { + if (!\in_array($sameSite, [self::SAMESITE_LAX, self::SAMESITE_STRICT, null], true)) { throw new \InvalidArgumentException('The "sameSite" parameter value is not valid.'); } diff --git a/vendor/symfony/http-foundation/ExpressionRequestMatcher.php b/vendor/symfony/http-foundation/ExpressionRequestMatcher.php index e9c8441ce3..26bed7d371 100644 --- a/vendor/symfony/http-foundation/ExpressionRequestMatcher.php +++ b/vendor/symfony/http-foundation/ExpressionRequestMatcher.php @@ -35,13 +35,13 @@ class ExpressionRequestMatcher extends RequestMatcher throw new \LogicException('Unable to match the request as the expression language is not available.'); } - return $this->language->evaluate($this->expression, array( + return $this->language->evaluate($this->expression, [ 'request' => $request, 'method' => $request->getMethod(), 'path' => rawurldecode($request->getPathInfo()), 'host' => $request->getHost(), 'ip' => $request->getClientIp(), 'attributes' => $request->attributes->all(), - )) && parent::matches($request); + ]) && parent::matches($request); } } diff --git a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php b/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php index 263fb321c5..80f4d47f76 100644 --- a/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/ExtensionGuesser.php @@ -37,7 +37,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface * * @var array */ - protected $guessers = array(); + protected $guessers = []; /** * Returns the singleton instance. diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php index 77bf51b1e5..d5acb34094 100644 --- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php @@ -20,11 +20,11 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface * A map of mime types and their default extensions. * * This list has been placed under the public domain by the Apache HTTPD project. - * This list has been updated from upstream on 2013-04-23. + * This list has been updated from upstream on 2019-01-14. * - * @see http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types + * @see https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types */ - protected $defaultExtensions = array( + protected $defaultExtensions = [ 'application/andrew-inset' => 'ez', 'application/applixware' => 'aw', 'application/atom+xml' => 'atom', @@ -618,7 +618,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'audio/adpcm' => 'adp', 'audio/basic' => 'au', 'audio/midi' => 'mid', - 'audio/mp4' => 'mp4a', + 'audio/mp4' => 'm4a', 'audio/mpeg' => 'mpga', 'audio/ogg' => 'oga', 'audio/s3m' => 's3m', @@ -653,6 +653,11 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'chemical/x-cml' => 'cml', 'chemical/x-csml' => 'csml', 'chemical/x-xyz' => 'xyz', + 'font/collection' => 'ttc', + 'font/otf' => 'otf', + 'font/ttf' => 'ttf', + 'font/woff' => 'woff', + 'font/woff2' => 'woff2', 'image/bmp' => 'bmp', 'image/x-ms-bmp' => 'bmp', 'image/cgm' => 'cgm', @@ -669,8 +674,8 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'image/tiff' => 'tiff', 'image/vnd.adobe.photoshop' => 'psd', 'image/vnd.dece.graphic' => 'uvi', - 'image/vnd.dvb.subtitle' => 'sub', 'image/vnd.djvu' => 'djvu', + 'image/vnd.dvb.subtitle' => 'sub', 'image/vnd.dwg' => 'dwg', 'image/vnd.dxf' => 'dxf', 'image/vnd.fastbidsheet' => 'fbs', @@ -732,8 +737,8 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'text/vcard' => 'vcard', 'text/vnd.curl' => 'curl', 'text/vnd.curl.dcurl' => 'dcurl', - 'text/vnd.curl.scurl' => 'scurl', 'text/vnd.curl.mcurl' => 'mcurl', + 'text/vnd.curl.scurl' => 'scurl', 'text/vnd.dvb.subtitle' => 'sub', 'text/vnd.fly' => 'fly', 'text/vnd.fmi.flexstor' => 'flx', @@ -747,10 +752,10 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'text/x-asm' => 's', 'text/x-c' => 'c', 'text/x-fortran' => 'f', - 'text/x-pascal' => 'p', 'text/x-java-source' => 'java', - 'text/x-opml' => 'opml', 'text/x-nfo' => 'nfo', + 'text/x-opml' => 'opml', + 'text/x-pascal' => 'p', 'text/x-setext' => 'etx', 'text/x-sfv' => 'sfv', 'text/x-uuencode' => 'uu', @@ -796,7 +801,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'video/x-sgi-movie' => 'movie', 'video/x-smv' => 'smv', 'x-conference/x-cooltalk' => 'ice', - ); + ]; /** * {@inheritdoc} diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php index dae47a7c02..95d1ee2676 100644 --- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php @@ -51,7 +51,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface * * @var array */ - protected $guessers = array(); + protected $guessers = []; /** * Returns the singleton instance. diff --git a/vendor/symfony/http-foundation/File/UploadedFile.php b/vendor/symfony/http-foundation/File/UploadedFile.php index 63fa6c7302..efe00d64cc 100644 --- a/vendor/symfony/http-foundation/File/UploadedFile.php +++ b/vendor/symfony/http-foundation/File/UploadedFile.php @@ -281,7 +281,7 @@ class UploadedFile extends File */ public function getErrorMessage() { - static $errors = array( + static $errors = [ UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).', UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.', UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.', @@ -289,7 +289,7 @@ class UploadedFile extends File UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.', UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.', UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.', - ); + ]; $errorCode = $this->error; $maxFilesize = UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0; diff --git a/vendor/symfony/http-foundation/FileBag.php b/vendor/symfony/http-foundation/FileBag.php index f37e10f204..14fbc7aa9d 100644 --- a/vendor/symfony/http-foundation/FileBag.php +++ b/vendor/symfony/http-foundation/FileBag.php @@ -21,12 +21,12 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; */ class FileBag extends ParameterBag { - private static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); + private static $fileKeys = ['error', 'name', 'size', 'tmp_name', 'type']; /** * @param array $parameters An array of HTTP files */ - public function __construct(array $parameters = array()) + public function __construct(array $parameters = []) { $this->replace($parameters); } @@ -34,9 +34,9 @@ class FileBag extends ParameterBag /** * {@inheritdoc} */ - public function replace(array $files = array()) + public function replace(array $files = []) { - $this->parameters = array(); + $this->parameters = []; $this->add($files); } @@ -55,7 +55,7 @@ class FileBag extends ParameterBag /** * {@inheritdoc} */ - public function add(array $files = array()) + public function add(array $files = []) { foreach ($files as $key => $file) { $this->set($key, $file); @@ -87,7 +87,7 @@ class FileBag extends ParameterBag $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['error']); } } else { - $file = array_map(array($this, 'convertFileInformation'), $file); + $file = array_map([$this, 'convertFileInformation'], $file); if (array_keys($keys) === $keys) { $file = array_filter($file); } @@ -130,13 +130,13 @@ class FileBag extends ParameterBag } foreach ($data['name'] as $key => $name) { - $files[$key] = $this->fixPhpFilesArray(array( + $files[$key] = $this->fixPhpFilesArray([ 'error' => $data['error'][$key], 'name' => $name, 'type' => $data['type'][$key], 'tmp_name' => $data['tmp_name'][$key], 'size' => $data['size'][$key], - )); + ]); } return $files; diff --git a/vendor/symfony/http-foundation/HeaderBag.php b/vendor/symfony/http-foundation/HeaderBag.php index 8f51ef9dba..b37a72e47e 100644 --- a/vendor/symfony/http-foundation/HeaderBag.php +++ b/vendor/symfony/http-foundation/HeaderBag.php @@ -18,13 +18,13 @@ namespace Symfony\Component\HttpFoundation; */ class HeaderBag implements \IteratorAggregate, \Countable { - protected $headers = array(); - protected $cacheControl = array(); + protected $headers = []; + protected $cacheControl = []; /** * @param array $headers An array of HTTP headers */ - public function __construct(array $headers = array()) + public function __construct(array $headers = []) { foreach ($headers as $key => $values) { $this->set($key, $values); @@ -80,9 +80,9 @@ class HeaderBag implements \IteratorAggregate, \Countable * * @param array $headers An array of HTTP headers */ - public function replace(array $headers = array()) + public function replace(array $headers = []) { - $this->headers = array(); + $this->headers = []; $this->add($headers); } @@ -114,10 +114,10 @@ class HeaderBag implements \IteratorAggregate, \Countable if (!array_key_exists($key, $headers)) { if (null === $default) { - return $first ? null : array(); + return $first ? null : []; } - return $first ? $default : array($default); + return $first ? $default : [$default]; } if ($first) { @@ -148,7 +148,7 @@ class HeaderBag implements \IteratorAggregate, \Countable } } else { if (true === $replace || !isset($this->headers[$key])) { - $this->headers[$key] = array($values); + $this->headers[$key] = [$values]; } else { $this->headers[$key][] = $values; } @@ -196,7 +196,7 @@ class HeaderBag implements \IteratorAggregate, \Countable unset($this->headers[$key]); if ('cache-control' === $key) { - $this->cacheControl = array(); + $this->cacheControl = []; } } diff --git a/vendor/symfony/http-foundation/HeaderUtils.php b/vendor/symfony/http-foundation/HeaderUtils.php index 637bc5be47..31db1bd0de 100644 --- a/vendor/symfony/http-foundation/HeaderUtils.php +++ b/vendor/symfony/http-foundation/HeaderUtils.php @@ -34,7 +34,7 @@ class HeaderUtils * Example: * * HeaderUtils::split("da, en-gb;q=0.8", ",;") - * // => array(array('da'), array('en-gb', 'q=0.8')) + * // => ['da'], ['en-gb', 'q=0.8']] * * @param string $header HTTP header value * @param string $separators List of characters to split on, ordered by @@ -78,12 +78,12 @@ class HeaderUtils * * Example: * - * HeaderUtils::combine(array(array("foo", "abc"), array("bar"))) - * // => array("foo" => "abc", "bar" => true) + * HeaderUtils::combine([["foo", "abc"], ["bar"]]) + * // => ["foo" => "abc", "bar" => true] */ public static function combine(array $parts): array { - $assoc = array(); + $assoc = []; foreach ($parts as $part) { $name = strtolower($part[0]); $value = $part[1] ?? true; @@ -102,12 +102,12 @@ class HeaderUtils * * Example: * - * HeaderUtils::toString(array("foo" => "abc", "bar" => true, "baz" => "a b c"), ",") + * HeaderUtils::toString(["foo" => "abc", "bar" => true, "baz" => "a b c"], ",") * // => 'foo=abc, bar, baz="a b c"' */ public static function toString(array $assoc, string $separator): string { - $parts = array(); + $parts = []; foreach ($assoc as $name => $value) { if (true === $value) { $parts[] = $name; @@ -163,7 +163,7 @@ class HeaderUtils */ public static function makeDisposition(string $disposition, string $filename, string $filenameFallback = ''): string { - if (!\in_array($disposition, array(self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE))) { + if (!\in_array($disposition, [self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE])) { throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE)); } @@ -186,7 +186,7 @@ class HeaderUtils throw new \InvalidArgumentException('The filename and the fallback cannot contain the "/" and "\\" characters.'); } - $params = array('filename' => $filenameFallback); + $params = ['filename' => $filenameFallback]; if ($filename !== $filenameFallback) { $params['filename*'] = "utf-8''".rawurlencode($filename); } @@ -200,7 +200,7 @@ class HeaderUtils $partSeparators = substr($separators, 1); $i = 0; - $partMatches = array(); + $partMatches = []; foreach ($matches as $match) { if (isset($match['separator']) && $match['separator'] === $separator) { ++$i; @@ -209,7 +209,7 @@ class HeaderUtils } } - $parts = array(); + $parts = []; if ($partSeparators) { foreach ($partMatches as $matches) { $parts[] = self::groupParts($matches, $partSeparators); diff --git a/vendor/symfony/http-foundation/IpUtils.php b/vendor/symfony/http-foundation/IpUtils.php index a1bfa90885..67d13e57aa 100644 --- a/vendor/symfony/http-foundation/IpUtils.php +++ b/vendor/symfony/http-foundation/IpUtils.php @@ -18,7 +18,7 @@ namespace Symfony\Component\HttpFoundation; */ class IpUtils { - private static $checkedIps = array(); + private static $checkedIps = []; /** * This class should not be instantiated. @@ -38,7 +38,7 @@ class IpUtils public static function checkIp($requestIp, $ips) { if (!\is_array($ips)) { - $ips = array($ips); + $ips = [$ips]; } $method = substr_count($requestIp, ':') > 1 ? 'checkIp6' : 'checkIp4'; diff --git a/vendor/symfony/http-foundation/JsonResponse.php b/vendor/symfony/http-foundation/JsonResponse.php index f10262e88e..817cbb9afc 100644 --- a/vendor/symfony/http-foundation/JsonResponse.php +++ b/vendor/symfony/http-foundation/JsonResponse.php @@ -39,7 +39,7 @@ class JsonResponse extends Response * @param array $headers An array of response headers * @param bool $json If the data is already a JSON string */ - public function __construct($data = null, int $status = 200, array $headers = array(), bool $json = false) + public function __construct($data = null, int $status = 200, array $headers = [], bool $json = false) { parent::__construct('', $status, $headers); @@ -64,7 +64,7 @@ class JsonResponse extends Response * * @return static */ - public static function create($data = null, $status = 200, $headers = array()) + public static function create($data = null, $status = 200, $headers = []) { return new static($data, $status, $headers); } @@ -72,7 +72,7 @@ class JsonResponse extends Response /** * Make easier the creation of JsonResponse from raw json. */ - public static function fromJsonString($data = null, $status = 200, $headers = array()) + public static function fromJsonString($data = null, $status = 200, $headers = []) { return new static($data, $status, $headers, true); } @@ -94,11 +94,11 @@ class JsonResponse extends Response // JsonpCallbackValidator is released under the MIT License. See https://github.com/willdurand/JsonpCallbackValidator/blob/v1.1.0/LICENSE for details. // (c) William Durand <william.durand1@gmail.com> $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?:\[(?:"(?:\\\.|[^"\\\])*"|\'(?:\\\.|[^\'\\\])*\'|\d+)\])*?$/u'; - $reserved = array( + $reserved = [ 'break', 'do', 'instanceof', 'typeof', 'case', 'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue', 'for', 'switch', 'while', 'debugger', 'function', 'this', 'with', 'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum', 'extends', 'super', 'const', 'export', 'import', 'implements', 'let', 'private', 'public', 'yield', 'interface', 'package', 'protected', 'static', 'null', 'true', 'false', - ); + ]; $parts = explode('.', $callback); foreach ($parts as $part) { if (!preg_match($pattern, $part) || \in_array($part, $reserved, true)) { @@ -137,7 +137,7 @@ class JsonResponse extends Response * * @throws \InvalidArgumentException */ - public function setData($data = array()) + public function setData($data = []) { try { $data = json_encode($data, $this->encodingOptions); diff --git a/vendor/symfony/http-foundation/ParameterBag.php b/vendor/symfony/http-foundation/ParameterBag.php index 19d7ee913a..3c6ba46a6a 100644 --- a/vendor/symfony/http-foundation/ParameterBag.php +++ b/vendor/symfony/http-foundation/ParameterBag.php @@ -26,7 +26,7 @@ class ParameterBag implements \IteratorAggregate, \Countable /** * @param array $parameters An array of parameters */ - public function __construct(array $parameters = array()) + public function __construct(array $parameters = []) { $this->parameters = $parameters; } @@ -56,7 +56,7 @@ class ParameterBag implements \IteratorAggregate, \Countable * * @param array $parameters An array of parameters */ - public function replace(array $parameters = array()) + public function replace(array $parameters = []) { $this->parameters = $parameters; } @@ -66,7 +66,7 @@ class ParameterBag implements \IteratorAggregate, \Countable * * @param array $parameters An array of parameters */ - public function add(array $parameters = array()) + public function add(array $parameters = []) { $this->parameters = array_replace($this->parameters, $parameters); } @@ -154,7 +154,7 @@ class ParameterBag implements \IteratorAggregate, \Countable public function getDigits($key, $default = '') { // we need to remove - and + because they're allowed in the filter - return str_replace(array('-', '+'), '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT)); + return str_replace(['-', '+'], '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT)); } /** @@ -195,13 +195,13 @@ class ParameterBag implements \IteratorAggregate, \Countable * * @return mixed */ - public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = array()) + public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options = []) { $value = $this->get($key, $default); // Always turn $options into an array - this allows filter_var option shortcuts. if (!\is_array($options) && $options) { - $options = array('flags' => $options); + $options = ['flags' => $options]; } // Add a convenience check for arrays. diff --git a/vendor/symfony/http-foundation/RedirectResponse.php b/vendor/symfony/http-foundation/RedirectResponse.php index 11f71a0342..22e5fbb2d0 100644 --- a/vendor/symfony/http-foundation/RedirectResponse.php +++ b/vendor/symfony/http-foundation/RedirectResponse.php @@ -32,7 +32,7 @@ class RedirectResponse extends Response * * @see http://tools.ietf.org/html/rfc2616#section-10.3 */ - public function __construct(?string $url, int $status = 302, array $headers = array()) + public function __construct(?string $url, int $status = 302, array $headers = []) { parent::__construct('', $status, $headers); @@ -56,7 +56,7 @@ class RedirectResponse extends Response * * @return static */ - public static function create($url = '', $status = 302, $headers = array()) + public static function create($url = '', $status = 302, $headers = []) { return new static($url, $status, $headers); } diff --git a/vendor/symfony/http-foundation/Request.php b/vendor/symfony/http-foundation/Request.php index c13016e522..7f44aab1d5 100644 --- a/vendor/symfony/http-foundation/Request.php +++ b/vendor/symfony/http-foundation/Request.php @@ -52,17 +52,17 @@ class Request /** * @var string[] */ - protected static $trustedProxies = array(); + protected static $trustedProxies = []; /** * @var string[] */ - protected static $trustedHostPatterns = array(); + protected static $trustedHostPatterns = []; /** * @var string[] */ - protected static $trustedHosts = array(); + protected static $trustedHosts = []; protected static $httpMethodParameterOverride = false; @@ -197,12 +197,12 @@ class Request private static $trustedHeaderSet = -1; - private static $forwardedParams = array( + private static $forwardedParams = [ self::HEADER_X_FORWARDED_FOR => 'for', self::HEADER_X_FORWARDED_HOST => 'host', self::HEADER_X_FORWARDED_PROTO => 'proto', self::HEADER_X_FORWARDED_PORT => 'host', - ); + ]; /** * Names for headers that can be trusted when @@ -213,13 +213,13 @@ class Request * The other headers are non-standard, but widely used * by popular reverse proxies (like Apache mod_proxy or Amazon EC2). */ - private static $trustedHeaders = array( + private static $trustedHeaders = [ self::HEADER_FORWARDED => 'FORWARDED', self::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR', self::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST', self::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO', self::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT', - ); + ]; /** * @param array $query The GET parameters @@ -230,7 +230,7 @@ class Request * @param array $server The SERVER parameters * @param string|resource|null $content The raw body data */ - public function __construct(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) + public function __construct(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null) { $this->initialize($query, $request, $attributes, $cookies, $files, $server, $content); } @@ -248,7 +248,7 @@ class Request * @param array $server The SERVER parameters * @param string|resource|null $content The raw body data */ - public function initialize(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) + public function initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null) { $this->request = new ParameterBag($request); $this->query = new ParameterBag($query); @@ -278,10 +278,10 @@ class Request */ public static function createFromGlobals() { - $request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); + $request = self::createRequestFromFactory($_GET, $_POST, [], $_COOKIE, $_FILES, $_SERVER); if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') - && \in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH')) + && \in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), ['PUT', 'DELETE', 'PATCH']) ) { parse_str($request->getContent(), $data); $request->request = new ParameterBag($data); @@ -306,9 +306,9 @@ class Request * * @return static */ - public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) + public static function create($uri, $method = 'GET', $parameters = [], $cookies = [], $files = [], $server = [], $content = null) { - $server = array_replace(array( + $server = array_replace([ 'SERVER_NAME' => 'localhost', 'SERVER_PORT' => 80, 'HTTP_HOST' => 'localhost', @@ -321,7 +321,7 @@ class Request 'SCRIPT_FILENAME' => '', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_TIME' => time(), - ), $server); + ], $server); $server['PATH_INFO'] = ''; $server['REQUEST_METHOD'] = strtoupper($method); @@ -369,10 +369,10 @@ class Request // no break case 'PATCH': $request = $parameters; - $query = array(); + $query = []; break; default: - $request = array(); + $request = []; $query = $parameters; break; } @@ -395,7 +395,7 @@ class Request $server['REQUEST_URI'] = $components['path'].('' !== $queryString ? '?'.$queryString : ''); $server['QUERY_STRING'] = $queryString; - return self::createRequestFromFactory($query, $request, array(), $cookies, $files, $server, $content); + return self::createRequestFromFactory($query, $request, [], $cookies, $files, $server, $content); } /** @@ -499,7 +499,7 @@ class Request } $cookieHeader = ''; - $cookies = array(); + $cookies = []; foreach ($this->cookies as $k => $v) { $cookies[] = $k.'='.$v; @@ -533,19 +533,19 @@ class Request foreach ($this->headers->all() as $key => $value) { $key = strtoupper(str_replace('-', '_', $key)); - if (\in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) { + if (\in_array($key, ['CONTENT_TYPE', 'CONTENT_LENGTH'])) { $_SERVER[$key] = implode(', ', $value); } else { $_SERVER['HTTP_'.$key] = implode(', ', $value); } } - $request = array('g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE); + $request = ['g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE]; $requestOrder = ini_get('request_order') ?: ini_get('variables_order'); $requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp'; - $_REQUEST = array(array()); + $_REQUEST = [[]]; foreach (str_split($requestOrder) as $order) { $_REQUEST[] = $request[$order]; @@ -603,7 +603,7 @@ class Request return sprintf('{%s}i', $hostPattern); }, $hostPatterns); // we need to reset trusted hosts on trusted host patterns change - self::$trustedHosts = array(); + self::$trustedHosts = []; } /** @@ -777,10 +777,10 @@ class Request $ip = $this->server->get('REMOTE_ADDR'); if (!$this->isFromTrustedProxy()) { - return array($ip); + return [$ip]; } - return $this->getTrustedValues(self::HEADER_X_FORWARDED_FOR, $ip) ?: array($ip); + return $this->getTrustedValues(self::HEADER_X_FORWARDED_FOR, $ip) ?: [$ip]; } /** @@ -1114,7 +1114,7 @@ class Request public function isSecure() { if ($this->isFromTrustedProxy() && $proto = $this->getTrustedValues(self::HEADER_X_FORWARDED_PROTO)) { - return \in_array(strtolower($proto[0]), array('https', 'on', 'ssl', '1'), true); + return \in_array(strtolower($proto[0]), ['https', 'on', 'ssl', '1'], true); } $https = $this->server->get('HTTPS'); @@ -1273,7 +1273,7 @@ class Request static::initializeFormats(); } - return isset(static::$formats[$format]) ? static::$formats[$format] : array(); + return isset(static::$formats[$format]) ? static::$formats[$format] : []; } /** @@ -1316,7 +1316,7 @@ class Request static::initializeFormats(); } - static::$formats[$format] = \is_array($mimeTypes) ? $mimeTypes : array($mimeTypes); + static::$formats[$format] = \is_array($mimeTypes) ? $mimeTypes : [$mimeTypes]; } /** @@ -1433,7 +1433,7 @@ class Request throw new \BadMethodCallException('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is not supported.'); } - return \in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS', 'TRACE')); + return \in_array($this->getMethod(), ['GET', 'HEAD', 'OPTIONS', 'TRACE']); } /** @@ -1443,7 +1443,7 @@ class Request */ public function isMethodIdempotent() { - return \in_array($this->getMethod(), array('HEAD', 'GET', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'PURGE')); + return \in_array($this->getMethod(), ['HEAD', 'GET', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'PURGE']); } /** @@ -1455,7 +1455,7 @@ class Request */ public function isMethodCacheable() { - return \in_array($this->getMethod(), array('GET', 'HEAD')); + return \in_array($this->getMethod(), ['GET', 'HEAD']); } /** @@ -1566,7 +1566,7 @@ class Request return $locales[0]; } - $extendedPreferredLanguages = array(); + $extendedPreferredLanguages = []; foreach ($preferredLanguages as $language) { $extendedPreferredLanguages[] = $language; if (false !== $position = strpos($language, '_')) { @@ -1594,7 +1594,7 @@ class Request } $languages = AcceptHeader::fromString($this->headers->get('Accept-Language'))->all(); - $this->languages = array(); + $this->languages = []; foreach ($languages as $lang => $acceptHeaderItem) { if (false !== strpos($lang, '-')) { $codes = explode('-', $lang); @@ -1864,19 +1864,19 @@ class Request */ protected static function initializeFormats() { - static::$formats = array( - 'html' => array('text/html', 'application/xhtml+xml'), - 'txt' => array('text/plain'), - 'js' => array('application/javascript', 'application/x-javascript', 'text/javascript'), - 'css' => array('text/css'), - 'json' => array('application/json', 'application/x-json'), - 'jsonld' => array('application/ld+json'), - 'xml' => array('text/xml', 'application/xml', 'application/x-xml'), - 'rdf' => array('application/rdf+xml'), - 'atom' => array('application/atom+xml'), - 'rss' => array('application/rss+xml'), - 'form' => array('application/x-www-form-urlencoded'), - ); + static::$formats = [ + 'html' => ['text/html', 'application/xhtml+xml'], + 'txt' => ['text/plain'], + 'js' => ['application/javascript', 'application/x-javascript', 'text/javascript'], + 'css' => ['text/css'], + 'json' => ['application/json', 'application/x-json'], + 'jsonld' => ['application/ld+json'], + 'xml' => ['text/xml', 'application/xml', 'application/x-xml'], + 'rdf' => ['application/rdf+xml'], + 'atom' => ['application/atom+xml'], + 'rss' => ['application/rss+xml'], + 'form' => ['application/x-www-form-urlencoded'], + ]; } private function setPhpDefaultLocale(string $locale) @@ -1913,7 +1913,7 @@ class Request return false; } - private static function createRequestFromFactory(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) + private static function createRequestFromFactory(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null) { if (self::$requestFactory) { $request = (self::$requestFactory)($query, $request, $attributes, $cookies, $files, $server, $content); @@ -1943,8 +1943,8 @@ class Request private function getTrustedValues($type, $ip = null) { - $clientValues = array(); - $forwardedValues = array(); + $clientValues = []; + $forwardedValues = []; if ((self::$trustedHeaderSet & $type) && $this->headers->has(self::$trustedHeaders[$type])) { foreach (explode(',', $this->headers->get(self::$trustedHeaders[$type])) as $v) { @@ -1955,7 +1955,7 @@ class Request if ((self::$trustedHeaderSet & self::HEADER_FORWARDED) && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED])) { $forwarded = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]); $parts = HeaderUtils::split($forwarded, ',;='); - $forwardedValues = array(); + $forwardedValues = []; $param = self::$forwardedParams[$type]; foreach ($parts as $subParts) { if (null === $v = HeaderUtils::combine($subParts)[$param] ?? null) { @@ -1985,7 +1985,7 @@ class Request } if (!$this->isForwardedValid) { - return null !== $ip ? array('0.0.0.0', $ip) : array(); + return null !== $ip ? ['0.0.0.0', $ip] : []; } $this->isForwardedValid = false; @@ -1995,7 +1995,7 @@ class Request private function normalizeAndFilterClientIps(array $clientIps, $ip) { if (!$clientIps) { - return array(); + return []; } $clientIps[] = $ip; // Complete the IP chain with the IP the request actually came from $firstTrustedIp = null; @@ -2031,6 +2031,6 @@ class Request } // Now the IP chain contains only untrusted proxies and the client IP - return $clientIps ? array_reverse($clientIps) : array($firstTrustedIp); + return $clientIps ? array_reverse($clientIps) : [$firstTrustedIp]; } } diff --git a/vendor/symfony/http-foundation/RequestMatcher.php b/vendor/symfony/http-foundation/RequestMatcher.php index ab9434f43f..d79c7f2ea2 100644 --- a/vendor/symfony/http-foundation/RequestMatcher.php +++ b/vendor/symfony/http-foundation/RequestMatcher.php @@ -36,22 +36,22 @@ class RequestMatcher implements RequestMatcherInterface /** * @var string[] */ - private $methods = array(); + private $methods = []; /** * @var string[] */ - private $ips = array(); + private $ips = []; /** * @var array */ - private $attributes = array(); + private $attributes = []; /** * @var string[] */ - private $schemes = array(); + private $schemes = []; /** * @param string|null $path @@ -61,7 +61,7 @@ class RequestMatcher implements RequestMatcherInterface * @param array $attributes * @param string|string[]|null $schemes */ - public function __construct(string $path = null, string $host = null, $methods = null, $ips = null, array $attributes = array(), $schemes = null, int $port = null) + public function __construct(string $path = null, string $host = null, $methods = null, $ips = null, array $attributes = [], $schemes = null, int $port = null) { $this->matchPath($path); $this->matchHost($host); @@ -82,7 +82,7 @@ class RequestMatcher implements RequestMatcherInterface */ public function matchScheme($scheme) { - $this->schemes = null !== $scheme ? array_map('strtolower', (array) $scheme) : array(); + $this->schemes = null !== $scheme ? array_map('strtolower', (array) $scheme) : []; } /** @@ -132,7 +132,7 @@ class RequestMatcher implements RequestMatcherInterface */ public function matchIps($ips) { - $this->ips = null !== $ips ? (array) $ips : array(); + $this->ips = null !== $ips ? (array) $ips : []; } /** @@ -142,7 +142,7 @@ class RequestMatcher implements RequestMatcherInterface */ public function matchMethod($method) { - $this->methods = null !== $method ? array_map('strtoupper', (array) $method) : array(); + $this->methods = null !== $method ? array_map('strtoupper', (array) $method) : []; } /** diff --git a/vendor/symfony/http-foundation/RequestStack.php b/vendor/symfony/http-foundation/RequestStack.php index 40123f66f9..885d78a50e 100644 --- a/vendor/symfony/http-foundation/RequestStack.php +++ b/vendor/symfony/http-foundation/RequestStack.php @@ -21,7 +21,7 @@ class RequestStack /** * @var Request[] */ - private $requests = array(); + private $requests = []; /** * Pushes a Request on the stack. diff --git a/vendor/symfony/http-foundation/Response.php b/vendor/symfony/http-foundation/Response.php index 7c96212603..26b3f209d5 100644 --- a/vendor/symfony/http-foundation/Response.php +++ b/vendor/symfony/http-foundation/Response.php @@ -128,7 +128,7 @@ class Response * * @var array */ - public static $statusTexts = array( + public static $statusTexts = [ 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', // RFC2518 @@ -191,12 +191,12 @@ class Response 508 => 'Loop Detected', // RFC5842 510 => 'Not Extended', // RFC2774 511 => 'Network Authentication Required', // RFC6585 - ); + ]; /** * @throws \InvalidArgumentException When the HTTP status code is not valid */ - public function __construct($content = '', int $status = 200, array $headers = array()) + public function __construct($content = '', int $status = 200, array $headers = []) { $this->headers = new ResponseHeaderBag($headers); $this->setContent($content); @@ -218,7 +218,7 @@ class Response * * @return static */ - public static function create($content = '', $status = 200, $headers = array()) + public static function create($content = '', $status = 200, $headers = []) { return new static($content, $status, $headers); } @@ -377,7 +377,7 @@ class Response if (\function_exists('fastcgi_finish_request')) { fastcgi_finish_request(); - } elseif (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) { + } elseif (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) { static::closeOutputBuffers(0, true); } @@ -397,7 +397,7 @@ class Response */ public function setContent($content) { - if (null !== $content && !\is_string($content) && !is_numeric($content) && !\is_callable(array($content, '__toString'))) { + if (null !== $content && !\is_string($content) && !is_numeric($content) && !\is_callable([$content, '__toString'])) { throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', \gettype($content))); } @@ -529,7 +529,7 @@ class Response */ public function isCacheable(): bool { - if (!\in_array($this->statusCode, array(200, 203, 300, 301, 302, 404, 410))) { + if (!\in_array($this->statusCode, [200, 203, 300, 301, 302, 404, 410])) { return false; } @@ -939,7 +939,7 @@ class Response */ public function setCache(array $options) { - if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'))) { + if ($diff = array_diff(array_keys($options), ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'])) { throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', $diff))); } @@ -1000,7 +1000,7 @@ class Response $this->setContent(null); // remove headers that MUST NOT be included with 304 Not Modified responses - foreach (array('Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified') as $header) { + foreach (['Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified'] as $header) { $this->headers->remove($header); } @@ -1025,10 +1025,10 @@ class Response public function getVary(): array { if (!$vary = $this->headers->get('Vary', null, false)) { - return array(); + return []; } - $ret = array(); + $ret = []; foreach ($vary as $item) { $ret = array_merge($ret, preg_split('/[\s,]+/', $item)); } @@ -1188,7 +1188,7 @@ class Response */ public function isRedirect(string $location = null): bool { - return \in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null === $location ?: $location == $this->headers->get('Location')); + return \in_array($this->statusCode, [201, 301, 302, 303, 307, 308]) && (null === $location ?: $location == $this->headers->get('Location')); } /** @@ -1198,7 +1198,7 @@ class Response */ public function isEmpty(): bool { - return \in_array($this->statusCode, array(204, 304)); + return \in_array($this->statusCode, [204, 304]); } /** diff --git a/vendor/symfony/http-foundation/ResponseHeaderBag.php b/vendor/symfony/http-foundation/ResponseHeaderBag.php index 1141e8d987..9dd8908b27 100644 --- a/vendor/symfony/http-foundation/ResponseHeaderBag.php +++ b/vendor/symfony/http-foundation/ResponseHeaderBag.php @@ -24,11 +24,11 @@ class ResponseHeaderBag extends HeaderBag const DISPOSITION_ATTACHMENT = 'attachment'; const DISPOSITION_INLINE = 'inline'; - protected $computedCacheControl = array(); - protected $cookies = array(); - protected $headerNames = array(); + protected $computedCacheControl = []; + protected $cookies = []; + protected $headerNames = []; - public function __construct(array $headers = array()) + public function __construct(array $headers = []) { parent::__construct($headers); @@ -49,7 +49,7 @@ class ResponseHeaderBag extends HeaderBag */ public function allPreserveCase() { - $headers = array(); + $headers = []; foreach ($this->all() as $name => $value) { $headers[isset($this->headerNames[$name]) ? $this->headerNames[$name] : $name] = $value; } @@ -70,9 +70,9 @@ class ResponseHeaderBag extends HeaderBag /** * {@inheritdoc} */ - public function replace(array $headers = array()) + public function replace(array $headers = []) { - $this->headerNames = array(); + $this->headerNames = []; parent::replace($headers); @@ -107,7 +107,7 @@ class ResponseHeaderBag extends HeaderBag if ('set-cookie' === $uniqueKey) { if ($replace) { - $this->cookies = array(); + $this->cookies = []; } foreach ((array) $values as $cookie) { $this->setCookie(Cookie::fromString($cookie)); @@ -122,9 +122,9 @@ class ResponseHeaderBag extends HeaderBag parent::set($key, $values, $replace); // ensure the cache-control header has sensible defaults - if (\in_array($uniqueKey, array('cache-control', 'etag', 'last-modified', 'expires'), true)) { + if (\in_array($uniqueKey, ['cache-control', 'etag', 'last-modified', 'expires'], true)) { $computed = $this->computeCacheControlValue(); - $this->headers['cache-control'] = array($computed); + $this->headers['cache-control'] = [$computed]; $this->headerNames['cache-control'] = 'Cache-Control'; $this->computedCacheControl = $this->parseCacheControl($computed); } @@ -139,7 +139,7 @@ class ResponseHeaderBag extends HeaderBag unset($this->headerNames[$uniqueKey]); if ('set-cookie' === $uniqueKey) { - $this->cookies = array(); + $this->cookies = []; return; } @@ -147,7 +147,7 @@ class ResponseHeaderBag extends HeaderBag parent::remove($key); if ('cache-control' === $uniqueKey) { - $this->computedCacheControl = array(); + $this->computedCacheControl = []; } if ('date' === $uniqueKey) { @@ -216,15 +216,15 @@ class ResponseHeaderBag extends HeaderBag */ public function getCookies($format = self::COOKIES_FLAT) { - if (!\in_array($format, array(self::COOKIES_FLAT, self::COOKIES_ARRAY))) { - throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', array(self::COOKIES_FLAT, self::COOKIES_ARRAY)))); + if (!\in_array($format, [self::COOKIES_FLAT, self::COOKIES_ARRAY])) { + throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', [self::COOKIES_FLAT, self::COOKIES_ARRAY]))); } if (self::COOKIES_ARRAY === $format) { return $this->cookies; } - $flattenedCookies = array(); + $flattenedCookies = []; foreach ($this->cookies as $path) { foreach ($path as $cookies) { foreach ($cookies as $cookie) { diff --git a/vendor/symfony/http-foundation/ServerBag.php b/vendor/symfony/http-foundation/ServerBag.php index d8ab561aaf..90da49fae5 100644 --- a/vendor/symfony/http-foundation/ServerBag.php +++ b/vendor/symfony/http-foundation/ServerBag.php @@ -27,8 +27,8 @@ class ServerBag extends ParameterBag */ public function getHeaders() { - $headers = array(); - $contentHeaders = array('CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true); + $headers = []; + $contentHeaders = ['CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true]; foreach ($this->parameters as $key => $value) { if (0 === strpos($key, 'HTTP_')) { $headers[substr($key, 5)] = $value; diff --git a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php index 82577b804e..7b53e7fc76 100644 --- a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php +++ b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php @@ -19,7 +19,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta private $name = 'attributes'; private $storageKey; - protected $attributes = array(); + protected $attributes = []; /** * @param string $storageKey The key used to store attributes in the session @@ -95,7 +95,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta */ public function replace(array $attributes) { - $this->attributes = array(); + $this->attributes = []; foreach ($attributes as $key => $value) { $this->set($key, $value); } @@ -121,7 +121,7 @@ class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Counta public function clear() { $return = $this->attributes; - $this->attributes = array(); + $this->attributes = []; return $return; } diff --git a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php index 50cd740d95..7890214e82 100644 --- a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php +++ b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php @@ -115,7 +115,7 @@ class NamespacedAttributeBag extends AttributeBag return $array; } - $array[$parts[0]] = array(); + $array[$parts[0]] = []; return $array; } @@ -130,7 +130,7 @@ class NamespacedAttributeBag extends AttributeBag return $null; } - $array[$part] = array(); + $array[$part] = []; } $array = &$array[$part]; diff --git a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php index ef23457b41..782665caff 100644 --- a/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php +++ b/vendor/symfony/http-foundation/Session/Flash/AutoExpireFlashBag.php @@ -19,7 +19,7 @@ namespace Symfony\Component\HttpFoundation\Session\Flash; class AutoExpireFlashBag implements FlashBagInterface { private $name = 'flashes'; - private $flashes = array('display' => array(), 'new' => array()); + private $flashes = ['display' => [], 'new' => []]; private $storageKey; /** @@ -53,8 +53,8 @@ class AutoExpireFlashBag implements FlashBagInterface // The logic: messages from the last request will be stored in new, so we move them to previous // This request we will show what is in 'display'. What is placed into 'new' this time round will // be moved to display next time round. - $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : array(); - $this->flashes['new'] = array(); + $this->flashes['display'] = array_key_exists('new', $this->flashes) ? $this->flashes['new'] : []; + $this->flashes['new'] = []; } /** @@ -68,7 +68,7 @@ class AutoExpireFlashBag implements FlashBagInterface /** * {@inheritdoc} */ - public function peek($type, array $default = array()) + public function peek($type, array $default = []) { return $this->has($type) ? $this->flashes['display'][$type] : $default; } @@ -78,13 +78,13 @@ class AutoExpireFlashBag implements FlashBagInterface */ public function peekAll() { - return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array(); + return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : []; } /** * {@inheritdoc} */ - public function get($type, array $default = array()) + public function get($type, array $default = []) { $return = $default; @@ -106,7 +106,7 @@ class AutoExpireFlashBag implements FlashBagInterface public function all() { $return = $this->flashes['display']; - $this->flashes['display'] = array(); + $this->flashes['display'] = []; return $return; } diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php index 44ddb96330..9674e3514b 100644 --- a/vendor/symfony/http-foundation/Session/Flash/FlashBag.php +++ b/vendor/symfony/http-foundation/Session/Flash/FlashBag.php @@ -19,7 +19,7 @@ namespace Symfony\Component\HttpFoundation\Session\Flash; class FlashBag implements FlashBagInterface { private $name = 'flashes'; - private $flashes = array(); + private $flashes = []; private $storageKey; /** @@ -62,7 +62,7 @@ class FlashBag implements FlashBagInterface /** * {@inheritdoc} */ - public function peek($type, array $default = array()) + public function peek($type, array $default = []) { return $this->has($type) ? $this->flashes[$type] : $default; } @@ -78,7 +78,7 @@ class FlashBag implements FlashBagInterface /** * {@inheritdoc} */ - public function get($type, array $default = array()) + public function get($type, array $default = []) { if (!$this->has($type)) { return $default; @@ -97,7 +97,7 @@ class FlashBag implements FlashBagInterface public function all() { $return = $this->peekAll(); - $this->flashes = array(); + $this->flashes = []; return $return; } diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php index f53c9dae6c..2bd1d62bdb 100644 --- a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php +++ b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php @@ -44,7 +44,7 @@ interface FlashBagInterface extends SessionBagInterface * * @return array */ - public function peek($type, array $default = array()); + public function peek($type, array $default = []); /** * Gets all flash messages. @@ -61,7 +61,7 @@ interface FlashBagInterface extends SessionBagInterface * * @return array */ - public function get($type, array $default = array()); + public function get($type, array $default = []); /** * Gets and clears flashes from the stack. diff --git a/vendor/symfony/http-foundation/Session/Session.php b/vendor/symfony/http-foundation/Session/Session.php index 3349906875..867ceba97f 100644 --- a/vendor/symfony/http-foundation/Session/Session.php +++ b/vendor/symfony/http-foundation/Session/Session.php @@ -28,7 +28,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable private $flashName; private $attributeName; - private $data = array(); + private $data = []; private $usageIndex = 0; /** diff --git a/vendor/symfony/http-foundation/Session/SessionUtils.php b/vendor/symfony/http-foundation/Session/SessionUtils.php index 91737c39ac..b5bce4a884 100644 --- a/vendor/symfony/http-foundation/Session/SessionUtils.php +++ b/vendor/symfony/http-foundation/Session/SessionUtils.php @@ -30,7 +30,7 @@ final class SessionUtils $sessionCookie = null; $sessionCookiePrefix = sprintf(' %s=', urlencode($sessionName)); $sessionCookieWithId = sprintf('%s%s;', $sessionCookiePrefix, urlencode($sessionId)); - $otherCookies = array(); + $otherCookies = []; foreach (headers_list() as $h) { if (0 !== stripos($h, 'Set-Cookie:')) { continue; diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php index 95f110332a..defca606ef 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php @@ -104,7 +104,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess { if (null === $this->igbinaryEmptyData) { // see https://github.com/igbinary/igbinary/issues/146 - $this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize(array()) : ''; + $this->igbinaryEmptyData = \function_exists('igbinary_serialize') ? igbinary_serialize([]) : ''; } if ('' === $data || $this->igbinaryEmptyData === $data) { return $this->destroy($sessionId); diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php index 61a7afd904..1db590b360 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -45,11 +45,11 @@ class MemcachedSessionHandler extends AbstractSessionHandler * * @throws \InvalidArgumentException When unsupported options are passed */ - public function __construct(\Memcached $memcached, array $options = array()) + public function __construct(\Memcached $memcached, array $options = []) { $this->memcached = $memcached; - if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { + if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) { throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff))); } @@ -62,7 +62,7 @@ class MemcachedSessionHandler extends AbstractSessionHandler */ public function close() { - return true; + return $this->memcached->quit(); } /** diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php index 853b0bc723..904dc1b523 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -74,12 +74,12 @@ class MongoDbSessionHandler extends AbstractSessionHandler $this->mongo = $mongo; - $this->options = array_merge(array( + $this->options = array_merge([ 'id_field' => '_id', 'data_field' => 'data', 'time_field' => 'time', 'expiry_field' => 'expires_at', - ), $options); + ], $options); } /** @@ -95,9 +95,9 @@ class MongoDbSessionHandler extends AbstractSessionHandler */ protected function doDestroy($sessionId) { - $this->getCollection()->deleteOne(array( + $this->getCollection()->deleteOne([ $this->options['id_field'] => $sessionId, - )); + ]); return true; } @@ -107,9 +107,9 @@ class MongoDbSessionHandler extends AbstractSessionHandler */ public function gc($maxlifetime) { - $this->getCollection()->deleteMany(array( - $this->options['expiry_field'] => array('$lt' => new \MongoDB\BSON\UTCDateTime()), - )); + $this->getCollection()->deleteMany([ + $this->options['expiry_field'] => ['$lt' => new \MongoDB\BSON\UTCDateTime()], + ]); return true; } @@ -121,16 +121,16 @@ class MongoDbSessionHandler extends AbstractSessionHandler { $expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000); - $fields = array( + $fields = [ $this->options['time_field'] => new \MongoDB\BSON\UTCDateTime(), $this->options['expiry_field'] => $expiry, $this->options['data_field'] => new \MongoDB\BSON\Binary($data, \MongoDB\BSON\Binary::TYPE_OLD_BINARY), - ); + ]; $this->getCollection()->updateOne( - array($this->options['id_field'] => $sessionId), - array('$set' => $fields), - array('upsert' => true) + [$this->options['id_field'] => $sessionId], + ['$set' => $fields], + ['upsert' => true] ); return true; @@ -144,11 +144,11 @@ class MongoDbSessionHandler extends AbstractSessionHandler $expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000); $this->getCollection()->updateOne( - array($this->options['id_field'] => $sessionId), - array('$set' => array( + [$this->options['id_field'] => $sessionId], + ['$set' => [ $this->options['time_field'] => new \MongoDB\BSON\UTCDateTime(), $this->options['expiry_field'] => $expiry, - )) + ]] ); return true; @@ -159,10 +159,10 @@ class MongoDbSessionHandler extends AbstractSessionHandler */ protected function doRead($sessionId) { - $dbData = $this->getCollection()->findOne(array( + $dbData = $this->getCollection()->findOne([ $this->options['id_field'] => $sessionId, - $this->options['expiry_field'] => array('$gte' => new \MongoDB\BSON\UTCDateTime()), - )); + $this->options['expiry_field'] => ['$gte' => new \MongoDB\BSON\UTCDateTime()], + ]); if (null === $dbData) { return ''; diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php index 1bb647ef42..0623318d0a 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php @@ -118,7 +118,7 @@ class PdoSessionHandler extends AbstractSessionHandler /** * @var array Connection options when lazy-connect */ - private $connectionOptions = array(); + private $connectionOptions = []; /** * @var int The strategy for locking, see constants @@ -130,7 +130,7 @@ class PdoSessionHandler extends AbstractSessionHandler * * @var \PDOStatement[] An array of statements to release advisory locks */ - private $unlockStatements = array(); + private $unlockStatements = []; /** * @var bool True when the current session exists but expired according to session.gc_maxlifetime @@ -161,7 +161,7 @@ class PdoSessionHandler extends AbstractSessionHandler * * db_time_col: The column where to store the timestamp [default: sess_time] * * db_username: The username when lazy-connect [default: ''] * * db_password: The password when lazy-connect [default: ''] - * * db_connection_options: An array of driver-specific connection options [default: array()] + * * db_connection_options: An array of driver-specific connection options [default: []] * * lock_mode: The strategy for locking, see constants [default: LOCK_TRANSACTIONAL] * * @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or URL string or null @@ -169,7 +169,7 @@ class PdoSessionHandler extends AbstractSessionHandler * * @throws \InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION */ - public function __construct($pdoOrDsn = null, array $options = array()) + public function __construct($pdoOrDsn = null, array $options = []) { if ($pdoOrDsn instanceof \PDO) { if (\PDO::ERRMODE_EXCEPTION !== $pdoOrDsn->getAttribute(\PDO::ATTR_ERRMODE)) { @@ -468,13 +468,13 @@ class PdoSessionHandler extends AbstractSessionHandler throw new \InvalidArgumentException('URLs without scheme are not supported to configure the PdoSessionHandler'); } - $driverAliasMap = array( + $driverAliasMap = [ 'mssql' => 'sqlsrv', 'mysql2' => 'mysql', // Amazon RDS, for some weird reason 'postgres' => 'pgsql', 'postgresql' => 'pgsql', 'sqlite3' => 'sqlite', - ); + ]; $driver = isset($driverAliasMap[$params['scheme']]) ? $driverAliasMap[$params['scheme']] : $params['scheme']; diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php index 9c08ddcc01..a6498b882c 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/RedisSessionHandler.php @@ -39,7 +39,7 @@ class RedisSessionHandler extends AbstractSessionHandler * * @throws \InvalidArgumentException When unsupported client or options are passed */ - public function __construct($redis, array $options = array()) + public function __construct($redis, array $options = []) { if ( !$redis instanceof \Redis && @@ -52,7 +52,7 @@ class RedisSessionHandler extends AbstractSessionHandler throw new \InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\Client, %s given', __METHOD__, \is_object($redis) ? \get_class($redis) : \gettype($redis))); } - if ($diff = array_diff(array_keys($options), array('prefix'))) { + if ($diff = array_diff(array_keys($options), ['prefix'])) { throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff))); } diff --git a/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php b/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php index ea0d5ecb51..2eff4109b4 100644 --- a/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php +++ b/vendor/symfony/http-foundation/Session/Storage/MetadataBag.php @@ -39,7 +39,7 @@ class MetadataBag implements SessionBagInterface /** * @var array */ - protected $meta = array(self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0); + protected $meta = [self::CREATED => 0, self::UPDATED => 0, self::LIFETIME => 0]; /** * Unix timestamp. diff --git a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php index 47cac39854..37b6f145b8 100644 --- a/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php @@ -50,7 +50,7 @@ class MockArraySessionStorage implements SessionStorageInterface /** * @var array */ - protected $data = array(); + protected $data = []; /** * @var MetadataBag @@ -60,7 +60,7 @@ class MockArraySessionStorage implements SessionStorageInterface /** * @var array|SessionBagInterface[] */ - protected $bags = array(); + protected $bags = []; public function __construct(string $name = 'MOCKSESSID', MetadataBag $metaBag = null) { @@ -166,7 +166,7 @@ class MockArraySessionStorage implements SessionStorageInterface } // clear out the session - $this->data = array(); + $this->data = []; // reconnect the bags to the session $this->loadSession(); @@ -238,11 +238,11 @@ class MockArraySessionStorage implements SessionStorageInterface protected function loadSession() { - $bags = array_merge($this->bags, array($this->metadataBag)); + $bags = array_merge($this->bags, [$this->metadataBag]); foreach ($bags as $bag) { $key = $bag->getStorageKey(); - $this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : array(); + $this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : []; $bag->initialize($this->data[$key]); } diff --git a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php index 732f92abf9..c0316c2c74 100644 --- a/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/MockFileSessionStorage.php @@ -98,7 +98,7 @@ class MockFileSessionStorage extends MockArraySessionStorage unset($data[$key]); } } - if (array($key = $this->metadataBag->getStorageKey()) === array_keys($data)) { + if ([$key = $this->metadataBag->getStorageKey()] === array_keys($data)) { unset($data[$key]); } @@ -145,7 +145,7 @@ class MockFileSessionStorage extends MockArraySessionStorage private function read() { $filePath = $this->getFilePath(); - $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : array(); + $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : []; $this->loadSession(); } diff --git a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php index 232eb64cfd..ce7027954e 100644 --- a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php @@ -27,7 +27,7 @@ class NativeSessionStorage implements SessionStorageInterface /** * @var SessionBagInterface[] */ - protected $bags = array(); + protected $bags = []; /** * @var bool @@ -101,15 +101,15 @@ class NativeSessionStorage implements SessionStorageInterface * @param \SessionHandlerInterface|null $handler * @param MetadataBag $metaBag MetadataBag */ - public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) + public function __construct(array $options = [], $handler = null, MetadataBag $metaBag = null) { - $options += array( + $options += [ 'cache_limiter' => '', 'cache_expire' => 0, 'use_cookies' => 1, 'lazy_write' => 1, 'use_strict_mode' => 1, - ); + ]; session_register_shutdown(); @@ -244,7 +244,7 @@ class NativeSessionStorage implements SessionStorageInterface unset($_SESSION[$key]); } } - if (array($key = $this->metadataBag->getStorageKey()) === array_keys($_SESSION)) { + if ([$key = $this->metadataBag->getStorageKey()] === array_keys($_SESSION)) { unset($_SESSION[$key]); } @@ -280,7 +280,7 @@ class NativeSessionStorage implements SessionStorageInterface } // clear out the session - $_SESSION = array(); + $_SESSION = []; // reconnect the bags to the session $this->loadSession(); @@ -349,7 +349,7 @@ class NativeSessionStorage implements SessionStorageInterface * For convenience we omit 'session.' from the beginning of the keys. * Explicitly ignores other ini keys. * - * @param array $options Session ini directives array(key => value) + * @param array $options Session ini directives [key => value] * * @see http://php.net/session.configuration */ @@ -359,7 +359,7 @@ class NativeSessionStorage implements SessionStorageInterface return; } - $validOptions = array_flip(array( + $validOptions = array_flip([ 'cache_expire', 'cache_limiter', 'cookie_domain', 'cookie_httponly', 'cookie_lifetime', 'cookie_path', 'cookie_secure', 'cookie_samesite', 'gc_divisor', 'gc_maxlifetime', 'gc_probability', @@ -369,7 +369,7 @@ class NativeSessionStorage implements SessionStorageInterface 'upload_progress.cleanup', 'upload_progress.prefix', 'upload_progress.name', 'upload_progress.freq', 'upload_progress.min_freq', 'url_rewriter.tags', 'sid_length', 'sid_bits_per_character', 'trans_sid_hosts', 'trans_sid_tags', - )); + ]); foreach ($options as $key => $value) { if (isset($validOptions[$key])) { @@ -445,11 +445,11 @@ class NativeSessionStorage implements SessionStorageInterface $session = &$_SESSION; } - $bags = array_merge($this->bags, array($this->metadataBag)); + $bags = array_merge($this->bags, [$this->metadataBag]); foreach ($bags as $bag) { $key = $bag->getStorageKey(); - $session[$key] = isset($session[$key]) ? $session[$key] : array(); + $session[$key] = isset($session[$key]) ? $session[$key] : []; $bag->initialize($session[$key]); } diff --git a/vendor/symfony/http-foundation/StreamedResponse.php b/vendor/symfony/http-foundation/StreamedResponse.php index d3bcbb79d3..8310ea72d6 100644 --- a/vendor/symfony/http-foundation/StreamedResponse.php +++ b/vendor/symfony/http-foundation/StreamedResponse.php @@ -35,7 +35,7 @@ class StreamedResponse extends Response * @param int $status The response status code * @param array $headers An array of response headers */ - public function __construct(callable $callback = null, int $status = 200, array $headers = array()) + public function __construct(callable $callback = null, int $status = 200, array $headers = []) { parent::__construct(null, $status, $headers); @@ -55,7 +55,7 @@ class StreamedResponse extends Response * * @return static */ - public static function create($callback = null, $status = 200, $headers = array()) + public static function create($callback = null, $status = 200, $headers = []) { return new static($callback, $status, $headers); } diff --git a/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php b/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php index 1a660247c8..516bd5551a 100644 --- a/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php +++ b/vendor/symfony/http-foundation/Tests/AcceptHeaderItemTest.php @@ -28,24 +28,24 @@ class AcceptHeaderItemTest extends TestCase public function provideFromStringData() { - return array( - array( + return [ + [ 'text/html', - 'text/html', array(), - ), - array( + 'text/html', [], + ], + [ '"this;should,not=matter"', - 'this;should,not=matter', array(), - ), - array( + 'this;should,not=matter', [], + ], + [ "text/plain; charset=utf-8;param=\"this;should,not=matter\";\tfootnotes=true", - 'text/plain', array('charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'), - ), - array( + 'text/plain', ['charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'], + ], + [ '"this;should,not=matter";charset=utf-8', - 'this;should,not=matter', array('charset' => 'utf-8'), - ), - ); + 'this;should,not=matter', ['charset' => 'utf-8'], + ], + ]; } /** @@ -59,21 +59,21 @@ class AcceptHeaderItemTest extends TestCase public function provideToStringData() { - return array( - array( - 'text/html', array(), + return [ + [ + 'text/html', [], 'text/html', - ), - array( - 'text/plain', array('charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'), + ], + [ + 'text/plain', ['charset' => 'utf-8', 'param' => 'this;should,not=matter', 'footnotes' => 'true'], 'text/plain; charset=utf-8; param="this;should,not=matter"; footnotes=true', - ), - ); + ], + ]; } public function testValue() { - $item = new AcceptHeaderItem('value', array()); + $item = new AcceptHeaderItem('value', []); $this->assertEquals('value', $item->getValue()); $item->setValue('new value'); @@ -85,7 +85,7 @@ class AcceptHeaderItemTest extends TestCase public function testQuality() { - $item = new AcceptHeaderItem('value', array()); + $item = new AcceptHeaderItem('value', []); $this->assertEquals(1.0, $item->getQuality()); $item->setQuality(0.5); @@ -98,14 +98,14 @@ class AcceptHeaderItemTest extends TestCase public function testAttribute() { - $item = new AcceptHeaderItem('value', array()); - $this->assertEquals(array(), $item->getAttributes()); + $item = new AcceptHeaderItem('value', []); + $this->assertEquals([], $item->getAttributes()); $this->assertFalse($item->hasAttribute('test')); $this->assertNull($item->getAttribute('test')); $this->assertEquals('default', $item->getAttribute('test', 'default')); $item->setAttribute('test', 'value'); - $this->assertEquals(array('test' => 'value'), $item->getAttributes()); + $this->assertEquals(['test' => 'value'], $item->getAttributes()); $this->assertTrue($item->hasAttribute('test')); $this->assertEquals('value', $item->getAttribute('test')); $this->assertEquals('value', $item->getAttribute('test', 'default')); diff --git a/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php b/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php index 1ac6103e0d..1987e97fb8 100644 --- a/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php +++ b/vendor/symfony/http-foundation/Tests/AcceptHeaderTest.php @@ -39,13 +39,13 @@ class AcceptHeaderTest extends TestCase public function provideFromStringData() { - return array( - array('', array()), - array('gzip', array(new AcceptHeaderItem('gzip'))), - array('gzip,deflate,sdch', array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch'))), - array("gzip, deflate\t,sdch", array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch'))), - array('"this;should,not=matter"', array(new AcceptHeaderItem('this;should,not=matter'))), - ); + return [ + ['', []], + ['gzip', [new AcceptHeaderItem('gzip')]], + ['gzip,deflate,sdch', [new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')]], + ["gzip, deflate\t,sdch", [new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')]], + ['"this;should,not=matter"', [new AcceptHeaderItem('this;should,not=matter')]], + ]; } /** @@ -59,12 +59,12 @@ class AcceptHeaderTest extends TestCase public function provideToStringData() { - return array( - array(array(), ''), - array(array(new AcceptHeaderItem('gzip')), 'gzip'), - array(array(new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')), 'gzip,deflate,sdch'), - array(array(new AcceptHeaderItem('this;should,not=matter')), 'this;should,not=matter'), - ); + return [ + [[], ''], + [[new AcceptHeaderItem('gzip')], 'gzip'], + [[new AcceptHeaderItem('gzip'), new AcceptHeaderItem('deflate'), new AcceptHeaderItem('sdch')], 'gzip,deflate,sdch'], + [[new AcceptHeaderItem('this;should,not=matter')], 'this;should,not=matter'], + ]; } /** @@ -78,9 +78,9 @@ class AcceptHeaderTest extends TestCase public function provideFilterData() { - return array( - array('fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4', '/fr.*/', array('fr-FR', 'fr')), - ); + return [ + ['fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4', '/fr.*/', ['fr-FR', 'fr']], + ]; } /** @@ -94,11 +94,11 @@ class AcceptHeaderTest extends TestCase public function provideSortingData() { - return array( - 'quality has priority' => array('*;q=0.3,ISO-8859-1,utf-8;q=0.7', array('ISO-8859-1', 'utf-8', '*')), - 'order matters when q is equal' => array('*;q=0.3,ISO-8859-1;q=0.7,utf-8;q=0.7', array('ISO-8859-1', 'utf-8', '*')), - 'order matters when q is equal2' => array('*;q=0.3,utf-8;q=0.7,ISO-8859-1;q=0.7', array('utf-8', 'ISO-8859-1', '*')), - ); + return [ + 'quality has priority' => ['*;q=0.3,ISO-8859-1,utf-8;q=0.7', ['ISO-8859-1', 'utf-8', '*']], + 'order matters when q is equal' => ['*;q=0.3,ISO-8859-1;q=0.7,utf-8;q=0.7', ['ISO-8859-1', 'utf-8', '*']], + 'order matters when q is equal2' => ['*;q=0.3,utf-8;q=0.7,ISO-8859-1;q=0.7', ['utf-8', 'ISO-8859-1', '*']], + ]; } /** @@ -112,19 +112,19 @@ class AcceptHeaderTest extends TestCase public function provideDefaultValueData() { - yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, *;q=0.3', 'text/xml', 0.3); - yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/xml', 0.3); - yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/html', 1.0); - yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/plain', 0.5); - yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', '*', 0.3); - yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', '*', 1.0); - yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', 'text/xml', 1.0); - yield array('text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', 'text/*', 1.0); - yield array('text/plain;q=0.5, text/html, text/*;q=0.8, */*', 'text/*', 0.8); - yield array('text/plain;q=0.5, text/html, text/*;q=0.8, */*', 'text/html', 1.0); - yield array('text/plain;q=0.5, text/html, text/*;q=0.8, */*', 'text/x-dvi', 0.8); - yield array('*;q=0.3, ISO-8859-1;q=0.7, utf-8;q=0.7', '*', 0.3); - yield array('*;q=0.3, ISO-8859-1;q=0.7, utf-8;q=0.7', 'utf-8', 0.7); - yield array('*;q=0.3, ISO-8859-1;q=0.7, utf-8;q=0.7', 'SHIFT_JIS', 0.3); + yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, *;q=0.3', 'text/xml', 0.3]; + yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/xml', 0.3]; + yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/html', 1.0]; + yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', 'text/plain', 0.5]; + yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*;q=0.3', '*', 0.3]; + yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', '*', 1.0]; + yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', 'text/xml', 1.0]; + yield ['text/plain;q=0.5, text/html, text/x-dvi;q=0.8, */*', 'text/*', 1.0]; + yield ['text/plain;q=0.5, text/html, text/*;q=0.8, */*', 'text/*', 0.8]; + yield ['text/plain;q=0.5, text/html, text/*;q=0.8, */*', 'text/html', 1.0]; + yield ['text/plain;q=0.5, text/html, text/*;q=0.8, */*', 'text/x-dvi', 0.8]; + yield ['*;q=0.3, ISO-8859-1;q=0.7, utf-8;q=0.7', '*', 0.3]; + yield ['*;q=0.3, ISO-8859-1;q=0.7, utf-8;q=0.7', 'utf-8', 0.7]; + yield ['*;q=0.3, ISO-8859-1;q=0.7, utf-8;q=0.7', 'SHIFT_JIS', 0.3]; } } diff --git a/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php b/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php index 157ab90ec5..6fa3b88917 100644 --- a/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php +++ b/vendor/symfony/http-foundation/Tests/ApacheRequestTest.php @@ -31,63 +31,63 @@ class ApacheRequestTest extends TestCase public function provideServerVars() { - return array( - array( - array( + return [ + [ + [ 'REQUEST_URI' => '/foo/app_dev.php/bar', 'SCRIPT_NAME' => '/foo/app_dev.php', 'PATH_INFO' => '/bar', - ), + ], '/foo/app_dev.php/bar', '/foo/app_dev.php', '/bar', - ), - array( - array( + ], + [ + [ 'REQUEST_URI' => '/foo/bar', 'SCRIPT_NAME' => '/foo/app_dev.php', - ), + ], '/foo/bar', '/foo', '/bar', - ), - array( - array( + ], + [ + [ 'REQUEST_URI' => '/app_dev.php/foo/bar', 'SCRIPT_NAME' => '/app_dev.php', 'PATH_INFO' => '/foo/bar', - ), + ], '/app_dev.php/foo/bar', '/app_dev.php', '/foo/bar', - ), - array( - array( + ], + [ + [ 'REQUEST_URI' => '/foo/bar', 'SCRIPT_NAME' => '/app_dev.php', - ), + ], '/foo/bar', '', '/foo/bar', - ), - array( - array( + ], + [ + [ 'REQUEST_URI' => '/app_dev.php', 'SCRIPT_NAME' => '/app_dev.php', - ), + ], '/app_dev.php', '/app_dev.php', '/', - ), - array( - array( + ], + [ + [ 'REQUEST_URI' => '/', 'SCRIPT_NAME' => '/app_dev.php', - ), + ], '/', '', '/', - ), - ); + ], + ]; } } diff --git a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php index 6bf04e16b7..9f3beb08d1 100644 --- a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php @@ -22,14 +22,14 @@ class BinaryFileResponseTest extends ResponseTestCase public function testConstruction() { $file = __DIR__.'/../README.md'; - $response = new BinaryFileResponse($file, 404, array('X-Header' => 'Foo'), true, null, true, true); + $response = new BinaryFileResponse($file, 404, ['X-Header' => 'Foo'], true, null, true, true); $this->assertEquals(404, $response->getStatusCode()); $this->assertEquals('Foo', $response->headers->get('X-Header')); $this->assertTrue($response->headers->has('ETag')); $this->assertTrue($response->headers->has('Last-Modified')); $this->assertFalse($response->headers->has('Content-Disposition')); - $response = BinaryFileResponse::create($file, 404, array(), true, ResponseHeaderBag::DISPOSITION_INLINE); + $response = BinaryFileResponse::create($file, 404, [], true, ResponseHeaderBag::DISPOSITION_INLINE); $this->assertEquals(404, $response->getStatusCode()); $this->assertFalse($response->headers->has('ETag')); $this->assertEquals('inline; filename=README.md', $response->headers->get('Content-Disposition')); @@ -39,7 +39,7 @@ class BinaryFileResponseTest extends ResponseTestCase { touch(sys_get_temp_dir().'/fööö.html'); - $response = new BinaryFileResponse(sys_get_temp_dir().'/fööö.html', 200, array(), true, 'attachment'); + $response = new BinaryFileResponse(sys_get_temp_dir().'/fööö.html', 200, [], true, 'attachment'); @unlink(sys_get_temp_dir().'/fööö.html'); @@ -85,7 +85,7 @@ class BinaryFileResponseTest extends ResponseTestCase */ public function testRequests($requestRange, $offset, $length, $responseRange) { - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag(); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'])->setAutoEtag(); // do a request to get the ETag $request = Request::create('/'); @@ -117,7 +117,7 @@ class BinaryFileResponseTest extends ResponseTestCase */ public function testRequestsWithoutEtag($requestRange, $offset, $length, $responseRange) { - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream')); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']); // do a request to get the LastModified $request = Request::create('/'); @@ -145,19 +145,19 @@ class BinaryFileResponseTest extends ResponseTestCase public function provideRanges() { - return array( - array('bytes=1-4', 1, 4, 'bytes 1-4/35'), - array('bytes=-5', 30, 5, 'bytes 30-34/35'), - array('bytes=30-', 30, 5, 'bytes 30-34/35'), - array('bytes=30-30', 30, 1, 'bytes 30-30/35'), - array('bytes=30-34', 30, 5, 'bytes 30-34/35'), - ); + return [ + ['bytes=1-4', 1, 4, 'bytes 1-4/35'], + ['bytes=-5', 30, 5, 'bytes 30-34/35'], + ['bytes=30-', 30, 5, 'bytes 30-34/35'], + ['bytes=30-30', 30, 1, 'bytes 30-30/35'], + ['bytes=30-34', 30, 5, 'bytes 30-34/35'], + ]; } public function testRangeRequestsWithoutLastModifiedDate() { // prevent auto last modified - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'), true, null, false, false); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'], true, null, false, false); // prepare a request for a range of the testing file $request = Request::create('/'); @@ -178,7 +178,7 @@ class BinaryFileResponseTest extends ResponseTestCase */ public function testFullFileRequests($requestRange) { - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag(); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'])->setAutoEtag(); // prepare a request for a range of the testing file $request = Request::create('/'); @@ -198,14 +198,14 @@ class BinaryFileResponseTest extends ResponseTestCase public function provideFullFileRanges() { - return array( - array('bytes=0-'), - array('bytes=0-34'), - array('bytes=-35'), + return [ + ['bytes=0-'], + ['bytes=0-34'], + ['bytes=-35'], // Syntactical invalid range-request should also return the full resource - array('bytes=20-10'), - array('bytes=50-40'), - ); + ['bytes=20-10'], + ['bytes=50-40'], + ]; } public function testUnpreparedResponseSendsFullFile() @@ -226,7 +226,7 @@ class BinaryFileResponseTest extends ResponseTestCase */ public function testInvalidRequests($requestRange) { - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag(); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream'])->setAutoEtag(); // prepare a request for a range of the testing file $request = Request::create('/'); @@ -242,10 +242,10 @@ class BinaryFileResponseTest extends ResponseTestCase public function provideInvalidRanges() { - return array( - array('bytes=-40'), - array('bytes=30-40'), - ); + return [ + ['bytes=-40'], + ['bytes=30-40'], + ]; } /** @@ -257,7 +257,7 @@ class BinaryFileResponseTest extends ResponseTestCase $request->headers->set('X-Sendfile-Type', 'X-Sendfile'); BinaryFileResponse::trustXSendfileTypeHeader(); - $response = BinaryFileResponse::create($file, 200, array('Content-Type' => 'application/octet-stream')); + $response = BinaryFileResponse::create($file, 200, ['Content-Type' => 'application/octet-stream']); $response->prepare($request); $this->expectOutputString(''); @@ -268,10 +268,10 @@ class BinaryFileResponseTest extends ResponseTestCase public function provideXSendfileFiles() { - return array( - array(__DIR__.'/../README.md'), - array('file://'.__DIR__.'/../README.md'), - ); + return [ + [__DIR__.'/../README.md'], + ['file://'.__DIR__.'/../README.md'], + ]; } /** @@ -286,7 +286,7 @@ class BinaryFileResponseTest extends ResponseTestCase $file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test'); BinaryFileResponse::trustXSendfileTypeHeader(); - $response = new BinaryFileResponse($file, 200, array('Content-Type' => 'application/octet-stream')); + $response = new BinaryFileResponse($file, 200, ['Content-Type' => 'application/octet-stream']); $reflection = new \ReflectionObject($response); $property = $reflection->getProperty('file'); $property->setAccessible(true); @@ -305,7 +305,7 @@ class BinaryFileResponseTest extends ResponseTestCase $realPath = realpath($path); $this->assertFileExists($realPath); - $response = new BinaryFileResponse($realPath, 200, array('Content-Type' => 'application/octet-stream')); + $response = new BinaryFileResponse($realPath, 200, ['Content-Type' => 'application/octet-stream']); $response->deleteFileAfterSend(true); $response->prepare($request); @@ -317,7 +317,7 @@ class BinaryFileResponseTest extends ResponseTestCase public function testAcceptRangeOnUnsafeMethods() { $request = Request::create('/', 'POST'); - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream')); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']); $response->prepare($request); $this->assertEquals('none', $response->headers->get('Accept-Ranges')); @@ -326,7 +326,7 @@ class BinaryFileResponseTest extends ResponseTestCase public function testAcceptRangeNotOverriden() { $request = Request::create('/', 'POST'); - $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream')); + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']); $response->headers->set('Accept-Ranges', 'foo'); $response->prepare($request); @@ -335,17 +335,17 @@ class BinaryFileResponseTest extends ResponseTestCase public function getSampleXAccelMappings() { - return array( - array('/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'), - array('/home/Foo/bar.txt', '/var/www/=/files/,/home/Foo/=/baz/', '/baz/bar.txt'), - array('/home/Foo/bar.txt', '"/var/www/"="/files/", "/home/Foo/"="/baz/"', '/baz/bar.txt'), - ); + return [ + ['/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'], + ['/home/Foo/bar.txt', '/var/www/=/files/,/home/Foo/=/baz/', '/baz/bar.txt'], + ['/home/Foo/bar.txt', '"/var/www/"="/files/", "/home/Foo/"="/baz/"', '/baz/bar.txt'], + ]; } public function testStream() { $request = Request::create('/'); - $response = new BinaryFileResponse(new Stream(__DIR__.'/../README.md'), 200, array('Content-Type' => 'text/plain')); + $response = new BinaryFileResponse(new Stream(__DIR__.'/../README.md'), 200, ['Content-Type' => 'text/plain']); $response->prepare($request); $this->assertNull($response->headers->get('Content-Length')); @@ -353,7 +353,7 @@ class BinaryFileResponseTest extends ResponseTestCase protected function provideResponse() { - return new BinaryFileResponse(__DIR__.'/../README.md', 200, array('Content-Type' => 'application/octet-stream')); + return new BinaryFileResponse(__DIR__.'/../README.md', 200, ['Content-Type' => 'application/octet-stream']); } public static function tearDownAfterClass() diff --git a/vendor/symfony/http-foundation/Tests/CookieTest.php b/vendor/symfony/http-foundation/Tests/CookieTest.php index 44981dff8b..4aa32eea45 100644 --- a/vendor/symfony/http-foundation/Tests/CookieTest.php +++ b/vendor/symfony/http-foundation/Tests/CookieTest.php @@ -26,17 +26,17 @@ class CookieTest extends TestCase { public function invalidNames() { - return array( - array(''), - array(',MyName'), - array(';MyName'), - array(' MyName'), - array("\tMyName"), - array("\rMyName"), - array("\nMyName"), - array("\013MyName"), - array("\014MyName"), - ); + return [ + [''], + [',MyName'], + [';MyName'], + [' MyName'], + ["\tMyName"], + ["\rMyName"], + ["\nMyName"], + ["\013MyName"], + ["\014MyName"], + ]; } /** diff --git a/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php b/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php index 1152e46c0b..2afdade67d 100644 --- a/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php +++ b/vendor/symfony/http-foundation/Tests/ExpressionRequestMatcherTest.php @@ -55,15 +55,15 @@ class ExpressionRequestMatcherTest extends TestCase public function provideExpressions() { - return array( - array('request.getMethod() == method', true), - array('request.getPathInfo() == path', true), - array('request.getHost() == host', true), - array('request.getClientIp() == ip', true), - array('request.attributes.all() == attributes', true), - array('request.getMethod() == method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', true), - array('request.getMethod() != method', false), - array('request.getMethod() != method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', false), - ); + return [ + ['request.getMethod() == method', true], + ['request.getPathInfo() == path', true], + ['request.getHost() == host', true], + ['request.getClientIp() == ip', true], + ['request.attributes.all() == attributes', true], + ['request.getMethod() == method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', true], + ['request.getMethod() != method', false], + ['request.getMethod() != method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes', false], + ]; } } diff --git a/vendor/symfony/http-foundation/Tests/File/FileTest.php b/vendor/symfony/http-foundation/Tests/File/FileTest.php index dbd9c44bd8..fb82dae768 100644 --- a/vendor/symfony/http-foundation/Tests/File/FileTest.php +++ b/vendor/symfony/http-foundation/Tests/File/FileTest.php @@ -110,14 +110,14 @@ class FileTest extends TestCase public function getFilenameFixtures() { - return array( - array('original.gif', 'original.gif'), - array('..\\..\\original.gif', 'original.gif'), - array('../../original.gif', 'original.gif'), - array('файлfile.gif', 'файлfile.gif'), - array('..\\..\\файлfile.gif', 'файлfile.gif'), - array('../../файлfile.gif', 'файлfile.gif'), - ); + return [ + ['original.gif', 'original.gif'], + ['..\\..\\original.gif', 'original.gif'], + ['../../original.gif', 'original.gif'], + ['файлfile.gif', 'файлfile.gif'], + ['..\\..\\файлfile.gif', 'файлfile.gif'], + ['../../файлfile.gif', 'файлfile.gif'], + ]; } /** diff --git a/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php b/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php index 6a0b550d79..3952a69c69 100644 --- a/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php +++ b/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php @@ -147,13 +147,13 @@ class UploadedFileTest extends TestCase public function failedUploadedFile() { - foreach (array(UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_EXTENSION, -1) as $error) { - yield array(new UploadedFile( + foreach ([UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_PARTIAL, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_EXTENSION, -1] as $error) { + yield [new UploadedFile( __DIR__.'/Fixtures/test.gif', 'original.gif', 'image/gif', $error - )); + )]; } } @@ -323,13 +323,13 @@ class UploadedFileTest extends TestCase public function uploadedFileErrorProvider() { - return array( - array(UPLOAD_ERR_INI_SIZE), - array(UPLOAD_ERR_FORM_SIZE), - array(UPLOAD_ERR_PARTIAL), - array(UPLOAD_ERR_NO_TMP_DIR), - array(UPLOAD_ERR_EXTENSION), - ); + return [ + [UPLOAD_ERR_INI_SIZE], + [UPLOAD_ERR_FORM_SIZE], + [UPLOAD_ERR_PARTIAL], + [UPLOAD_ERR_NO_TMP_DIR], + [UPLOAD_ERR_EXTENSION], + ]; } public function testIsInvalidIfNotHttpUpload() diff --git a/vendor/symfony/http-foundation/Tests/FileBagTest.php b/vendor/symfony/http-foundation/Tests/FileBagTest.php index 06136e2097..5eaf64f89f 100644 --- a/vendor/symfony/http-foundation/Tests/FileBagTest.php +++ b/vendor/symfony/http-foundation/Tests/FileBagTest.php @@ -28,7 +28,7 @@ class FileBagTest extends TestCase */ public function testFileMustBeAnArrayOrUploadedFile() { - new FileBag(array('file' => 'foo')); + new FileBag(['file' => 'foo']); } public function testShouldConvertsUploadedFiles() @@ -36,54 +36,54 @@ class FileBagTest extends TestCase $tmpFile = $this->createTempFile(); $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain'); - $bag = new FileBag(array('file' => array( + $bag = new FileBag(['file' => [ 'name' => basename($tmpFile), 'type' => 'text/plain', 'tmp_name' => $tmpFile, 'error' => 0, 'size' => null, - ))); + ]]); $this->assertEquals($file, $bag->get('file')); } public function testShouldSetEmptyUploadedFilesToNull() { - $bag = new FileBag(array('file' => array( + $bag = new FileBag(['file' => [ 'name' => '', 'type' => '', 'tmp_name' => '', 'error' => UPLOAD_ERR_NO_FILE, 'size' => 0, - ))); + ]]); $this->assertNull($bag->get('file')); } public function testShouldRemoveEmptyUploadedFilesForMultiUpload() { - $bag = new FileBag(array('files' => array( - 'name' => array(''), - 'type' => array(''), - 'tmp_name' => array(''), - 'error' => array(UPLOAD_ERR_NO_FILE), - 'size' => array(0), - ))); + $bag = new FileBag(['files' => [ + 'name' => [''], + 'type' => [''], + 'tmp_name' => [''], + 'error' => [UPLOAD_ERR_NO_FILE], + 'size' => [0], + ]]); - $this->assertSame(array(), $bag->get('files')); + $this->assertSame([], $bag->get('files')); } public function testShouldNotRemoveEmptyUploadedFilesForAssociativeArray() { - $bag = new FileBag(array('files' => array( - 'name' => array('file1' => ''), - 'type' => array('file1' => ''), - 'tmp_name' => array('file1' => ''), - 'error' => array('file1' => UPLOAD_ERR_NO_FILE), - 'size' => array('file1' => 0), - ))); + $bag = new FileBag(['files' => [ + 'name' => ['file1' => ''], + 'type' => ['file1' => ''], + 'tmp_name' => ['file1' => ''], + 'error' => ['file1' => UPLOAD_ERR_NO_FILE], + 'size' => ['file1' => 0], + ]]); - $this->assertSame(array('file1' => null), $bag->get('files')); + $this->assertSame(['file1' => null], $bag->get('files')); } public function testShouldConvertUploadedFilesWithPhpBug() @@ -91,25 +91,25 @@ class FileBagTest extends TestCase $tmpFile = $this->createTempFile(); $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain'); - $bag = new FileBag(array( - 'child' => array( - 'name' => array( + $bag = new FileBag([ + 'child' => [ + 'name' => [ 'file' => basename($tmpFile), - ), - 'type' => array( + ], + 'type' => [ 'file' => 'text/plain', - ), - 'tmp_name' => array( + ], + 'tmp_name' => [ 'file' => $tmpFile, - ), - 'error' => array( + ], + 'error' => [ 'file' => 0, - ), - 'size' => array( + ], + 'size' => [ 'file' => null, - ), - ), - )); + ], + ], + ]); $files = $bag->all(); $this->assertEquals($file, $files['child']['file']); @@ -120,25 +120,25 @@ class FileBagTest extends TestCase $tmpFile = $this->createTempFile(); $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain'); - $bag = new FileBag(array( - 'child' => array( - 'name' => array( - 'sub' => array('file' => basename($tmpFile)), - ), - 'type' => array( - 'sub' => array('file' => 'text/plain'), - ), - 'tmp_name' => array( - 'sub' => array('file' => $tmpFile), - ), - 'error' => array( - 'sub' => array('file' => 0), - ), - 'size' => array( - 'sub' => array('file' => null), - ), - ), - )); + $bag = new FileBag([ + 'child' => [ + 'name' => [ + 'sub' => ['file' => basename($tmpFile)], + ], + 'type' => [ + 'sub' => ['file' => 'text/plain'], + ], + 'tmp_name' => [ + 'sub' => ['file' => $tmpFile], + ], + 'error' => [ + 'sub' => ['file' => 0], + ], + 'size' => [ + 'sub' => ['file' => null], + ], + ], + ]); $files = $bag->all(); $this->assertEquals($file, $files['child']['sub']['file']); @@ -148,7 +148,7 @@ class FileBagTest extends TestCase { $tmpFile = $this->createTempFile(); $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain'); - $bag = new FileBag(array('image' => array('file' => $file))); + $bag = new FileBag(['image' => ['file' => $file]]); $files = $bag->all(); $this->assertEquals($file, $files['image']['file']); diff --git a/vendor/symfony/http-foundation/Tests/HeaderBagTest.php b/vendor/symfony/http-foundation/Tests/HeaderBagTest.php index c5a437f999..6c4915f2e4 100644 --- a/vendor/symfony/http-foundation/Tests/HeaderBagTest.php +++ b/vendor/symfony/http-foundation/Tests/HeaderBagTest.php @@ -18,7 +18,7 @@ class HeaderBagTest extends TestCase { public function testConstructor() { - $bag = new HeaderBag(array('foo' => 'bar')); + $bag = new HeaderBag(['foo' => 'bar']); $this->assertTrue($bag->has('foo')); } @@ -30,20 +30,20 @@ class HeaderBagTest extends TestCase public function testToStringNotNull() { - $bag = new HeaderBag(array('foo' => 'bar')); + $bag = new HeaderBag(['foo' => 'bar']); $this->assertEquals("Foo: bar\r\n", $bag->__toString()); } public function testKeys() { - $bag = new HeaderBag(array('foo' => 'bar')); + $bag = new HeaderBag(['foo' => 'bar']); $keys = $bag->keys(); $this->assertEquals('foo', $keys[0]); } public function testGetDate() { - $bag = new HeaderBag(array('foo' => 'Tue, 4 Sep 2012 20:00:00 +0200')); + $bag = new HeaderBag(['foo' => 'Tue, 4 Sep 2012 20:00:00 +0200']); $headerDate = $bag->getDate('foo'); $this->assertInstanceOf('DateTime', $headerDate); } @@ -53,7 +53,7 @@ class HeaderBagTest extends TestCase */ public function testGetDateException() { - $bag = new HeaderBag(array('foo' => 'Tue')); + $bag = new HeaderBag(['foo' => 'Tue']); $headerDate = $bag->getDate('foo'); } @@ -67,50 +67,50 @@ class HeaderBagTest extends TestCase public function testAll() { - $bag = new HeaderBag(array('foo' => 'bar')); - $this->assertEquals(array('foo' => array('bar')), $bag->all(), '->all() gets all the input'); + $bag = new HeaderBag(['foo' => 'bar']); + $this->assertEquals(['foo' => ['bar']], $bag->all(), '->all() gets all the input'); - $bag = new HeaderBag(array('FOO' => 'BAR')); - $this->assertEquals(array('foo' => array('BAR')), $bag->all(), '->all() gets all the input key are lower case'); + $bag = new HeaderBag(['FOO' => 'BAR']); + $this->assertEquals(['foo' => ['BAR']], $bag->all(), '->all() gets all the input key are lower case'); } public function testReplace() { - $bag = new HeaderBag(array('foo' => 'bar')); + $bag = new HeaderBag(['foo' => 'bar']); - $bag->replace(array('NOPE' => 'BAR')); - $this->assertEquals(array('nope' => array('BAR')), $bag->all(), '->replace() replaces the input with the argument'); + $bag->replace(['NOPE' => 'BAR']); + $this->assertEquals(['nope' => ['BAR']], $bag->all(), '->replace() replaces the input with the argument'); $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input'); } public function testGet() { - $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz')); + $bag = new HeaderBag(['foo' => 'bar', 'fuzz' => 'bizz']); $this->assertEquals('bar', $bag->get('foo'), '->get return current value'); $this->assertEquals('bar', $bag->get('FoO'), '->get key in case insensitive'); - $this->assertEquals(array('bar'), $bag->get('foo', 'nope', false), '->get return the value as array'); + $this->assertEquals(['bar'], $bag->get('foo', 'nope', false), '->get return the value as array'); // defaults $this->assertNull($bag->get('none'), '->get unknown values returns null'); $this->assertEquals('default', $bag->get('none', 'default'), '->get unknown values returns default'); - $this->assertEquals(array('default'), $bag->get('none', 'default', false), '->get unknown values returns default as array'); + $this->assertEquals(['default'], $bag->get('none', 'default', false), '->get unknown values returns default as array'); $bag->set('foo', 'bor', false); $this->assertEquals('bar', $bag->get('foo'), '->get return first value'); - $this->assertEquals(array('bar', 'bor'), $bag->get('foo', 'nope', false), '->get return all values as array'); + $this->assertEquals(['bar', 'bor'], $bag->get('foo', 'nope', false), '->get return all values as array'); } public function testSetAssociativeArray() { $bag = new HeaderBag(); - $bag->set('foo', array('bad-assoc-index' => 'value')); + $bag->set('foo', ['bad-assoc-index' => 'value']); $this->assertSame('value', $bag->get('foo')); - $this->assertEquals(array('value'), $bag->get('foo', 'nope', false), 'assoc indices of multi-valued headers are ignored'); + $this->assertEquals(['value'], $bag->get('foo', 'nope', false), 'assoc indices of multi-valued headers are ignored'); } public function testContains() { - $bag = new HeaderBag(array('foo' => 'bar', 'fuzz' => 'bizz')); + $bag = new HeaderBag(['foo' => 'bar', 'fuzz' => 'bizz']); $this->assertTrue($bag->contains('foo', 'bar'), '->contains first value'); $this->assertTrue($bag->contains('fuzz', 'bizz'), '->contains second value'); $this->assertFalse($bag->contains('nope', 'nope'), '->contains unknown value'); @@ -143,7 +143,7 @@ class HeaderBagTest extends TestCase public function testCacheControlDirectiveParsing() { - $bag = new HeaderBag(array('cache-control' => 'public, max-age=10')); + $bag = new HeaderBag(['cache-control' => 'public, max-age=10']); $this->assertTrue($bag->hasCacheControlDirective('public')); $this->assertTrue($bag->getCacheControlDirective('public')); @@ -156,15 +156,15 @@ class HeaderBagTest extends TestCase public function testCacheControlDirectiveParsingQuotedZero() { - $bag = new HeaderBag(array('cache-control' => 'max-age="0"')); + $bag = new HeaderBag(['cache-control' => 'max-age="0"']); $this->assertTrue($bag->hasCacheControlDirective('max-age')); $this->assertEquals(0, $bag->getCacheControlDirective('max-age')); } public function testCacheControlDirectiveOverrideWithReplace() { - $bag = new HeaderBag(array('cache-control' => 'private, max-age=100')); - $bag->replace(array('cache-control' => 'public, max-age=10')); + $bag = new HeaderBag(['cache-control' => 'private, max-age=100']); + $bag->replace(['cache-control' => 'public, max-age=10']); $this->assertTrue($bag->hasCacheControlDirective('public')); $this->assertTrue($bag->getCacheControlDirective('public')); @@ -174,7 +174,7 @@ class HeaderBagTest extends TestCase public function testCacheControlClone() { - $headers = array('foo' => 'bar'); + $headers = ['foo' => 'bar']; $bag1 = new HeaderBag($headers); $bag2 = new HeaderBag($bag1->all()); @@ -183,13 +183,13 @@ class HeaderBagTest extends TestCase public function testGetIterator() { - $headers = array('foo' => 'bar', 'hello' => 'world', 'third' => 'charm'); + $headers = ['foo' => 'bar', 'hello' => 'world', 'third' => 'charm']; $headerBag = new HeaderBag($headers); $i = 0; foreach ($headerBag as $key => $val) { ++$i; - $this->assertEquals(array($headers[$key]), $val); + $this->assertEquals([$headers[$key]], $val); } $this->assertEquals(\count($headers), $i); @@ -197,7 +197,7 @@ class HeaderBagTest extends TestCase public function testCount() { - $headers = array('foo' => 'bar', 'HELLO' => 'WORLD'); + $headers = ['foo' => 'bar', 'HELLO' => 'WORLD']; $headerBag = new HeaderBag($headers); $this->assertCount(\count($headers), $headerBag); diff --git a/vendor/symfony/http-foundation/Tests/HeaderUtilsTest.php b/vendor/symfony/http-foundation/Tests/HeaderUtilsTest.php index 15efdf9234..2f82dc4e67 100644 --- a/vendor/symfony/http-foundation/Tests/HeaderUtilsTest.php +++ b/vendor/symfony/http-foundation/Tests/HeaderUtilsTest.php @@ -18,48 +18,48 @@ class HeaderUtilsTest extends TestCase { public function testSplit() { - $this->assertSame(array('foo=123', 'bar'), HeaderUtils::split('foo=123,bar', ',')); - $this->assertSame(array('foo=123', 'bar'), HeaderUtils::split('foo=123, bar', ',')); - $this->assertSame(array(array('foo=123', 'bar')), HeaderUtils::split('foo=123; bar', ',;')); - $this->assertSame(array(array('foo=123'), array('bar')), HeaderUtils::split('foo=123, bar', ',;')); - $this->assertSame(array('foo', '123, bar'), HeaderUtils::split('foo=123, bar', '=')); - $this->assertSame(array('foo', '123, bar'), HeaderUtils::split(' foo = 123, bar ', '=')); - $this->assertSame(array(array('foo', '123'), array('bar')), HeaderUtils::split('foo=123, bar', ',=')); - $this->assertSame(array(array(array('foo', '123')), array(array('bar'), array('foo', '456'))), HeaderUtils::split('foo=123, bar; foo=456', ',;=')); - $this->assertSame(array(array(array('foo', 'a,b;c=d'))), HeaderUtils::split('foo="a,b;c=d"', ',;=')); + $this->assertSame(['foo=123', 'bar'], HeaderUtils::split('foo=123,bar', ',')); + $this->assertSame(['foo=123', 'bar'], HeaderUtils::split('foo=123, bar', ',')); + $this->assertSame([['foo=123', 'bar']], HeaderUtils::split('foo=123; bar', ',;')); + $this->assertSame([['foo=123'], ['bar']], HeaderUtils::split('foo=123, bar', ',;')); + $this->assertSame(['foo', '123, bar'], HeaderUtils::split('foo=123, bar', '=')); + $this->assertSame(['foo', '123, bar'], HeaderUtils::split(' foo = 123, bar ', '=')); + $this->assertSame([['foo', '123'], ['bar']], HeaderUtils::split('foo=123, bar', ',=')); + $this->assertSame([[['foo', '123']], [['bar'], ['foo', '456']]], HeaderUtils::split('foo=123, bar; foo=456', ',;=')); + $this->assertSame([[['foo', 'a,b;c=d']]], HeaderUtils::split('foo="a,b;c=d"', ',;=')); - $this->assertSame(array('foo', 'bar'), HeaderUtils::split('foo,,,, bar', ',')); - $this->assertSame(array('foo', 'bar'), HeaderUtils::split(',foo, bar,', ',')); - $this->assertSame(array('foo', 'bar'), HeaderUtils::split(' , foo, bar, ', ',')); - $this->assertSame(array('foo bar'), HeaderUtils::split('foo "bar"', ',')); - $this->assertSame(array('foo bar'), HeaderUtils::split('"foo" bar', ',')); - $this->assertSame(array('foo bar'), HeaderUtils::split('"foo" "bar"', ',')); + $this->assertSame(['foo', 'bar'], HeaderUtils::split('foo,,,, bar', ',')); + $this->assertSame(['foo', 'bar'], HeaderUtils::split(',foo, bar,', ',')); + $this->assertSame(['foo', 'bar'], HeaderUtils::split(' , foo, bar, ', ',')); + $this->assertSame(['foo bar'], HeaderUtils::split('foo "bar"', ',')); + $this->assertSame(['foo bar'], HeaderUtils::split('"foo" bar', ',')); + $this->assertSame(['foo bar'], HeaderUtils::split('"foo" "bar"', ',')); // These are not a valid header values. We test that they parse anyway, // and that both the valid and invalid parts are returned. - $this->assertSame(array(), HeaderUtils::split('', ',')); - $this->assertSame(array(), HeaderUtils::split(',,,', ',')); - $this->assertSame(array('foo', 'bar', 'baz'), HeaderUtils::split('foo, "bar", "baz', ',')); - $this->assertSame(array('foo', 'bar, baz'), HeaderUtils::split('foo, "bar, baz', ',')); - $this->assertSame(array('foo', 'bar, baz\\'), HeaderUtils::split('foo, "bar, baz\\', ',')); - $this->assertSame(array('foo', 'bar, baz\\'), HeaderUtils::split('foo, "bar, baz\\\\', ',')); + $this->assertSame([], HeaderUtils::split('', ',')); + $this->assertSame([], HeaderUtils::split(',,,', ',')); + $this->assertSame(['foo', 'bar', 'baz'], HeaderUtils::split('foo, "bar", "baz', ',')); + $this->assertSame(['foo', 'bar, baz'], HeaderUtils::split('foo, "bar, baz', ',')); + $this->assertSame(['foo', 'bar, baz\\'], HeaderUtils::split('foo, "bar, baz\\', ',')); + $this->assertSame(['foo', 'bar, baz\\'], HeaderUtils::split('foo, "bar, baz\\\\', ',')); } public function testCombine() { - $this->assertSame(array('foo' => '123'), HeaderUtils::combine(array(array('foo', '123')))); - $this->assertSame(array('foo' => true), HeaderUtils::combine(array(array('foo')))); - $this->assertSame(array('foo' => true), HeaderUtils::combine(array(array('Foo')))); - $this->assertSame(array('foo' => '123', 'bar' => true), HeaderUtils::combine(array(array('foo', '123'), array('bar')))); + $this->assertSame(['foo' => '123'], HeaderUtils::combine([['foo', '123']])); + $this->assertSame(['foo' => true], HeaderUtils::combine([['foo']])); + $this->assertSame(['foo' => true], HeaderUtils::combine([['Foo']])); + $this->assertSame(['foo' => '123', 'bar' => true], HeaderUtils::combine([['foo', '123'], ['bar']])); } public function testToString() { - $this->assertSame('foo', HeaderUtils::toString(array('foo' => true), ',')); - $this->assertSame('foo; bar', HeaderUtils::toString(array('foo' => true, 'bar' => true), ';')); - $this->assertSame('foo=123', HeaderUtils::toString(array('foo' => '123'), ',')); - $this->assertSame('foo="1 2 3"', HeaderUtils::toString(array('foo' => '1 2 3'), ',')); - $this->assertSame('foo="1 2 3", bar', HeaderUtils::toString(array('foo' => '1 2 3', 'bar' => true), ',')); + $this->assertSame('foo', HeaderUtils::toString(['foo' => true], ',')); + $this->assertSame('foo; bar', HeaderUtils::toString(['foo' => true, 'bar' => true], ';')); + $this->assertSame('foo=123', HeaderUtils::toString(['foo' => '123'], ',')); + $this->assertSame('foo="1 2 3"', HeaderUtils::toString(['foo' => '1 2 3'], ',')); + $this->assertSame('foo="1 2 3", bar', HeaderUtils::toString(['foo' => '1 2 3', 'bar' => true], ',')); } public function testQuote() @@ -101,14 +101,14 @@ class HeaderUtilsTest extends TestCase public function provideMakeDisposition() { - return array( - array('attachment', 'foo.html', 'foo.html', 'attachment; filename=foo.html'), - array('attachment', 'foo.html', '', 'attachment; filename=foo.html'), - array('attachment', 'foo bar.html', '', 'attachment; filename="foo bar.html"'), - array('attachment', 'foo "bar".html', '', 'attachment; filename="foo \\"bar\\".html"'), - array('attachment', 'foo%20bar.html', 'foo bar.html', 'attachment; filename="foo bar.html"; filename*=utf-8\'\'foo%2520bar.html'), - array('attachment', 'föö.html', 'foo.html', 'attachment; filename=foo.html; filename*=utf-8\'\'f%C3%B6%C3%B6.html'), - ); + return [ + ['attachment', 'foo.html', 'foo.html', 'attachment; filename=foo.html'], + ['attachment', 'foo.html', '', 'attachment; filename=foo.html'], + ['attachment', 'foo bar.html', '', 'attachment; filename="foo bar.html"'], + ['attachment', 'foo "bar".html', '', 'attachment; filename="foo \\"bar\\".html"'], + ['attachment', 'foo%20bar.html', 'foo bar.html', 'attachment; filename="foo bar.html"; filename*=utf-8\'\'foo%2520bar.html'], + ['attachment', 'föö.html', 'foo.html', 'attachment; filename=foo.html; filename*=utf-8\'\'f%C3%B6%C3%B6.html'], + ]; } /** @@ -122,13 +122,13 @@ class HeaderUtilsTest extends TestCase public function provideMakeDispositionFail() { - return array( - array('attachment', 'foo%20bar.html'), - array('attachment', 'foo/bar.html'), - array('attachment', '/foo.html'), - array('attachment', 'foo\bar.html'), - array('attachment', '\foo.html'), - array('attachment', 'föö.html'), - ); + return [ + ['attachment', 'foo%20bar.html'], + ['attachment', 'foo/bar.html'], + ['attachment', '/foo.html'], + ['attachment', 'foo\bar.html'], + ['attachment', '\foo.html'], + ['attachment', 'föö.html'], + ]; } } diff --git a/vendor/symfony/http-foundation/Tests/IpUtilsTest.php b/vendor/symfony/http-foundation/Tests/IpUtilsTest.php index 232a2040ff..c7f76b5de2 100644 --- a/vendor/symfony/http-foundation/Tests/IpUtilsTest.php +++ b/vendor/symfony/http-foundation/Tests/IpUtilsTest.php @@ -26,20 +26,20 @@ class IpUtilsTest extends TestCase public function getIpv4Data() { - return array( - array(true, '192.168.1.1', '192.168.1.1'), - array(true, '192.168.1.1', '192.168.1.1/1'), - array(true, '192.168.1.1', '192.168.1.0/24'), - array(false, '192.168.1.1', '1.2.3.4/1'), - array(false, '192.168.1.1', '192.168.1.1/33'), // invalid subnet - array(true, '192.168.1.1', array('1.2.3.4/1', '192.168.1.0/24')), - array(true, '192.168.1.1', array('192.168.1.0/24', '1.2.3.4/1')), - array(false, '192.168.1.1', array('1.2.3.4/1', '4.3.2.1/1')), - array(true, '1.2.3.4', '0.0.0.0/0'), - array(true, '1.2.3.4', '192.168.1.0/0'), - array(false, '1.2.3.4', '256.256.256/0'), // invalid CIDR notation - array(false, 'an_invalid_ip', '192.168.1.0/24'), - ); + return [ + [true, '192.168.1.1', '192.168.1.1'], + [true, '192.168.1.1', '192.168.1.1/1'], + [true, '192.168.1.1', '192.168.1.0/24'], + [false, '192.168.1.1', '1.2.3.4/1'], + [false, '192.168.1.1', '192.168.1.1/33'], // invalid subnet + [true, '192.168.1.1', ['1.2.3.4/1', '192.168.1.0/24']], + [true, '192.168.1.1', ['192.168.1.0/24', '1.2.3.4/1']], + [false, '192.168.1.1', ['1.2.3.4/1', '4.3.2.1/1']], + [true, '1.2.3.4', '0.0.0.0/0'], + [true, '1.2.3.4', '192.168.1.0/0'], + [false, '1.2.3.4', '256.256.256/0'], // invalid CIDR notation + [false, 'an_invalid_ip', '192.168.1.0/24'], + ]; } /** @@ -56,20 +56,20 @@ class IpUtilsTest extends TestCase public function getIpv6Data() { - return array( - array(true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'), - array(false, '2a00:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'), - array(false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'), - array(true, '0:0:0:0:0:0:0:1', '::1'), - array(false, '0:0:603:0:396e:4789:8e99:0001', '::1'), - array(true, '0:0:603:0:396e:4789:8e99:0001', '::/0'), - array(true, '0:0:603:0:396e:4789:8e99:0001', '2a01:198:603:0::/0'), - array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '2a01:198:603:0::/65')), - array(true, '2a01:198:603:0:396e:4789:8e99:890f', array('2a01:198:603:0::/65', '::1')), - array(false, '2a01:198:603:0:396e:4789:8e99:890f', array('::1', '1a01:198:603:0::/65')), - array(false, '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2', '::1'), - array(false, '2a01:198:603:0:396e:4789:8e99:890f', 'unknown'), - ); + return [ + [true, '2a01:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'], + [false, '2a00:198:603:0:396e:4789:8e99:890f', '2a01:198:603:0::/65'], + [false, '2a01:198:603:0:396e:4789:8e99:890f', '::1'], + [true, '0:0:0:0:0:0:0:1', '::1'], + [false, '0:0:603:0:396e:4789:8e99:0001', '::1'], + [true, '0:0:603:0:396e:4789:8e99:0001', '::/0'], + [true, '0:0:603:0:396e:4789:8e99:0001', '2a01:198:603:0::/0'], + [true, '2a01:198:603:0:396e:4789:8e99:890f', ['::1', '2a01:198:603:0::/65']], + [true, '2a01:198:603:0:396e:4789:8e99:890f', ['2a01:198:603:0::/65', '::1']], + [false, '2a01:198:603:0:396e:4789:8e99:890f', ['::1', '1a01:198:603:0::/65']], + [false, '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2', '::1'], + [false, '2a01:198:603:0:396e:4789:8e99:890f', 'unknown'], + ]; } /** @@ -95,10 +95,10 @@ class IpUtilsTest extends TestCase public function invalidIpAddressData() { - return array( - 'invalid proxy wildcard' => array('192.168.20.13', '*'), - 'invalid proxy missing netmask' => array('192.168.20.13', '0.0.0.0'), - 'invalid request IP with invalid proxy wildcard' => array('0.0.0.0', '*'), - ); + return [ + 'invalid proxy wildcard' => ['192.168.20.13', '*'], + 'invalid proxy missing netmask' => ['192.168.20.13', '0.0.0.0'], + 'invalid request IP with invalid proxy wildcard' => ['0.0.0.0', '*'], + ]; } } diff --git a/vendor/symfony/http-foundation/Tests/JsonResponseTest.php b/vendor/symfony/http-foundation/Tests/JsonResponseTest.php index 201839f89c..03a7b7d9b8 100644 --- a/vendor/symfony/http-foundation/Tests/JsonResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/JsonResponseTest.php @@ -24,13 +24,13 @@ class JsonResponseTest extends TestCase public function testConstructorWithArrayCreatesJsonArray() { - $response = new JsonResponse(array(0, 1, 2, 3)); + $response = new JsonResponse([0, 1, 2, 3]); $this->assertSame('[0,1,2,3]', $response->getContent()); } public function testConstructorWithAssocArrayCreatesJsonObject() { - $response = new JsonResponse(array('foo' => 'bar')); + $response = new JsonResponse(['foo' => 'bar']); $this->assertSame('{"foo":"bar"}', $response->getContent()); } @@ -51,7 +51,7 @@ class JsonResponseTest extends TestCase public function testConstructorWithCustomStatus() { - $response = new JsonResponse(array(), 202); + $response = new JsonResponse([], 202); $this->assertSame(202, $response->getStatusCode()); } @@ -63,35 +63,35 @@ class JsonResponseTest extends TestCase public function testConstructorWithCustomHeaders() { - $response = new JsonResponse(array(), 200, array('ETag' => 'foo')); + $response = new JsonResponse([], 200, ['ETag' => 'foo']); $this->assertSame('application/json', $response->headers->get('Content-Type')); $this->assertSame('foo', $response->headers->get('ETag')); } public function testConstructorWithCustomContentType() { - $headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json'); + $headers = ['Content-Type' => 'application/vnd.acme.blog-v1+json']; - $response = new JsonResponse(array(), 200, $headers); + $response = new JsonResponse([], 200, $headers); $this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type')); } public function testSetJson() { - $response = new JsonResponse('1', 200, array(), true); + $response = new JsonResponse('1', 200, [], true); $this->assertEquals('1', $response->getContent()); - $response = new JsonResponse('[1]', 200, array(), true); + $response = new JsonResponse('[1]', 200, [], true); $this->assertEquals('[1]', $response->getContent()); - $response = new JsonResponse(null, 200, array()); + $response = new JsonResponse(null, 200, []); $response->setJson('true'); $this->assertEquals('true', $response->getContent()); } public function testCreate() { - $response = JsonResponse::create(array('foo' => 'bar'), 204); + $response = JsonResponse::create(['foo' => 'bar'], 204); $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); $this->assertEquals('{"foo":"bar"}', $response->getContent()); @@ -107,14 +107,14 @@ class JsonResponseTest extends TestCase public function testStaticCreateJsonArray() { - $response = JsonResponse::create(array(0, 1, 2, 3)); + $response = JsonResponse::create([0, 1, 2, 3]); $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); $this->assertSame('[0,1,2,3]', $response->getContent()); } public function testStaticCreateJsonObject() { - $response = JsonResponse::create(array('foo' => 'bar')); + $response = JsonResponse::create(['foo' => 'bar']); $this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response); $this->assertSame('{"foo":"bar"}', $response->getContent()); } @@ -140,7 +140,7 @@ class JsonResponseTest extends TestCase public function testStaticCreateWithCustomStatus() { - $response = JsonResponse::create(array(), 202); + $response = JsonResponse::create([], 202); $this->assertSame(202, $response->getStatusCode()); } @@ -152,22 +152,22 @@ class JsonResponseTest extends TestCase public function testStaticCreateWithCustomHeaders() { - $response = JsonResponse::create(array(), 200, array('ETag' => 'foo')); + $response = JsonResponse::create([], 200, ['ETag' => 'foo']); $this->assertSame('application/json', $response->headers->get('Content-Type')); $this->assertSame('foo', $response->headers->get('ETag')); } public function testStaticCreateWithCustomContentType() { - $headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json'); + $headers = ['Content-Type' => 'application/vnd.acme.blog-v1+json']; - $response = JsonResponse::create(array(), 200, $headers); + $response = JsonResponse::create([], 200, $headers); $this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type')); } public function testSetCallback() { - $response = JsonResponse::create(array('foo' => 'bar'))->setCallback('callback'); + $response = JsonResponse::create(['foo' => 'bar'])->setCallback('callback'); $this->assertEquals('/**/callback({"foo":"bar"});', $response->getContent()); $this->assertEquals('text/javascript', $response->headers->get('Content-Type')); @@ -190,7 +190,7 @@ class JsonResponseTest extends TestCase public function testSetEncodingOptions() { $response = new JsonResponse(); - $response->setData(array(array(1, 2, 3))); + $response->setData([[1, 2, 3]]); $this->assertEquals('[[1,2,3]]', $response->getContent()); @@ -239,7 +239,7 @@ class JsonResponseTest extends TestCase public function testSetComplexCallback() { - $response = JsonResponse::create(array('foo' => 'bar')); + $response = JsonResponse::create(['foo' => 'bar']); $response->setCallback('ಠ_ಠ["foo"].bar[0]'); $this->assertEquals('/**/ಠ_ಠ["foo"].bar[0]({"foo":"bar"});', $response->getContent()); diff --git a/vendor/symfony/http-foundation/Tests/ParameterBagTest.php b/vendor/symfony/http-foundation/Tests/ParameterBagTest.php index dccfd4f308..d2a5c991cc 100644 --- a/vendor/symfony/http-foundation/Tests/ParameterBagTest.php +++ b/vendor/symfony/http-foundation/Tests/ParameterBagTest.php @@ -23,44 +23,44 @@ class ParameterBagTest extends TestCase public function testAll() { - $bag = new ParameterBag(array('foo' => 'bar')); - $this->assertEquals(array('foo' => 'bar'), $bag->all(), '->all() gets all the input'); + $bag = new ParameterBag(['foo' => 'bar']); + $this->assertEquals(['foo' => 'bar'], $bag->all(), '->all() gets all the input'); } public function testKeys() { - $bag = new ParameterBag(array('foo' => 'bar')); - $this->assertEquals(array('foo'), $bag->keys()); + $bag = new ParameterBag(['foo' => 'bar']); + $this->assertEquals(['foo'], $bag->keys()); } public function testAdd() { - $bag = new ParameterBag(array('foo' => 'bar')); - $bag->add(array('bar' => 'bas')); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all()); + $bag = new ParameterBag(['foo' => 'bar']); + $bag->add(['bar' => 'bas']); + $this->assertEquals(['foo' => 'bar', 'bar' => 'bas'], $bag->all()); } public function testRemove() { - $bag = new ParameterBag(array('foo' => 'bar')); - $bag->add(array('bar' => 'bas')); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'bas'), $bag->all()); + $bag = new ParameterBag(['foo' => 'bar']); + $bag->add(['bar' => 'bas']); + $this->assertEquals(['foo' => 'bar', 'bar' => 'bas'], $bag->all()); $bag->remove('bar'); - $this->assertEquals(array('foo' => 'bar'), $bag->all()); + $this->assertEquals(['foo' => 'bar'], $bag->all()); } public function testReplace() { - $bag = new ParameterBag(array('foo' => 'bar')); + $bag = new ParameterBag(['foo' => 'bar']); - $bag->replace(array('FOO' => 'BAR')); - $this->assertEquals(array('FOO' => 'BAR'), $bag->all(), '->replace() replaces the input with the argument'); + $bag->replace(['FOO' => 'BAR']); + $this->assertEquals(['FOO' => 'BAR'], $bag->all(), '->replace() replaces the input with the argument'); $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input'); } public function testGet() { - $bag = new ParameterBag(array('foo' => 'bar', 'null' => null)); + $bag = new ParameterBag(['foo' => 'bar', 'null' => null]); $this->assertEquals('bar', $bag->get('foo'), '->get() gets the value of a parameter'); $this->assertEquals('default', $bag->get('unknown', 'default'), '->get() returns second argument as default if a parameter is not defined'); @@ -69,14 +69,14 @@ class ParameterBagTest extends TestCase public function testGetDoesNotUseDeepByDefault() { - $bag = new ParameterBag(array('foo' => array('bar' => 'moo'))); + $bag = new ParameterBag(['foo' => ['bar' => 'moo']]); $this->assertNull($bag->get('foo[bar]')); } public function testSet() { - $bag = new ParameterBag(array()); + $bag = new ParameterBag([]); $bag->set('foo', 'bar'); $this->assertEquals('bar', $bag->get('foo'), '->set() sets the value of parameter'); @@ -87,7 +87,7 @@ class ParameterBagTest extends TestCase public function testHas() { - $bag = new ParameterBag(array('foo' => 'bar')); + $bag = new ParameterBag(['foo' => 'bar']); $this->assertTrue($bag->has('foo'), '->has() returns true if a parameter is defined'); $this->assertFalse($bag->has('unknown'), '->has() return false if a parameter is not defined'); @@ -95,7 +95,7 @@ class ParameterBagTest extends TestCase public function testGetAlpha() { - $bag = new ParameterBag(array('word' => 'foo_BAR_012')); + $bag = new ParameterBag(['word' => 'foo_BAR_012']); $this->assertEquals('fooBAR', $bag->getAlpha('word'), '->getAlpha() gets only alphabetic characters'); $this->assertEquals('', $bag->getAlpha('unknown'), '->getAlpha() returns empty string if a parameter is not defined'); @@ -103,7 +103,7 @@ class ParameterBagTest extends TestCase public function testGetAlnum() { - $bag = new ParameterBag(array('word' => 'foo_BAR_012')); + $bag = new ParameterBag(['word' => 'foo_BAR_012']); $this->assertEquals('fooBAR012', $bag->getAlnum('word'), '->getAlnum() gets only alphanumeric characters'); $this->assertEquals('', $bag->getAlnum('unknown'), '->getAlnum() returns empty string if a parameter is not defined'); @@ -111,7 +111,7 @@ class ParameterBagTest extends TestCase public function testGetDigits() { - $bag = new ParameterBag(array('word' => 'foo_BAR_012')); + $bag = new ParameterBag(['word' => 'foo_BAR_012']); $this->assertEquals('012', $bag->getDigits('word'), '->getDigits() gets only digits as string'); $this->assertEquals('', $bag->getDigits('unknown'), '->getDigits() returns empty string if a parameter is not defined'); @@ -119,7 +119,7 @@ class ParameterBagTest extends TestCase public function testGetInt() { - $bag = new ParameterBag(array('digits' => '0123')); + $bag = new ParameterBag(['digits' => '0123']); $this->assertEquals(123, $bag->getInt('digits'), '->getInt() gets a value of parameter as integer'); $this->assertEquals(0, $bag->getInt('unknown'), '->getInt() returns zero if a parameter is not defined'); @@ -127,14 +127,14 @@ class ParameterBagTest extends TestCase public function testFilter() { - $bag = new ParameterBag(array( + $bag = new ParameterBag([ 'digits' => '0123ab', 'email' => 'example@example.com', 'url' => 'http://example.com/foo', 'dec' => '256', 'hex' => '0x100', - 'array' => array('bang'), - )); + 'array' => ['bang'], + ]); $this->assertEmpty($bag->filter('nokey'), '->filter() should return empty by default if no key is found'); @@ -142,27 +142,27 @@ class ParameterBagTest extends TestCase $this->assertEquals('example@example.com', $bag->filter('email', '', FILTER_VALIDATE_EMAIL), '->filter() gets a value of parameter as email'); - $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, array('flags' => FILTER_FLAG_PATH_REQUIRED)), '->filter() gets a value of parameter as URL with a path'); + $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, ['flags' => FILTER_FLAG_PATH_REQUIRED]), '->filter() gets a value of parameter as URL with a path'); // This test is repeated for code-coverage $this->assertEquals('http://example.com/foo', $bag->filter('url', '', FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED), '->filter() gets a value of parameter as URL with a path'); - $this->assertFalse($bag->filter('dec', '', FILTER_VALIDATE_INT, array( + $this->assertFalse($bag->filter('dec', '', FILTER_VALIDATE_INT, [ 'flags' => FILTER_FLAG_ALLOW_HEX, - 'options' => array('min_range' => 1, 'max_range' => 0xff), - )), '->filter() gets a value of parameter as integer between boundaries'); + 'options' => ['min_range' => 1, 'max_range' => 0xff], + ]), '->filter() gets a value of parameter as integer between boundaries'); - $this->assertFalse($bag->filter('hex', '', FILTER_VALIDATE_INT, array( + $this->assertFalse($bag->filter('hex', '', FILTER_VALIDATE_INT, [ 'flags' => FILTER_FLAG_ALLOW_HEX, - 'options' => array('min_range' => 1, 'max_range' => 0xff), - )), '->filter() gets a value of parameter as integer between boundaries'); + 'options' => ['min_range' => 1, 'max_range' => 0xff], + ]), '->filter() gets a value of parameter as integer between boundaries'); - $this->assertEquals(array('bang'), $bag->filter('array', ''), '->filter() gets a value of parameter as an array'); + $this->assertEquals(['bang'], $bag->filter('array', ''), '->filter() gets a value of parameter as an array'); } public function testGetIterator() { - $parameters = array('foo' => 'bar', 'hello' => 'world'); + $parameters = ['foo' => 'bar', 'hello' => 'world']; $bag = new ParameterBag($parameters); $i = 0; @@ -176,7 +176,7 @@ class ParameterBagTest extends TestCase public function testCount() { - $parameters = array('foo' => 'bar', 'hello' => 'world'); + $parameters = ['foo' => 'bar', 'hello' => 'world']; $bag = new ParameterBag($parameters); $this->assertCount(\count($parameters), $bag); @@ -184,7 +184,7 @@ class ParameterBagTest extends TestCase public function testGetBoolean() { - $parameters = array('string_true' => 'true', 'string_false' => 'false'); + $parameters = ['string_true' => 'true', 'string_false' => 'false']; $bag = new ParameterBag($parameters); $this->assertTrue($bag->getBoolean('string_true'), '->getBoolean() gets the string true as boolean true'); diff --git a/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php b/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php index d389e83dbe..64c3e73ee2 100644 --- a/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/RedirectResponseTest.php @@ -22,7 +22,7 @@ class RedirectResponseTest extends TestCase $this->assertEquals(1, preg_match( '#<meta http-equiv="refresh" content="\d+;url=foo\.bar" />#', - preg_replace(array('/\s+/', '/\'/'), array(' ', '"'), $response->getContent()) + preg_replace(['/\s+/', '/\'/'], [' ', '"'], $response->getContent()) )); } @@ -87,7 +87,7 @@ class RedirectResponseTest extends TestCase $response = new RedirectResponse('foo.bar', 301); $this->assertFalse($response->headers->hasCacheControlDirective('no-cache')); - $response = new RedirectResponse('foo.bar', 301, array('cache-control' => 'max-age=86400')); + $response = new RedirectResponse('foo.bar', 301, ['cache-control' => 'max-age=86400']); $this->assertFalse($response->headers->hasCacheControlDirective('no-cache')); $this->assertTrue($response->headers->hasCacheControlDirective('max-age')); diff --git a/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php b/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php index cc35ad637b..57e9c3d30f 100644 --- a/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php +++ b/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php @@ -34,20 +34,20 @@ class RequestMatcherTest extends TestCase public function getMethodData() { - return array( - array('get', 'get', true), - array('get', array('get', 'post'), true), - array('get', 'post', false), - array('get', 'GET', true), - array('get', array('GET', 'POST'), true), - array('get', 'POST', false), - ); + return [ + ['get', 'get', true], + ['get', ['get', 'post'], true], + ['get', 'post', false], + ['get', 'GET', true], + ['get', ['GET', 'POST'], true], + ['get', 'POST', false], + ]; } public function testScheme() { $httpRequest = $request = $request = Request::create(''); - $httpsRequest = $request = $request = Request::create('', 'get', array(), array(), array(), array('HTTPS' => 'on')); + $httpsRequest = $request = $request = Request::create('', 'get', [], [], [], ['HTTPS' => 'on']); $matcher = new RequestMatcher(); $matcher->matchScheme('https'); @@ -69,7 +69,7 @@ class RequestMatcherTest extends TestCase public function testHost($pattern, $isMatch) { $matcher = new RequestMatcher(); - $request = Request::create('', 'get', array(), array(), array(), array('HTTP_HOST' => 'foo.example.com')); + $request = Request::create('', 'get', [], [], [], ['HTTP_HOST' => 'foo.example.com']); $matcher->matchHost($pattern); $this->assertSame($isMatch, $matcher->matches($request)); @@ -81,7 +81,7 @@ class RequestMatcherTest extends TestCase public function testPort() { $matcher = new RequestMatcher(); - $request = Request::create('', 'get', array(), array(), array(), array('HTTP_HOST' => null, 'SERVER_PORT' => 8000)); + $request = Request::create('', 'get', [], [], [], ['HTTP_HOST' => null, 'SERVER_PORT' => 8000]); $matcher->matchPort(8000); $this->assertTrue($matcher->matches($request)); @@ -89,22 +89,22 @@ class RequestMatcherTest extends TestCase $matcher->matchPort(9000); $this->assertFalse($matcher->matches($request)); - $matcher = new RequestMatcher(null, null, null, null, array(), null, 8000); + $matcher = new RequestMatcher(null, null, null, null, [], null, 8000); $this->assertTrue($matcher->matches($request)); } public function getHostData() { - return array( - array('.*\.example\.com', true), - array('\.example\.com$', true), - array('^.*\.example\.com$', true), - array('.*\.sensio\.com', false), - array('.*\.example\.COM', true), - array('\.example\.COM$', true), - array('^.*\.example\.COM$', true), - array('.*\.sensio\.COM', false), - ); + return [ + ['.*\.example\.com', true], + ['\.example\.com$', true], + ['^.*\.example\.com$', true], + ['.*\.sensio\.com', false], + ['.*\.example\.COM', true], + ['\.example\.COM$', true], + ['^.*\.example\.COM$', true], + ['.*\.sensio\.COM', false], + ]; } public function testPath() diff --git a/vendor/symfony/http-foundation/Tests/RequestTest.php b/vendor/symfony/http-foundation/Tests/RequestTest.php index 36a9491348..ab0dcf6818 100644 --- a/vendor/symfony/http-foundation/Tests/RequestTest.php +++ b/vendor/symfony/http-foundation/Tests/RequestTest.php @@ -21,24 +21,24 @@ class RequestTest extends TestCase { protected function tearDown() { - Request::setTrustedProxies(array(), -1); - Request::setTrustedHosts(array()); + Request::setTrustedProxies([], -1); + Request::setTrustedHosts([]); } public function testInitialize() { $request = new Request(); - $request->initialize(array('foo' => 'bar')); + $request->initialize(['foo' => 'bar']); $this->assertEquals('bar', $request->query->get('foo'), '->initialize() takes an array of query parameters as its first argument'); - $request->initialize(array(), array('foo' => 'bar')); + $request->initialize([], ['foo' => 'bar']); $this->assertEquals('bar', $request->request->get('foo'), '->initialize() takes an array of request parameters as its second argument'); - $request->initialize(array(), array(), array('foo' => 'bar')); + $request->initialize([], [], ['foo' => 'bar']); $this->assertEquals('bar', $request->attributes->get('foo'), '->initialize() takes an array of attributes as its third argument'); - $request->initialize(array(), array(), array(), array(), array(), array('HTTP_FOO' => 'bar')); + $request->initialize([], [], [], [], [], ['HTTP_FOO' => 'bar']); $this->assertEquals('bar', $request->headers->get('FOO'), '->initialize() takes an array of HTTP headers as its sixth argument'); } @@ -101,7 +101,7 @@ class RequestTest extends TestCase $this->assertEquals('test.com', $request->getHttpHost()); $this->assertFalse($request->isSecure()); - $request = Request::create('http://test.com/foo', 'GET', array('bar' => 'baz')); + $request = Request::create('http://test.com/foo', 'GET', ['bar' => 'baz']); $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('bar=baz', $request->getQueryString()); @@ -109,7 +109,7 @@ class RequestTest extends TestCase $this->assertEquals('test.com', $request->getHttpHost()); $this->assertFalse($request->isSecure()); - $request = Request::create('http://test.com/foo?bar=foo', 'GET', array('bar' => 'baz')); + $request = Request::create('http://test.com/foo?bar=foo', 'GET', ['bar' => 'baz']); $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('bar=baz', $request->getQueryString()); @@ -166,7 +166,7 @@ class RequestTest extends TestCase $this->assertTrue($request->isSecure()); $json = '{"jsonrpc":"2.0","method":"echo","id":7,"params":["Hello World"]}'; - $request = Request::create('http://example.com/jsonrpc', 'POST', array(), array(), array(), array(), $json); + $request = Request::create('http://example.com/jsonrpc', 'POST', [], [], [], [], $json); $this->assertEquals($json, $request->getContent()); $this->assertFalse($request->isSecure()); @@ -216,16 +216,16 @@ class RequestTest extends TestCase $request = Request::create('http://test.com/?foo'); $this->assertEquals('/?foo', $request->getRequestUri()); - $this->assertEquals(array('foo' => ''), $request->query->all()); + $this->assertEquals(['foo' => ''], $request->query->all()); // assume rewrite rule: (.*) --> app/app.php; app/ is a symlink to a symfony web/ directory - $request = Request::create('http://test.com/apparthotel-1234', 'GET', array(), array(), array(), - array( + $request = Request::create('http://test.com/apparthotel-1234', 'GET', [], [], [], + [ 'DOCUMENT_ROOT' => '/var/www/www.test.com', 'SCRIPT_FILENAME' => '/var/www/www.test.com/app/app.php', 'SCRIPT_NAME' => '/app/app.php', 'PHP_SELF' => '/app/app.php/apparthotel-1234', - )); + ]); $this->assertEquals('http://test.com/apparthotel-1234', $request->getUri()); $this->assertEquals('/apparthotel-1234', $request->getPathInfo()); $this->assertEquals('', $request->getQueryString()); @@ -258,7 +258,7 @@ class RequestTest extends TestCase $this->assertEquals(8080, $request->getPort()); $this->assertFalse($request->isSecure()); - $request = Request::create('http://test.com/foo?bar=foo', 'GET', array('bar' => 'baz')); + $request = Request::create('http://test.com/foo?bar=foo', 'GET', ['bar' => 'baz']); $request->server->set('REQUEST_URI', 'http://test.com/foo?bar=foo'); $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); @@ -289,13 +289,13 @@ class RequestTest extends TestCase public function testGetRequestUri($serverRequestUri, $expected, $message) { $request = new Request(); - $request->server->add(array( + $request->server->add([ 'REQUEST_URI' => $serverRequestUri, // For having http://test.com 'SERVER_NAME' => 'test.com', 'SERVER_PORT' => 80, - )); + ]); $this->assertSame($expected, $request->getRequestUri(), $message); $this->assertSame($expected, $request->server->get('REQUEST_URI'), 'Normalize the request URI.'); @@ -304,21 +304,21 @@ class RequestTest extends TestCase public function getRequestUriData() { $message = 'Do not modify the path.'; - yield array('/foo', '/foo', $message); - yield array('//bar/foo', '//bar/foo', $message); - yield array('///bar/foo', '///bar/foo', $message); + yield ['/foo', '/foo', $message]; + yield ['//bar/foo', '//bar/foo', $message]; + yield ['///bar/foo', '///bar/foo', $message]; $message = 'Handle when the scheme, host are on REQUEST_URI.'; - yield array('http://test.com/foo?bar=baz', '/foo?bar=baz', $message); + yield ['http://test.com/foo?bar=baz', '/foo?bar=baz', $message]; $message = 'Handle when the scheme, host and port are on REQUEST_URI.'; - yield array('http://test.com:80/foo', '/foo', $message); - yield array('https://test.com:8080/foo', '/foo', $message); - yield array('https://test.com:443/foo', '/foo', $message); + yield ['http://test.com:80/foo', '/foo', $message]; + yield ['https://test.com:8080/foo', '/foo', $message]; + yield ['https://test.com:443/foo', '/foo', $message]; $message = 'Fragment should not be included in the URI'; - yield array('http://test.com/foo#bar', '/foo', $message); - yield array('/foo#bar', '/foo', $message); + yield ['http://test.com/foo#bar', '/foo', $message]; + yield ['/foo#bar', '/foo', $message]; } public function testGetRequestUriWithoutRequiredHeader() @@ -335,7 +335,7 @@ class RequestTest extends TestCase public function testCreateCheckPrecedence() { // server is used by default - $request = Request::create('/', 'DELETE', array(), array(), array(), array( + $request = Request::create('/', 'DELETE', [], [], [], [ 'HTTP_HOST' => 'example.com', 'HTTPS' => 'on', 'SERVER_PORT' => 443, @@ -343,7 +343,7 @@ class RequestTest extends TestCase 'PHP_AUTH_PW' => 'pa$$', 'QUERY_STRING' => 'foo=bar', 'CONTENT_TYPE' => 'application/json', - )); + ]); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(443, $request->getPort()); $this->assertTrue($request->isSecure()); @@ -353,11 +353,11 @@ class RequestTest extends TestCase $this->assertEquals('application/json', $request->headers->get('CONTENT_TYPE')); // URI has precedence over server - $request = Request::create('http://thomas:pokemon@example.net:8080/?foo=bar', 'GET', array(), array(), array(), array( + $request = Request::create('http://thomas:pokemon@example.net:8080/?foo=bar', 'GET', [], [], [], [ 'HTTP_HOST' => 'example.com', 'HTTPS' => 'on', 'SERVER_PORT' => 443, - )); + ]); $this->assertEquals('example.net', $request->getHost()); $this->assertEquals(8080, $request->getPort()); $this->assertFalse($request->isSecure()); @@ -368,7 +368,7 @@ class RequestTest extends TestCase public function testDuplicate() { - $request = new Request(array('foo' => 'bar'), array('foo' => 'bar'), array('foo' => 'bar'), array(), array(), array('HTTP_FOO' => 'bar')); + $request = new Request(['foo' => 'bar'], ['foo' => 'bar'], ['foo' => 'bar'], [], [], ['HTTP_FOO' => 'bar']); $dup = $request->duplicate(); $this->assertEquals($request->query->all(), $dup->query->all(), '->duplicate() duplicates a request an copy the current query parameters'); @@ -376,17 +376,17 @@ class RequestTest extends TestCase $this->assertEquals($request->attributes->all(), $dup->attributes->all(), '->duplicate() duplicates a request an copy the current attributes'); $this->assertEquals($request->headers->all(), $dup->headers->all(), '->duplicate() duplicates a request an copy the current HTTP headers'); - $dup = $request->duplicate(array('foo' => 'foobar'), array('foo' => 'foobar'), array('foo' => 'foobar'), array(), array(), array('HTTP_FOO' => 'foobar')); + $dup = $request->duplicate(['foo' => 'foobar'], ['foo' => 'foobar'], ['foo' => 'foobar'], [], [], ['HTTP_FOO' => 'foobar']); - $this->assertEquals(array('foo' => 'foobar'), $dup->query->all(), '->duplicate() overrides the query parameters if provided'); - $this->assertEquals(array('foo' => 'foobar'), $dup->request->all(), '->duplicate() overrides the request parameters if provided'); - $this->assertEquals(array('foo' => 'foobar'), $dup->attributes->all(), '->duplicate() overrides the attributes if provided'); - $this->assertEquals(array('foo' => array('foobar')), $dup->headers->all(), '->duplicate() overrides the HTTP header if provided'); + $this->assertEquals(['foo' => 'foobar'], $dup->query->all(), '->duplicate() overrides the query parameters if provided'); + $this->assertEquals(['foo' => 'foobar'], $dup->request->all(), '->duplicate() overrides the request parameters if provided'); + $this->assertEquals(['foo' => 'foobar'], $dup->attributes->all(), '->duplicate() overrides the attributes if provided'); + $this->assertEquals(['foo' => ['foobar']], $dup->headers->all(), '->duplicate() overrides the HTTP header if provided'); } public function testDuplicateWithFormat() { - $request = new Request(array(), array(), array('_format' => 'json')); + $request = new Request([], [], ['_format' => 'json']); $dup = $request->duplicate(); $this->assertEquals('json', $dup->getRequestFormat()); @@ -421,7 +421,7 @@ class RequestTest extends TestCase public function getFormatToMimeTypeMapProviderWithAdditionalNullFormat() { return array_merge( - array(array(null, array(null, 'unexistent-mime-type'))), + [[null, [null, 'unexistent-mime-type']]], $this->getFormatToMimeTypeMapProvider() ); } @@ -456,7 +456,7 @@ class RequestTest extends TestCase { $request = new Request(); $this->assertNull($request->getMimeType('foo')); - $this->assertEquals(array(), Request::getMimeTypes('foo')); + $this->assertEquals([], Request::getMimeTypes('foo')); } public function testGetFormatWithCustomMimeType() @@ -468,21 +468,21 @@ class RequestTest extends TestCase public function getFormatToMimeTypeMapProvider() { - return array( - array('txt', array('text/plain')), - array('js', array('application/javascript', 'application/x-javascript', 'text/javascript')), - array('css', array('text/css')), - array('json', array('application/json', 'application/x-json')), - array('jsonld', array('application/ld+json')), - array('xml', array('text/xml', 'application/xml', 'application/x-xml')), - array('rdf', array('application/rdf+xml')), - array('atom', array('application/atom+xml')), - ); + return [ + ['txt', ['text/plain']], + ['js', ['application/javascript', 'application/x-javascript', 'text/javascript']], + ['css', ['text/css']], + ['json', ['application/json', 'application/x-json']], + ['jsonld', ['application/ld+json']], + ['xml', ['text/xml', 'application/xml', 'application/x-xml']], + ['rdf', ['application/rdf+xml']], + ['atom', ['application/atom+xml']], + ]; } public function testGetUri() { - $server = array(); + $server = []; // Standard Request on non default PORT // http://host:8080/index.php/path/info?query=string @@ -501,7 +501,7 @@ class RequestTest extends TestCase $request = new Request(); - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host:8080/index.php/path/info?query=string', $request->getUri(), '->getUri() with non default port'); @@ -510,7 +510,7 @@ class RequestTest extends TestCase $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port'); @@ -519,7 +519,7 @@ class RequestTest extends TestCase $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port without HOST_HEADER'); @@ -527,7 +527,7 @@ class RequestTest extends TestCase // RewriteCond %{REQUEST_FILENAME} !-f // RewriteRule ^(.*)$ index.php [QSA,L] // http://host:8080/path/info?query=string - $server = array(); + $server = []; $server['HTTP_HOST'] = 'host:8080'; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '8080'; @@ -541,7 +541,7 @@ class RequestTest extends TestCase $server['PHP_SELF'] = '/index.php'; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host:8080/path/info?query=string', $request->getUri(), '->getUri() with rewrite'); // Use std port number @@ -550,7 +550,7 @@ class RequestTest extends TestCase $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host/path/info?query=string', $request->getUri(), '->getUri() with rewrite and default port'); @@ -559,13 +559,13 @@ class RequestTest extends TestCase $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername/path/info?query=string', $request->getUri(), '->getUri() with rewrite, default port without HOST_HEADER'); // With encoded characters - $server = array( + $server = [ 'HTTP_HOST' => 'host:8080', 'SERVER_NAME' => 'servername', 'SERVER_PORT' => '8080', @@ -575,9 +575,9 @@ class RequestTest extends TestCase 'PATH_TRANSLATED' => 'redirect:/index.php/foo bar/in+fo', 'PHP_SELF' => '/ba se/index_dev.php/path/info', 'SCRIPT_FILENAME' => '/some/where/ba se/index_dev.php', - ); + ]; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals( 'http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', @@ -587,11 +587,11 @@ class RequestTest extends TestCase // with user info $server['PHP_AUTH_USER'] = 'fabien'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); $server['PHP_AUTH_PW'] = 'symfony'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); } @@ -609,7 +609,7 @@ class RequestTest extends TestCase $request = Request::create('https://test.com:90/foo?bar=baz'); $this->assertEquals('https://test.com:90/some/path', $request->getUriForPath('/some/path')); - $server = array(); + $server = []; // Standard Request on non default PORT // http://host:8080/index.php/path/info?query=string @@ -628,7 +628,7 @@ class RequestTest extends TestCase $request = new Request(); - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host:8080/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with non default port'); @@ -637,7 +637,7 @@ class RequestTest extends TestCase $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port'); @@ -646,7 +646,7 @@ class RequestTest extends TestCase $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port without HOST_HEADER'); @@ -654,7 +654,7 @@ class RequestTest extends TestCase // RewriteCond %{REQUEST_FILENAME} !-f // RewriteRule ^(.*)$ index.php [QSA,L] // http://host:8080/path/info?query=string - $server = array(); + $server = []; $server['HTTP_HOST'] = 'host:8080'; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '8080'; @@ -668,7 +668,7 @@ class RequestTest extends TestCase $server['PHP_SELF'] = '/index.php'; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host:8080/some/path', $request->getUriForPath('/some/path'), '->getUri() with rewrite'); // Use std port number @@ -677,7 +677,7 @@ class RequestTest extends TestCase $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://host/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite and default port'); @@ -686,7 +686,7 @@ class RequestTest extends TestCase $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite, default port without HOST_HEADER'); $this->assertEquals('servername', $request->getHttpHost()); @@ -694,11 +694,11 @@ class RequestTest extends TestCase // with user info $server['PHP_AUTH_USER'] = 'fabien'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path')); $server['PHP_AUTH_PW'] = 'symfony'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path')); } @@ -712,30 +712,30 @@ class RequestTest extends TestCase public function getRelativeUriForPathData() { - return array( - array('me.png', '/foo', '/me.png'), - array('../me.png', '/foo/bar', '/me.png'), - array('me.png', '/foo/bar', '/foo/me.png'), - array('../baz/me.png', '/foo/bar/b', '/foo/baz/me.png'), - array('../../fooz/baz/me.png', '/foo/bar/b', '/fooz/baz/me.png'), - array('baz/me.png', '/foo/bar/b', 'baz/me.png'), - ); + return [ + ['me.png', '/foo', '/me.png'], + ['../me.png', '/foo/bar', '/me.png'], + ['me.png', '/foo/bar', '/foo/me.png'], + ['../baz/me.png', '/foo/bar/b', '/foo/baz/me.png'], + ['../../fooz/baz/me.png', '/foo/bar/b', '/fooz/baz/me.png'], + ['baz/me.png', '/foo/bar/b', 'baz/me.png'], + ]; } public function testGetUserInfo() { $request = new Request(); - $server = array('PHP_AUTH_USER' => 'fabien'); - $request->initialize(array(), array(), array(), array(), array(), $server); + $server = ['PHP_AUTH_USER' => 'fabien']; + $request->initialize([], [], [], [], [], $server); $this->assertEquals('fabien', $request->getUserInfo()); $server['PHP_AUTH_USER'] = '0'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('0', $request->getUserInfo()); $server['PHP_AUTH_PW'] = '0'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('0:0', $request->getUserInfo()); } @@ -743,22 +743,22 @@ class RequestTest extends TestCase { $request = new Request(); - $server = array(); + $server = []; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '90'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); $server['PHP_AUTH_USER'] = 'fabien'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); $server['PHP_AUTH_USER'] = '0'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); $server['PHP_AUTH_PW'] = '0'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); } @@ -775,35 +775,35 @@ class RequestTest extends TestCase public function getQueryStringNormalizationData() { - return array( - array('foo', 'foo=', 'works with valueless parameters'), - array('foo=', 'foo=', 'includes a dangling equal sign'), - array('bar=&foo=bar', 'bar=&foo=bar', '->works with empty parameters'), - array('foo=bar&bar=', 'bar=&foo=bar', 'sorts keys alphabetically'), + return [ + ['foo', 'foo=', 'works with valueless parameters'], + ['foo=', 'foo=', 'includes a dangling equal sign'], + ['bar=&foo=bar', 'bar=&foo=bar', '->works with empty parameters'], + ['foo=bar&bar=', 'bar=&foo=bar', 'sorts keys alphabetically'], // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded). // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. - array('him=John%20Doe&her=Jane+Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes spaces in both encodings "%20" and "+"'), + ['baz=Foo%20Baz&bar=Foo+Bar', 'bar=Foo%20Bar&baz=Foo%20Baz', 'normalizes spaces in both encodings "%20" and "+"'], - array('foo[]=1&foo[]=2', 'foo%5B0%5D=1&foo%5B1%5D=2', 'allows array notation'), - array('foo=1&foo=2', 'foo=2', 'merges repeated parameters'), - array('pa%3Dram=foo%26bar%3Dbaz&test=test', 'pa%3Dram=foo%26bar%3Dbaz&test=test', 'works with encoded delimiters'), - array('0', '0=', 'allows "0"'), - array('Jane Doe&John%20Doe', 'Jane_Doe=&John_Doe=', 'normalizes encoding in keys'), - array('her=Jane Doe&him=John%20Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes encoding in values'), - array('foo=bar&&&test&&', 'foo=bar&test=', 'removes unneeded delimiters'), - array('formula=e=m*c^2', 'formula=e%3Dm%2Ac%5E2', 'correctly treats only the first "=" as delimiter and the next as value'), + ['foo[]=1&foo[]=2', 'foo%5B0%5D=1&foo%5B1%5D=2', 'allows array notation'], + ['foo=1&foo=2', 'foo=2', 'merges repeated parameters'], + ['pa%3Dram=foo%26bar%3Dbaz&test=test', 'pa%3Dram=foo%26bar%3Dbaz&test=test', 'works with encoded delimiters'], + ['0', '0=', 'allows "0"'], + ['Foo Bar&Foo%20Baz', 'Foo_Bar=&Foo_Baz=', 'normalizes encoding in keys'], + ['bar=Foo Bar&baz=Foo%20Baz', 'bar=Foo%20Bar&baz=Foo%20Baz', 'normalizes encoding in values'], + ['foo=bar&&&test&&', 'foo=bar&test=', 'removes unneeded delimiters'], + ['formula=e=m*c^2', 'formula=e%3Dm%2Ac%5E2', 'correctly treats only the first "=" as delimiter and the next as value'], // Ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway. // PHP also does not include them when building _GET. - array('foo=bar&=a=b&=x=y', 'foo=bar', 'removes params with empty key'), + ['foo=bar&=a=b&=x=y', 'foo=bar', 'removes params with empty key'], // Don't reorder nested query string keys - array('foo[]=Z&foo[]=A', 'foo%5B0%5D=Z&foo%5B1%5D=A', 'keeps order of values'), - array('foo[Z]=B&foo[A]=B', 'foo%5BZ%5D=B&foo%5BA%5D=B', 'keeps order of keys'), + ['foo[]=Z&foo[]=A', 'foo%5B0%5D=Z&foo%5B1%5D=A', 'keeps order of values'], + ['foo[Z]=B&foo[A]=B', 'foo%5BZ%5D=B&foo%5BA%5D=B', 'keeps order of keys'], - array('utf8=✓', 'utf8=%E2%9C%93', 'encodes UTF-8'), - ); + ['utf8=✓', 'utf8=%E2%9C%93', 'encodes UTF-8'], + ]; } public function testGetQueryStringReturnsNull() @@ -820,74 +820,74 @@ class RequestTest extends TestCase { $request = new Request(); - $request->initialize(array('foo' => 'bar')); + $request->initialize(['foo' => 'bar']); $this->assertEquals('', $request->getHost(), '->getHost() return empty string if not initialized'); - $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.example.com')); + $request->initialize([], [], [], [], [], ['HTTP_HOST' => 'www.example.com']); $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from Host Header'); // Host header with port number - $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.example.com:8080')); + $request->initialize([], [], [], [], [], ['HTTP_HOST' => 'www.example.com:8080']); $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from Host Header with port number'); // Server values - $request->initialize(array(), array(), array(), array(), array(), array('SERVER_NAME' => 'www.example.com')); + $request->initialize([], [], [], [], [], ['SERVER_NAME' => 'www.example.com']); $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from server name'); - $request->initialize(array(), array(), array(), array(), array(), array('SERVER_NAME' => 'www.example.com', 'HTTP_HOST' => 'www.host.com')); + $request->initialize([], [], [], [], [], ['SERVER_NAME' => 'www.example.com', 'HTTP_HOST' => 'www.host.com']); $this->assertEquals('www.host.com', $request->getHost(), '->getHost() value from Host header has priority over SERVER_NAME '); } public function testGetPort() { - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => 'https', 'HTTP_X_FORWARDED_PORT' => '443', - )); + ]); $port = $request->getPort(); $this->assertEquals(80, $port, 'Without trusted proxies FORWARDED_PROTO and FORWARDED_PORT are ignored.'); - Request::setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_ALL); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + Request::setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_ALL); + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => 'https', 'HTTP_X_FORWARDED_PORT' => '8443', - )); + ]); $this->assertEquals(80, $request->getPort(), 'With PROTO and PORT on untrusted connection server value takes precedence.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(8443, $request->getPort(), 'With PROTO and PORT set PORT takes precedence.'); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => 'https', - )); + ]); $this->assertEquals(80, $request->getPort(), 'With only PROTO set getPort() ignores trusted headers on untrusted connection.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(443, $request->getPort(), 'With only PROTO set getPort() defaults to 443.'); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => 'http', - )); + ]); $this->assertEquals(80, $request->getPort(), 'If X_FORWARDED_PROTO is set to HTTP getPort() ignores trusted headers on untrusted connection.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(80, $request->getPort(), 'If X_FORWARDED_PROTO is set to HTTP getPort() returns port of the original request.'); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => 'On', - )); + ]); $this->assertEquals(80, $request->getPort(), 'With only PROTO set and value is On, getPort() ignores trusted headers on untrusted connection.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(443, $request->getPort(), 'With only PROTO set and value is On, getPort() defaults to 443.'); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => '1', - )); + ]); $this->assertEquals(80, $request->getPort(), 'With only PROTO set and value is 1, getPort() ignores trusted headers on untrusted connection.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(443, $request->getPort(), 'With only PROTO set and value is 1, getPort() defaults to 443.'); - $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + $request = Request::create('http://example.com', 'GET', [], [], [], [ 'HTTP_X_FORWARDED_PROTO' => 'something-else', - )); + ]); $port = $request->getPort(); $this->assertEquals(80, $port, 'With only PROTO set and value is not recognized, getPort() defaults to 80.'); } @@ -898,7 +898,7 @@ class RequestTest extends TestCase public function testGetHostWithFakeHttpHostValue() { $request = new Request(); - $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.host.com?query=string')); + $request->initialize([], [], [], [], [], ['HTTP_HOST' => 'www.host.com?query=string']); $request->getHost(); } @@ -958,7 +958,7 @@ class RequestTest extends TestCase $request = new Request(); $request->setMethod('POST'); - $request->query->set('_method', array('delete', 'patch')); + $request->query->set('_method', ['delete', 'patch']); $this->assertSame('POST', $request->getMethod(), '->getMethod() returns the request method if invalid type is defined in query'); } @@ -995,69 +995,69 @@ class RequestTest extends TestCase public function getClientIpsForwardedProvider() { // $expected $remoteAddr $httpForwarded $trustedProxies - return array( - array(array('127.0.0.1'), '127.0.0.1', 'for="_gazonk"', null), - array(array('127.0.0.1'), '127.0.0.1', 'for="_gazonk"', array('127.0.0.1')), - array(array('88.88.88.88'), '127.0.0.1', 'for="88.88.88.88:80"', array('127.0.0.1')), - array(array('192.0.2.60'), '::1', 'for=192.0.2.60;proto=http;by=203.0.113.43', array('::1')), - array(array('2620:0:1cfe:face:b00c::3', '192.0.2.43'), '::1', 'for=192.0.2.43, for="[2620:0:1cfe:face:b00c::3]"', array('::1')), - array(array('2001:db8:cafe::17'), '::1', 'for="[2001:db8:cafe::17]:4711', array('::1')), - ); + return [ + [['127.0.0.1'], '127.0.0.1', 'for="_gazonk"', null], + [['127.0.0.1'], '127.0.0.1', 'for="_gazonk"', ['127.0.0.1']], + [['88.88.88.88'], '127.0.0.1', 'for="88.88.88.88:80"', ['127.0.0.1']], + [['192.0.2.60'], '::1', 'for=192.0.2.60;proto=http;by=203.0.113.43', ['::1']], + [['2620:0:1cfe:face:b00c::3', '192.0.2.43'], '::1', 'for=192.0.2.43, for="[2620:0:1cfe:face:b00c::3]"', ['::1']], + [['2001:db8:cafe::17'], '::1', 'for="[2001:db8:cafe::17]:4711', ['::1']], + ]; } public function getClientIpsProvider() { // $expected $remoteAddr $httpForwardedFor $trustedProxies - return array( + return [ // simple IPv4 - array(array('88.88.88.88'), '88.88.88.88', null, null), + [['88.88.88.88'], '88.88.88.88', null, null], // trust the IPv4 remote addr - array(array('88.88.88.88'), '88.88.88.88', null, array('88.88.88.88')), + [['88.88.88.88'], '88.88.88.88', null, ['88.88.88.88']], // simple IPv6 - array(array('::1'), '::1', null, null), + [['::1'], '::1', null, null], // trust the IPv6 remote addr - array(array('::1'), '::1', null, array('::1')), + [['::1'], '::1', null, ['::1']], // forwarded for with remote IPv4 addr not trusted - array(array('127.0.0.1'), '127.0.0.1', '88.88.88.88', null), + [['127.0.0.1'], '127.0.0.1', '88.88.88.88', null], // forwarded for with remote IPv4 addr trusted + comma - array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88,', array('127.0.0.1')), + [['88.88.88.88'], '127.0.0.1', '88.88.88.88,', ['127.0.0.1']], // forwarded for with remote IPv4 and all FF addrs trusted - array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88', array('127.0.0.1', '88.88.88.88')), + [['88.88.88.88'], '127.0.0.1', '88.88.88.88', ['127.0.0.1', '88.88.88.88']], // forwarded for with remote IPv4 range trusted - array(array('88.88.88.88'), '123.45.67.89', '88.88.88.88', array('123.45.67.0/24')), + [['88.88.88.88'], '123.45.67.89', '88.88.88.88', ['123.45.67.0/24']], // forwarded for with remote IPv6 addr not trusted - array(array('1620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', null), + [['1620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', null], // forwarded for with remote IPv6 addr trusted - array(array('2620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3')), + [['2620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', ['1620:0:1cfe:face:b00c::3']], // forwarded for with remote IPv6 range trusted - array(array('88.88.88.88'), '2a01:198:603:0:396e:4789:8e99:890f', '88.88.88.88', array('2a01:198:603:0::/65')), + [['88.88.88.88'], '2a01:198:603:0:396e:4789:8e99:890f', '88.88.88.88', ['2a01:198:603:0::/65']], // multiple forwarded for with remote IPv4 addr trusted - array(array('88.88.88.88', '87.65.43.21', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89')), + [['88.88.88.88', '87.65.43.21', '127.0.0.1'], '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', ['123.45.67.89']], // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted - array(array('87.65.43.21', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '88.88.88.88')), + [['87.65.43.21', '127.0.0.1'], '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', ['123.45.67.89', '88.88.88.88']], // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle - array(array('88.88.88.88', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '87.65.43.21')), + [['88.88.88.88', '127.0.0.1'], '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', ['123.45.67.89', '87.65.43.21']], // multiple forwarded for with remote IPv4 addr and all reverse proxies trusted - array(array('127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '87.65.43.21', '88.88.88.88', '127.0.0.1')), + [['127.0.0.1'], '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', ['123.45.67.89', '87.65.43.21', '88.88.88.88', '127.0.0.1']], // multiple forwarded for with remote IPv6 addr trusted - array(array('2620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3')), + [['2620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', ['1620:0:1cfe:face:b00c::3']], // multiple forwarded for with remote IPv6 addr and some reverse proxies trusted - array(array('3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3')), + [['3620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', ['1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3']], // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle - array(array('2620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3,3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3')), + [['2620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3'], '1620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3,3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', ['1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3']], // client IP with port - array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88:12345, 127.0.0.1', array('127.0.0.1')), + [['88.88.88.88'], '127.0.0.1', '88.88.88.88:12345, 127.0.0.1', ['127.0.0.1']], // invalid forwarded IP is ignored - array(array('88.88.88.88'), '127.0.0.1', 'unknown,88.88.88.88', array('127.0.0.1')), - array(array('88.88.88.88'), '127.0.0.1', '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2,88.88.88.88', array('127.0.0.1')), - ); + [['88.88.88.88'], '127.0.0.1', 'unknown,88.88.88.88', ['127.0.0.1']], + [['88.88.88.88'], '127.0.0.1', '}__test|O:21:"JDatabaseDriverMysqli":3:{s:2,88.88.88.88', ['127.0.0.1']], + ]; } /** @@ -1068,15 +1068,15 @@ class RequestTest extends TestCase { $request = new Request(); - $server = array( + $server = [ 'REMOTE_ADDR' => '88.88.88.88', 'HTTP_FORWARDED' => $httpForwarded, 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor, - ); + ]; - Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_ALL | Request::HEADER_FORWARDED); + Request::setTrustedProxies(['88.88.88.88'], Request::HEADER_X_FORWARDED_ALL | Request::HEADER_FORWARDED); - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $request->getClientIps(); } @@ -1088,15 +1088,15 @@ class RequestTest extends TestCase { $request = new Request(); - $server = array( + $server = [ 'REMOTE_ADDR' => '88.88.88.88', 'HTTP_FORWARDED' => $httpForwarded, 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor, - ); + ]; - Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_FOR); + Request::setTrustedProxies(['88.88.88.88'], Request::HEADER_X_FORWARDED_FOR); - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertSame(array_reverse(explode(',', $httpXForwardedFor)), $request->getClientIps()); } @@ -1104,13 +1104,13 @@ class RequestTest extends TestCase public function getClientIpsWithConflictingHeadersProvider() { // $httpForwarded $httpXForwardedFor - return array( - array('for=87.65.43.21', '192.0.2.60'), - array('for=87.65.43.21, for=192.0.2.60', '192.0.2.60'), - array('for=192.0.2.60', '192.0.2.60,87.65.43.21'), - array('for="::face", for=192.0.2.60', '192.0.2.60,192.0.2.43'), - array('for=87.65.43.21, for=192.0.2.60', '192.0.2.60,87.65.43.21'), - ); + return [ + ['for=87.65.43.21', '192.0.2.60'], + ['for=87.65.43.21, for=192.0.2.60', '192.0.2.60'], + ['for=192.0.2.60', '192.0.2.60,87.65.43.21'], + ['for="::face", for=192.0.2.60', '192.0.2.60,192.0.2.43'], + ['for=87.65.43.21, for=192.0.2.60', '192.0.2.60,87.65.43.21'], + ]; } /** @@ -1120,15 +1120,15 @@ class RequestTest extends TestCase { $request = new Request(); - $server = array( + $server = [ 'REMOTE_ADDR' => '88.88.88.88', 'HTTP_FORWARDED' => $httpForwarded, 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor, - ); + ]; - Request::setTrustedProxies(array('88.88.88.88'), -1); + Request::setTrustedProxies(['88.88.88.88'], -1); - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $clientIps = $request->getClientIps(); @@ -1138,14 +1138,14 @@ class RequestTest extends TestCase public function getClientIpsWithAgreeingHeadersProvider() { // $httpForwarded $httpXForwardedFor - return array( - array('for="192.0.2.60"', '192.0.2.60', array('192.0.2.60')), - array('for=192.0.2.60, for=87.65.43.21', '192.0.2.60,87.65.43.21', array('87.65.43.21', '192.0.2.60')), - array('for="[::face]", for=192.0.2.60', '::face,192.0.2.60', array('192.0.2.60', '::face')), - array('for="192.0.2.60:80"', '192.0.2.60', array('192.0.2.60')), - array('for=192.0.2.60;proto=http;by=203.0.113.43', '192.0.2.60', array('192.0.2.60')), - array('for="[2001:db8:cafe::17]:4711"', '2001:db8:cafe::17', array('2001:db8:cafe::17')), - ); + return [ + ['for="192.0.2.60"', '192.0.2.60', ['192.0.2.60']], + ['for=192.0.2.60, for=87.65.43.21', '192.0.2.60,87.65.43.21', ['87.65.43.21', '192.0.2.60']], + ['for="[::face]", for=192.0.2.60', '::face,192.0.2.60', ['192.0.2.60', '::face']], + ['for="192.0.2.60:80"', '192.0.2.60', ['192.0.2.60']], + ['for=192.0.2.60;proto=http;by=203.0.113.43', '192.0.2.60', ['192.0.2.60']], + ['for="[2001:db8:cafe::17]:4711"', '2001:db8:cafe::17', ['2001:db8:cafe::17']], + ]; } public function testGetContentWorksTwiceInDefaultMode() @@ -1166,7 +1166,7 @@ class RequestTest extends TestCase public function testGetContentReturnsResourceWhenContentSetInConstructor() { - $req = new Request(array(), array(), array(), array(), array(), array(), 'MyContent'); + $req = new Request([], [], [], [], [], [], 'MyContent'); $resource = $req->getContent(true); $this->assertInternalType('resource', $resource); @@ -1179,17 +1179,17 @@ class RequestTest extends TestCase fwrite($resource, 'My other content'); rewind($resource); - $req = new Request(array(), array(), array(), array(), array(), array(), $resource); + $req = new Request([], [], [], [], [], [], $resource); $this->assertEquals('My other content', stream_get_contents($req->getContent(true))); $this->assertEquals('My other content', $req->getContent()); } public function getContentCantBeCalledTwiceWithResourcesProvider() { - return array( - 'Resource then fetch' => array(true, false), - 'Resource then resource' => array(true, true), - ); + return [ + 'Resource then fetch' => [true, false], + 'Resource then resource' => [true, true], + ]; } /** @@ -1214,24 +1214,24 @@ class RequestTest extends TestCase public function getContentCanBeCalledTwiceWithResourcesProvider() { - return array( - 'Fetch then fetch' => array(false, false), - 'Fetch then resource' => array(false, true), - 'Resource then fetch' => array(true, false), - 'Resource then resource' => array(true, true), - ); + return [ + 'Fetch then fetch' => [false, false], + 'Fetch then resource' => [false, true], + 'Resource then fetch' => [true, false], + 'Resource then resource' => [true, true], + ]; } public function provideOverloadedMethods() { - return array( - array('PUT'), - array('DELETE'), - array('PATCH'), - array('put'), - array('delete'), - array('patch'), - ); + return [ + ['PUT'], + ['DELETE'], + ['PATCH'], + ['put'], + ['delete'], + ['patch'], + ]; } /** @@ -1244,14 +1244,14 @@ class RequestTest extends TestCase $_GET['foo1'] = 'bar1'; $_POST['foo2'] = 'bar2'; $_COOKIE['foo3'] = 'bar3'; - $_FILES['foo4'] = array('bar4'); + $_FILES['foo4'] = ['bar4']; $_SERVER['foo5'] = 'bar5'; $request = Request::createFromGlobals(); $this->assertEquals('bar1', $request->query->get('foo1'), '::fromGlobals() uses values from $_GET'); $this->assertEquals('bar2', $request->request->get('foo2'), '::fromGlobals() uses values from $_POST'); $this->assertEquals('bar3', $request->cookies->get('foo3'), '::fromGlobals() uses values from $_COOKIE'); - $this->assertEquals(array('bar4'), $request->files->get('foo4'), '::fromGlobals() uses values from $_FILES'); + $this->assertEquals(['bar4'], $request->files->get('foo4'), '::fromGlobals() uses values from $_FILES'); $this->assertEquals('bar5', $request->server->get('foo5'), '::fromGlobals() uses values from $_SERVER'); unset($_GET['foo1'], $_POST['foo2'], $_COOKIE['foo3'], $_FILES['foo4'], $_SERVER['foo5']); @@ -1281,25 +1281,25 @@ class RequestTest extends TestCase public function testOverrideGlobals() { $request = new Request(); - $request->initialize(array('foo' => 'bar')); + $request->initialize(['foo' => 'bar']); // as the Request::overrideGlobals really work, it erase $_SERVER, so we must backup it $server = $_SERVER; $request->overrideGlobals(); - $this->assertEquals(array('foo' => 'bar'), $_GET); + $this->assertEquals(['foo' => 'bar'], $_GET); - $request->initialize(array(), array('foo' => 'bar')); + $request->initialize([], ['foo' => 'bar']); $request->overrideGlobals(); - $this->assertEquals(array('foo' => 'bar'), $_POST); + $this->assertEquals(['foo' => 'bar'], $_POST); $this->assertArrayNotHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER); $request->headers->set('X_FORWARDED_PROTO', 'https'); - Request::setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_ALL); $this->assertFalse($request->isSecure()); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertTrue($request->isSecure()); @@ -1316,12 +1316,12 @@ class RequestTest extends TestCase $this->assertArrayHasKey('CONTENT_TYPE', $_SERVER); $this->assertArrayHasKey('CONTENT_LENGTH', $_SERVER); - $request->initialize(array('foo' => 'bar', 'baz' => 'foo')); + $request->initialize(['foo' => 'bar', 'baz' => 'foo']); $request->query->remove('baz'); $request->overrideGlobals(); - $this->assertEquals(array('foo' => 'bar'), $_GET); + $this->assertEquals(['foo' => 'bar'], $_GET); $this->assertEquals('foo=bar', $_SERVER['QUERY_STRING']); $this->assertEquals('foo=bar', $request->server->get('QUERY_STRING')); @@ -1334,23 +1334,23 @@ class RequestTest extends TestCase $request = new Request(); $this->assertEquals('', $request->getScriptName()); - $server = array(); + $server = []; $server['SCRIPT_NAME'] = '/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('/index.php', $request->getScriptName()); - $server = array(); + $server = []; $server['ORIG_SCRIPT_NAME'] = '/frontend.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('/frontend.php', $request->getScriptName()); - $server = array(); + $server = []; $server['SCRIPT_NAME'] = '/index.php'; $server['ORIG_SCRIPT_NAME'] = '/frontend.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('/index.php', $request->getScriptName()); } @@ -1360,29 +1360,29 @@ class RequestTest extends TestCase $request = new Request(); $this->assertEquals('', $request->getBasePath()); - $server = array(); + $server = []; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('', $request->getBasePath()); - $server = array(); + $server = []; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $server['SCRIPT_NAME'] = '/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('', $request->getBasePath()); - $server = array(); + $server = []; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $server['PHP_SELF'] = '/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('', $request->getBasePath()); - $server = array(); + $server = []; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $server['ORIG_SCRIPT_NAME'] = '/index.php'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('', $request->getBasePath()); } @@ -1392,21 +1392,21 @@ class RequestTest extends TestCase $request = new Request(); $this->assertEquals('/', $request->getPathInfo()); - $server = array(); + $server = []; $server['REQUEST_URI'] = '/path/info'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('/path/info', $request->getPathInfo()); - $server = array(); + $server = []; $server['REQUEST_URI'] = '/path%20test/info'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('/path%20test/info', $request->getPathInfo()); - $server = array(); + $server = []; $server['REQUEST_URI'] = '?a=b'; - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); $this->assertEquals('/', $request->getPathInfo()); } @@ -1434,27 +1434,27 @@ class RequestTest extends TestCase { $request = new Request(); $this->assertNull($request->getPreferredLanguage()); - $this->assertNull($request->getPreferredLanguage(array())); - $this->assertEquals('fr', $request->getPreferredLanguage(array('fr'))); - $this->assertEquals('fr', $request->getPreferredLanguage(array('fr', 'en'))); - $this->assertEquals('en', $request->getPreferredLanguage(array('en', 'fr'))); - $this->assertEquals('fr-ch', $request->getPreferredLanguage(array('fr-ch', 'fr-fr'))); + $this->assertNull($request->getPreferredLanguage([])); + $this->assertEquals('fr', $request->getPreferredLanguage(['fr'])); + $this->assertEquals('fr', $request->getPreferredLanguage(['fr', 'en'])); + $this->assertEquals('en', $request->getPreferredLanguage(['en', 'fr'])); + $this->assertEquals('fr-ch', $request->getPreferredLanguage(['fr-ch', 'fr-fr'])); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); - $this->assertEquals('en', $request->getPreferredLanguage(array('en', 'en-us'))); + $this->assertEquals('en', $request->getPreferredLanguage(['en', 'en-us'])); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); - $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en'))); + $this->assertEquals('en', $request->getPreferredLanguage(['fr', 'en'])); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8'); - $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en'))); + $this->assertEquals('en', $request->getPreferredLanguage(['fr', 'en'])); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, fr-fr; q=0.6, fr; q=0.5'); - $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en'))); + $this->assertEquals('en', $request->getPreferredLanguage(['fr', 'en'])); } public function testIsXmlHttpRequest() @@ -1492,72 +1492,72 @@ class RequestTest extends TestCase public function testGetCharsets() { $request = new Request(); - $this->assertEquals(array(), $request->getCharsets()); + $this->assertEquals([], $request->getCharsets()); $request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6'); - $this->assertEquals(array(), $request->getCharsets()); // testing caching + $this->assertEquals([], $request->getCharsets()); // testing caching $request = new Request(); $request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6'); - $this->assertEquals(array('ISO-8859-1', 'US-ASCII', 'UTF-8', 'ISO-10646-UCS-2'), $request->getCharsets()); + $this->assertEquals(['ISO-8859-1', 'US-ASCII', 'UTF-8', 'ISO-10646-UCS-2'], $request->getCharsets()); $request = new Request(); $request->headers->set('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'); - $this->assertEquals(array('ISO-8859-1', 'utf-8', '*'), $request->getCharsets()); + $this->assertEquals(['ISO-8859-1', 'utf-8', '*'], $request->getCharsets()); } public function testGetEncodings() { $request = new Request(); - $this->assertEquals(array(), $request->getEncodings()); + $this->assertEquals([], $request->getEncodings()); $request->headers->set('Accept-Encoding', 'gzip,deflate,sdch'); - $this->assertEquals(array(), $request->getEncodings()); // testing caching + $this->assertEquals([], $request->getEncodings()); // testing caching $request = new Request(); $request->headers->set('Accept-Encoding', 'gzip,deflate,sdch'); - $this->assertEquals(array('gzip', 'deflate', 'sdch'), $request->getEncodings()); + $this->assertEquals(['gzip', 'deflate', 'sdch'], $request->getEncodings()); $request = new Request(); $request->headers->set('Accept-Encoding', 'gzip;q=0.4,deflate;q=0.9,compress;q=0.7'); - $this->assertEquals(array('deflate', 'compress', 'gzip'), $request->getEncodings()); + $this->assertEquals(['deflate', 'compress', 'gzip'], $request->getEncodings()); } public function testGetAcceptableContentTypes() { $request = new Request(); - $this->assertEquals(array(), $request->getAcceptableContentTypes()); + $this->assertEquals([], $request->getAcceptableContentTypes()); $request->headers->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*'); - $this->assertEquals(array(), $request->getAcceptableContentTypes()); // testing caching + $this->assertEquals([], $request->getAcceptableContentTypes()); // testing caching $request = new Request(); $request->headers->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*'); - $this->assertEquals(array('application/vnd.wap.wmlscriptc', 'text/vnd.wap.wml', 'application/vnd.wap.xhtml+xml', 'application/xhtml+xml', 'text/html', 'multipart/mixed', '*/*'), $request->getAcceptableContentTypes()); + $this->assertEquals(['application/vnd.wap.wmlscriptc', 'text/vnd.wap.wml', 'application/vnd.wap.xhtml+xml', 'application/xhtml+xml', 'text/html', 'multipart/mixed', '*/*'], $request->getAcceptableContentTypes()); } public function testGetLanguages() { $request = new Request(); - $this->assertEquals(array(), $request->getLanguages()); + $this->assertEquals([], $request->getLanguages()); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); - $this->assertEquals(array('zh', 'en_US', 'en'), $request->getLanguages()); - $this->assertEquals(array('zh', 'en_US', 'en'), $request->getLanguages()); + $this->assertEquals(['zh', 'en_US', 'en'], $request->getLanguages()); + $this->assertEquals(['zh', 'en_US', 'en'], $request->getLanguages()); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.6, en; q=0.8'); - $this->assertEquals(array('zh', 'en', 'en_US'), $request->getLanguages()); // Test out of order qvalues + $this->assertEquals(['zh', 'en', 'en_US'], $request->getLanguages()); // Test out of order qvalues $request = new Request(); $request->headers->set('Accept-language', 'zh, en, en-us'); - $this->assertEquals(array('zh', 'en', 'en_US'), $request->getLanguages()); // Test equal weighting without qvalues + $this->assertEquals(['zh', 'en', 'en_US'], $request->getLanguages()); // Test equal weighting without qvalues $request = new Request(); $request->headers->set('Accept-language', 'zh; q=0.6, en, en-us; q=0.6'); - $this->assertEquals(array('en', 'zh', 'en_US'), $request->getLanguages()); // Test equal weighting with qvalues + $this->assertEquals(['en', 'zh', 'en_US'], $request->getLanguages()); // Test equal weighting with qvalues $request = new Request(); $request->headers->set('Accept-language', 'zh, i-cherokee; q=0.6'); - $this->assertEquals(array('zh', 'cherokee'), $request->getLanguages()); + $this->assertEquals(['zh', 'cherokee'], $request->getLanguages()); } public function testGetRequestFormat() @@ -1577,7 +1577,7 @@ class RequestTest extends TestCase $this->assertNull($request->setRequestFormat('foo')); $this->assertEquals('foo', $request->getRequestFormat(null)); - $request = new Request(array('_format' => 'foo')); + $request = new Request(['_format' => 'foo']); $this->assertEquals('html', $request->getRequestFormat()); } @@ -1663,7 +1663,7 @@ class RequestTest extends TestCase */ public function testGetBaseUrl($uri, $server, $expectedBaseUrl, $expectedPathInfo) { - $request = Request::create($uri, 'GET', array(), array(), array(), $server); + $request = Request::create($uri, 'GET', [], [], [], $server); $this->assertSame($expectedBaseUrl, $request->getBaseUrl(), 'baseUrl'); $this->assertSame($expectedPathInfo, $request->getPathInfo(), 'pathInfo'); @@ -1671,78 +1671,78 @@ class RequestTest extends TestCase public function getBaseUrlData() { - return array( - array( + return [ + [ '/fruit/strawberry/1234index.php/blah', - array( + [ 'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/fruit/index.php', 'SCRIPT_NAME' => '/fruit/index.php', 'PHP_SELF' => '/fruit/index.php', - ), + ], '/fruit', '/strawberry/1234index.php/blah', - ), - array( + ], + [ '/fruit/strawberry/1234index.php/blah', - array( + [ 'SCRIPT_FILENAME' => 'E:/Sites/cc-new/public_html/index.php', 'SCRIPT_NAME' => '/index.php', 'PHP_SELF' => '/index.php', - ), + ], '', '/fruit/strawberry/1234index.php/blah', - ), - array( + ], + [ '/foo%20bar/', - array( + [ 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', 'SCRIPT_NAME' => '/foo bar/app.php', 'PHP_SELF' => '/foo bar/app.php', - ), + ], '/foo%20bar', '/', - ), - array( + ], + [ '/foo%20bar/home', - array( + [ 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', 'SCRIPT_NAME' => '/foo bar/app.php', 'PHP_SELF' => '/foo bar/app.php', - ), + ], '/foo%20bar', '/home', - ), - array( + ], + [ '/foo%20bar/app.php/home', - array( + [ 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', 'SCRIPT_NAME' => '/foo bar/app.php', 'PHP_SELF' => '/foo bar/app.php', - ), + ], '/foo%20bar/app.php', '/home', - ), - array( + ], + [ '/foo%20bar/app.php/home%3Dbaz', - array( + [ 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', 'SCRIPT_NAME' => '/foo bar/app.php', 'PHP_SELF' => '/foo bar/app.php', - ), + ], '/foo%20bar/app.php', '/home%3Dbaz', - ), - array( + ], + [ '/foo/bar+baz', - array( + [ 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app.php', 'SCRIPT_NAME' => '/foo/app.php', 'PHP_SELF' => '/foo/app.php', - ), + ], '/foo', '/bar+baz', - ), - ); + ], + ]; } /** @@ -1760,16 +1760,16 @@ class RequestTest extends TestCase public function urlencodedStringPrefixData() { - return array( - array('foo', 'foo', 'foo'), - array('fo%6f', 'foo', 'fo%6f'), - array('foo/bar', 'foo', 'foo'), - array('fo%6f/bar', 'foo', 'fo%6f'), - array('f%6f%6f/bar', 'foo', 'f%6f%6f'), - array('%66%6F%6F/bar', 'foo', '%66%6F%6F'), - array('fo+o/bar', 'fo+o', 'fo+o'), - array('fo%2Bo/bar', 'fo+o', 'fo%2Bo'), - ); + return [ + ['foo', 'foo', 'foo'], + ['fo%6f', 'foo', 'fo%6f'], + ['foo/bar', 'foo', 'foo'], + ['fo%6f/bar', 'foo', 'fo%6f'], + ['f%6f%6f/bar', 'foo', 'f%6f%6f'], + ['%66%6F%6F/bar', 'foo', '%66%6F%6F'], + ['fo+o/bar', 'fo+o', 'fo+o'], + ['fo%2Bo/bar', 'fo+o', 'fo%2Bo'], + ]; } private function disableHttpMethodParameterOverride() @@ -1784,7 +1784,7 @@ class RequestTest extends TestCase { $request = new Request(); - $server = array('REMOTE_ADDR' => $remoteAddr); + $server = ['REMOTE_ADDR' => $remoteAddr]; if (null !== $httpForwardedFor) { $server['HTTP_X_FORWARDED_FOR'] = $httpForwardedFor; } @@ -1793,7 +1793,7 @@ class RequestTest extends TestCase Request::setTrustedProxies($trustedProxies, Request::HEADER_X_FORWARDED_ALL); } - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); return $request; } @@ -1802,7 +1802,7 @@ class RequestTest extends TestCase { $request = new Request(); - $server = array('REMOTE_ADDR' => $remoteAddr); + $server = ['REMOTE_ADDR' => $remoteAddr]; if (null !== $httpForwarded) { $server['HTTP_FORWARDED'] = $httpForwarded; @@ -1812,7 +1812,7 @@ class RequestTest extends TestCase Request::setTrustedProxies($trustedProxies, Request::HEADER_FORWARDED); } - $request->initialize(array(), array(), array(), array(), array(), $server); + $request->initialize([], [], [], [], [], $server); return $request; } @@ -1833,35 +1833,35 @@ class RequestTest extends TestCase $this->assertFalse($request->isSecure()); // disabling proxy trusting - Request::setTrustedProxies(array(), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies([], Request::HEADER_X_FORWARDED_ALL); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // request is forwarded by a non-trusted proxy - Request::setTrustedProxies(array('2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['2.2.2.2'], Request::HEADER_X_FORWARDED_ALL); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // trusted proxy via setTrustedProxies() - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_X_FORWARDED_ALL); $this->assertEquals('1.1.1.1', $request->getClientIp()); $this->assertEquals('foo.example.com', $request->getHost()); $this->assertEquals(443, $request->getPort()); $this->assertTrue($request->isSecure()); // trusted proxy via setTrustedProxies() - Request::setTrustedProxies(array('3.3.3.4', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['3.3.3.4', '2.2.2.2'], Request::HEADER_X_FORWARDED_ALL); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // check various X_FORWARDED_PROTO header values - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_X_FORWARDED_ALL); $request->headers->set('X_FORWARDED_PROTO', 'ssl'); $this->assertTrue($request->isSecure()); @@ -1882,35 +1882,35 @@ class RequestTest extends TestCase $this->assertFalse($request->isSecure()); // disabling proxy trusting - Request::setTrustedProxies(array(), Request::HEADER_FORWARDED); + Request::setTrustedProxies([], Request::HEADER_FORWARDED); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // request is forwarded by a non-trusted proxy - Request::setTrustedProxies(array('2.2.2.2'), Request::HEADER_FORWARDED); + Request::setTrustedProxies(['2.2.2.2'], Request::HEADER_FORWARDED); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // trusted proxy via setTrustedProxies() - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_FORWARDED); + Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_FORWARDED); $this->assertEquals('1.1.1.1', $request->getClientIp()); $this->assertEquals('foo.example.com', $request->getHost()); $this->assertEquals(8080, $request->getPort()); $this->assertTrue($request->isSecure()); // trusted proxy via setTrustedProxies() - Request::setTrustedProxies(array('3.3.3.4', '2.2.2.2'), Request::HEADER_FORWARDED); + Request::setTrustedProxies(['3.3.3.4', '2.2.2.2'], Request::HEADER_FORWARDED); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // check various X_FORWARDED_PROTO header values - Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2'), Request::HEADER_FORWARDED); + Request::setTrustedProxies(['3.3.3.3', '2.2.2.2'], Request::HEADER_FORWARDED); $request->headers->set('FORWARDED', 'proto=ssl'); $this->assertTrue($request->isSecure()); @@ -1930,37 +1930,37 @@ class RequestTest extends TestCase $this->assertEquals($expectedRequestUri, $request->getRequestUri(), '->getRequestUri() is correct'); $subRequestUri = '/bar/foo'; - $subRequest = Request::create($subRequestUri, 'get', array(), array(), array(), $request->server->all()); + $subRequest = Request::create($subRequestUri, 'get', [], [], [], $request->server->all()); $this->assertEquals($subRequestUri, $subRequest->getRequestUri(), '->getRequestUri() is correct in sub request'); } public function iisRequestUriProvider() { - return array( - array( - array(), - array( + return [ + [ + [], + [ 'IIS_WasUrlRewritten' => '1', 'UNENCODED_URL' => '/foo/bar', - ), + ], '/foo/bar', - ), - array( - array(), - array( + ], + [ + [], + [ 'ORIG_PATH_INFO' => '/foo/bar', - ), + ], '/foo/bar', - ), - array( - array(), - array( + ], + [ + [], + [ 'ORIG_PATH_INFO' => '/foo/bar', 'QUERY_STRING' => 'foo=bar', - ), + ], '/foo/bar?foo=bar', - ), - ); + ], + ]; } public function testTrustedHosts() @@ -1973,7 +1973,7 @@ class RequestTest extends TestCase $this->assertEquals('evil.com', $request->getHost()); // add a trusted domain and all its subdomains - Request::setTrustedHosts(array('^([a-z]{9}\.)?trusted\.com$')); + Request::setTrustedHosts(['^([a-z]{9}\.)?trusted\.com$']); // untrusted host $request->headers->set('host', 'evil.com'); @@ -2005,7 +2005,7 @@ class RequestTest extends TestCase public function testSetTrustedHostsDoesNotBreakOnSpecialCharacters() { - Request::setTrustedHosts(array('localhost(\.local){0,1}#,example.com', 'localhost')); + Request::setTrustedHosts(['localhost(\.local){0,1}#,example.com', 'localhost']); $request = Request::create('/'); $request->headers->set('host', 'localhost'); @@ -2014,7 +2014,7 @@ class RequestTest extends TestCase public function testFactory() { - Request::setFactory(function (array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) { + Request::setFactory(function (array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null) { return new NewRequest(); }); @@ -2063,23 +2063,23 @@ class RequestTest extends TestCase public function getHostValidities() { - return array( - array('.a', false), - array('a..', false), - array('a.', true), - array("\xE9", false), - array('[::1]', true), - array('[::1]:80', true, '[::1]', 80), - array(str_repeat('.', 101), false), - ); + return [ + ['.a', false], + ['a..', false], + ['a.', true], + ["\xE9", false], + ['[::1]', true], + ['[::1]:80', true, '[::1]', 80], + [str_repeat('.', 101), false], + ]; } public function getLongHostNames() { - return array( - array('a'.str_repeat('.a', 40000)), - array(str_repeat(':', 101)), - ); + return [ + ['a'.str_repeat('.a', 40000)], + [str_repeat(':', 101)], + ]; } /** @@ -2094,18 +2094,18 @@ class RequestTest extends TestCase public function methodIdempotentProvider() { - return array( - array('HEAD', true), - array('GET', true), - array('POST', false), - array('PUT', true), - array('PATCH', false), - array('DELETE', true), - array('PURGE', true), - array('OPTIONS', true), - array('TRACE', true), - array('CONNECT', false), - ); + return [ + ['HEAD', true], + ['GET', true], + ['POST', false], + ['PUT', true], + ['PATCH', false], + ['DELETE', true], + ['PURGE', true], + ['OPTIONS', true], + ['TRACE', true], + ['CONNECT', false], + ]; } /** @@ -2120,18 +2120,18 @@ class RequestTest extends TestCase public function methodSafeProvider() { - return array( - array('HEAD', true), - array('GET', true), - array('POST', false), - array('PUT', false), - array('PATCH', false), - array('DELETE', false), - array('PURGE', false), - array('OPTIONS', true), - array('TRACE', true), - array('CONNECT', false), - ); + return [ + ['HEAD', true], + ['GET', true], + ['POST', false], + ['PUT', false], + ['PATCH', false], + ['DELETE', false], + ['PURGE', false], + ['OPTIONS', true], + ['TRACE', true], + ['CONNECT', false], + ]; } /** @@ -2156,18 +2156,18 @@ class RequestTest extends TestCase public function methodCacheableProvider() { - return array( - array('HEAD', true), - array('GET', true), - array('POST', false), - array('PUT', false), - array('PATCH', false), - array('DELETE', false), - array('PURGE', false), - array('OPTIONS', false), - array('TRACE', false), - array('CONNECT', false), - ); + return [ + ['HEAD', true], + ['GET', true], + ['POST', false], + ['PUT', false], + ['PATCH', false], + ['DELETE', false], + ['PURGE', false], + ['OPTIONS', false], + ['TRACE', false], + ['CONNECT', false], + ]; } /** @@ -2176,7 +2176,7 @@ class RequestTest extends TestCase public function testProtocolVersion($serverProtocol, $trustedProxy, $via, $expected) { if ($trustedProxy) { - Request::setTrustedProxies(array('1.1.1.1'), -1); + Request::setTrustedProxies(['1.1.1.1'], -1); } $request = new Request(); @@ -2189,41 +2189,41 @@ class RequestTest extends TestCase public function protocolVersionProvider() { - return array( - 'untrusted without via' => array('HTTP/2.0', false, '', 'HTTP/2.0'), - 'untrusted with via' => array('HTTP/2.0', false, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/2.0'), - 'trusted without via' => array('HTTP/2.0', true, '', 'HTTP/2.0'), - 'trusted with via' => array('HTTP/2.0', true, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'), - 'trusted with via and protocol name' => array('HTTP/2.0', true, 'HTTP/1.0 fred, HTTP/1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'), - 'trusted with broken via' => array('HTTP/2.0', true, 'HTTP/1^0 foo', 'HTTP/2.0'), - 'trusted with partially-broken via' => array('HTTP/2.0', true, '1.0 fred, foo', 'HTTP/1.0'), - ); + return [ + 'untrusted without via' => ['HTTP/2.0', false, '', 'HTTP/2.0'], + 'untrusted with via' => ['HTTP/2.0', false, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/2.0'], + 'trusted without via' => ['HTTP/2.0', true, '', 'HTTP/2.0'], + 'trusted with via' => ['HTTP/2.0', true, '1.0 fred, 1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'], + 'trusted with via and protocol name' => ['HTTP/2.0', true, 'HTTP/1.0 fred, HTTP/1.1 nowhere.com (Apache/1.1)', 'HTTP/1.0'], + 'trusted with broken via' => ['HTTP/2.0', true, 'HTTP/1^0 foo', 'HTTP/2.0'], + 'trusted with partially-broken via' => ['HTTP/2.0', true, '1.0 fred, foo', 'HTTP/1.0'], + ]; } public function nonstandardRequestsData() { - return array( - array('', '', '/', 'http://host:8080/', ''), - array('/', '', '/', 'http://host:8080/', ''), + return [ + ['', '', '/', 'http://host:8080/', ''], + ['/', '', '/', 'http://host:8080/', ''], - array('hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'), - array('/hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'), + ['hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'], + ['/hello/app.php/x', '', '/x', 'http://host:8080/hello/app.php/x', '/hello', '/hello/app.php'], - array('', 'a=b', '/', 'http://host:8080/?a=b'), - array('?a=b', 'a=b', '/', 'http://host:8080/?a=b'), - array('/?a=b', 'a=b', '/', 'http://host:8080/?a=b'), + ['', 'a=b', '/', 'http://host:8080/?a=b'], + ['?a=b', 'a=b', '/', 'http://host:8080/?a=b'], + ['/?a=b', 'a=b', '/', 'http://host:8080/?a=b'], - array('x', 'a=b', '/x', 'http://host:8080/x?a=b'), - array('x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'), - array('/x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'), + ['x', 'a=b', '/x', 'http://host:8080/x?a=b'], + ['x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'], + ['/x?a=b', 'a=b', '/x', 'http://host:8080/x?a=b'], - array('hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'), - array('/hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'), + ['hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'], + ['/hello/x', '', '/x', 'http://host:8080/hello/x', '/hello'], - array('hello/app.php/x', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'), - array('hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'), - array('/hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'), - ); + ['hello/app.php/x', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'], + ['hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'], + ['/hello/app.php/x?a=b', 'a=b', '/x', 'http://host:8080/hello/app.php/x?a=b', '/hello', '/hello/app.php'], + ]; } /** @@ -2235,16 +2235,16 @@ class RequestTest extends TestCase $expectedBaseUrl = $expectedBasePath; } - $server = array( + $server = [ 'HTTP_HOST' => 'host:8080', 'SERVER_PORT' => '8080', 'QUERY_STRING' => $queryString, 'PHP_SELF' => '/hello/app.php', 'SCRIPT_FILENAME' => '/some/path/app.php', 'REQUEST_URI' => $requestUri, - ); + ]; - $request = new Request(array(), array(), array(), array(), array(), $server); + $request = new Request([], [], [], [], [], $server); $this->assertEquals($expectedPathInfo, $request->getPathInfo()); $this->assertEquals($expectedUri, $request->getUri()); @@ -2257,7 +2257,7 @@ class RequestTest extends TestCase public function testTrustedHost() { - Request::setTrustedProxies(array('1.1.1.1'), -1); + Request::setTrustedProxies(['1.1.1.1'], -1); $request = Request::create('/'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); @@ -2279,7 +2279,7 @@ class RequestTest extends TestCase public function testTrustedPort() { - Request::setTrustedProxies(array('1.1.1.1'), -1); + Request::setTrustedProxies(['1.1.1.1'], -1); $request = Request::create('/'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); @@ -2309,7 +2309,7 @@ class RequestContentProxy extends Request { public function getContent($asResource = false) { - return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent'), '', '&'); + return http_build_query(['_method' => 'PUT', 'content' => 'mycontent'], '', '&'); } } diff --git a/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php b/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php index 22f25e978e..3d3e696c75 100644 --- a/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php +++ b/vendor/symfony/http-foundation/Tests/ResponseFunctionalTest.php @@ -22,10 +22,10 @@ class ResponseFunctionalTest extends TestCase public static function setUpBeforeClass() { - $spec = array( - 1 => array('file', '/dev/null', 'w'), - 2 => array('file', '/dev/null', 'w'), - ); + $spec = [ + 1 => ['file', '/dev/null', 'w'], + 2 => ['file', '/dev/null', 'w'], + ]; if (!self::$server = @proc_open('exec php -S localhost:8054', $spec, $pipes, __DIR__.'/Fixtures/response-functional')) { self::markTestSkipped('PHP server unable to start.'); } @@ -52,7 +52,7 @@ class ResponseFunctionalTest extends TestCase public function provideCookie() { foreach (glob(__DIR__.'/Fixtures/response-functional/*.php') as $file) { - yield array(pathinfo($file, PATHINFO_FILENAME)); + yield [pathinfo($file, PATHINFO_FILENAME)]; } } } diff --git a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php index f6ddb98ea7..35df36c1c6 100644 --- a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php +++ b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php @@ -22,7 +22,7 @@ class ResponseHeaderBagTest extends TestCase { public function testAllPreserveCase() { - $headers = array( + $headers = [ 'fOo' => 'BAR', 'ETag' => 'xyzzy', 'Content-MD5' => 'Q2hlY2sgSW50ZWdyaXR5IQ==', @@ -30,7 +30,7 @@ class ResponseHeaderBagTest extends TestCase 'WWW-Authenticate' => 'Basic realm="WallyWorld"', 'X-UA-Compatible' => 'IE=edge,chrome=1', 'X-XSS-Protection' => '1; mode=block', - ); + ]; $bag = new ResponseHeaderBag($headers); $allPreservedCase = $bag->allPreserveCase(); @@ -42,45 +42,45 @@ class ResponseHeaderBagTest extends TestCase public function testCacheControlHeader() { - $bag = new ResponseHeaderBag(array()); + $bag = new ResponseHeaderBag([]); $this->assertEquals('no-cache, private', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('no-cache')); - $bag = new ResponseHeaderBag(array('Cache-Control' => 'public')); + $bag = new ResponseHeaderBag(['Cache-Control' => 'public']); $this->assertEquals('public', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('public')); - $bag = new ResponseHeaderBag(array('ETag' => 'abcde')); + $bag = new ResponseHeaderBag(['ETag' => 'abcde']); $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('private')); $this->assertTrue($bag->hasCacheControlDirective('must-revalidate')); $this->assertFalse($bag->hasCacheControlDirective('max-age')); - $bag = new ResponseHeaderBag(array('Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT')); + $bag = new ResponseHeaderBag(['Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT']); $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array( + $bag = new ResponseHeaderBag([ 'Expires' => 'Wed, 16 Feb 2011 14:17:43 GMT', 'Cache-Control' => 'max-age=3600', - )); + ]); $this->assertEquals('max-age=3600, private', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array('Last-Modified' => 'abcde')); + $bag = new ResponseHeaderBag(['Last-Modified' => 'abcde']); $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array('Etag' => 'abcde', 'Last-Modified' => 'abcde')); + $bag = new ResponseHeaderBag(['Etag' => 'abcde', 'Last-Modified' => 'abcde']); $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array('cache-control' => 'max-age=100')); + $bag = new ResponseHeaderBag(['cache-control' => 'max-age=100']); $this->assertEquals('max-age=100, private', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array('cache-control' => 's-maxage=100')); + $bag = new ResponseHeaderBag(['cache-control' => 's-maxage=100']); $this->assertEquals('s-maxage=100', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array('cache-control' => 'private, max-age=100')); + $bag = new ResponseHeaderBag(['cache-control' => 'private, max-age=100']); $this->assertEquals('max-age=100, private', $bag->get('Cache-Control')); - $bag = new ResponseHeaderBag(array('cache-control' => 'public, max-age=100')); + $bag = new ResponseHeaderBag(['cache-control' => 'public, max-age=100']); $this->assertEquals('max-age=100, public', $bag->get('Cache-Control')); $bag = new ResponseHeaderBag(); @@ -88,7 +88,7 @@ class ResponseHeaderBagTest extends TestCase $this->assertEquals('private, must-revalidate', $bag->get('Cache-Control')); $bag = new ResponseHeaderBag(); - $bag->set('Cache-Control', array('public', 'must-revalidate')); + $bag->set('Cache-Control', ['public', 'must-revalidate']); $this->assertCount(1, $bag->get('Cache-Control', null, false)); $this->assertEquals('must-revalidate, public', $bag->get('Cache-Control')); @@ -101,7 +101,7 @@ class ResponseHeaderBagTest extends TestCase public function testCacheControlClone() { - $headers = array('foo' => 'bar'); + $headers = ['foo' => 'bar']; $bag1 = new ResponseHeaderBag($headers); $bag2 = new ResponseHeaderBag($bag1->allPreserveCase()); $this->assertEquals($bag1->allPreserveCase(), $bag2->allPreserveCase()); @@ -109,7 +109,7 @@ class ResponseHeaderBagTest extends TestCase public function testToStringIncludesCookieHeaders() { - $bag = new ResponseHeaderBag(array()); + $bag = new ResponseHeaderBag([]); $bag->setCookie(Cookie::create('foo', 'bar')); $this->assertSetCookieHeader('foo=bar; path=/; httponly; samesite=lax', $bag); @@ -121,7 +121,7 @@ class ResponseHeaderBagTest extends TestCase public function testClearCookieSecureNotHttpOnly() { - $bag = new ResponseHeaderBag(array()); + $bag = new ResponseHeaderBag([]); $bag->clearCookie('foo', '/', null, true, false); @@ -130,23 +130,23 @@ class ResponseHeaderBagTest extends TestCase public function testReplace() { - $bag = new ResponseHeaderBag(array()); + $bag = new ResponseHeaderBag([]); $this->assertEquals('no-cache, private', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('no-cache')); - $bag->replace(array('Cache-Control' => 'public')); + $bag->replace(['Cache-Control' => 'public']); $this->assertEquals('public', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('public')); } public function testReplaceWithRemove() { - $bag = new ResponseHeaderBag(array()); + $bag = new ResponseHeaderBag([]); $this->assertEquals('no-cache, private', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('no-cache')); $bag->remove('Cache-Control'); - $bag->replace(array()); + $bag->replace([]); $this->assertEquals('no-cache, private', $bag->get('Cache-Control')); $this->assertTrue($bag->hasCacheControlDirective('no-cache')); } @@ -161,12 +161,12 @@ class ResponseHeaderBagTest extends TestCase $this->assertCount(4, $bag->getCookies()); $this->assertEquals('foo=bar; path=/path/foo; domain=foo.bar; httponly; samesite=lax', $bag->get('set-cookie')); - $this->assertEquals(array( + $this->assertEquals([ 'foo=bar; path=/path/foo; domain=foo.bar; httponly; samesite=lax', 'foo=bar; path=/path/bar; domain=foo.bar; httponly; samesite=lax', 'foo=bar; path=/path/bar; domain=bar.foo; httponly; samesite=lax', 'foo=bar; path=/; httponly; samesite=lax', - ), $bag->get('set-cookie', null, false)); + ], $bag->get('set-cookie', null, false)); $this->assertSetCookieHeader('foo=bar; path=/path/foo; domain=foo.bar; httponly; samesite=lax', $bag); $this->assertSetCookieHeader('foo=bar; path=/path/bar; domain=foo.bar; httponly; samesite=lax', $bag); @@ -228,16 +228,16 @@ class ResponseHeaderBagTest extends TestCase { $bag = new ResponseHeaderBag(); $bag->set('set-cookie', 'foo=bar'); - $this->assertEquals(array(Cookie::create('foo', 'bar', 0, '/', null, false, false, true, null)), $bag->getCookies()); + $this->assertEquals([Cookie::create('foo', 'bar', 0, '/', null, false, false, true, null)], $bag->getCookies()); $bag->set('set-cookie', 'foo2=bar2', false); - $this->assertEquals(array( + $this->assertEquals([ Cookie::create('foo', 'bar', 0, '/', null, false, false, true, null), Cookie::create('foo2', 'bar2', 0, '/', null, false, false, true, null), - ), $bag->getCookies()); + ], $bag->getCookies()); $bag->remove('set-cookie'); - $this->assertEquals(array(), $bag->getCookies()); + $this->assertEquals([], $bag->getCookies()); } /** @@ -260,8 +260,8 @@ class ResponseHeaderBagTest extends TestCase (string) $headers; $allHeaders = $headers->allPreserveCase(); - $this->assertEquals(array('http://www.symfony.com'), $allHeaders['Location']); - $this->assertEquals(array('text/html'), $allHeaders['Content-type']); + $this->assertEquals(['http://www.symfony.com'], $allHeaders['Location']); + $this->assertEquals(['text/html'], $allHeaders['Content-type']); } public function testDateHeaderAddedOnCreation() @@ -277,7 +277,7 @@ class ResponseHeaderBagTest extends TestCase public function testDateHeaderCanBeSetOnCreation() { $someDate = 'Thu, 23 Mar 2017 09:15:12 GMT'; - $bag = new ResponseHeaderBag(array('Date' => $someDate)); + $bag = new ResponseHeaderBag(['Date' => $someDate]); $this->assertEquals($someDate, $bag->get('Date')); } @@ -285,7 +285,7 @@ class ResponseHeaderBagTest extends TestCase public function testDateHeaderWillBeRecreatedWhenRemoved() { $someDate = 'Thu, 23 Mar 2017 09:15:12 GMT'; - $bag = new ResponseHeaderBag(array('Date' => $someDate)); + $bag = new ResponseHeaderBag(['Date' => $someDate]); $bag->remove('Date'); // a (new) Date header is still present @@ -296,7 +296,7 @@ class ResponseHeaderBagTest extends TestCase public function testDateHeaderWillBeRecreatedWhenHeadersAreReplaced() { $bag = new ResponseHeaderBag(); - $bag->replace(array()); + $bag->replace([]); $this->assertTrue($bag->has('Date')); } diff --git a/vendor/symfony/http-foundation/Tests/ResponseTest.php b/vendor/symfony/http-foundation/Tests/ResponseTest.php index 03dcc11abd..adfae08b9e 100644 --- a/vendor/symfony/http-foundation/Tests/ResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/ResponseTest.php @@ -22,7 +22,7 @@ class ResponseTest extends ResponseTestCase { public function testCreate() { - $response = Response::create('foo', 301, array('Foo' => 'bar')); + $response = Response::create('foo', 301, ['Foo' => 'bar']); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response); $this->assertEquals(301, $response->getStatusCode()); @@ -254,10 +254,10 @@ class ResponseTest extends ResponseTestCase public function testIsValidateable() { - $response = new Response('', 200, array('Last-Modified' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822))); + $response = new Response('', 200, ['Last-Modified' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)]); $this->assertTrue($response->isValidateable(), '->isValidateable() returns true if Last-Modified is present'); - $response = new Response('', 200, array('ETag' => '"12345"')); + $response = new Response('', 200, ['ETag' => '"12345"']); $this->assertTrue($response->isValidateable(), '->isValidateable() returns true if ETag is present'); $response = new Response(); @@ -267,7 +267,7 @@ class ResponseTest extends ResponseTestCase public function testGetDate() { $oneHourAgo = $this->createDateTimeOneHourAgo(); - $response = new Response('', 200, array('Date' => $oneHourAgo->format(DATE_RFC2822))); + $response = new Response('', 200, ['Date' => $oneHourAgo->format(DATE_RFC2822)]); $date = $response->getDate(); $this->assertEquals($oneHourAgo->getTimestamp(), $date->getTimestamp(), '->getDate() returns the Date header if present'); @@ -275,7 +275,7 @@ class ResponseTest extends ResponseTestCase $date = $response->getDate(); $this->assertEquals(time(), $date->getTimestamp(), '->getDate() returns the current Date if no Date header present'); - $response = new Response('', 200, array('Date' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822))); + $response = new Response('', 200, ['Date' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)]); $now = $this->createDateTimeNow(); $response->headers->set('Date', $now->format(DATE_RFC2822)); $date = $response->getDate(); @@ -415,21 +415,21 @@ class ResponseTest extends ResponseTestCase public function testGetVary() { $response = new Response(); - $this->assertEquals(array(), $response->getVary(), '->getVary() returns an empty array if no Vary header is present'); + $this->assertEquals([], $response->getVary(), '->getVary() returns an empty array if no Vary header is present'); $response = new Response(); $response->headers->set('Vary', 'Accept-Language'); - $this->assertEquals(array('Accept-Language'), $response->getVary(), '->getVary() parses a single header name value'); + $this->assertEquals(['Accept-Language'], $response->getVary(), '->getVary() parses a single header name value'); $response = new Response(); $response->headers->set('Vary', 'Accept-Language User-Agent X-Foo'); - $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->getVary() parses multiple header name values separated by spaces'); + $this->assertEquals(['Accept-Language', 'User-Agent', 'X-Foo'], $response->getVary(), '->getVary() parses multiple header name values separated by spaces'); $response = new Response(); $response->headers->set('Vary', 'Accept-Language,User-Agent, X-Foo'); - $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->getVary() parses multiple header name values separated by commas'); + $this->assertEquals(['Accept-Language', 'User-Agent', 'X-Foo'], $response->getVary(), '->getVary() parses multiple header name values separated by commas'); - $vary = array('Accept-Language', 'User-Agent', 'X-foo'); + $vary = ['Accept-Language', 'User-Agent', 'X-foo']; $response = new Response(); $response->headers->set('Vary', $vary); @@ -444,18 +444,18 @@ class ResponseTest extends ResponseTestCase { $response = new Response(); $response->setVary('Accept-Language'); - $this->assertEquals(array('Accept-Language'), $response->getVary()); + $this->assertEquals(['Accept-Language'], $response->getVary()); $response->setVary('Accept-Language, User-Agent'); - $this->assertEquals(array('Accept-Language', 'User-Agent'), $response->getVary(), '->setVary() replace the vary header by default'); + $this->assertEquals(['Accept-Language', 'User-Agent'], $response->getVary(), '->setVary() replace the vary header by default'); $response->setVary('X-Foo', false); - $this->assertEquals(array('Accept-Language', 'User-Agent', 'X-Foo'), $response->getVary(), '->setVary() doesn\'t wipe out earlier Vary headers if replace is set to false'); + $this->assertEquals(['Accept-Language', 'User-Agent', 'X-Foo'], $response->getVary(), '->setVary() doesn\'t wipe out earlier Vary headers if replace is set to false'); } public function testDefaultContentType() { - $headerMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\ResponseHeaderBag')->setMethods(array('set'))->getMock(); + $headerMock = $this->getMockBuilder('Symfony\Component\HttpFoundation\ResponseHeaderBag')->setMethods(['set'])->getMock(); $headerMock->expects($this->at(0)) ->method('set') ->with('Content-Type', 'text/html'); @@ -595,55 +595,55 @@ class ResponseTest extends ResponseTestCase public function testSetCache() { $response = new Response(); - //array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public') + // ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public'] try { - $response->setCache(array('wrong option' => 'value')); + $response->setCache(['wrong option' => 'value']); $this->fail('->setCache() throws an InvalidArgumentException if an option is not supported'); } catch (\Exception $e) { $this->assertInstanceOf('InvalidArgumentException', $e, '->setCache() throws an InvalidArgumentException if an option is not supported'); $this->assertContains('"wrong option"', $e->getMessage()); } - $options = array('etag' => '"whatever"'); + $options = ['etag' => '"whatever"']; $response->setCache($options); $this->assertEquals($response->getEtag(), '"whatever"'); $now = $this->createDateTimeNow(); - $options = array('last_modified' => $now); + $options = ['last_modified' => $now]; $response->setCache($options); $this->assertEquals($response->getLastModified()->getTimestamp(), $now->getTimestamp()); - $options = array('max_age' => 100); + $options = ['max_age' => 100]; $response->setCache($options); $this->assertEquals($response->getMaxAge(), 100); - $options = array('s_maxage' => 200); + $options = ['s_maxage' => 200]; $response->setCache($options); $this->assertEquals($response->getMaxAge(), 200); $this->assertTrue($response->headers->hasCacheControlDirective('public')); $this->assertFalse($response->headers->hasCacheControlDirective('private')); - $response->setCache(array('public' => true)); + $response->setCache(['public' => true]); $this->assertTrue($response->headers->hasCacheControlDirective('public')); $this->assertFalse($response->headers->hasCacheControlDirective('private')); - $response->setCache(array('public' => false)); + $response->setCache(['public' => false]); $this->assertFalse($response->headers->hasCacheControlDirective('public')); $this->assertTrue($response->headers->hasCacheControlDirective('private')); - $response->setCache(array('private' => true)); + $response->setCache(['private' => true]); $this->assertFalse($response->headers->hasCacheControlDirective('public')); $this->assertTrue($response->headers->hasCacheControlDirective('private')); - $response->setCache(array('private' => false)); + $response->setCache(['private' => false]); $this->assertTrue($response->headers->hasCacheControlDirective('public')); $this->assertFalse($response->headers->hasCacheControlDirective('private')); - $response->setCache(array('immutable' => true)); + $response->setCache(['immutable' => true]); $this->assertTrue($response->headers->hasCacheControlDirective('immutable')); - $response->setCache(array('immutable' => false)); + $response->setCache(['immutable' => false]); $this->assertFalse($response->headers->hasCacheControlDirective('immutable')); } @@ -780,14 +780,14 @@ class ResponseTest extends ResponseTestCase public function getStatusCodeFixtures() { - return array( - array('200', null, 'OK'), - array('200', false, ''), - array('200', 'foo', 'foo'), - array('199', null, 'unknown status'), - array('199', false, ''), - array('199', 'foo', 'foo'), - ); + return [ + ['200', null, 'OK'], + ['200', false, ''], + ['200', 'foo', 'foo'], + ['199', null, 'unknown status'], + ['199', false, ''], + ['199', 'foo', 'foo'], + ]; } public function testIsInformational() @@ -801,7 +801,7 @@ class ResponseTest extends ResponseTestCase public function testIsRedirectRedirection() { - foreach (array(301, 302, 303, 307) as $code) { + foreach ([301, 302, 303, 307] as $code) { $response = new Response('', $code); $this->assertTrue($response->isRedirection()); $this->assertTrue($response->isRedirect()); @@ -819,7 +819,7 @@ class ResponseTest extends ResponseTestCase $this->assertFalse($response->isRedirection()); $this->assertFalse($response->isRedirect()); - $response = new Response('', 301, array('Location' => '/good-uri')); + $response = new Response('', 301, ['Location' => '/good-uri']); $this->assertFalse($response->isRedirect('/bad-uri')); $this->assertTrue($response->isRedirect('/good-uri')); } @@ -835,7 +835,7 @@ class ResponseTest extends ResponseTestCase public function testIsEmpty() { - foreach (array(204, 304) as $code) { + foreach ([204, 304] as $code) { $response = new Response('', $code); $this->assertTrue($response->isEmpty()); } @@ -884,7 +884,7 @@ class ResponseTest extends ResponseTestCase public function testSetEtag() { - $response = new Response('', 200, array('ETag' => '"12345"')); + $response = new Response('', 200, ['ETag' => '"12345"']); $response->setEtag(); $this->assertNull($response->headers->get('Etag'), '->setEtag() removes Etags when call with null'); @@ -914,7 +914,7 @@ class ResponseTest extends ResponseTestCase { $response = new Response(); - $setters = array( + $setters = [ 'setProtocolVersion' => '1.0', 'setCharset' => 'UTF-8', 'setPublic' => null, @@ -925,7 +925,7 @@ class ResponseTest extends ResponseTestCase 'setSharedMaxAge' => 1, 'setTtl' => 1, 'setClientTtl' => 1, - ); + ]; foreach ($setters as $setter => $arg) { $this->assertEquals($response, $response->{$setter}($arg)); @@ -944,20 +944,20 @@ class ResponseTest extends ResponseTestCase public function validContentProvider() { - return array( - 'obj' => array(new StringableObject()), - 'string' => array('Foo'), - 'int' => array(2), - ); + return [ + 'obj' => [new StringableObject()], + 'string' => ['Foo'], + 'int' => [2], + ]; } public function invalidContentProvider() { - return array( - 'obj' => array(new \stdClass()), - 'array' => array(array()), - 'bool' => array(true, '1'), - ); + return [ + 'obj' => [new \stdClass()], + 'array' => [[]], + 'bool' => [true, '1'], + ]; } protected function createDateTimeOneHourAgo() @@ -1004,19 +1004,19 @@ class ResponseTest extends ResponseTestCase $ianaHttpStatusCodes = new \DOMDocument(); - libxml_set_streams_context(stream_context_create(array( - 'http' => array( + libxml_set_streams_context(stream_context_create([ + 'http' => [ 'method' => 'GET', 'timeout' => 30, - ), - ))); + ], + ])); $ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml'); if (!$ianaHttpStatusCodes->relaxNGValidate(__DIR__.'/schema/http-status-codes.rng')) { self::fail('Invalid IANA\'s HTTP status code list.'); } - $ianaCodesReasonPhrases = array(); + $ianaCodesReasonPhrases = []; $xpath = new \DOMXPath($ianaHttpStatusCodes); $xpath->registerNamespace('ns', 'http://www.iana.org/assignments'); @@ -1026,16 +1026,16 @@ class ResponseTest extends ResponseTestCase $value = $xpath->query('.//ns:value', $record)->item(0)->nodeValue; $description = $xpath->query('.//ns:description', $record)->item(0)->nodeValue; - if (\in_array($description, array('Unassigned', '(Unused)'), true)) { + if (\in_array($description, ['Unassigned', '(Unused)'], true)) { continue; } if (preg_match('/^([0-9]+)\s*\-\s*([0-9]+)$/', $value, $matches)) { for ($value = $matches[1]; $value <= $matches[2]; ++$value) { - $ianaCodesReasonPhrases[] = array($value, $description); + $ianaCodesReasonPhrases[] = [$value, $description]; } } else { - $ianaCodesReasonPhrases[] = array($value, $description); + $ianaCodesReasonPhrases[] = [$value, $description]; } } diff --git a/vendor/symfony/http-foundation/Tests/ServerBagTest.php b/vendor/symfony/http-foundation/Tests/ServerBagTest.php index f8becec5a9..0663b118e6 100644 --- a/vendor/symfony/http-foundation/Tests/ServerBagTest.php +++ b/vendor/symfony/http-foundation/Tests/ServerBagTest.php @@ -23,7 +23,7 @@ class ServerBagTest extends TestCase { public function testShouldExtractHeadersFromServerArray() { - $server = array( + $server = [ 'SOME_SERVER_VARIABLE' => 'value', 'SOME_SERVER_VARIABLE2' => 'value', 'ROOT' => 'value', @@ -32,45 +32,45 @@ class ServerBagTest extends TestCase 'HTTP_ETAG' => 'asdf', 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => 'bar', - ); + ]; $bag = new ServerBag($server); - $this->assertEquals(array( + $this->assertEquals([ 'CONTENT_TYPE' => 'text/html', 'CONTENT_LENGTH' => '0', 'ETAG' => 'asdf', 'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'), 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => 'bar', - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testHttpPasswordIsOptional() { - $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo')); + $bag = new ServerBag(['PHP_AUTH_USER' => 'foo']); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => 'Basic '.base64_encode('foo:'), 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => '', - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testHttpBasicAuthWithPhpCgi() { - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'))); + $bag = new ServerBag(['HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:bar')]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'), 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => 'bar', - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testHttpBasicAuthWithPhpCgiBogus() { - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic_'.base64_encode('foo:bar'))); + $bag = new ServerBag(['HTTP_AUTHORIZATION' => 'Basic_'.base64_encode('foo:bar')]); // Username and passwords should not be set as the header is bogus $headers = $bag->getHeaders(); @@ -80,41 +80,41 @@ class ServerBagTest extends TestCase public function testHttpBasicAuthWithPhpCgiRedirect() { - $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word'))); + $bag = new ServerBag(['REDIRECT_HTTP_AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word')]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => 'Basic '.base64_encode('username:pass:word'), 'PHP_AUTH_USER' => 'username', 'PHP_AUTH_PW' => 'pass:word', - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testHttpBasicAuthWithPhpCgiEmptyPassword() { - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:'))); + $bag = new ServerBag(['HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:')]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => 'Basic '.base64_encode('foo:'), 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => '', - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testHttpDigestAuthWithPhpCgi() { $digest = 'Digest username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"'; - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $digest)); + $bag = new ServerBag(['HTTP_AUTHORIZATION' => $digest]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => $digest, 'PHP_AUTH_DIGEST' => $digest, - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testHttpDigestAuthWithPhpCgiBogus() { $digest = 'Digest_username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"'; - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $digest)); + $bag = new ServerBag(['HTTP_AUTHORIZATION' => $digest]); // Username and passwords should not be set as the header is bogus $headers = $bag->getHeaders(); @@ -125,32 +125,32 @@ class ServerBagTest extends TestCase public function testHttpDigestAuthWithPhpCgiRedirect() { $digest = 'Digest username="foo", realm="acme", nonce="'.md5('secret').'", uri="/protected, qop="auth"'; - $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => $digest)); + $bag = new ServerBag(['REDIRECT_HTTP_AUTHORIZATION' => $digest]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => $digest, 'PHP_AUTH_DIGEST' => $digest, - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testOAuthBearerAuth() { $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo'; - $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $headerContent)); + $bag = new ServerBag(['HTTP_AUTHORIZATION' => $headerContent]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => $headerContent, - ), $bag->getHeaders()); + ], $bag->getHeaders()); } public function testOAuthBearerAuthWithRedirect() { $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo'; - $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => $headerContent)); + $bag = new ServerBag(['REDIRECT_HTTP_AUTHORIZATION' => $headerContent]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => $headerContent, - ), $bag->getHeaders()); + ], $bag->getHeaders()); } /** @@ -159,12 +159,12 @@ class ServerBagTest extends TestCase public function testItDoesNotOverwriteTheAuthorizationHeaderIfItIsAlreadySet() { $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo'; - $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo', 'HTTP_AUTHORIZATION' => $headerContent)); + $bag = new ServerBag(['PHP_AUTH_USER' => 'foo', 'HTTP_AUTHORIZATION' => $headerContent]); - $this->assertEquals(array( + $this->assertEquals([ 'AUTHORIZATION' => $headerContent, 'PHP_AUTH_USER' => 'foo', 'PHP_AUTH_PW' => '', - ), $bag->getHeaders()); + ], $bag->getHeaders()); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php index 8c41e47510..44c8174e30 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php @@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; */ class AttributeBagTest extends TestCase { - private $array = array(); + private $array = []; /** * @var AttributeBag @@ -30,21 +30,21 @@ class AttributeBagTest extends TestCase protected function setUp() { - $this->array = array( + $this->array = [ 'hello' => 'world', 'always' => 'be happy', 'user.login' => 'drak', - 'csrf.token' => array( + 'csrf.token' => [ 'a' => '1234', 'b' => '4321', - ), - 'category' => array( - 'fishing' => array( + ], + 'category' => [ + 'fishing' => [ 'first' => 'cod', 'second' => 'sole', - ), - ), - ); + ], + ], + ]; $this->bag = new AttributeBag('_sf'); $this->bag->initialize($this->array); } @@ -52,7 +52,7 @@ class AttributeBagTest extends TestCase protected function tearDown() { $this->bag = null; - $this->array = array(); + $this->array = []; } public function testInitialize() @@ -60,7 +60,7 @@ class AttributeBagTest extends TestCase $bag = new AttributeBag(); $bag->initialize($this->array); $this->assertEquals($this->array, $bag->all()); - $array = array('should' => 'change'); + $array = ['should' => 'change']; $bag->initialize($array); $this->assertEquals($array, $bag->all()); } @@ -122,7 +122,7 @@ class AttributeBagTest extends TestCase public function testReplace() { - $array = array(); + $array = []; $array['name'] = 'jack'; $array['foo.bar'] = 'beep'; $this->bag->replace($array); @@ -150,22 +150,22 @@ class AttributeBagTest extends TestCase public function testClear() { $this->bag->clear(); - $this->assertEquals(array(), $this->bag->all()); + $this->assertEquals([], $this->bag->all()); } public function attributesProvider() { - return array( - array('hello', 'world', true), - array('always', 'be happy', true), - array('user.login', 'drak', true), - array('csrf.token', array('a' => '1234', 'b' => '4321'), true), - array('category', array('fishing' => array('first' => 'cod', 'second' => 'sole')), true), - array('user2.login', null, false), - array('never', null, false), - array('bye', null, false), - array('bye/for/now', null, false), - ); + return [ + ['hello', 'world', true], + ['always', 'be happy', true], + ['user.login', 'drak', true], + ['csrf.token', ['a' => '1234', 'b' => '4321'], true], + ['category', ['fishing' => ['first' => 'cod', 'second' => 'sole']], true], + ['user2.login', null, false], + ['never', null, false], + ['bye', null, false], + ['bye/for/now', null, false], + ]; } public function testGetIterator() diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php index ec4cd5ad1a..6b4bb17d69 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php @@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag; */ class NamespacedAttributeBagTest extends TestCase { - private $array = array(); + private $array = []; /** * @var NamespacedAttributeBag @@ -30,21 +30,21 @@ class NamespacedAttributeBagTest extends TestCase protected function setUp() { - $this->array = array( + $this->array = [ 'hello' => 'world', 'always' => 'be happy', 'user.login' => 'drak', - 'csrf.token' => array( + 'csrf.token' => [ 'a' => '1234', 'b' => '4321', - ), - 'category' => array( - 'fishing' => array( + ], + 'category' => [ + 'fishing' => [ 'first' => 'cod', 'second' => 'sole', - ), - ), - ); + ], + ], + ]; $this->bag = new NamespacedAttributeBag('_sf2', '/'); $this->bag->initialize($this->array); } @@ -52,7 +52,7 @@ class NamespacedAttributeBagTest extends TestCase protected function tearDown() { $this->bag = null; - $this->array = array(); + $this->array = []; } public function testInitialize() @@ -60,7 +60,7 @@ class NamespacedAttributeBagTest extends TestCase $bag = new NamespacedAttributeBag(); $bag->initialize($this->array); $this->assertEquals($this->array, $this->bag->all()); - $array = array('should' => 'not stick'); + $array = ['should' => 'not stick']; $bag->initialize($array); // should have remained the same @@ -139,7 +139,7 @@ class NamespacedAttributeBagTest extends TestCase public function testReplace() { - $array = array(); + $array = []; $array['name'] = 'jack'; $array['foo.bar'] = 'beep'; $this->bag->replace($array); @@ -177,28 +177,28 @@ class NamespacedAttributeBagTest extends TestCase public function testClear() { $this->bag->clear(); - $this->assertEquals(array(), $this->bag->all()); + $this->assertEquals([], $this->bag->all()); } public function attributesProvider() { - return array( - array('hello', 'world', true), - array('always', 'be happy', true), - array('user.login', 'drak', true), - array('csrf.token', array('a' => '1234', 'b' => '4321'), true), - array('csrf.token/a', '1234', true), - array('csrf.token/b', '4321', true), - array('category', array('fishing' => array('first' => 'cod', 'second' => 'sole')), true), - array('category/fishing', array('first' => 'cod', 'second' => 'sole'), true), - array('category/fishing/missing/first', null, false), - array('category/fishing/first', 'cod', true), - array('category/fishing/second', 'sole', true), - array('category/fishing/missing/second', null, false), - array('user2.login', null, false), - array('never', null, false), - array('bye', null, false), - array('bye/for/now', null, false), - ); + return [ + ['hello', 'world', true], + ['always', 'be happy', true], + ['user.login', 'drak', true], + ['csrf.token', ['a' => '1234', 'b' => '4321'], true], + ['csrf.token/a', '1234', true], + ['csrf.token/b', '4321', true], + ['category', ['fishing' => ['first' => 'cod', 'second' => 'sole']], true], + ['category/fishing', ['first' => 'cod', 'second' => 'sole'], true], + ['category/fishing/missing/first', null, false], + ['category/fishing/first', 'cod', true], + ['category/fishing/second', 'sole', true], + ['category/fishing/missing/second', null, false], + ['user2.login', null, false], + ['never', null, false], + ['bye', null, false], + ['bye/for/now', null, false], + ]; } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php index fa8626ab92..b4e2c3a5ad 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Flash/AutoExpireFlashBagTest.php @@ -26,13 +26,13 @@ class AutoExpireFlashBagTest extends TestCase */ private $bag; - protected $array = array(); + protected $array = []; protected function setUp() { parent::setUp(); $this->bag = new FlashBag(); - $this->array = array('new' => array('notice' => array('A previous flash message'))); + $this->array = ['new' => ['notice' => ['A previous flash message']]]; $this->bag->initialize($this->array); } @@ -45,16 +45,16 @@ class AutoExpireFlashBagTest extends TestCase public function testInitialize() { $bag = new FlashBag(); - $array = array('new' => array('notice' => array('A previous flash message'))); + $array = ['new' => ['notice' => ['A previous flash message']]]; $bag->initialize($array); - $this->assertEquals(array('A previous flash message'), $bag->peek('notice')); - $array = array('new' => array( - 'notice' => array('Something else'), - 'error' => array('a'), - )); + $this->assertEquals(['A previous flash message'], $bag->peek('notice')); + $array = ['new' => [ + 'notice' => ['Something else'], + 'error' => ['a'], + ]]; $bag->initialize($array); - $this->assertEquals(array('Something else'), $bag->peek('notice')); - $this->assertEquals(array('a'), $bag->peek('error')); + $this->assertEquals(['Something else'], $bag->peek('notice')); + $this->assertEquals(['a'], $bag->peek('error')); } public function testGetStorageKey() @@ -73,16 +73,16 @@ class AutoExpireFlashBagTest extends TestCase public function testPeek() { - $this->assertEquals(array(), $this->bag->peek('non_existing')); - $this->assertEquals(array('default'), $this->bag->peek('non_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); + $this->assertEquals([], $this->bag->peek('non_existing')); + $this->assertEquals(['default'], $this->bag->peek('non_existing', ['default'])); + $this->assertEquals(['A previous flash message'], $this->bag->peek('notice')); + $this->assertEquals(['A previous flash message'], $this->bag->peek('notice')); } public function testSet() { $this->bag->set('notice', 'Foo'); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); + $this->assertEquals(['A previous flash message'], $this->bag->peek('notice')); } public function testHas() @@ -93,43 +93,43 @@ class AutoExpireFlashBagTest extends TestCase public function testKeys() { - $this->assertEquals(array('notice'), $this->bag->keys()); + $this->assertEquals(['notice'], $this->bag->keys()); } public function testPeekAll() { - $array = array( - 'new' => array( + $array = [ + 'new' => [ 'notice' => 'Foo', 'error' => 'Bar', - ), - ); + ], + ]; $this->bag->initialize($array); - $this->assertEquals(array( + $this->assertEquals([ 'notice' => 'Foo', 'error' => 'Bar', - ), $this->bag->peekAll() + ], $this->bag->peekAll() ); - $this->assertEquals(array( + $this->assertEquals([ 'notice' => 'Foo', 'error' => 'Bar', - ), $this->bag->peekAll() + ], $this->bag->peekAll() ); } public function testGet() { - $this->assertEquals(array(), $this->bag->get('non_existing')); - $this->assertEquals(array('default'), $this->bag->get('non_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->get('notice')); - $this->assertEquals(array(), $this->bag->get('notice')); + $this->assertEquals([], $this->bag->get('non_existing')); + $this->assertEquals(['default'], $this->bag->get('non_existing', ['default'])); + $this->assertEquals(['A previous flash message'], $this->bag->get('notice')); + $this->assertEquals([], $this->bag->get('notice')); } public function testSetAll() { - $this->bag->setAll(array('a' => 'first', 'b' => 'second')); + $this->bag->setAll(['a' => 'first', 'b' => 'second']); $this->assertFalse($this->bag->has('a')); $this->assertFalse($this->bag->has('b')); } @@ -138,17 +138,17 @@ class AutoExpireFlashBagTest extends TestCase { $this->bag->set('notice', 'Foo'); $this->bag->set('error', 'Bar'); - $this->assertEquals(array( - 'notice' => array('A previous flash message'), - ), $this->bag->all() + $this->assertEquals([ + 'notice' => ['A previous flash message'], + ], $this->bag->all() ); - $this->assertEquals(array(), $this->bag->all()); + $this->assertEquals([], $this->bag->all()); } public function testClear() { - $this->assertEquals(array('notice' => array('A previous flash message')), $this->bag->clear()); + $this->assertEquals(['notice' => ['A previous flash message']], $this->bag->clear()); } public function testDoNotRemoveTheNewFlashesWhenDisplayingTheExistingOnes() @@ -156,6 +156,6 @@ class AutoExpireFlashBagTest extends TestCase $this->bag->add('success', 'Something'); $this->bag->all(); - $this->assertEquals(array('new' => array('success' => array('Something')), 'display' => array()), $this->array); + $this->assertEquals(['new' => ['success' => ['Something']], 'display' => []], $this->array); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php index 905a1f7517..6d8619e078 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php @@ -26,13 +26,13 @@ class FlashBagTest extends TestCase */ private $bag; - protected $array = array(); + protected $array = []; protected function setUp() { parent::setUp(); $this->bag = new FlashBag(); - $this->array = array('notice' => array('A previous flash message')); + $this->array = ['notice' => ['A previous flash message']]; $this->bag->initialize($this->array); } @@ -47,7 +47,7 @@ class FlashBagTest extends TestCase $bag = new FlashBag(); $bag->initialize($this->array); $this->assertEquals($this->array, $bag->peekAll()); - $array = array('should' => array('change')); + $array = ['should' => ['change']]; $bag->initialize($array); $this->assertEquals($array, $bag->peekAll()); } @@ -68,49 +68,49 @@ class FlashBagTest extends TestCase public function testPeek() { - $this->assertEquals(array(), $this->bag->peek('non_existing')); - $this->assertEquals(array('default'), $this->bag->peek('not_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); + $this->assertEquals([], $this->bag->peek('non_existing')); + $this->assertEquals(['default'], $this->bag->peek('not_existing', ['default'])); + $this->assertEquals(['A previous flash message'], $this->bag->peek('notice')); + $this->assertEquals(['A previous flash message'], $this->bag->peek('notice')); } public function testAdd() { - $tab = array('bar' => 'baz'); + $tab = ['bar' => 'baz']; $this->bag->add('string_message', 'lorem'); $this->bag->add('object_message', new \stdClass()); $this->bag->add('array_message', $tab); - $this->assertEquals(array('lorem'), $this->bag->get('string_message')); - $this->assertEquals(array(new \stdClass()), $this->bag->get('object_message')); - $this->assertEquals(array($tab), $this->bag->get('array_message')); + $this->assertEquals(['lorem'], $this->bag->get('string_message')); + $this->assertEquals([new \stdClass()], $this->bag->get('object_message')); + $this->assertEquals([$tab], $this->bag->get('array_message')); } public function testGet() { - $this->assertEquals(array(), $this->bag->get('non_existing')); - $this->assertEquals(array('default'), $this->bag->get('not_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->get('notice')); - $this->assertEquals(array(), $this->bag->get('notice')); + $this->assertEquals([], $this->bag->get('non_existing')); + $this->assertEquals(['default'], $this->bag->get('not_existing', ['default'])); + $this->assertEquals(['A previous flash message'], $this->bag->get('notice')); + $this->assertEquals([], $this->bag->get('notice')); } public function testAll() { $this->bag->set('notice', 'Foo'); $this->bag->set('error', 'Bar'); - $this->assertEquals(array( - 'notice' => array('Foo'), - 'error' => array('Bar'), ), $this->bag->all() + $this->assertEquals([ + 'notice' => ['Foo'], + 'error' => ['Bar'], ], $this->bag->all() ); - $this->assertEquals(array(), $this->bag->all()); + $this->assertEquals([], $this->bag->all()); } public function testSet() { $this->bag->set('notice', 'Foo'); $this->bag->set('notice', 'Bar'); - $this->assertEquals(array('Bar'), $this->bag->peek('notice')); + $this->assertEquals(['Bar'], $this->bag->peek('notice')); } public function testHas() @@ -121,7 +121,7 @@ class FlashBagTest extends TestCase public function testKeys() { - $this->assertEquals(array('notice'), $this->bag->keys()); + $this->assertEquals(['notice'], $this->bag->keys()); } public function testSetAll() @@ -130,28 +130,28 @@ class FlashBagTest extends TestCase $this->bag->add('another_flash', 'Bar'); $this->assertTrue($this->bag->has('one_flash')); $this->assertTrue($this->bag->has('another_flash')); - $this->bag->setAll(array('unique_flash' => 'FooBar')); + $this->bag->setAll(['unique_flash' => 'FooBar']); $this->assertFalse($this->bag->has('one_flash')); $this->assertFalse($this->bag->has('another_flash')); - $this->assertSame(array('unique_flash' => 'FooBar'), $this->bag->all()); - $this->assertSame(array(), $this->bag->all()); + $this->assertSame(['unique_flash' => 'FooBar'], $this->bag->all()); + $this->assertSame([], $this->bag->all()); } public function testPeekAll() { $this->bag->set('notice', 'Foo'); $this->bag->set('error', 'Bar'); - $this->assertEquals(array( - 'notice' => array('Foo'), - 'error' => array('Bar'), - ), $this->bag->peekAll() + $this->assertEquals([ + 'notice' => ['Foo'], + 'error' => ['Bar'], + ], $this->bag->peekAll() ); $this->assertTrue($this->bag->has('notice')); $this->assertTrue($this->bag->has('error')); - $this->assertEquals(array( - 'notice' => array('Foo'), - 'error' => array('Bar'), - ), $this->bag->peekAll() + $this->assertEquals([ + 'notice' => ['Foo'], + 'error' => ['Bar'], + ], $this->bag->peekAll() ); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php index 63351e575a..afa00fc7c3 100644 --- a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php @@ -127,10 +127,10 @@ class SessionTest extends TestCase public function testReplace() { - $this->session->replace(array('happiness' => 'be good', 'symfony' => 'awesome')); - $this->assertEquals(array('happiness' => 'be good', 'symfony' => 'awesome'), $this->session->all()); - $this->session->replace(array()); - $this->assertEquals(array(), $this->session->all()); + $this->session->replace(['happiness' => 'be good', 'symfony' => 'awesome']); + $this->assertEquals(['happiness' => 'be good', 'symfony' => 'awesome'], $this->session->all()); + $this->session->replace([]); + $this->assertEquals([], $this->session->all()); } /** @@ -150,16 +150,16 @@ class SessionTest extends TestCase $this->session->set('hi', 'fabien'); $this->session->set($key, $value); $this->session->clear(); - $this->assertEquals(array(), $this->session->all()); + $this->assertEquals([], $this->session->all()); } public function setProvider() { - return array( - array('foo', 'bar', array('foo' => 'bar')), - array('foo.bar', 'too much beer', array('foo.bar' => 'too much beer')), - array('great', 'symfony is great', array('great' => 'symfony is great')), - ); + return [ + ['foo', 'bar', ['foo' => 'bar']], + ['foo.bar', 'too much beer', ['foo.bar' => 'too much beer']], + ['great', 'symfony is great', ['great' => 'symfony is great']], + ]; } /** @@ -170,14 +170,14 @@ class SessionTest extends TestCase $this->session->set('hi.world', 'have a nice day'); $this->session->set($key, $value); $this->session->remove($key); - $this->assertEquals(array('hi.world' => 'have a nice day'), $this->session->all()); + $this->assertEquals(['hi.world' => 'have a nice day'], $this->session->all()); } public function testInvalidate() { $this->session->set('invalidate', 123); $this->session->invalidate(); - $this->assertEquals(array(), $this->session->all()); + $this->assertEquals([], $this->session->all()); } public function testMigrate() @@ -216,7 +216,7 @@ class SessionTest extends TestCase public function testGetIterator() { - $attributes = array('hello' => 'world', 'symfony' => 'rocks'); + $attributes = ['hello' => 'world', 'symfony' => 'rocks']; foreach ($attributes as $key => $val) { $this->session->set($key, $val); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php index a2bf168de4..c0651498f2 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractRedisSessionHandlerTestCase.php @@ -50,7 +50,7 @@ abstract class AbstractRedisSessionHandlerTestCase extends TestCase $this->redisClient = $this->createRedisClient($host); $this->storage = new RedisSessionHandler( $this->redisClient, - array('prefix' => self::PREFIX) + ['prefix' => self::PREFIX] ); } @@ -117,7 +117,7 @@ abstract class AbstractRedisSessionHandlerTestCase extends TestCase $lowTtl = 10; $this->redisClient->setex(self::PREFIX.'id', $lowTtl, 'foo'); - $this->storage->updateTimestamp('id', array()); + $this->storage->updateTimestamp('id', []); $this->assertGreaterThan($lowTtl, $this->redisClient->ttl(self::PREFIX.'id')); } @@ -137,9 +137,9 @@ abstract class AbstractRedisSessionHandlerTestCase extends TestCase public function getOptionFixtures(): array { - return array( - array(array('prefix' => 'session'), true), - array(array('prefix' => 'sfs', 'foo' => 'bar'), false), - ); + return [ + [['prefix' => 'session'], true], + [['prefix' => 'sfs', 'foo' => 'bar'], false], + ]; } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php index 6566d6eee4..f65e62b506 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/AbstractSessionHandlerTest.php @@ -19,10 +19,10 @@ class AbstractSessionHandlerTest extends TestCase public static function setUpBeforeClass() { - $spec = array( - 1 => array('file', '/dev/null', 'w'), - 2 => array('file', '/dev/null', 'w'), - ); + $spec = [ + 1 => ['file', '/dev/null', 'w'], + 2 => ['file', '/dev/null', 'w'], + ]; if (!self::$server = @proc_open('exec php -S localhost:8053', $spec, $pipes, __DIR__.'/Fixtures')) { self::markTestSkipped('PHP server unable to start.'); } @@ -42,7 +42,7 @@ class AbstractSessionHandlerTest extends TestCase */ public function testSession($fixture) { - $context = array('http' => array('header' => "Cookie: sid=123abc\r\n")); + $context = ['http' => ['header' => "Cookie: sid=123abc\r\n"]]; $context = stream_context_create($context); $result = file_get_contents(sprintf('http://localhost:8053/%s.php', $fixture), false, $context); @@ -52,7 +52,7 @@ class AbstractSessionHandlerTest extends TestCase public function provideSession() { foreach (glob(__DIR__.'/Fixtures/*.php') as $file) { - yield array(pathinfo($file, PATHINFO_FILENAME)); + yield [pathinfo($file, PATHINFO_FILENAME)]; } } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php index 2d32792a8f..fc2c418289 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite.php @@ -4,10 +4,10 @@ require __DIR__.'/common.inc'; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; -$storage = new NativeSessionStorage(array('cookie_samesite' => 'lax')); +$storage = new NativeSessionStorage(['cookie_samesite' => 'lax']); $storage->setSaveHandler(new TestSessionHandler()); $storage->start(); -$_SESSION = array('foo' => 'bar'); +$_SESSION = ['foo' => 'bar']; ob_start(function ($buffer) { return str_replace(session_id(), 'random_session_id', $buffer); }); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php index e0ff64b951..a28b6fedfc 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/Fixtures/with_samesite_and_migration.php @@ -4,11 +4,11 @@ require __DIR__.'/common.inc'; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; -$storage = new NativeSessionStorage(array('cookie_samesite' => 'lax')); +$storage = new NativeSessionStorage(['cookie_samesite' => 'lax']); $storage->setSaveHandler(new TestSessionHandler()); $storage->start(); -$_SESSION = array('foo' => 'bar'); +$_SESSION = ['foo' => 'bar']; $storage->regenerate(true); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php index 5bb2db0699..5c72a89aa5 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php @@ -41,7 +41,7 @@ class MemcachedSessionHandlerTest extends TestCase $this->memcached = $this->getMockBuilder('Memcached')->getMock(); $this->storage = new MemcachedSessionHandler( $this->memcached, - array('prefix' => self::PREFIX, 'expiretime' => self::TTL) + ['prefix' => self::PREFIX, 'expiretime' => self::TTL] ); } @@ -59,6 +59,12 @@ class MemcachedSessionHandlerTest extends TestCase public function testCloseSession() { + $this->memcached + ->expects($this->once()) + ->method('quit') + ->will($this->returnValue(true)) + ; + $this->assertTrue($this->storage->close()); } @@ -117,12 +123,12 @@ class MemcachedSessionHandlerTest extends TestCase public function getOptionFixtures() { - return array( - array(array('prefix' => 'session'), true), - array(array('expiretime' => 100), true), - array(array('prefix' => 'session', 'expiretime' => 200), true), - array(array('expiretime' => 100, 'foo' => 'bar'), false), - ); + return [ + [['prefix' => 'session'], true], + [['expiretime' => 100], true], + [['prefix' => 'session', 'expiretime' => 200], true], + [['expiretime' => 100, 'foo' => 'bar'], false], + ]; } public function testGetConnection() diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index c585fd4f1b..891516d523 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -40,14 +40,14 @@ class MongoDbSessionHandlerTest extends TestCase ->disableOriginalConstructor() ->getMock(); - $this->options = array( + $this->options = [ 'id_field' => '_id', 'data_field' => 'data', 'time_field' => 'time', 'expiry_field' => 'expires_at', 'database' => 'sf-test', 'collection' => 'session-test', - ); + ]; $this->storage = new MongoDbSessionHandler($this->mongo, $this->options); } @@ -57,7 +57,7 @@ class MongoDbSessionHandlerTest extends TestCase */ public function testConstructorShouldThrowExceptionForMissingOptions() { - new MongoDbSessionHandler($this->mongo, array()); + new MongoDbSessionHandler($this->mongo, []); } public function testOpenMethodAlwaysReturnTrue() @@ -95,11 +95,11 @@ class MongoDbSessionHandlerTest extends TestCase $this->assertInstanceOf(\MongoDB\BSON\UTCDateTime::class, $criteria[$this->options['expiry_field']]['$gte']); $this->assertGreaterThanOrEqual(round((string) $criteria[$this->options['expiry_field']]['$gte'] / 1000), $testTimeout); - return array( + return [ $this->options['id_field'] => 'foo', $this->options['expiry_field'] => new \MongoDB\BSON\UTCDateTime(), $this->options['data_field'] => new \MongoDB\BSON\Binary('bar', \MongoDB\BSON\Binary::TYPE_OLD_BINARY), - ); + ]; })); $this->assertEquals('bar', $this->storage->read('foo')); @@ -117,8 +117,8 @@ class MongoDbSessionHandlerTest extends TestCase $collection->expects($this->once()) ->method('updateOne') ->will($this->returnCallback(function ($criteria, $updateData, $options) { - $this->assertEquals(array($this->options['id_field'] => 'foo'), $criteria); - $this->assertEquals(array('upsert' => true), $options); + $this->assertEquals([$this->options['id_field'] => 'foo'], $criteria); + $this->assertEquals(['upsert' => true], $options); $data = $updateData['$set']; $expectedExpiry = time() + (int) ini_get('session.gc_maxlifetime'); @@ -141,7 +141,7 @@ class MongoDbSessionHandlerTest extends TestCase ->with($this->options['database'], $this->options['collection']) ->will($this->returnValue($collection)); - $data = array(); + $data = []; $collection->expects($this->exactly(2)) ->method('updateOne') @@ -166,7 +166,7 @@ class MongoDbSessionHandlerTest extends TestCase $collection->expects($this->once()) ->method('deleteOne') - ->with(array($this->options['id_field'] => 'foo')); + ->with([$this->options['id_field'] => 'foo']); $this->assertTrue($this->storage->destroy('foo')); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php index 95e725f4bc..e227bebf62 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php @@ -27,7 +27,7 @@ class NativeFileSessionHandlerTest extends TestCase { public function testConstruct() { - $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir())); + $storage = new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler(sys_get_temp_dir())); $this->assertEquals('user', ini_get('session.save_handler')); @@ -51,11 +51,11 @@ class NativeFileSessionHandlerTest extends TestCase { $base = sys_get_temp_dir(); - return array( - array("$base/foo", "$base/foo", "$base/foo"), - array("5;$base/foo", "5;$base/foo", "$base/foo"), - array("5;0600;$base/foo", "5;0600;$base/foo", "$base/foo"), - ); + return [ + ["$base/foo", "$base/foo", "$base/foo"], + ["5;$base/foo", "5;$base/foo", "$base/foo"], + ["5;0600;$base/foo", "5;0600;$base/foo", "$base/foo"], + ]; } /** @@ -69,7 +69,7 @@ class NativeFileSessionHandlerTest extends TestCase public function testConstructDefault() { $path = ini_get('session.save_path'); - $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler()); + $storage = new NativeSessionStorage(['name' => 'TESTING'], new NativeFileSessionHandler()); $this->assertEquals($path, ini_get('session.save_path')); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php index 9a2212b8b4..0d246e1aa5 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php @@ -54,6 +54,6 @@ class NullSessionHandlerTest extends TestCase public function getStorage() { - return new NativeSessionStorage(array(), new NullSessionHandler()); + return new NativeSessionStorage([], new NullSessionHandler()); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index 0edda00aa9..8aa84cff81 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -64,7 +64,7 @@ class PdoSessionHandlerTest extends TestCase */ public function testInexistentTable() { - $storage = new PdoSessionHandler($this->getMemorySqlitePdo(), array('db_table' => 'inexistent_table')); + $storage = new PdoSessionHandler($this->getMemorySqlitePdo(), ['db_table' => 'inexistent_table']); $storage->open('', 'sid'); $storage->read('id'); $storage->write('id', 'data'); @@ -143,7 +143,7 @@ class PdoSessionHandlerTest extends TestCase $stream = $this->createStream($content); $pdo->prepareResult->expects($this->once())->method('fetchAll') - ->will($this->returnValue(array(array($stream, 42, time())))); + ->will($this->returnValue([[$stream, 42, time()]])); $storage = new PdoSessionHandler($pdo); $result = $storage->read('foo'); @@ -171,7 +171,7 @@ class PdoSessionHandlerTest extends TestCase $selectStmt->expects($this->atLeast(2))->method('fetchAll') ->will($this->returnCallback(function () use (&$exception, $stream) { - return $exception ? array(array($stream, 42, time())) : array(); + return $exception ? [[$stream, 42, time()]] : []; })); $insertStmt->expects($this->once())->method('execute') @@ -337,19 +337,19 @@ class PdoSessionHandlerTest extends TestCase public function provideUrlDsnPairs() { - yield array('mysql://localhost/test', 'mysql:host=localhost;dbname=test;'); - yield array('mysql://localhost:56/test', 'mysql:host=localhost;port=56;dbname=test;'); - yield array('mysql2://root:pwd@localhost/test', 'mysql:host=localhost;dbname=test;', 'root', 'pwd'); - yield array('postgres://localhost/test', 'pgsql:host=localhost;dbname=test;'); - yield array('postgresql://localhost:5634/test', 'pgsql:host=localhost;port=5634;dbname=test;'); - yield array('postgres://root:pwd@localhost/test', 'pgsql:host=localhost;dbname=test;', 'root', 'pwd'); - yield 'sqlite relative path' => array('sqlite://localhost/tmp/test', 'sqlite:tmp/test'); - yield 'sqlite absolute path' => array('sqlite://localhost//tmp/test', 'sqlite:/tmp/test'); - yield 'sqlite relative path without host' => array('sqlite:///tmp/test', 'sqlite:tmp/test'); - yield 'sqlite absolute path without host' => array('sqlite3:////tmp/test', 'sqlite:/tmp/test'); - yield array('sqlite://localhost/:memory:', 'sqlite::memory:'); - yield array('mssql://localhost/test', 'sqlsrv:server=localhost;Database=test'); - yield array('mssql://localhost:56/test', 'sqlsrv:server=localhost,56;Database=test'); + yield ['mysql://localhost/test', 'mysql:host=localhost;dbname=test;']; + yield ['mysql://localhost:56/test', 'mysql:host=localhost;port=56;dbname=test;']; + yield ['mysql2://root:pwd@localhost/test', 'mysql:host=localhost;dbname=test;', 'root', 'pwd']; + yield ['postgres://localhost/test', 'pgsql:host=localhost;dbname=test;']; + yield ['postgresql://localhost:5634/test', 'pgsql:host=localhost;port=5634;dbname=test;']; + yield ['postgres://root:pwd@localhost/test', 'pgsql:host=localhost;dbname=test;', 'root', 'pwd']; + yield 'sqlite relative path' => ['sqlite://localhost/tmp/test', 'sqlite:tmp/test']; + yield 'sqlite absolute path' => ['sqlite://localhost//tmp/test', 'sqlite:/tmp/test']; + yield 'sqlite relative path without host' => ['sqlite:///tmp/test', 'sqlite:tmp/test']; + yield 'sqlite absolute path without host' => ['sqlite3:////tmp/test', 'sqlite:/tmp/test']; + yield ['sqlite://localhost/:memory:', 'sqlite::memory:']; + yield ['mssql://localhost/test', 'sqlsrv:server=localhost;Database=test']; + yield ['mssql://localhost:56/test', 'sqlsrv:server=localhost,56;Database=test']; } private function createStream($content) @@ -387,7 +387,7 @@ class MockPdo extends \PDO return parent::getAttribute($attribute); } - public function prepare($statement, $driverOptions = array()) + public function prepare($statement, $driverOptions = []) { return \is_callable($this->prepareResult) ? ($this->prepareResult)($statement, $driverOptions) diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisClusterSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisClusterSessionHandlerTest.php index 458100101c..622b42da1a 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisClusterSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisClusterSessionHandlerTest.php @@ -17,6 +17,6 @@ class PredisClusterSessionHandlerTest extends AbstractRedisSessionHandlerTestCas { protected function createRedisClient(string $host): Client { - return new Client(array(array('host' => $host))); + return new Client([['host' => $host]]); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisSessionHandlerTest.php index a9db4eb1bf..5ecab116f7 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PredisSessionHandlerTest.php @@ -17,6 +17,6 @@ class PredisSessionHandlerTest extends AbstractRedisSessionHandlerTestCase { protected function createRedisClient(string $host): Client { - return new Client(array('host' => $host)); + return new Client(['host' => $host]); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/RedisArraySessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/RedisArraySessionHandlerTest.php index d263e18ff7..b03a37236f 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/RedisArraySessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/RedisArraySessionHandlerTest.php @@ -15,6 +15,6 @@ class RedisArraySessionHandlerTest extends AbstractRedisSessionHandlerTestCase { protected function createRedisClient(string $host): \RedisArray { - return new \RedisArray(array($host)); + return new \RedisArray([$host]); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php index b02c41ae89..6a0d16876e 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/StrictSessionHandlerTest.php @@ -84,7 +84,7 @@ class StrictSessionHandlerTest extends TestCase { $handler = $this->getMockBuilder('SessionHandlerInterface')->getMock(); $handler->expects($this->exactly(2))->method('read') - ->withConsecutive(array('id1'), array('id2')) + ->withConsecutive(['id1'], ['id2']) ->will($this->onConsecutiveCalls('data1', 'data2')); $proxy = new StrictSessionHandler($handler); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php index 69cf6163c1..2c4758b913 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/MetadataBagTest.php @@ -26,26 +26,26 @@ class MetadataBagTest extends TestCase */ protected $bag; - protected $array = array(); + protected $array = []; protected function setUp() { parent::setUp(); $this->bag = new MetadataBag(); - $this->array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0); + $this->array = [MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 0]; $this->bag->initialize($this->array); } protected function tearDown() { - $this->array = array(); + $this->array = []; $this->bag = null; parent::tearDown(); } public function testInitialize() { - $sessionMetadata = array(); + $sessionMetadata = []; $bag1 = new MetadataBag(); $bag1->initialize($sessionMetadata); @@ -82,7 +82,7 @@ class MetadataBagTest extends TestCase public function testGetLifetime() { $bag = new MetadataBag(); - $array = array(MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 1000); + $array = [MetadataBag::CREATED => 1234567, MetadataBag::UPDATED => 12345678, MetadataBag::LIFETIME => 1000]; $bag->initialize($array); $this->assertEquals(1000, $bag->getLifetime()); } @@ -111,11 +111,11 @@ class MetadataBagTest extends TestCase $timeStamp = time(); $created = $timeStamp - 15; - $sessionMetadata = array( + $sessionMetadata = [ MetadataBag::CREATED => $created, MetadataBag::UPDATED => $created, MetadataBag::LIFETIME => 1000, - ); + ]; $bag->initialize($sessionMetadata); $this->assertEquals($created, $sessionMetadata[MetadataBag::UPDATED]); @@ -127,11 +127,11 @@ class MetadataBagTest extends TestCase $timeStamp = time(); $created = $timeStamp - 45; - $sessionMetadata = array( + $sessionMetadata = [ MetadataBag::CREATED => $created, MetadataBag::UPDATED => $created, MetadataBag::LIFETIME => 1000, - ); + ]; $bag->initialize($sessionMetadata); $this->assertEquals($timeStamp, $sessionMetadata[MetadataBag::UPDATED]); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php index 893e120ce1..2e3024ef1b 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php @@ -45,10 +45,10 @@ class MockArraySessionStorageTest extends TestCase $this->attributes = new AttributeBag(); $this->flashes = new FlashBag(); - $this->data = array( - $this->attributes->getStorageKey() => array('foo' => 'bar'), - $this->flashes->getStorageKey() => array('notice' => 'hello'), - ); + $this->data = [ + $this->attributes->getStorageKey() => ['foo' => 'bar'], + $this->flashes->getStorageKey() => ['notice' => 'hello'], + ]; $this->storage = new MockArraySessionStorage(); $this->storage->registerBag($this->flashes); @@ -80,14 +80,14 @@ class MockArraySessionStorageTest extends TestCase $id = $this->storage->getId(); $this->storage->regenerate(); $this->assertNotEquals($id, $this->storage->getId()); - $this->assertEquals(array('foo' => 'bar'), $this->storage->getBag('attributes')->all()); - $this->assertEquals(array('notice' => 'hello'), $this->storage->getBag('flashes')->peekAll()); + $this->assertEquals(['foo' => 'bar'], $this->storage->getBag('attributes')->all()); + $this->assertEquals(['notice' => 'hello'], $this->storage->getBag('flashes')->peekAll()); $id = $this->storage->getId(); $this->storage->regenerate(true); $this->assertNotEquals($id, $this->storage->getId()); - $this->assertEquals(array('foo' => 'bar'), $this->storage->getBag('attributes')->all()); - $this->assertEquals(array('notice' => 'hello'), $this->storage->getBag('flashes')->peekAll()); + $this->assertEquals(['foo' => 'bar'], $this->storage->getBag('attributes')->all()); + $this->assertEquals(['notice' => 'hello'], $this->storage->getBag('flashes')->peekAll()); } public function testGetId() @@ -101,8 +101,8 @@ class MockArraySessionStorageTest extends TestCase { $this->storage->clear(); - $this->assertSame(array(), $this->storage->getBag('attributes')->all()); - $this->assertSame(array(), $this->storage->getBag('flashes')->peekAll()); + $this->assertSame([], $this->storage->getBag('attributes')->all()); + $this->assertSame([], $this->storage->getBag('flashes')->peekAll()); } public function testClearStartsSession() diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php index f8394d8cab..062769e282 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php @@ -91,7 +91,7 @@ class MockFileSessionStorageTest extends TestCase $storage->start(); $this->assertEquals('108', $storage->getBag('attributes')->get('new')); $this->assertTrue($storage->getBag('flashes')->has('newkey')); - $this->assertEquals(array('test'), $storage->getBag('flashes')->peek('newkey')); + $this->assertEquals(['test'], $storage->getBag('flashes')->peek('newkey')); } public function testMultipleInstances() diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php index 8ce703b34e..d97973e2eb 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -56,7 +56,7 @@ class NativeSessionStorageTest extends TestCase /** * @return NativeSessionStorage */ - protected function getStorage(array $options = array()) + protected function getStorage(array $options = []) { $storage = new NativeSessionStorage($options); $storage->registerBag(new AttributeBag()); @@ -157,19 +157,19 @@ class NativeSessionStorageTest extends TestCase { $this->iniSet('session.cache_limiter', 'nocache'); - $storage = new NativeSessionStorage(array('cache_limiter' => 'public')); + $storage = new NativeSessionStorage(['cache_limiter' => 'public']); $this->assertEquals('public', ini_get('session.cache_limiter')); } public function testCookieOptions() { - $options = array( + $options = [ 'cookie_lifetime' => 123456, 'cookie_path' => '/my/cookie/path', 'cookie_domain' => 'symfony.example.com', 'cookie_secure' => true, 'cookie_httponly' => false, - ); + ]; if (\PHP_VERSION_ID >= 70300) { $options['cookie_samesite'] = 'lax'; @@ -177,7 +177,7 @@ class NativeSessionStorageTest extends TestCase $this->getStorage($options); $temp = session_get_cookie_params(); - $gco = array(); + $gco = []; foreach ($temp as $key => $value) { $gco['cookie_'.$key] = $value; @@ -192,10 +192,10 @@ class NativeSessionStorageTest extends TestCase $this->markTestSkipped('HHVM is not handled in this test case.'); } - $options = array( + $options = [ 'url_rewriter.tags' => 'a=href', 'cache_expire' => '200', - ); + ]; $this->getStorage($options); @@ -276,9 +276,9 @@ class NativeSessionStorageTest extends TestCase public function testSetSessionOptionsOnceSessionStartedIsIgnored() { session_start(); - $this->getStorage(array( + $this->getStorage([ 'name' => 'something-else', - )); + ]); // Assert no exception has been thrown by `getStorage()` $this->addToAssertionCount(1); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php index a5a8561465..4332400246 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php @@ -86,10 +86,10 @@ class PhpBridgeSessionStorageTest extends TestCase $_SESSION['drak'] = 'loves symfony'; $storage->getBag('attributes')->set('symfony', 'greatness'); $key = $storage->getBag('attributes')->getStorageKey(); - $this->assertEquals($_SESSION[$key], array('symfony' => 'greatness')); + $this->assertEquals($_SESSION[$key], ['symfony' => 'greatness']); $this->assertEquals($_SESSION['drak'], 'loves symfony'); $storage->clear(); - $this->assertEquals($_SESSION[$key], array()); + $this->assertEquals($_SESSION[$key], []); $this->assertEquals($_SESSION['drak'], 'loves symfony'); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php index 0b48250e01..0459a8ce97 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php @@ -127,7 +127,7 @@ class SessionHandlerProxyTest extends TestCase */ public function testValidateId() { - $mock = $this->getMockBuilder(array('SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'))->getMock(); + $mock = $this->getMockBuilder(['SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'])->getMock(); $mock->expects($this->once()) ->method('validateId'); @@ -142,7 +142,7 @@ class SessionHandlerProxyTest extends TestCase */ public function testUpdateTimestamp() { - $mock = $this->getMockBuilder(array('SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'))->getMock(); + $mock = $this->getMockBuilder(['SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'])->getMock(); $mock->expects($this->once()) ->method('updateTimestamp'); diff --git a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php index 699222e379..62dfc9bc94 100644 --- a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php @@ -19,7 +19,7 @@ class StreamedResponseTest extends TestCase { public function testConstructor() { - $response = new StreamedResponse(function () { echo 'foo'; }, 404, array('Content-Type' => 'text/plain')); + $response = new StreamedResponse(function () { echo 'foo'; }, 404, ['Content-Type' => 'text/plain']); $this->assertEquals(404, $response->getStatusCode()); $this->assertEquals('text/plain', $response->headers->get('Content-Type')); @@ -51,7 +51,7 @@ class StreamedResponseTest extends TestCase public function testPrepareWithHeadRequest() { - $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Content-Length' => '123')); + $response = new StreamedResponse(function () { echo 'foo'; }, 200, ['Content-Length' => '123']); $request = Request::create('/', 'HEAD'); $response->prepare($request); @@ -61,7 +61,7 @@ class StreamedResponseTest extends TestCase public function testPrepareWithCacheHeaders() { - $response = new StreamedResponse(function () { echo 'foo'; }, 200, array('Cache-Control' => 'max-age=600, public')); + $response = new StreamedResponse(function () { echo 'foo'; }, 200, ['Cache-Control' => 'max-age=600, public']); $request = Request::create('/', 'GET'); $response->prepare($request); diff --git a/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php b/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php index a646119d99..5061a8d181 100644 --- a/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php +++ b/vendor/symfony/http-kernel/CacheClearer/ChainCacheClearer.php @@ -22,7 +22,7 @@ class ChainCacheClearer implements CacheClearerInterface { private $clearers; - public function __construct(iterable $clearers = array()) + public function __construct(iterable $clearers = []) { $this->clearers = $clearers; } diff --git a/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php b/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php index d7db027072..47a6ece5c1 100644 --- a/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php +++ b/vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php @@ -16,9 +16,9 @@ namespace Symfony\Component\HttpKernel\CacheClearer; */ class Psr6CacheClearer implements CacheClearerInterface { - private $pools = array(); + private $pools = []; - public function __construct(array $pools = array()) + public function __construct(array $pools = []) { $this->pools = $pools; } diff --git a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php index 171b38596f..dd527708be 100644 --- a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php +++ b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php @@ -26,7 +26,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface private $optionalsEnabled = false; private $onlyOptionalsEnabled = false; - public function __construct(iterable $warmers = array(), bool $debug = false, string $deprecationLogsFilepath = null) + public function __construct(iterable $warmers = [], bool $debug = false, string $deprecationLogsFilepath = null) { $this->warmers = $warmers; $this->debug = $debug; @@ -51,7 +51,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface public function warmUp($cacheDir) { if ($this->debug) { - $collectedLogs = array(); + $collectedLogs = []; $previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL'); $previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { @@ -73,14 +73,14 @@ class CacheWarmerAggregate implements CacheWarmerInterface } } - $collectedLogs[$message] = array( + $collectedLogs[$message] = [ 'type' => $type, 'message' => $message, 'file' => $file, 'line' => $line, 'trace' => $backtrace, 'count' => 1, - ); + ]; }); } diff --git a/vendor/symfony/http-kernel/Client.php b/vendor/symfony/http-kernel/Client.php index 62555e9a5a..51b853c6e1 100644 --- a/vendor/symfony/http-kernel/Client.php +++ b/vendor/symfony/http-kernel/Client.php @@ -39,7 +39,7 @@ class Client extends BaseClient * @param History $history A History instance to store the browser history * @param CookieJar $cookieJar A CookieJar instance to store the cookies */ - public function __construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null) + public function __construct(HttpKernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null) { // These class properties must be set before calling the parent constructor, as it may depend on it. $this->kernel = $kernel; @@ -159,7 +159,7 @@ EOF; */ protected function filterFiles(array $files) { - $filtered = array(); + $filtered = []; foreach ($files as $key => $value) { if (\is_array($value)) { $filtered[$key] = $this->filterFiles($value); diff --git a/vendor/symfony/http-kernel/Config/FileLocator.php b/vendor/symfony/http-kernel/Config/FileLocator.php index 20d91b2f05..f88d1684fe 100644 --- a/vendor/symfony/http-kernel/Config/FileLocator.php +++ b/vendor/symfony/http-kernel/Config/FileLocator.php @@ -29,7 +29,7 @@ class FileLocator extends BaseFileLocator * @param string|null $path The path the global resource directory * @param array $paths An array of paths where to look for resources */ - public function __construct(KernelInterface $kernel, string $path = null, array $paths = array()) + public function __construct(KernelInterface $kernel, string $path = null, array $paths = []) { $this->kernel = $kernel; if (null !== $path) { diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver.php index 142a6d54a6..86ceab2f26 100644 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver.php +++ b/vendor/symfony/http-kernel/Controller/ArgumentResolver.php @@ -34,7 +34,7 @@ final class ArgumentResolver implements ArgumentResolverInterface */ private $argumentValueResolvers; - public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = array()) + public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = []) { $this->argumentMetadataFactory = $argumentMetadataFactory ?: new ArgumentMetadataFactory(); $this->argumentValueResolvers = $argumentValueResolvers ?: self::getDefaultArgumentValueResolvers(); @@ -45,7 +45,7 @@ final class ArgumentResolver implements ArgumentResolverInterface */ public function getArguments(Request $request, $controller) { - $arguments = array(); + $arguments = []; foreach ($this->argumentMetadataFactory->createArgumentMetadata($controller) as $metadata) { foreach ($this->argumentValueResolvers as $resolver) { @@ -83,12 +83,12 @@ final class ArgumentResolver implements ArgumentResolverInterface public static function getDefaultArgumentValueResolvers(): iterable { - return array( + return [ new RequestAttributeValueResolver(), new RequestValueResolver(), new SessionValueResolver(), new DefaultValueResolver(), new VariadicValueResolver(), - ); + ]; } } diff --git a/vendor/symfony/http-kernel/Controller/ControllerReference.php b/vendor/symfony/http-kernel/Controller/ControllerReference.php index f424fdc833..b4fdadd21e 100644 --- a/vendor/symfony/http-kernel/Controller/ControllerReference.php +++ b/vendor/symfony/http-kernel/Controller/ControllerReference.php @@ -27,15 +27,15 @@ use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface; class ControllerReference { public $controller; - public $attributes = array(); - public $query = array(); + public $attributes = []; + public $query = []; /** * @param string $controller The controller name * @param array $attributes An array of parameters to add to the Request attributes * @param array $query An array of parameters to add to the Request query string */ - public function __construct(string $controller, array $attributes = array(), array $query = array()) + public function __construct(string $controller, array $attributes = [], array $query = []) { $this->controller = $controller; $this->attributes = $attributes; diff --git a/vendor/symfony/http-kernel/Controller/ControllerResolver.php b/vendor/symfony/http-kernel/Controller/ControllerResolver.php index 04c5fcf53d..3cebfb3e8b 100644 --- a/vendor/symfony/http-kernel/Controller/ControllerResolver.php +++ b/vendor/symfony/http-kernel/Controller/ControllerResolver.php @@ -107,7 +107,7 @@ class ControllerResolver implements ControllerResolverInterface list($class, $method) = explode('::', $controller, 2); try { - return array($this->instantiateController($class), $method); + return [$this->instantiateController($class), $method]; } catch (\Error | \LogicException $e) { try { if ((new \ReflectionMethod($class, $method))->isStatic()) { @@ -155,7 +155,7 @@ class ControllerResolver implements ControllerResolverInterface } if (!isset($callable[0]) || !isset($callable[1]) || 2 !== \count($callable)) { - return 'Invalid array callable, expected array(controller, method).'; + return 'Invalid array callable, expected [controller, method].'; } list($controller, $method) = $callable; @@ -172,7 +172,7 @@ class ControllerResolver implements ControllerResolverInterface $collection = $this->getClassMethodsWithoutMagicMethods($controller); - $alternatives = array(); + $alternatives = []; foreach ($collection as $item) { $lev = levenshtein($method, $item); diff --git a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php index cc2ed9f2b7..8ee9b0b938 100644 --- a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php +++ b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php @@ -23,7 +23,7 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface */ public function createArgumentMetadata($controller) { - $arguments = array(); + $arguments = []; if (\is_array($controller)) { $reflection = new \ReflectionMethod($controller[0], $controller[1]); diff --git a/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php b/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php index f07ac89c0f..c3c3f94ead 100644 --- a/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php @@ -57,7 +57,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte */ public function collect(Request $request, Response $response, \Exception $exception = null) { - $this->data = array( + $this->data = [ 'app_name' => $this->name, 'app_version' => $this->version, 'token' => $response->headers->get('X-Debug-Token'), @@ -72,9 +72,9 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte 'xdebug_enabled' => \extension_loaded('xdebug'), 'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN), 'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN), - 'bundles' => array(), + 'bundles' => [], 'sapi_name' => \PHP_SAPI, - ); + ]; if (isset($this->kernel)) { foreach ($this->kernel->getBundles() as $name => $bundle) { @@ -100,7 +100,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte */ public function reset() { - $this->data = array(); + $this->data = []; } public function lateCollect() diff --git a/vendor/symfony/http-kernel/DataCollector/DataCollector.php b/vendor/symfony/http-kernel/DataCollector/DataCollector.php index a3d8c99d84..14ea230f57 100644 --- a/vendor/symfony/http-kernel/DataCollector/DataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/DataCollector.php @@ -27,21 +27,30 @@ use Symfony\Component\VarDumper\Cloner\VarCloner; */ abstract class DataCollector implements DataCollectorInterface, \Serializable { - protected $data = array(); + protected $data = []; /** * @var ClonerInterface */ private $cloner; + /** + * @internal + */ public function serialize() { - return serialize($this->data); + $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); + $isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object']; + + return $isCalledFromOverridingMethod ? $this->data : serialize($this->data); } + /** + * @internal + */ public function unserialize($data) { - $this->data = unserialize($data); + $this->data = \is_array($data) ? $data : unserialize($data); } /** @@ -76,7 +85,7 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable */ protected function getCasters() { - return array( + return [ '*' => function ($v, array $a, Stub $s, $isNested) { if (!$v instanceof Stub) { foreach ($a as $k => $v) { @@ -88,6 +97,6 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable return $a; }, - ); + ]; } } diff --git a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php index 13694f5a59..04ea44a073 100644 --- a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php @@ -52,12 +52,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface $this->dumper = $dumper; // All clones share these properties by reference: - $this->rootRefs = array( + $this->rootRefs = [ &$this->data, &$this->dataCount, &$this->isCollected, &$this->clonesCount, - ); + ]; $this->sourceContextProvider = $dumper instanceof Connection && isset($dumper->getContextProviders()['source']) ? $dumper->getContextProviders()['source'] : new SourceContextProvider($this->charset); } @@ -110,7 +110,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface ) { if ($response->headers->has('Content-Type') && false !== strpos($response->headers->get('Content-Type'), 'html')) { $dumper = new HtmlDumper('php://output', $this->charset); - $dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat)); + $dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]); } else { $dumper = new CliDumper('php://output', $this->charset); } @@ -126,13 +126,16 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface if ($this->stopwatch) { $this->stopwatch->reset(); } - $this->data = array(); + $this->data = []; $this->dataCount = 0; $this->isCollected = true; $this->clonesCount = 0; $this->clonesIndex = 0; } + /** + * @internal + */ public function serialize() { if ($this->clonesCount !== $this->clonesIndex) { @@ -142,16 +145,19 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface $this->data[] = $this->fileLinkFormat; $this->data[] = $this->charset; $ser = serialize($this->data); - $this->data = array(); + $this->data = []; $this->dataCount = 0; $this->isCollected = true; return $ser; } + /** + * @internal + */ public function unserialize($data) { - parent::unserialize($data); + $this->data = unserialize($data); $charset = array_pop($this->data); $fileLinkFormat = array_pop($this->data); $this->dataCount = \count($this->data); @@ -169,11 +175,11 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface if ('html' === $format) { $dumper = new HtmlDumper($data, $this->charset); - $dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat)); + $dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]); } else { throw new \InvalidArgumentException(sprintf('Invalid dump format: %s', $format)); } - $dumps = array(); + $dumps = []; foreach ($this->data as $dump) { $dumper->dump($dump['data']->withMaxDepth($maxDepthLimit)->withMaxItemsPerDepth($maxItemsPerDepth)); @@ -207,12 +213,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface if (isset($_SERVER['VAR_DUMPER_FORMAT'])) { $html = 'html' === $_SERVER['VAR_DUMPER_FORMAT']; } else { - $html = !\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html'); + $html = !\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && stripos($h[$i], 'html'); } if ($html) { $dumper = new HtmlDumper('php://output', $this->charset); - $dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat)); + $dumper->setDisplayOptions(['fileLinkFormat' => $this->fileLinkFormat]); } else { $dumper = new CliDumper('php://output', $this->charset); } @@ -222,7 +228,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface $this->doDump($dumper, $dump['data'], $dump['name'], $dump['file'], $dump['line']); } - $this->data = array(); + $this->data = []; $this->dataCount = 0; } } @@ -236,7 +242,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface $s = $this->style('meta', '%s'); $f = strip_tags($this->style('', $file)); $name = strip_tags($this->style('', $name)); - if ($fmt && $link = \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line)) { + if ($fmt && $link = \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line)) { $name = sprintf('<a href="%s" title="%s">'.$s.'</a>', strip_tags($this->style('', $link)), $f, $name); } else { $name = sprintf('<abbr title="%s">'.$s.'</abbr>', $f, $name); diff --git a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php b/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php index 3a7e51bf8d..c0de250940 100644 --- a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php @@ -37,16 +37,16 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter */ public function collect(Request $request, Response $response, \Exception $exception = null) { - $this->data = array( - 'called_listeners' => array(), - 'not_called_listeners' => array(), - 'orphaned_events' => array(), - ); + $this->data = [ + 'called_listeners' => [], + 'not_called_listeners' => [], + 'orphaned_events' => [], + ]; } public function reset() { - $this->data = array(); + $this->data = []; if ($this->dispatcher instanceof ResetInterface) { $this->dispatcher->reset(); diff --git a/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php b/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php index 7a25f14921..c76e7f45bd 100644 --- a/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/ExceptionDataCollector.php @@ -28,9 +28,9 @@ class ExceptionDataCollector extends DataCollector public function collect(Request $request, Response $response, \Exception $exception = null) { if (null !== $exception) { - $this->data = array( + $this->data = [ 'exception' => FlattenException::create($exception), - ); + ]; } } @@ -39,7 +39,7 @@ class ExceptionDataCollector extends DataCollector */ public function reset() { - $this->data = array(); + $this->data = []; } /** diff --git a/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php b/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php index 3081ac7fb5..885375d733 100644 --- a/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php @@ -55,7 +55,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte if ($this->logger instanceof DebugLoggerInterface) { $this->logger->clear(); } - $this->data = array(); + $this->data = []; } /** @@ -80,12 +80,12 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte */ public function getLogs() { - return isset($this->data['logs']) ? $this->data['logs'] : array(); + return isset($this->data['logs']) ? $this->data['logs'] : []; } public function getPriorities() { - return isset($this->data['priorities']) ? $this->data['priorities'] : array(); + return isset($this->data['priorities']) ? $this->data['priorities'] : []; } public function countErrors() @@ -110,7 +110,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte public function getCompilerLogs() { - return isset($this->data['compiler_logs']) ? $this->data['compiler_logs'] : array(); + return isset($this->data['compiler_logs']) ? $this->data['compiler_logs'] : []; } /** @@ -124,13 +124,13 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte private function getContainerDeprecationLogs() { if (null === $this->containerPathPrefix || !file_exists($file = $this->containerPathPrefix.'Deprecations.log')) { - return array(); + return []; } $bootTime = filemtime($file); - $logs = array(); + $logs = []; foreach (unserialize(file_get_contents($file)) as $log) { - $log['context'] = array('exception' => new SilencedErrorContext($log['type'], $log['file'], $log['line'], $log['trace'], $log['count'])); + $log['context'] = ['exception' => new SilencedErrorContext($log['type'], $log['file'], $log['line'], $log['trace'], $log['count'])]; $log['timestamp'] = $bootTime; $log['priority'] = 100; $log['priorityName'] = 'DEBUG'; @@ -146,17 +146,17 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte private function getContainerCompilerLogs() { if (null === $this->containerPathPrefix || !file_exists($file = $this->containerPathPrefix.'Compiler.log')) { - return array(); + return []; } - $logs = array(); + $logs = []; foreach (file($file, FILE_IGNORE_NEW_LINES) as $log) { $log = explode(': ', $log, 2); if (!isset($log[1]) || !preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $log[0])) { - $log = array('Unknown Compiler Pass', implode(': ', $log)); + $log = ['Unknown Compiler Pass', implode(': ', $log)]; } - $logs[$log[0]][] = array('message' => $log[1]); + $logs[$log[0]][] = ['message' => $log[1]]; } return $logs; @@ -164,8 +164,8 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte private function sanitizeLogs($logs) { - $sanitizedLogs = array(); - $silencedLogs = array(); + $sanitizedLogs = []; + $silencedLogs = []; foreach ($logs as $log) { if (!$this->isSilencedOrDeprecationErrorLog($log)) { @@ -184,10 +184,10 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte $silencedLogs[$h] = true; if (!isset($sanitizedLogs[$message])) { - $sanitizedLogs[$message] = $log + array( + $sanitizedLogs[$message] = $log + [ 'errorCount' => 0, 'scream' => true, - ); + ]; } $sanitizedLogs[$message]['errorCount'] += $exception->count; @@ -199,10 +199,10 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte if (isset($sanitizedLogs[$errorId])) { ++$sanitizedLogs[$errorId]['errorCount']; } else { - $log += array( + $log += [ 'errorCount' => 1, 'scream' => false, - ); + ]; $sanitizedLogs[$errorId] = $log; } @@ -223,7 +223,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte return true; } - if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), array(E_DEPRECATED, E_USER_DEPRECATED), true)) { + if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), [E_DEPRECATED, E_USER_DEPRECATED], true)) { return true; } @@ -232,23 +232,23 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte private function computeErrorsCount(array $containerDeprecationLogs) { - $silencedLogs = array(); - $count = array( + $silencedLogs = []; + $count = [ 'error_count' => $this->logger->countErrors($this->currentRequest), 'deprecation_count' => 0, 'warning_count' => 0, 'scream_count' => 0, - 'priorities' => array(), - ); + 'priorities' => [], + ]; foreach ($this->logger->getLogs($this->currentRequest) as $log) { if (isset($count['priorities'][$log['priority']])) { ++$count['priorities'][$log['priority']]['count']; } else { - $count['priorities'][$log['priority']] = array( + $count['priorities'][$log['priority']] = [ 'count' => 1, 'name' => $log['priorityName'], - ); + ]; } if ('WARNING' === $log['priorityName']) { ++$count['warning_count']; diff --git a/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php b/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php index 310b2f91a5..7a6e1c0646 100644 --- a/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php @@ -39,10 +39,10 @@ class MemoryDataCollector extends DataCollector implements LateDataCollectorInte */ public function reset() { - $this->data = array( + $this->data = [ 'memory' => 0, 'memory_limit' => $this->convertToBytes(ini_get('memory_limit')), - ); + ]; } /** diff --git a/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php b/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php index ed75382618..2df5f94fd4 100644 --- a/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php @@ -38,7 +38,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter public function collect(Request $request, Response $response, \Exception $exception = null) { // attributes are serialized and as they can be anything, they need to be converted to strings. - $attributes = array(); + $attributes = []; $route = ''; foreach ($request->attributes->all() as $key => $value) { if ('_route' === $key) { @@ -57,10 +57,10 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter $content = false; } - $sessionMetadata = array(); - $sessionAttributes = array(); + $sessionMetadata = []; + $sessionAttributes = []; $session = null; - $flashes = array(); + $flashes = []; if ($request->hasSession()) { $session = $request->getSession(); if ($session->isStarted()) { @@ -74,19 +74,19 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter $statusCode = $response->getStatusCode(); - $responseCookies = array(); + $responseCookies = []; foreach ($response->headers->getCookies() as $cookie) { $responseCookies[$cookie->getName()] = $cookie; } - $dotenvVars = array(); + $dotenvVars = []; foreach (explode(',', getenv('SYMFONY_DOTENV_VARS')) as $name) { if ('' !== $name && false !== $value = getenv($name)) { $dotenvVars[$name] = $value; } } - $this->data = array( + $this->data = [ 'method' => $request->getMethod(), 'format' => $request->getRequestFormat(), 'content' => $content, @@ -110,7 +110,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter 'controller' => 'n/a', 'locale' => $request->getLocale(), 'dotenv_vars' => $dotenvVars, - ); + ]; if (isset($this->data['request_headers']['php-auth-pw'])) { $this->data['request_headers']['php-auth-pw'] = '******'; @@ -147,14 +147,14 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter if ($response->isRedirect()) { $response->headers->setCookie(new Cookie( 'sf_redirect', - json_encode(array( + json_encode([ 'token' => $response->headers->get('x-debug-token'), 'route' => $request->attributes->get('_route', 'n/a'), 'method' => $request->getMethod(), 'controller' => $this->parseController($request->attributes->get('_controller')), 'status_code' => $statusCode, 'status_text' => Response::$statusTexts[(int) $statusCode], - )), + ]), 0, '/', null, $request->isSecure(), true, false, 'lax' )); } @@ -173,7 +173,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter public function reset() { - $this->data = array(); + $this->data = []; $this->controllers = new \SplObjectStorage(); } @@ -308,7 +308,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter */ public function getRouteParams() { - return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params']->getValue() : array(); + return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params']->getValue() : []; } /** @@ -356,10 +356,10 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter public static function getSubscribedEvents() { - return array( + return [ KernelEvents::CONTROLLER => 'onKernelController', KernelEvents::RESPONSE => 'onKernelResponse', - ); + ]; } /** @@ -387,21 +387,21 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter try { $r = new \ReflectionMethod($controller[0], $controller[1]); - return array( + return [ 'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0], 'method' => $controller[1], 'file' => $r->getFileName(), 'line' => $r->getStartLine(), - ); + ]; } catch (\ReflectionException $e) { if (\is_callable($controller)) { // using __call or __callStatic - return array( + return [ 'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0], 'method' => $controller[1], 'file' => 'n/a', 'line' => 'n/a', - ); + ]; } } } @@ -409,12 +409,12 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter if ($controller instanceof \Closure) { $r = new \ReflectionFunction($controller); - $controller = array( + $controller = [ 'class' => $r->getName(), 'method' => null, 'file' => $r->getFileName(), 'line' => $r->getStartLine(), - ); + ]; if (false !== strpos($r->name, '{closure}')) { return $controller; @@ -433,12 +433,12 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter if (\is_object($controller)) { $r = new \ReflectionClass($controller); - return array( + return [ 'class' => $r->getName(), 'method' => null, 'file' => $r->getFileName(), 'line' => $r->getStartLine(), - ); + ]; } return \is_string($controller) ? $controller : 'n/a'; diff --git a/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php b/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php index 481747b3c8..432dc3618f 100644 --- a/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php @@ -54,11 +54,11 @@ class RouterDataCollector extends DataCollector { $this->controllers = new \SplObjectStorage(); - $this->data = array( + $this->data = [ 'redirect' => false, 'url' => null, 'route' => null, - ); + ]; } protected function guessRoute(Request $request, $controller) diff --git a/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php b/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php index e489d77598..99149ab0be 100644 --- a/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/TimeDataCollector.php @@ -43,11 +43,11 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf $startTime = $request->server->get('REQUEST_TIME_FLOAT'); } - $this->data = array( + $this->data = [ 'token' => $response->headers->get('X-Debug-Token'), 'start_time' => $startTime * 1000, - 'events' => array(), - ); + 'events' => [], + ]; } /** @@ -55,7 +55,7 @@ class TimeDataCollector extends DataCollector implements LateDataCollectorInterf */ public function reset() { - $this->data = array(); + $this->data = []; if (null !== $this->stopwatch) { $this->stopwatch->reset(); diff --git a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php index 221d33473e..9476d50486 100644 --- a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php +++ b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php @@ -36,7 +36,7 @@ class FileLinkFormatter implements \Serializable $fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); if ($fileLinkFormat && !\is_array($fileLinkFormat)) { $i = strpos($f = $fileLinkFormat, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f); - $fileLinkFormat = array(substr($f, 0, $i)) + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); + $fileLinkFormat = [substr($f, 0, $i)] + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); } $this->fileLinkFormat = $fileLinkFormat; @@ -55,20 +55,26 @@ class FileLinkFormatter implements \Serializable } } - return strtr($fmt[0], array('%f' => $file, '%l' => $line)); + return strtr($fmt[0], ['%f' => $file, '%l' => $line]); } return false; } + /** + * @internal + */ public function serialize() { return serialize($this->getFileLinkFormat()); } + /** + * @internal + */ public function unserialize($serialized) { - $this->fileLinkFormat = unserialize($serialized, array('allowed_classes' => false)); + $this->fileLinkFormat = unserialize($serialized, ['allowed_classes' => false]); } /** @@ -95,10 +101,10 @@ class FileLinkFormatter implements \Serializable return; } - return array( + return [ $request->getSchemeAndHttpHost().$request->getBasePath().$this->urlFormat, $this->baseDir.\DIRECTORY_SEPARATOR, '', - ); + ]; } } } diff --git a/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php b/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php index 783e6fbbe6..2659d34de6 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php @@ -59,7 +59,7 @@ class AddAnnotatedClassesToCachePass implements CompilerPassInterface */ private function expandClasses(array $patterns, array $classes) { - $expanded = array(); + $expanded = []; // Explicit classes declared in the patterns are returned directly foreach ($patterns as $key => $pattern) { @@ -85,7 +85,7 @@ class AddAnnotatedClassesToCachePass implements CompilerPassInterface private function getClassesInComposerClassMaps() { - $classes = array(); + $classes = []; foreach (spl_autoload_functions() as $function) { if (!\is_array($function)) { @@ -106,14 +106,14 @@ class AddAnnotatedClassesToCachePass implements CompilerPassInterface private function patternsToRegexps($patterns) { - $regexps = array(); + $regexps = []; foreach ($patterns as $pattern) { // Escape user input $regex = preg_quote(ltrim($pattern, '\\')); // Wildcards * and ** - $regex = strtr($regex, array('\\*\\*' => '.*?', '\\*' => '[^\\\\]*?')); + $regex = strtr($regex, ['\\*\\*' => '.*?', '\\*' => '[^\\\\]*?']); // If this class does not end by a slash, anchor the end if ('\\' !== substr($regex, -1)) { diff --git a/vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php b/vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php index 77c0e479ae..705c88dbfa 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php @@ -52,7 +52,7 @@ class ControllerArgumentValueResolverPass implements CompilerPassInterface $id = (string) $resolverReference; $container->register("debug.$id", TraceableValueResolver::class) ->setDecoratedService($id) - ->setArguments(array(new Reference("debug.$id.inner"), new Reference($this->traceableResolverStopwatch))); + ->setArguments([new Reference("debug.$id.inner"), new Reference($this->traceableResolverStopwatch)]); } } diff --git a/vendor/symfony/http-kernel/DependencyInjection/Extension.php b/vendor/symfony/http-kernel/DependencyInjection/Extension.php index 647875554b..db376e6d9f 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/Extension.php +++ b/vendor/symfony/http-kernel/DependencyInjection/Extension.php @@ -20,7 +20,7 @@ use Symfony\Component\DependencyInjection\Extension\Extension as BaseExtension; */ abstract class Extension extends BaseExtension { - private $annotatedClasses = array(); + private $annotatedClasses = []; /** * Gets the annotated classes to cache. diff --git a/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php b/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php index 2a8c1b1b11..432f767202 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php @@ -41,7 +41,7 @@ class FragmentRendererPass implements CompilerPassInterface } $definition = $container->getDefinition($this->handlerService); - $renderers = array(); + $renderers = []; foreach ($container->findTaggedServiceIds($this->rendererTag, true) as $id => $tags) { $def = $container->getDefinition($id); $class = $container->getParameterBag()->resolveValue($def->getClass()); diff --git a/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php b/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php index 4bb47902b5..526c11faac 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php +++ b/vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php @@ -23,19 +23,19 @@ use Symfony\Component\HttpKernel\Fragment\FragmentHandler; class LazyLoadingFragmentHandler extends FragmentHandler { private $container; - private $initialized = array(); + private $initialized = []; public function __construct(ContainerInterface $container, RequestStack $requestStack, bool $debug = false) { $this->container = $container; - parent::__construct($requestStack, array(), $debug); + parent::__construct($requestStack, [], $debug); } /** * {@inheritdoc} */ - public function render($uri, $renderer = 'inline', array $options = array()) + public function render($uri, $renderer = 'inline', array $options = []) { if (!isset($this->initialized[$renderer]) && $this->container->has($renderer)) { $this->addRenderer($this->container->get($renderer)); diff --git a/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php b/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php index 1dbf7f7bee..83e1b758de 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php @@ -32,7 +32,7 @@ class MergeExtensionConfigurationPass extends BaseMergeExtensionConfigurationPas { foreach ($this->extensions as $extension) { if (!\count($container->getExtensionConfig($extension))) { - $container->loadFromExtension($extension, array()); + $container->loadFromExtension($extension, []); } } diff --git a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php index 125464b123..64d5e02473 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php @@ -49,7 +49,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface } $parameterBag = $container->getParameterBag(); - $controllers = array(); + $controllers = []; foreach ($container->findTaggedServiceIds($this->controllerTag, true) as $id => $tags) { $def = $container->getDefinition($id); @@ -72,14 +72,14 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface $isContainerAware = $r->implementsInterface(ContainerAwareInterface::class) || is_subclass_of($class, AbstractController::class); // get regular public methods - $methods = array(); - $arguments = array(); + $methods = []; + $arguments = []; foreach ($r->getMethods(\ReflectionMethod::IS_PUBLIC) as $r) { if ('setContainer' === $r->name && $isContainerAware) { continue; } if (!$r->isConstructor() && !$r->isDestructor() && !$r->isAbstract()) { - $methods[strtolower($r->name)] = array($r, $r->getParameters()); + $methods[strtolower($r->name)] = [$r, $r->getParameters()]; } } @@ -89,7 +89,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface $autowire = true; continue; } - foreach (array('action', 'argument', 'id') as $k) { + foreach (['action', 'argument', 'id'] as $k) { if (!isset($attributes[$k][0])) { throw new InvalidArgumentException(sprintf('Missing "%s" attribute on tag "%s" %s for service "%s".', $k, $this->controllerTag, json_encode($attributes, JSON_UNESCAPED_UNICODE), $id)); } @@ -119,7 +119,7 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface /** @var \ReflectionMethod $r */ // create a per-method map of argument-names to service/type-references - $args = array(); + $args = []; foreach ($parameters as $p) { /** @var \ReflectionParameter $p */ $type = ltrim($target = ProxyHelper::getTypeHint($r, $p), '\\'); @@ -138,13 +138,13 @@ class RegisterControllerArgumentLocatorsPass implements CompilerPassInterface $binding = $bindings[$bindingName]; list($bindingValue, $bindingId) = $binding->getValues(); - $binding->setValues(array($bindingValue, $bindingId, true)); + $binding->setValues([$bindingValue, $bindingId, true]); if (!$bindingValue instanceof Reference) { $args[$p->name] = new Reference('.value.'.$container->hash($bindingValue)); $container->register((string) $args[$p->name], 'mixed') ->setFactory('current') - ->addArgument(array($bindingValue)); + ->addArgument([$bindingValue]); } else { $args[$p->name] = $bindingValue; } diff --git a/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php b/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php index 564f879ca7..c1199f639e 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php @@ -39,7 +39,7 @@ class ResettableServicePass implements CompilerPassInterface return; } - $services = $methods = array(); + $services = $methods = []; foreach ($container->findTaggedServiceIds($this->tagName, true) as $id => $tags) { $services[$id] = new Reference($id, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE); diff --git a/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php b/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php index c7c1717069..80d57e506a 100644 --- a/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php @@ -38,7 +38,7 @@ abstract class AbstractSessionListener implements EventSubscriberInterface const NO_AUTO_CACHE_CONTROL_HEADER = 'Symfony-Session-NoAutoCacheControl'; protected $container; - private $sessionUsageStack = array(); + private $sessionUsageStack = []; public function __construct(ContainerInterface $container = null) { @@ -131,12 +131,12 @@ abstract class AbstractSessionListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array('onKernelRequest', 128), + return [ + KernelEvents::REQUEST => ['onKernelRequest', 128], // low priority to come after regular response listeners, but higher than StreamedResponseListener - KernelEvents::RESPONSE => array('onKernelResponse', -1000), - KernelEvents::FINISH_REQUEST => array('onFinishRequest'), - ); + KernelEvents::RESPONSE => ['onKernelResponse', -1000], + KernelEvents::FINISH_REQUEST => ['onFinishRequest'], + ]; } /** diff --git a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php index 993c6ddf97..58b3580024 100644 --- a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php @@ -32,7 +32,7 @@ abstract class AbstractTestSessionListener implements EventSubscriberInterface private $sessionId; private $sessionOptions; - public function __construct(array $sessionOptions = array()) + public function __construct(array $sessionOptions = []) { $this->sessionOptions = $sessionOptions; } @@ -78,7 +78,7 @@ abstract class AbstractTestSessionListener implements EventSubscriberInterface } if ($session instanceof Session ? !$session->isEmpty() || (null !== $this->sessionId && $session->getId() !== $this->sessionId) : $wasStarted) { - $params = session_get_cookie_params() + array('samesite' => null); + $params = session_get_cookie_params() + ['samesite' => null]; foreach ($this->sessionOptions as $k => $v) { if (0 === strpos($k, 'cookie_')) { $params[substr($k, 7)] = $v; @@ -98,10 +98,10 @@ abstract class AbstractTestSessionListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array('onKernelRequest', 192), - KernelEvents::RESPONSE => array('onKernelResponse', -128), - ); + return [ + KernelEvents::REQUEST => ['onKernelRequest', 192], + KernelEvents::RESPONSE => ['onKernelResponse', -128], + ]; } /** diff --git a/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php b/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php index 5ec528417c..68d806af01 100644 --- a/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php +++ b/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php @@ -45,6 +45,6 @@ class AddRequestFormatsListener implements EventSubscriberInterface */ public static function getSubscribedEvents() { - return array(KernelEvents::REQUEST => array('onKernelRequest', 1)); + return [KernelEvents::REQUEST => ['onKernelRequest', 1]]; } } diff --git a/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php b/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php index 47fe05c5e1..529375a5dd 100644 --- a/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php +++ b/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php @@ -145,10 +145,10 @@ class DebugHandlersListener implements EventSubscriberInterface public static function getSubscribedEvents() { - $events = array(KernelEvents::REQUEST => array('configure', 2048)); + $events = [KernelEvents::REQUEST => ['configure', 2048]]; if ('cli' === \PHP_SAPI && \defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) { - $events[ConsoleEvents::COMMAND] = array('configure', 2048); + $events[ConsoleEvents::COMMAND] = ['configure', 2048]; } return $events; diff --git a/vendor/symfony/http-kernel/EventListener/DumpListener.php b/vendor/symfony/http-kernel/EventListener/DumpListener.php index 3acbe7d46c..30908a4f45 100644 --- a/vendor/symfony/http-kernel/EventListener/DumpListener.php +++ b/vendor/symfony/http-kernel/EventListener/DumpListener.php @@ -54,10 +54,10 @@ class DumpListener implements EventSubscriberInterface public static function getSubscribedEvents() { if (!class_exists(ConsoleEvents::class)) { - return array(); + return []; } // Register early to have a working dump() as early as possible - return array(ConsoleEvents::COMMAND => array('configure', 1024)); + return [ConsoleEvents::COMMAND => ['configure', 1024]]; } } diff --git a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php index 02b1d4ddc3..dd00797f5f 100644 --- a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php +++ b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php @@ -112,12 +112,12 @@ class ExceptionListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::EXCEPTION => array( - array('logKernelException', 0), - array('onKernelException', -128), - ), - ); + return [ + KernelEvents::EXCEPTION => [ + ['logKernelException', 0], + ['onKernelException', -128], + ], + ]; } /** @@ -130,9 +130,9 @@ class ExceptionListener implements EventSubscriberInterface { if (null !== $this->logger) { if (!$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500) { - $this->logger->critical($message, array('exception' => $exception)); + $this->logger->critical($message, ['exception' => $exception]); } else { - $this->logger->error($message, array('exception' => $exception)); + $this->logger->error($message, ['exception' => $exception]); } } } @@ -147,7 +147,7 @@ class ExceptionListener implements EventSubscriberInterface */ protected function duplicateRequest(\Exception $exception, Request $request) { - $attributes = array( + $attributes = [ 'exception' => $exception = FlattenException::create($exception), '_controller' => $this->controller ?: function () use ($exception) { $handler = new ExceptionHandler($this->debug, $this->charset, $this->fileLinkFormat); @@ -155,7 +155,7 @@ class ExceptionListener implements EventSubscriberInterface return new Response($handler->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders()); }, 'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null, - ); + ]; $request = $request->duplicate(null, null, $attributes); $request->setMethod('GET'); diff --git a/vendor/symfony/http-kernel/EventListener/FragmentListener.php b/vendor/symfony/http-kernel/EventListener/FragmentListener.php index b47aa7cca0..5a789a3eb9 100644 --- a/vendor/symfony/http-kernel/EventListener/FragmentListener.php +++ b/vendor/symfony/http-kernel/EventListener/FragmentListener.php @@ -70,7 +70,7 @@ class FragmentListener implements EventSubscriberInterface parse_str($request->query->get('_path', ''), $attributes); $request->attributes->add($attributes); - $request->attributes->set('_route_params', array_replace($request->attributes->get('_route_params', array()), $attributes)); + $request->attributes->set('_route_params', array_replace($request->attributes->get('_route_params', []), $attributes)); $request->query->remove('_path'); } @@ -92,8 +92,8 @@ class FragmentListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array(array('onKernelRequest', 48)), - ); + return [ + KernelEvents::REQUEST => [['onKernelRequest', 48]], + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/LocaleListener.php b/vendor/symfony/http-kernel/EventListener/LocaleListener.php index 1067e8a0a5..a60bc69f0a 100644 --- a/vendor/symfony/http-kernel/EventListener/LocaleListener.php +++ b/vendor/symfony/http-kernel/EventListener/LocaleListener.php @@ -74,10 +74,10 @@ class LocaleListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( + return [ // must be registered after the Router to have access to the _locale - KernelEvents::REQUEST => array(array('onKernelRequest', 16)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - ); + KernelEvents::REQUEST => [['onKernelRequest', 16]], + KernelEvents::FINISH_REQUEST => [['onKernelFinishRequest', 0]], + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/ProfilerListener.php b/vendor/symfony/http-kernel/EventListener/ProfilerListener.php index 03344be7a6..df0e5cf8a6 100644 --- a/vendor/symfony/http-kernel/EventListener/ProfilerListener.php +++ b/vendor/symfony/http-kernel/EventListener/ProfilerListener.php @@ -119,10 +119,10 @@ class ProfilerListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::RESPONSE => array('onKernelResponse', -100), - KernelEvents::EXCEPTION => array('onKernelException', 0), - KernelEvents::TERMINATE => array('onKernelTerminate', -1024), - ); + return [ + KernelEvents::RESPONSE => ['onKernelResponse', -100], + KernelEvents::EXCEPTION => ['onKernelException', 0], + KernelEvents::TERMINATE => ['onKernelTerminate', -1024], + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/ResponseListener.php b/vendor/symfony/http-kernel/EventListener/ResponseListener.php index 0550c0230e..331694b176 100644 --- a/vendor/symfony/http-kernel/EventListener/ResponseListener.php +++ b/vendor/symfony/http-kernel/EventListener/ResponseListener.php @@ -49,8 +49,8 @@ class ResponseListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( + return [ KernelEvents::RESPONSE => 'onKernelResponse', - ); + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/RouterListener.php b/vendor/symfony/http-kernel/EventListener/RouterListener.php index 3919284564..3098657760 100644 --- a/vendor/symfony/http-kernel/EventListener/RouterListener.php +++ b/vendor/symfony/http-kernel/EventListener/RouterListener.php @@ -118,12 +118,12 @@ class RouterListener implements EventSubscriberInterface } if (null !== $this->logger) { - $this->logger->info('Matched route "{route}".', array( + $this->logger->info('Matched route "{route}".', [ 'route' => isset($parameters['_route']) ? $parameters['_route'] : 'n/a', 'route_parameters' => $parameters, 'request_uri' => $request->getUri(), 'method' => $request->getMethod(), - )); + ]); } $request->attributes->add($parameters); @@ -157,11 +157,11 @@ class RouterListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array(array('onKernelRequest', 32)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - KernelEvents::EXCEPTION => array('onKernelException', -64), - ); + return [ + KernelEvents::REQUEST => [['onKernelRequest', 32]], + KernelEvents::FINISH_REQUEST => [['onKernelFinishRequest', 0]], + KernelEvents::EXCEPTION => ['onKernelException', -64], + ]; } private function createWelcomeResponse() diff --git a/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php b/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php index 99382ea3cc..b14153ad3c 100644 --- a/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/SaveSessionListener.php @@ -38,9 +38,9 @@ class SaveSessionListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( + return [ // low priority but higher than StreamedResponseListener - KernelEvents::RESPONSE => array(array('onKernelResponse', -1000)), - ); + KernelEvents::RESPONSE => [['onKernelResponse', -1000]], + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/SessionListener.php b/vendor/symfony/http-kernel/EventListener/SessionListener.php index 75624b6c5c..aaf3be507f 100644 --- a/vendor/symfony/http-kernel/EventListener/SessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/SessionListener.php @@ -42,7 +42,7 @@ class SessionListener extends AbstractSessionListener && ($storage = $this->container->get('session_storage')) instanceof NativeSessionStorage && $this->container->get('request_stack')->getMasterRequest()->isSecure() ) { - $storage->setOptions(array('cookie_secure' => true)); + $storage->setOptions(['cookie_secure' => true]); } return $this->container->get('session'); diff --git a/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php b/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php index 2c616b9182..895176a931 100644 --- a/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php +++ b/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php @@ -42,8 +42,8 @@ class StreamedResponseListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::RESPONSE => array('onKernelResponse', -1024), - ); + return [ + KernelEvents::RESPONSE => ['onKernelResponse', -1024], + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/SurrogateListener.php b/vendor/symfony/http-kernel/EventListener/SurrogateListener.php index 6343533857..0fddddde42 100644 --- a/vendor/symfony/http-kernel/EventListener/SurrogateListener.php +++ b/vendor/symfony/http-kernel/EventListener/SurrogateListener.php @@ -58,8 +58,8 @@ class SurrogateListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( + return [ KernelEvents::RESPONSE => 'onKernelResponse', - ); + ]; } } diff --git a/vendor/symfony/http-kernel/EventListener/TestSessionListener.php b/vendor/symfony/http-kernel/EventListener/TestSessionListener.php index 23589a2bb3..46323ae2a8 100644 --- a/vendor/symfony/http-kernel/EventListener/TestSessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/TestSessionListener.php @@ -24,7 +24,7 @@ class TestSessionListener extends AbstractTestSessionListener { private $container; - public function __construct(ContainerInterface $container, array $sessionOptions = array()) + public function __construct(ContainerInterface $container, array $sessionOptions = []) { $this->container = $container; parent::__construct($sessionOptions); diff --git a/vendor/symfony/http-kernel/EventListener/TranslatorListener.php b/vendor/symfony/http-kernel/EventListener/TranslatorListener.php index e0b344e4a8..361b11fcec 100644 --- a/vendor/symfony/http-kernel/EventListener/TranslatorListener.php +++ b/vendor/symfony/http-kernel/EventListener/TranslatorListener.php @@ -58,11 +58,11 @@ class TranslatorListener implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( + return [ // must be registered after the Locale listener - KernelEvents::REQUEST => array(array('onKernelRequest', 10)), - KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), - ); + KernelEvents::REQUEST => [['onKernelRequest', 10]], + KernelEvents::FINISH_REQUEST => [['onKernelFinishRequest', 0]], + ]; } private function setLocale(Request $request) diff --git a/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php b/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php index a33853f727..2e921869b9 100644 --- a/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php +++ b/vendor/symfony/http-kernel/EventListener/ValidateRequestListener.php @@ -44,10 +44,10 @@ class ValidateRequestListener implements EventSubscriberInterface */ public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array( - array('onKernelRequest', 256), - ), - ); + return [ + KernelEvents::REQUEST => [ + ['onKernelRequest', 256], + ], + ]; } } diff --git a/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php b/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php index 3aedbf97fe..f6f4ff53f0 100644 --- a/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php +++ b/vendor/symfony/http-kernel/Exception/AccessDeniedHttpException.php @@ -23,7 +23,7 @@ class AccessDeniedHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = array()) + public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = []) { parent::__construct(403, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php b/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php index ff215db45f..4b25adcba3 100644 --- a/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php +++ b/vendor/symfony/http-kernel/Exception/BadRequestHttpException.php @@ -22,7 +22,7 @@ class BadRequestHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = array()) + public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = []) { parent::__construct(400, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Exception/ConflictHttpException.php b/vendor/symfony/http-kernel/Exception/ConflictHttpException.php index 60195daf7b..6c8a1b3c53 100644 --- a/vendor/symfony/http-kernel/Exception/ConflictHttpException.php +++ b/vendor/symfony/http-kernel/Exception/ConflictHttpException.php @@ -22,7 +22,7 @@ class ConflictHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = array()) + public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = []) { parent::__construct(409, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Exception/ControllerDoesNotReturnResponseException.php b/vendor/symfony/http-kernel/Exception/ControllerDoesNotReturnResponseException.php index 39149aa5b7..517313db60 100644 --- a/vendor/symfony/http-kernel/Exception/ControllerDoesNotReturnResponseException.php +++ b/vendor/symfony/http-kernel/Exception/ControllerDoesNotReturnResponseException.php @@ -28,12 +28,12 @@ class ControllerDoesNotReturnResponseException extends \LogicException $this->line = $controllerDefinition['line']; $r = new \ReflectionProperty(\Exception::class, 'trace'); $r->setAccessible(true); - $r->setValue($this, array_merge(array( - array( + $r->setValue($this, array_merge([ + [ 'line' => $line, 'file' => $file, - ), - ), $this->getTrace())); + ], + ], $this->getTrace())); } private function parseControllerDefinition(callable $controller): ?array @@ -46,10 +46,10 @@ class ControllerDoesNotReturnResponseException extends \LogicException try { $r = new \ReflectionMethod($controller[0], $controller[1]); - return array( + return [ 'file' => $r->getFileName(), 'line' => $r->getEndLine(), - ); + ]; } catch (\ReflectionException $e) { return null; } @@ -58,19 +58,19 @@ class ControllerDoesNotReturnResponseException extends \LogicException if ($controller instanceof \Closure) { $r = new \ReflectionFunction($controller); - return array( + return [ 'file' => $r->getFileName(), 'line' => $r->getEndLine(), - ); + ]; } if (\is_object($controller)) { $r = new \ReflectionClass($controller); - return array( + return [ 'file' => $r->getFileName(), 'line' => $r->getEndLine(), - ); + ]; } return null; diff --git a/vendor/symfony/http-kernel/Exception/GoneHttpException.php b/vendor/symfony/http-kernel/Exception/GoneHttpException.php index f2f3515f77..de0d5f2c2c 100644 --- a/vendor/symfony/http-kernel/Exception/GoneHttpException.php +++ b/vendor/symfony/http-kernel/Exception/GoneHttpException.php @@ -22,7 +22,7 @@ class GoneHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = array()) + public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = []) { parent::__construct(410, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Exception/HttpException.php b/vendor/symfony/http-kernel/Exception/HttpException.php index dab73120d0..3acb52ac35 100644 --- a/vendor/symfony/http-kernel/Exception/HttpException.php +++ b/vendor/symfony/http-kernel/Exception/HttpException.php @@ -21,7 +21,7 @@ class HttpException extends \RuntimeException implements HttpExceptionInterface private $statusCode; private $headers; - public function __construct(int $statusCode, string $message = null, \Exception $previous = null, array $headers = array(), ?int $code = 0) + public function __construct(int $statusCode, string $message = null, \Exception $previous = null, array $headers = [], ?int $code = 0) { $this->statusCode = $statusCode; $this->headers = $headers; diff --git a/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php b/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php index 46b76ba6a3..287c07a0c1 100644 --- a/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php +++ b/vendor/symfony/http-kernel/Exception/LengthRequiredHttpException.php @@ -22,7 +22,7 @@ class LengthRequiredHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = array()) + public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = []) { parent::__construct(411, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php b/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php index b0085c16fa..e9a3f069f1 100644 --- a/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php +++ b/vendor/symfony/http-kernel/Exception/MethodNotAllowedHttpException.php @@ -23,7 +23,7 @@ class MethodNotAllowedHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(array $allow, string $message = null, \Exception $previous = null, ?int $code = 0, array $headers = array()) + public function __construct(array $allow, string $message = null, \Exception $previous = null, ?int $code = 0, array $headers = []) { $headers['Allow'] = strtoupper(implode(', ', $allow)); diff --git a/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php b/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php index 32c3089374..5596330881 100644 --- a/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php +++ b/vendor/symfony/http-kernel/Exception/NotAcceptableHttpException.php @@ -22,7 +22,7 @@ class NotAcceptableHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = array()) + public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = []) { parent::__construct(406, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php b/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php index 433ff9b9e0..551b3edc59 100644 --- a/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php +++ b/vendor/symfony/http-kernel/Exception/NotFoundHttpException.php @@ -22,7 +22,7 @@ class NotFoundHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = array()) + public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = []) { parent::__construct(404, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php b/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php index 108178889c..c1a59fb8df 100644 --- a/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php +++ b/vendor/symfony/http-kernel/Exception/PreconditionFailedHttpException.php @@ -22,7 +22,7 @@ class PreconditionFailedHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = array()) + public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = []) { parent::__construct(412, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php b/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php index 3078328241..fd95b042c5 100644 --- a/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php +++ b/vendor/symfony/http-kernel/Exception/PreconditionRequiredHttpException.php @@ -24,7 +24,7 @@ class PreconditionRequiredHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = array()) + public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = []) { parent::__construct(428, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php b/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php index 667764779f..18b12d83cc 100644 --- a/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php +++ b/vendor/symfony/http-kernel/Exception/ServiceUnavailableHttpException.php @@ -23,7 +23,7 @@ class ServiceUnavailableHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct($retryAfter = null, string $message = null, \Exception $previous = null, ?int $code = 0, array $headers = array()) + public function __construct($retryAfter = null, string $message = null, \Exception $previous = null, ?int $code = 0, array $headers = []) { if ($retryAfter) { $headers['Retry-After'] = $retryAfter; diff --git a/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php b/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php index 60b024c330..91e65e2d70 100644 --- a/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php +++ b/vendor/symfony/http-kernel/Exception/TooManyRequestsHttpException.php @@ -25,7 +25,7 @@ class TooManyRequestsHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct($retryAfter = null, string $message = null, \Exception $previous = null, ?int $code = 0, array $headers = array()) + public function __construct($retryAfter = null, string $message = null, \Exception $previous = null, ?int $code = 0, array $headers = []) { if ($retryAfter) { $headers['Retry-After'] = $retryAfter; diff --git a/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php b/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php index 17ebb25464..bc42877fe8 100644 --- a/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php +++ b/vendor/symfony/http-kernel/Exception/UnauthorizedHttpException.php @@ -23,7 +23,7 @@ class UnauthorizedHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(string $challenge, string $message = null, \Exception $previous = null, ?int $code = 0, array $headers = array()) + public function __construct(string $challenge, string $message = null, \Exception $previous = null, ?int $code = 0, array $headers = []) { $headers['WWW-Authenticate'] = $challenge; diff --git a/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php b/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php index 3a4b40c984..9cad444c6c 100644 --- a/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php +++ b/vendor/symfony/http-kernel/Exception/UnprocessableEntityHttpException.php @@ -22,7 +22,7 @@ class UnprocessableEntityHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = array()) + public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = []) { parent::__construct(422, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php b/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php index ed6861154a..e52e1d88d2 100644 --- a/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php +++ b/vendor/symfony/http-kernel/Exception/UnsupportedMediaTypeHttpException.php @@ -22,7 +22,7 @@ class UnsupportedMediaTypeHttpException extends HttpException * @param int $code The internal exception code * @param array $headers */ - public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = array()) + public function __construct(string $message = null, \Exception $previous = null, int $code = 0, array $headers = []) { parent::__construct(415, $message, $previous, $headers, $code); } diff --git a/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php index 6ab6ec1fd0..5b76f7a8d8 100644 --- a/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php +++ b/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php @@ -59,7 +59,7 @@ abstract class AbstractSurrogateFragmentRenderer extends RoutableFragmentRendere * * @see Symfony\Component\HttpKernel\HttpCache\SurrogateInterface */ - public function render($uri, Request $request, array $options = array()) + public function render($uri, Request $request, array $options = []) { if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) { if ($uri instanceof ControllerReference && $this->containsNonScalars($uri->attributes)) { diff --git a/vendor/symfony/http-kernel/Fragment/FragmentHandler.php b/vendor/symfony/http-kernel/Fragment/FragmentHandler.php index 0c31826b27..758f0e8fc1 100644 --- a/vendor/symfony/http-kernel/Fragment/FragmentHandler.php +++ b/vendor/symfony/http-kernel/Fragment/FragmentHandler.php @@ -29,7 +29,7 @@ use Symfony\Component\HttpKernel\Controller\ControllerReference; class FragmentHandler { private $debug; - private $renderers = array(); + private $renderers = []; private $requestStack; /** @@ -37,7 +37,7 @@ class FragmentHandler * @param FragmentRendererInterface[] $renderers An array of FragmentRendererInterface instances * @param bool $debug Whether the debug mode is enabled or not */ - public function __construct(RequestStack $requestStack, array $renderers = array(), bool $debug = false) + public function __construct(RequestStack $requestStack, array $renderers = [], bool $debug = false) { $this->requestStack = $requestStack; foreach ($renderers as $renderer) { @@ -70,7 +70,7 @@ class FragmentHandler * @throws \InvalidArgumentException when the renderer does not exist * @throws \LogicException when no master request is being handled */ - public function render($uri, $renderer = 'inline', array $options = array()) + public function render($uri, $renderer = 'inline', array $options = []) { if (!isset($options['ignore_errors'])) { $options['ignore_errors'] = !$this->debug; diff --git a/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php b/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php index bcf4e9944a..8e454a01a6 100644 --- a/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php +++ b/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php @@ -31,7 +31,7 @@ interface FragmentRendererInterface * * @return Response A Response instance */ - public function render($uri, Request $request, array $options = array()); + public function render($uri, Request $request, array $options = []); /** * Gets the name of the strategy. diff --git a/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php index 3ee0cfa264..7b8e761922 100644 --- a/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php +++ b/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php @@ -81,7 +81,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer * * id: An optional hx:include tag id attribute * * attributes: An optional array of hx:include tag attributes */ - public function render($uri, Request $request, array $options = array()) + public function render($uri, Request $request, array $options = []) { if ($uri instanceof ControllerReference) { if (null === $this->signer) { @@ -102,7 +102,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer $content = $template; } - $attributes = isset($options['attributes']) && \is_array($options['attributes']) ? $options['attributes'] : array(); + $attributes = isset($options['attributes']) && \is_array($options['attributes']) ? $options['attributes'] : []; if (isset($options['id']) && $options['id']) { $attributes['id'] = $options['id']; } diff --git a/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php index ecf12f2182..5ee09fb1a7 100644 --- a/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php +++ b/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php @@ -43,7 +43,7 @@ class InlineFragmentRenderer extends RoutableFragmentRenderer * * * alt: an alternative URI to render in case of an error */ - public function render($uri, Request $request, array $options = array()) + public function render($uri, Request $request, array $options = []) { $reference = null; if ($uri instanceof ControllerReference) { @@ -54,10 +54,10 @@ class InlineFragmentRenderer extends RoutableFragmentRenderer // want that as we want to preserve objects (so we manually set Request attributes // below instead) $attributes = $reference->attributes; - $reference->attributes = array(); + $reference->attributes = []; // The request format and locale might have been overridden by the user - foreach (array('_format', '_locale') as $key) { + foreach (['_format', '_locale'] as $key) { if (isset($attributes[$key])) { $reference->attributes[$key] = $attributes[$key]; } @@ -113,7 +113,7 @@ class InlineFragmentRenderer extends RoutableFragmentRenderer unset($server['HTTP_IF_MODIFIED_SINCE']); unset($server['HTTP_IF_NONE_MATCH']); - $subRequest = Request::create($uri, 'get', array(), $cookies, array(), $server); + $subRequest = Request::create($uri, 'get', [], $cookies, [], $server); if ($request->headers->has('Surrogate-Capability')) { $subRequest->headers->set('Surrogate-Capability', $request->headers->get('Surrogate-Capability')); } diff --git a/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php b/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php index 3b2d5f262c..8918a30570 100644 --- a/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php +++ b/vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php @@ -24,16 +24,16 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; abstract class AbstractSurrogate implements SurrogateInterface { protected $contentTypes; - protected $phpEscapeMap = array( - array('<?', '<%', '<s', '<S'), - array('<?php echo "<?"; ?>', '<?php echo "<%"; ?>', '<?php echo "<s"; ?>', '<?php echo "<S"; ?>'), - ); + protected $phpEscapeMap = [ + ['<?', '<%', '<s', '<S'], + ['<?php echo "<?"; ?>', '<?php echo "<%"; ?>', '<?php echo "<s"; ?>', '<?php echo "<S"; ?>'], + ]; /** * @param array $contentTypes An array of content-type that should be parsed for Surrogate information * (default: text/html, text/xml, application/xhtml+xml, and application/xml) */ - public function __construct(array $contentTypes = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/xml')) + public function __construct(array $contentTypes = ['text/html', 'text/xml', 'application/xhtml+xml', 'application/xml']) { $this->contentTypes = $contentTypes; } @@ -90,7 +90,7 @@ abstract class AbstractSurrogate implements SurrogateInterface */ public function handle(HttpCache $cache, $uri, $alt, $ignoreErrors) { - $subRequest = Request::create($uri, Request::METHOD_GET, array(), $cache->getRequest()->cookies->all(), array(), $cache->getRequest()->server->all()); + $subRequest = Request::create($uri, Request::METHOD_GET, [], $cache->getRequest()->cookies->all(), [], $cache->getRequest()->server->all()); try { $response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true); diff --git a/vendor/symfony/http-kernel/HttpCache/Esi.php b/vendor/symfony/http-kernel/HttpCache/Esi.php index 69134c71a1..dc62990b40 100644 --- a/vendor/symfony/http-kernel/HttpCache/Esi.php +++ b/vendor/symfony/http-kernel/HttpCache/Esi.php @@ -85,7 +85,7 @@ class Esi extends AbstractSurrogate $i = 1; while (isset($chunks[$i])) { - $options = array(); + $options = []; preg_match_all('/(src|onerror|alt)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER); foreach ($matches as $set) { $options[$set[1]] = $set[2]; diff --git a/vendor/symfony/http-kernel/HttpCache/HttpCache.php b/vendor/symfony/http-kernel/HttpCache/HttpCache.php index 6980745add..84b01659f9 100644 --- a/vendor/symfony/http-kernel/HttpCache/HttpCache.php +++ b/vendor/symfony/http-kernel/HttpCache/HttpCache.php @@ -32,8 +32,8 @@ class HttpCache implements HttpKernelInterface, TerminableInterface private $request; private $surrogate; private $surrogateCacheStrategy; - private $options = array(); - private $traces = array(); + private $options = []; + private $traces = []; /** * Constructor. @@ -70,24 +70,24 @@ class HttpCache implements HttpKernelInterface, TerminableInterface * This setting is overridden by the stale-if-error HTTP Cache-Control extension * (see RFC 5861). */ - public function __construct(HttpKernelInterface $kernel, StoreInterface $store, SurrogateInterface $surrogate = null, array $options = array()) + public function __construct(HttpKernelInterface $kernel, StoreInterface $store, SurrogateInterface $surrogate = null, array $options = []) { $this->store = $store; $this->kernel = $kernel; $this->surrogate = $surrogate; // needed in case there is a fatal error because the backend is too slow to respond - register_shutdown_function(array($this->store, 'cleanup')); + register_shutdown_function([$this->store, 'cleanup']); - $this->options = array_merge(array( + $this->options = array_merge([ 'debug' => false, 'default_ttl' => 0, - 'private_headers' => array('Authorization', 'Cookie'), + 'private_headers' => ['Authorization', 'Cookie'], 'allow_reload' => false, 'allow_revalidate' => false, 'stale_while_revalidate' => 2, 'stale_if_error' => 60, - ), $options); + ], $options); } /** @@ -117,7 +117,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface */ public function getLog() { - $log = array(); + $log = []; foreach ($this->traces as $request => $traces) { $log[] = sprintf('%s: %s', $request, implode(', ', $traces)); } @@ -164,7 +164,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface { // FIXME: catch exceptions and implement a 500 error page here? -> in Varnish, there is a built-in error page mechanism if (HttpKernelInterface::MASTER_REQUEST === $type) { - $this->traces = array(); + $this->traces = []; // Keep a clone of the original request for surrogates so they can access it. // We must clone here to get a separate instance because the application will modify the request during // the application flow (we know it always does because we do ourselves by setting REMOTE_ADDR to 127.0.0.1 @@ -175,7 +175,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface } } - $this->traces[$this->getTraceKey($request)] = array(); + $this->traces[$this->getTraceKey($request)] = []; if (!$request->isMethodSafe(false)) { $response = $this->invalidate($request, $catch); @@ -260,9 +260,9 @@ class HttpCache implements HttpKernelInterface, TerminableInterface $this->store->invalidate($request); // As per the RFC, invalidate Location and Content-Location URLs if present - foreach (array('Location', 'Content-Location') as $header) { + foreach (['Location', 'Content-Location'] as $header) { if ($uri = $response->headers->get($header)) { - $subRequest = Request::create($uri, 'get', array(), array(), array(), $request->server->all()); + $subRequest = Request::create($uri, 'get', [], [], [], $request->server->all()); $this->store->invalidate($subRequest); } @@ -357,7 +357,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface // Add our cached etag validator to the environment. // We keep the etags from the client to handle the case when the client // has a different private valid entry which is not cached here. - $cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array(); + $cachedEtags = $entry->getEtag() ? [$entry->getEtag()] : []; $requestEtags = $request->getETags(); if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) { $subRequest->headers->set('if_none_match', implode(', ', $etags)); @@ -377,7 +377,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface $entry = clone $entry; $entry->headers->remove('Date'); - foreach (array('Date', 'Expires', 'Cache-Control', 'ETag', 'Last-Modified') as $name) { + foreach (['Date', 'Expires', 'Cache-Control', 'ETag', 'Last-Modified'] as $name) { if ($response->headers->has($name)) { $entry->headers->set($name, $response->headers->get($name)); } @@ -448,7 +448,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface $response = SubRequestHandler::handle($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, $catch); // we don't implement the stale-if-error on Requests, which is nonetheless part of the RFC - if (null !== $entry && \in_array($response->getStatusCode(), array(500, 502, 503, 504))) { + if (null !== $entry && \in_array($response->getStatusCode(), [500, 502, 503, 504])) { if (null === $age = $entry->headers->getCacheControlDirective('stale-if-error')) { $age = $this->options['stale_if_error']; } diff --git a/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php b/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php index 672cc893fe..168e9564b0 100644 --- a/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php +++ b/vendor/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php @@ -30,8 +30,8 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface { private $cacheable = true; private $embeddedResponses = 0; - private $ttls = array(); - private $maxAges = array(); + private $ttls = []; + private $maxAges = []; private $isNotCacheableResponseEmbedded = false; /** diff --git a/vendor/symfony/http-kernel/HttpCache/Ssi.php b/vendor/symfony/http-kernel/HttpCache/Ssi.php index 58df176019..eaaa230b50 100644 --- a/vendor/symfony/http-kernel/HttpCache/Ssi.php +++ b/vendor/symfony/http-kernel/HttpCache/Ssi.php @@ -70,7 +70,7 @@ class Ssi extends AbstractSurrogate $i = 1; while (isset($chunks[$i])) { - $options = array(); + $options = []; preg_match_all('/(virtual)="([^"]*?)"/', $chunks[$i], $matches, PREG_SET_ORDER); foreach ($matches as $set) { $options[$set[1]] = $set[2]; diff --git a/vendor/symfony/http-kernel/HttpCache/Store.php b/vendor/symfony/http-kernel/HttpCache/Store.php index 925ca96fd4..0ca14c7590 100644 --- a/vendor/symfony/http-kernel/HttpCache/Store.php +++ b/vendor/symfony/http-kernel/HttpCache/Store.php @@ -38,7 +38,7 @@ class Store implements StoreInterface throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root)); } $this->keyCache = new \SplObjectStorage(); - $this->locks = array(); + $this->locks = []; } /** @@ -52,7 +52,7 @@ class Store implements StoreInterface fclose($lock); } - $this->locks = array(); + $this->locks = []; } /** @@ -190,11 +190,11 @@ class Store implements StoreInterface } // read existing cache entries, remove non-varying, and add this one to the list - $entries = array(); + $entries = []; $vary = $response->headers->get('vary'); foreach ($this->getMetadata($key) as $entry) { if (!isset($entry[1]['vary'][0])) { - $entry[1]['vary'] = array(''); + $entry[1]['vary'] = ['']; } if ($entry[1]['vary'][0] != $vary || !$this->requestsMatch($vary, $entry[0], $storedEnv)) { @@ -205,7 +205,7 @@ class Store implements StoreInterface $headers = $this->persistResponse($response); unset($headers['age']); - array_unshift($entries, array($storedEnv, $headers)); + array_unshift($entries, [$storedEnv, $headers]); if (false === $this->save($key, serialize($entries))) { throw new \RuntimeException('Unable to store the metadata.'); @@ -234,13 +234,13 @@ class Store implements StoreInterface $modified = false; $key = $this->getCacheKey($request); - $entries = array(); + $entries = []; foreach ($this->getMetadata($key) as $entry) { $response = $this->restoreResponse($entry[1]); if ($response->isFresh()) { $response->expire(); $modified = true; - $entries[] = array($entry[0], $this->persistResponse($response)); + $entries[] = [$entry[0], $this->persistResponse($response)]; } else { $entries[] = $entry; } @@ -291,7 +291,7 @@ class Store implements StoreInterface private function getMetadata($key) { if (!$entries = $this->load($key)) { - return array(); + return []; } return unserialize($entries); @@ -462,7 +462,7 @@ class Store implements StoreInterface private function persistResponse(Response $response) { $headers = $response->headers->all(); - $headers['X-Status'] = array($response->getStatusCode()); + $headers['X-Status'] = [$response->getStatusCode()]; return $headers; } @@ -481,7 +481,7 @@ class Store implements StoreInterface unset($headers['X-Status']); if (null !== $body) { - $headers['X-Body-File'] = array($body); + $headers['X-Body-File'] = [$body]; } return new Response($body, $status, $headers); diff --git a/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php b/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php index 84d7a84e79..cef9817e01 100644 --- a/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php +++ b/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php @@ -32,13 +32,13 @@ class SubRequestHandler // remove untrusted values $remoteAddr = $request->server->get('REMOTE_ADDR'); if (!IpUtils::checkIp($remoteAddr, $trustedProxies)) { - $trustedHeaders = array( + $trustedHeaders = [ 'FORWARDED' => $trustedHeaderSet & Request::HEADER_FORWARDED, 'X_FORWARDED_FOR' => $trustedHeaderSet & Request::HEADER_X_FORWARDED_FOR, 'X_FORWARDED_HOST' => $trustedHeaderSet & Request::HEADER_X_FORWARDED_HOST, 'X_FORWARDED_PROTO' => $trustedHeaderSet & Request::HEADER_X_FORWARDED_PROTO, 'X_FORWARDED_PORT' => $trustedHeaderSet & Request::HEADER_X_FORWARDED_PORT, - ); + ]; foreach (array_filter($trustedHeaders) as $name => $key) { $request->headers->remove($name); $request->server->remove('HTTP_'.$name); @@ -46,8 +46,8 @@ class SubRequestHandler } // compute trusted values, taking any trusted proxies into account - $trustedIps = array(); - $trustedValues = array(); + $trustedIps = []; + $trustedValues = []; foreach (array_reverse($request->getClientIps()) as $ip) { $trustedIps[] = $ip; $trustedValues[] = sprintf('for="%s"', $ip); @@ -78,7 +78,7 @@ class SubRequestHandler // ensure 127.0.0.1 is set as trusted proxy if (!IpUtils::checkIp('127.0.0.1', $trustedProxies)) { - Request::setTrustedProxies(array_merge($trustedProxies, array('127.0.0.1')), Request::getTrustedHeaderSet()); + Request::setTrustedProxies(array_merge($trustedProxies, ['127.0.0.1']), Request::getTrustedHeaderSet()); } try { diff --git a/vendor/symfony/http-kernel/HttpKernel.php b/vendor/symfony/http-kernel/HttpKernel.php index 7ed4118ea4..11eb718aff 100644 --- a/vendor/symfony/http-kernel/HttpKernel.php +++ b/vendor/symfony/http-kernel/HttpKernel.php @@ -260,7 +260,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface } if (\is_array($var)) { - $a = array(); + $a = []; foreach ($var as $k => $v) { $a[] = sprintf('%s => ...', $k); } diff --git a/vendor/symfony/http-kernel/Kernel.php b/vendor/symfony/http-kernel/Kernel.php index d09be5a0ba..c5e351ca3a 100644 --- a/vendor/symfony/http-kernel/Kernel.php +++ b/vendor/symfony/http-kernel/Kernel.php @@ -52,7 +52,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl /** * @var BundleInterface[] */ - protected $bundles = array(); + protected $bundles = []; protected $container; /** @@ -73,11 +73,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '4.2.2'; - const VERSION_ID = 40202; + const VERSION = '4.2.3'; + const VERSION_ID = 40203; const MAJOR_VERSION = 4; const MINOR_VERSION = 2; - const RELEASE_VERSION = 2; + const RELEASE_VERSION = 3; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '07/2019'; @@ -258,7 +258,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl $isResource = 0 === strpos($path, 'Resources') && null !== $dir; $overridePath = substr($path, 9); $bundle = $this->getBundle($bundleName); - $files = array(); + $files = []; if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { $files[] = $file; @@ -409,7 +409,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ public function getAnnotatedClassesToCompile(): array { - return array(); + return []; } /** @@ -420,7 +420,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl protected function initializeBundles() { // init bundles - $this->bundles = array(); + $this->bundles = []; foreach ($this->registerBundles() as $bundle) { $name = $bundle->getName(); if (isset($this->bundles[$name])) { @@ -447,7 +447,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl protected function getContainerClass() { $class = \get_class($this); - $class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).ContainerBuilder::hash($class) : $class; + $class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).str_replace('.', '_', ContainerBuilder::hash($class)) : $class; return $this->name.str_replace('\\', '_', $class).ucfirst($this->environment).($this->debug ? 'Debug' : '').'Container'; } @@ -498,7 +498,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl } if ($this->debug) { - $collectedLogs = array(); + $collectedLogs = []; $previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL'); $previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { @@ -522,19 +522,19 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl // Remove frames added by DebugClassLoader. for ($i = \count($backtrace) - 2; 0 < $i; --$i) { if (DebugClassLoader::class === ($backtrace[$i]['class'] ?? null)) { - $backtrace = array($backtrace[$i + 1]); + $backtrace = [$backtrace[$i + 1]]; break; } } - $collectedLogs[$message] = array( + $collectedLogs[$message] = [ 'type' => $type, 'message' => $message, 'file' => $file, 'line' => $line, - 'trace' => array($backtrace[0]), + 'trace' => [$backtrace[0]], 'count' => 1, - ); + ]; }); } @@ -571,7 +571,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl // Because concurrent requests might still be using them, // old container files are not removed immediately, // but on a next dump of the container. - static $legacyContainers = array(); + static $legacyContainers = []; $oldContainerDir = \dirname($oldContainer->getFileName()); $legacyContainers[$oldContainerDir.'.legacy'] = true; foreach (glob(\dirname($oldContainerDir).\DIRECTORY_SEPARATOR.'*.legacy') as $legacyContainer) { @@ -595,18 +595,18 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ protected function getKernelParameters() { - $bundles = array(); - $bundlesMetadata = array(); + $bundles = []; + $bundlesMetadata = []; foreach ($this->bundles as $name => $bundle) { $bundles[$name] = \get_class($bundle); - $bundlesMetadata[$name] = array( + $bundlesMetadata[$name] = [ 'path' => $bundle->getPath(), 'namespace' => $bundle->getNamespace(), - ); + ]; } - return array( + return [ /* * @deprecated since Symfony 4.2, use kernel.project_dir instead */ @@ -624,7 +624,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl 'kernel.bundles_metadata' => $bundlesMetadata, 'kernel.charset' => $this->getCharset(), 'kernel.container_class' => $this->getContainerClass(), - ); + ]; } /** @@ -636,7 +636,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ protected function buildContainer() { - foreach (array('cache' => $this->warmupDir ?: $this->getCacheDir(), 'logs' => $this->getLogDir()) as $name => $dir) { + foreach (['cache' => $this->warmupDir ?: $this->getCacheDir(), 'logs' => $this->getLogDir()] as $name => $dir) { if (!is_dir($dir)) { if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) { throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir)); @@ -664,7 +664,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl */ protected function prepareContainer(ContainerBuilder $container) { - $extensions = array(); + $extensions = []; foreach ($this->bundles as $bundle) { if ($extension = $bundle->getContainerExtension()) { $container->registerExtension($extension); @@ -726,14 +726,14 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl $dumper->setProxyDumper(new ProxyDumper()); } - $content = $dumper->dump(array( + $content = $dumper->dump([ 'class' => $class, 'base_class' => $baseClass, 'file' => $cache->getPath(), 'as_files' => true, 'debug' => $this->debug, 'build_time' => $container->hasParameter('kernel.container_build_time') ? $container->getParameter('kernel.container_build_time') : time(), - )); + ]); $rootCode = array_pop($content); $dir = \dirname($cache->getPath()).'/'; @@ -759,7 +759,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl protected function getContainerLoader(ContainerInterface $container) { $locator = new FileLocator($this); - $resolver = new LoaderResolver(array( + $resolver = new LoaderResolver([ new XmlFileLoader($container, $locator), new YamlFileLoader($container, $locator), new IniFileLoader($container, $locator), @@ -767,7 +767,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl new GlobFileLoader($container, $locator), new DirectoryLoader($container, $locator), new ClosureLoader($container), - )); + ]); return new DelegatingLoader($resolver); } @@ -811,8 +811,8 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl } // replace multiple new lines with a single newline - $rawChunk .= preg_replace(array('/\n{2,}/S'), "\n", $token[1]); - } elseif (\in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { + $rawChunk .= preg_replace(['/\n{2,}/S'], "\n", $token[1]); + } elseif (\in_array($token[0], [T_COMMENT, T_DOC_COMMENT])) { $ignoreSpace = true; } else { $rawChunk .= $token[1]; @@ -835,12 +835,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl public function serialize() { - return serialize(array($this->environment, $this->debug)); + return serialize([$this->environment, $this->debug]); } public function unserialize($data) { - list($environment, $debug) = unserialize($data, array('allowed_classes' => false)); + list($environment, $debug) = unserialize($data, ['allowed_classes' => false]); $this->__construct($environment, $debug); } diff --git a/vendor/symfony/http-kernel/Log/Logger.php b/vendor/symfony/http-kernel/Log/Logger.php index 8b671d84df..2344aa0a54 100644 --- a/vendor/symfony/http-kernel/Log/Logger.php +++ b/vendor/symfony/http-kernel/Log/Logger.php @@ -22,7 +22,7 @@ use Psr\Log\LogLevel; */ class Logger extends AbstractLogger { - private static $levels = array( + private static $levels = [ LogLevel::DEBUG => 0, LogLevel::INFO => 1, LogLevel::NOTICE => 2, @@ -31,7 +31,7 @@ class Logger extends AbstractLogger LogLevel::CRITICAL => 5, LogLevel::ALERT => 6, LogLevel::EMERGENCY => 7, - ); + ]; private $minLevelIndex; private $formatter; @@ -57,7 +57,7 @@ class Logger extends AbstractLogger } $this->minLevelIndex = self::$levels[$minLevel]; - $this->formatter = $formatter ?: array($this, 'format'); + $this->formatter = $formatter ?: [$this, 'format']; if (false === $this->handle = \is_resource($output) ? $output : @fopen($output, 'a')) { throw new InvalidArgumentException(sprintf('Unable to open "%s".', $output)); } @@ -66,7 +66,7 @@ class Logger extends AbstractLogger /** * {@inheritdoc} */ - public function log($level, $message, array $context = array()) + public function log($level, $message, array $context = []) { if (!isset(self::$levels[$level])) { throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level)); @@ -83,7 +83,7 @@ class Logger extends AbstractLogger private function format(string $level, string $message, array $context): string { if (false !== strpos($message, '{')) { - $replacements = array(); + $replacements = []; foreach ($context as $key => $val) { if (null === $val || is_scalar($val) || (\is_object($val) && method_exists($val, '__toString'))) { $replacements["{{$key}}"] = $val; diff --git a/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php b/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php index 955afed580..863998fd31 100644 --- a/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php +++ b/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php @@ -52,13 +52,13 @@ class FileProfilerStorage implements ProfilerStorageInterface $file = $this->getIndexFilename(); if (!file_exists($file)) { - return array(); + return []; } $file = fopen($file, 'r'); fseek($file, 0, SEEK_END); - $result = array(); + $result = []; while (\count($result) < $limit && $line = $this->readLineFromFile($file)) { $values = str_getcsv($line); list($csvToken, $csvIp, $csvMethod, $csvUrl, $csvTime, $csvParent, $csvStatusCode) = $values; @@ -76,7 +76,7 @@ class FileProfilerStorage implements ProfilerStorageInterface continue; } - $result[$csvToken] = array( + $result[$csvToken] = [ 'token' => $csvToken, 'ip' => $csvIp, 'method' => $csvMethod, @@ -84,7 +84,7 @@ class FileProfilerStorage implements ProfilerStorageInterface 'time' => $csvTime, 'parent' => $csvParent, 'status_code' => $csvStatusCode, - ); + ]; } fclose($file); @@ -149,7 +149,7 @@ class FileProfilerStorage implements ProfilerStorageInterface }, $profile->getChildren())); // Store profile - $data = array( + $data = [ 'token' => $profileToken, 'parent' => $parentToken, 'children' => $childrenToken, @@ -159,7 +159,7 @@ class FileProfilerStorage implements ProfilerStorageInterface 'url' => $profile->getUrl(), 'time' => $profile->getTime(), 'status_code' => $profile->getStatusCode(), - ); + ]; if (false === file_put_contents($file, serialize($data))) { return false; @@ -171,7 +171,7 @@ class FileProfilerStorage implements ProfilerStorageInterface return false; } - fputcsv($file, array( + fputcsv($file, [ $profile->getToken(), $profile->getIp(), $profile->getMethod(), @@ -179,7 +179,7 @@ class FileProfilerStorage implements ProfilerStorageInterface $profile->getTime(), $profile->getParentToken(), $profile->getStatusCode(), - )); + ]); fclose($file); } diff --git a/vendor/symfony/http-kernel/Profiler/Profile.php b/vendor/symfony/http-kernel/Profiler/Profile.php index 4716a229ea..f896c00e52 100644 --- a/vendor/symfony/http-kernel/Profiler/Profile.php +++ b/vendor/symfony/http-kernel/Profiler/Profile.php @@ -25,7 +25,7 @@ class Profile /** * @var DataCollectorInterface[] */ - private $collectors = array(); + private $collectors = []; private $ip; private $method; @@ -41,7 +41,7 @@ class Profile /** * @var Profile[] */ - private $children = array(); + private $children = []; public function __construct(string $token) { @@ -201,7 +201,7 @@ class Profile */ public function setChildren(array $children) { - $this->children = array(); + $this->children = []; foreach ($children as $child) { $this->addChild($child); } @@ -262,7 +262,7 @@ class Profile */ public function setCollectors(array $collectors) { - $this->collectors = array(); + $this->collectors = []; foreach ($collectors as $collector) { $this->addCollector($collector); } @@ -290,6 +290,6 @@ class Profile public function __sleep() { - return array('token', 'parent', 'children', 'collectors', 'ip', 'method', 'url', 'time', 'statusCode'); + return ['token', 'parent', 'children', 'collectors', 'ip', 'method', 'url', 'time', 'statusCode']; } } diff --git a/vendor/symfony/http-kernel/Profiler/Profiler.php b/vendor/symfony/http-kernel/Profiler/Profiler.php index 809a3396b9..4a32c78420 100644 --- a/vendor/symfony/http-kernel/Profiler/Profiler.php +++ b/vendor/symfony/http-kernel/Profiler/Profiler.php @@ -31,7 +31,7 @@ class Profiler implements ResetInterface /** * @var DataCollectorInterface[] */ - private $collectors = array(); + private $collectors = []; private $logger; private $initiallyEnabled = true; @@ -101,7 +101,7 @@ class Profiler implements ResetInterface } if (!($ret = $this->storage->write($profile)) && null !== $this->logger) { - $this->logger->warning('Unable to store the profiler information.', array('configured_storage' => \get_class($this->storage))); + $this->logger->warning('Unable to store the profiler information.', ['configured_storage' => \get_class($this->storage)]); } return $ret; @@ -196,9 +196,9 @@ class Profiler implements ResetInterface * * @param DataCollectorInterface[] $collectors An array of collectors */ - public function set(array $collectors = array()) + public function set(array $collectors = []) { - $this->collectors = array(); + $this->collectors = []; foreach ($collectors as $collector) { $this->add($collector); } diff --git a/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php b/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php index 5f09e4b226..9892db20ea 100644 --- a/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php +++ b/vendor/symfony/http-kernel/Tests/CacheClearer/ChainCacheClearerTest.php @@ -35,7 +35,7 @@ class ChainCacheClearerTest extends TestCase ->expects($this->once()) ->method('clear'); - $chainClearer = new ChainCacheClearer(array($clearer)); + $chainClearer = new ChainCacheClearer([$clearer]); $chainClearer->clear(self::$cacheDir); } diff --git a/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php b/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php index e1d2fe82e9..d24131dae5 100644 --- a/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php +++ b/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php @@ -24,7 +24,7 @@ class Psr6CacheClearerTest extends TestCase ->expects($this->once()) ->method('clear'); - (new Psr6CacheClearer(array('pool' => $pool)))->clear(''); + (new Psr6CacheClearer(['pool' => $pool]))->clear(''); } public function testClearPool() @@ -34,7 +34,7 @@ class Psr6CacheClearerTest extends TestCase ->expects($this->once()) ->method('clear'); - (new Psr6CacheClearer(array('pool' => $pool)))->clearPool('pool'); + (new Psr6CacheClearer(['pool' => $pool]))->clearPool('pool'); } /** diff --git a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php b/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php index 09ba7020ff..7753600959 100644 --- a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php +++ b/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php @@ -34,7 +34,7 @@ class CacheWarmerAggregateTest extends TestCase $warmer ->expects($this->once()) ->method('warmUp'); - $aggregate = new CacheWarmerAggregate(array($warmer)); + $aggregate = new CacheWarmerAggregate([$warmer]); $aggregate->warmUp(self::$cacheDir); } @@ -48,7 +48,7 @@ class CacheWarmerAggregateTest extends TestCase ->expects($this->once()) ->method('warmUp'); - $aggregate = new CacheWarmerAggregate(array($warmer)); + $aggregate = new CacheWarmerAggregate([$warmer]); $aggregate->enableOptionalWarmers(); $aggregate->warmUp(self::$cacheDir); } @@ -64,7 +64,7 @@ class CacheWarmerAggregateTest extends TestCase ->expects($this->never()) ->method('warmUp'); - $aggregate = new CacheWarmerAggregate(array($warmer)); + $aggregate = new CacheWarmerAggregate([$warmer]); $aggregate->warmUp(self::$cacheDir); } diff --git a/vendor/symfony/http-kernel/Tests/ClientTest.php b/vendor/symfony/http-kernel/Tests/ClientTest.php index 4ce3670a30..c260727849 100644 --- a/vendor/symfony/http-kernel/Tests/ClientTest.php +++ b/vendor/symfony/http-kernel/Tests/ClientTest.php @@ -70,7 +70,7 @@ class ClientTest extends TestCase $response->headers->setCookie($cookie2 = new Cookie('foo1', 'bar1', \DateTime::createFromFormat('j-M-Y H:i:s T', '15-Feb-2009 20:00:00 GMT')->format('U'), '/foo', 'http://example.com', true, true, false, null)); $domResponse = $m->invoke($client, $response); $this->assertSame((string) $cookie1, $domResponse->getHeader('Set-Cookie')); - $this->assertSame(array((string) $cookie1, (string) $cookie2), $domResponse->getHeader('Set-Cookie', false)); + $this->assertSame([(string) $cookie1, (string) $cookie2], $domResponse->getHeader('Set-Cookie', false)); } public function testFilterResponseSupportsStreamedResponses() @@ -99,14 +99,14 @@ class ClientTest extends TestCase $kernel = new TestHttpKernel(); $client = new Client($kernel); - $files = array( - array('tmp_name' => $source, 'name' => 'original', 'type' => 'mime/original', 'size' => null, 'error' => UPLOAD_ERR_OK), + $files = [ + ['tmp_name' => $source, 'name' => 'original', 'type' => 'mime/original', 'size' => null, 'error' => UPLOAD_ERR_OK], new UploadedFile($source, 'original', 'mime/original', UPLOAD_ERR_OK, true), - ); + ]; $file = null; foreach ($files as $file) { - $client->request('POST', '/', array(), array('foo' => $file)); + $client->request('POST', '/', [], ['foo' => $file]); $files = $client->getRequest()->files->all(); @@ -130,9 +130,9 @@ class ClientTest extends TestCase $kernel = new TestHttpKernel(); $client = new Client($kernel); - $file = array('tmp_name' => '', 'name' => '', 'type' => '', 'size' => 0, 'error' => UPLOAD_ERR_NO_FILE); + $file = ['tmp_name' => '', 'name' => '', 'type' => '', 'size' => 0, 'error' => UPLOAD_ERR_NO_FILE]; - $client->request('POST', '/', array(), array('foo' => $file)); + $client->request('POST', '/', [], ['foo' => $file]); $files = $client->getRequest()->files->all(); @@ -149,8 +149,8 @@ class ClientTest extends TestCase $file = $this ->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile') - ->setConstructorArgs(array($source, 'original', 'mime/original', UPLOAD_ERR_OK, true)) - ->setMethods(array('getSize', 'getClientSize')) + ->setConstructorArgs([$source, 'original', 'mime/original', UPLOAD_ERR_OK, true]) + ->setMethods(['getSize', 'getClientSize']) ->getMock() ; /* should be modified when the getClientSize will be removed */ @@ -163,7 +163,7 @@ class ClientTest extends TestCase ->will($this->returnValue(INF)) ; - $client->request('POST', '/', array(), array($file)); + $client->request('POST', '/', [], [$file]); $files = $client->getRequest()->files->all(); diff --git a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php index 0b38af9556..f1915961ff 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php @@ -23,86 +23,86 @@ class ServiceValueResolverTest extends TestCase { public function testDoNotSupportWhenControllerDoNotExists() { - $resolver = new ServiceValueResolver(new ServiceLocator(array())); + $resolver = new ServiceValueResolver(new ServiceLocator([])); $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); - $request = $this->requestWithAttributes(array('_controller' => 'my_controller')); + $request = $this->requestWithAttributes(['_controller' => 'my_controller']); $this->assertFalse($resolver->supports($request, $argument)); } public function testExistingController() { - $resolver = new ServiceValueResolver(new ServiceLocator(array( + $resolver = new ServiceValueResolver(new ServiceLocator([ 'App\\Controller\\Mine::method' => function () { - return new ServiceLocator(array( + return new ServiceLocator([ 'dummy' => function () { return new DummyService(); }, - )); + ]); }, - ))); + ])); - $request = $this->requestWithAttributes(array('_controller' => 'App\\Controller\\Mine::method')); + $request = $this->requestWithAttributes(['_controller' => 'App\\Controller\\Mine::method']); $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); $this->assertTrue($resolver->supports($request, $argument)); - $this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument)); + $this->assertYieldEquals([new DummyService()], $resolver->resolve($request, $argument)); } public function testExistingControllerWithATrailingBackSlash() { - $resolver = new ServiceValueResolver(new ServiceLocator(array( + $resolver = new ServiceValueResolver(new ServiceLocator([ 'App\\Controller\\Mine::method' => function () { - return new ServiceLocator(array( + return new ServiceLocator([ 'dummy' => function () { return new DummyService(); }, - )); + ]); }, - ))); + ])); - $request = $this->requestWithAttributes(array('_controller' => '\\App\\Controller\\Mine::method')); + $request = $this->requestWithAttributes(['_controller' => '\\App\\Controller\\Mine::method']); $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); $this->assertTrue($resolver->supports($request, $argument)); - $this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument)); + $this->assertYieldEquals([new DummyService()], $resolver->resolve($request, $argument)); } public function testExistingControllerWithMethodNameStartUppercase() { - $resolver = new ServiceValueResolver(new ServiceLocator(array( + $resolver = new ServiceValueResolver(new ServiceLocator([ 'App\\Controller\\Mine::method' => function () { - return new ServiceLocator(array( + return new ServiceLocator([ 'dummy' => function () { return new DummyService(); }, - )); + ]); }, - ))); - $request = $this->requestWithAttributes(array('_controller' => 'App\\Controller\\Mine::Method')); + ])); + $request = $this->requestWithAttributes(['_controller' => 'App\\Controller\\Mine::Method']); $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); $this->assertTrue($resolver->supports($request, $argument)); - $this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument)); + $this->assertYieldEquals([new DummyService()], $resolver->resolve($request, $argument)); } public function testControllerNameIsAnArray() { - $resolver = new ServiceValueResolver(new ServiceLocator(array( + $resolver = new ServiceValueResolver(new ServiceLocator([ 'App\\Controller\\Mine::method' => function () { - return new ServiceLocator(array( + return new ServiceLocator([ 'dummy' => function () { return new DummyService(); }, - )); + ]); }, - ))); + ])); - $request = $this->requestWithAttributes(array('_controller' => array('App\\Controller\\Mine', 'method'))); + $request = $this->requestWithAttributes(['_controller' => ['App\\Controller\\Mine', 'method']]); $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); $this->assertTrue($resolver->supports($request, $argument)); - $this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument)); + $this->assertYieldEquals([new DummyService()], $resolver->resolve($request, $argument)); } /** @@ -119,7 +119,7 @@ class ServiceValueResolverTest extends TestCase $container->compile(); - $request = $this->requestWithAttributes(array('_controller' => array(DummyController::class, 'index'))); + $request = $this->requestWithAttributes(['_controller' => [DummyController::class, 'index']]); $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); $container->get('argument_resolver.service')->resolve($request, $argument)->current(); } @@ -137,7 +137,7 @@ class ServiceValueResolverTest extends TestCase private function assertYieldEquals(array $expected, \Generator $generator) { - $args = array(); + $args = []; foreach ($generator as $arg) { $args[] = $arg; } diff --git a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php index bb4e06617e..45aa9ef26a 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php @@ -40,33 +40,33 @@ class ArgumentResolverTest extends TestCase public function testDefaultState() { $this->assertEquals(self::$resolver, new ArgumentResolver()); - $this->assertNotEquals(self::$resolver, new ArgumentResolver(null, array(new RequestAttributeValueResolver()))); + $this->assertNotEquals(self::$resolver, new ArgumentResolver(null, [new RequestAttributeValueResolver()])); } public function testGetArguments() { $request = Request::create('/'); $request->attributes->set('foo', 'foo'); - $controller = array(new self(), 'controllerWithFoo'); + $controller = [new self(), 'controllerWithFoo']; - $this->assertEquals(array('foo'), self::$resolver->getArguments($request, $controller), '->getArguments() returns an array of arguments for the controller method'); + $this->assertEquals(['foo'], self::$resolver->getArguments($request, $controller), '->getArguments() returns an array of arguments for the controller method'); } public function testGetArgumentsReturnsEmptyArrayWhenNoArguments() { $request = Request::create('/'); - $controller = array(new self(), 'controllerWithoutArguments'); + $controller = [new self(), 'controllerWithoutArguments']; - $this->assertEquals(array(), self::$resolver->getArguments($request, $controller), '->getArguments() returns an empty array if the method takes no arguments'); + $this->assertEquals([], self::$resolver->getArguments($request, $controller), '->getArguments() returns an empty array if the method takes no arguments'); } public function testGetArgumentsUsesDefaultValue() { $request = Request::create('/'); $request->attributes->set('foo', 'foo'); - $controller = array(new self(), 'controllerWithFooAndDefaultBar'); + $controller = [new self(), 'controllerWithFooAndDefaultBar']; - $this->assertEquals(array('foo', null), self::$resolver->getArguments($request, $controller), '->getArguments() uses default values if present'); + $this->assertEquals(['foo', null], self::$resolver->getArguments($request, $controller), '->getArguments() uses default values if present'); } public function testGetArgumentsOverrideDefaultValueByRequestAttribute() @@ -74,9 +74,9 @@ class ArgumentResolverTest extends TestCase $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $request->attributes->set('bar', 'bar'); - $controller = array(new self(), 'controllerWithFooAndDefaultBar'); + $controller = [new self(), 'controllerWithFooAndDefaultBar']; - $this->assertEquals(array('foo', 'bar'), self::$resolver->getArguments($request, $controller), '->getArguments() overrides default values if provided in the request attributes'); + $this->assertEquals(['foo', 'bar'], self::$resolver->getArguments($request, $controller), '->getArguments() overrides default values if provided in the request attributes'); } public function testGetArgumentsFromClosure() @@ -85,7 +85,7 @@ class ArgumentResolverTest extends TestCase $request->attributes->set('foo', 'foo'); $controller = function ($foo) {}; - $this->assertEquals(array('foo'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo'], self::$resolver->getArguments($request, $controller)); } public function testGetArgumentsUsesDefaultValueFromClosure() @@ -94,7 +94,7 @@ class ArgumentResolverTest extends TestCase $request->attributes->set('foo', 'foo'); $controller = function ($foo, $bar = 'bar') {}; - $this->assertEquals(array('foo', 'bar'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', 'bar'], self::$resolver->getArguments($request, $controller)); } public function testGetArgumentsFromInvokableObject() @@ -103,12 +103,12 @@ class ArgumentResolverTest extends TestCase $request->attributes->set('foo', 'foo'); $controller = new self(); - $this->assertEquals(array('foo', null), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', null], self::$resolver->getArguments($request, $controller)); // Test default bar overridden by request attribute $request->attributes->set('bar', 'bar'); - $this->assertEquals(array('foo', 'bar'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', 'bar'], self::$resolver->getArguments($request, $controller)); } public function testGetArgumentsFromFunctionName() @@ -118,7 +118,7 @@ class ArgumentResolverTest extends TestCase $request->attributes->set('foobar', 'foobar'); $controller = __NAMESPACE__.'\controller_function'; - $this->assertEquals(array('foo', 'foobar'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', 'foobar'], self::$resolver->getArguments($request, $controller)); } public function testGetArgumentsFailsOnUnresolvedValue() @@ -126,7 +126,7 @@ class ArgumentResolverTest extends TestCase $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $request->attributes->set('foobar', 'foobar'); - $controller = array(new self(), 'controllerWithFooBarFoobar'); + $controller = [new self(), 'controllerWithFooBarFoobar']; try { self::$resolver->getArguments($request, $controller); @@ -139,27 +139,27 @@ class ArgumentResolverTest extends TestCase public function testGetArgumentsInjectsRequest() { $request = Request::create('/'); - $controller = array(new self(), 'controllerWithRequest'); + $controller = [new self(), 'controllerWithRequest']; - $this->assertEquals(array($request), self::$resolver->getArguments($request, $controller), '->getArguments() injects the request'); + $this->assertEquals([$request], self::$resolver->getArguments($request, $controller), '->getArguments() injects the request'); } public function testGetArgumentsInjectsExtendingRequest() { $request = ExtendingRequest::create('/'); - $controller = array(new self(), 'controllerWithExtendingRequest'); + $controller = [new self(), 'controllerWithExtendingRequest']; - $this->assertEquals(array($request), self::$resolver->getArguments($request, $controller), '->getArguments() injects the request when extended'); + $this->assertEquals([$request], self::$resolver->getArguments($request, $controller), '->getArguments() injects the request when extended'); } public function testGetVariadicArguments() { $request = Request::create('/'); $request->attributes->set('foo', 'foo'); - $request->attributes->set('bar', array('foo', 'bar')); - $controller = array(new VariadicController(), 'action'); + $request->attributes->set('bar', ['foo', 'bar']); + $controller = [new VariadicController(), 'action']; - $this->assertEquals(array('foo', 'foo', 'bar'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', 'foo', 'bar'], self::$resolver->getArguments($request, $controller)); } /** @@ -170,7 +170,7 @@ class ArgumentResolverTest extends TestCase $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $request->attributes->set('bar', 'foo'); - $controller = array(new VariadicController(), 'action'); + $controller = [new VariadicController(), 'action']; self::$resolver->getArguments($request, $controller); } @@ -182,7 +182,7 @@ class ArgumentResolverTest extends TestCase { $factory = new ArgumentMetadataFactory(); $valueResolver = $this->getMockBuilder(ArgumentValueResolverInterface::class)->getMock(); - $resolver = new ArgumentResolver($factory, array($valueResolver)); + $resolver = new ArgumentResolver($factory, [$valueResolver]); $valueResolver->expects($this->any())->method('supports')->willReturn(true); $valueResolver->expects($this->any())->method('resolve')->willReturn('foo'); @@ -190,7 +190,7 @@ class ArgumentResolverTest extends TestCase $request = Request::create('/'); $request->attributes->set('foo', 'foo'); $request->attributes->set('bar', 'foo'); - $controller = array($this, 'controllerWithFooAndDefaultBar'); + $controller = [$this, 'controllerWithFooAndDefaultBar']; $resolver->getArguments($request, $controller); } @@ -200,7 +200,7 @@ class ArgumentResolverTest extends TestCase public function testIfExceptionIsThrownWhenMissingAnArgument() { $request = Request::create('/'); - $controller = array($this, 'controllerWithFoo'); + $controller = [$this, 'controllerWithFoo']; self::$resolver->getArguments($request, $controller); } @@ -211,18 +211,18 @@ class ArgumentResolverTest extends TestCase $request->attributes->set('foo', 'foo'); $request->attributes->set('bar', new \stdClass()); $request->attributes->set('mandatory', 'mandatory'); - $controller = array(new NullableController(), 'action'); + $controller = [new NullableController(), 'action']; - $this->assertEquals(array('foo', new \stdClass(), 'value', 'mandatory'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals(['foo', new \stdClass(), 'value', 'mandatory'], self::$resolver->getArguments($request, $controller)); } public function testGetNullableArgumentsWithDefaults() { $request = Request::create('/'); $request->attributes->set('mandatory', 'mandatory'); - $controller = array(new NullableController(), 'action'); + $controller = [new NullableController(), 'action']; - $this->assertEquals(array(null, null, 'value', 'mandatory'), self::$resolver->getArguments($request, $controller)); + $this->assertEquals([null, null, 'value', 'mandatory'], self::$resolver->getArguments($request, $controller)); } public function testGetSessionArguments() @@ -230,9 +230,9 @@ class ArgumentResolverTest extends TestCase $session = new Session(new MockArraySessionStorage()); $request = Request::create('/'); $request->setSession($session); - $controller = array($this, 'controllerWithSession'); + $controller = [$this, 'controllerWithSession']; - $this->assertEquals(array($session), self::$resolver->getArguments($request, $controller)); + $this->assertEquals([$session], self::$resolver->getArguments($request, $controller)); } public function testGetSessionArgumentsWithExtendedSession() @@ -240,9 +240,9 @@ class ArgumentResolverTest extends TestCase $session = new ExtendingSession(new MockArraySessionStorage()); $request = Request::create('/'); $request->setSession($session); - $controller = array($this, 'controllerWithExtendingSession'); + $controller = [$this, 'controllerWithExtendingSession']; - $this->assertEquals(array($session), self::$resolver->getArguments($request, $controller)); + $this->assertEquals([$session], self::$resolver->getArguments($request, $controller)); } public function testGetSessionArgumentsWithInterface() @@ -250,9 +250,9 @@ class ArgumentResolverTest extends TestCase $session = $this->getMockBuilder(SessionInterface::class)->getMock(); $request = Request::create('/'); $request->setSession($session); - $controller = array($this, 'controllerWithSessionInterface'); + $controller = [$this, 'controllerWithSessionInterface']; - $this->assertEquals(array($session), self::$resolver->getArguments($request, $controller)); + $this->assertEquals([$session], self::$resolver->getArguments($request, $controller)); } /** @@ -263,7 +263,7 @@ class ArgumentResolverTest extends TestCase $session = $this->getMockBuilder(SessionInterface::class)->getMock(); $request = Request::create('/'); $request->setSession($session); - $controller = array($this, 'controllerWithExtendingSession'); + $controller = [$this, 'controllerWithExtendingSession']; self::$resolver->getArguments($request, $controller); } @@ -276,7 +276,7 @@ class ArgumentResolverTest extends TestCase $session = new Session(new MockArraySessionStorage()); $request = Request::create('/'); $request->setSession($session); - $controller = array($this, 'controllerWithExtendingSession'); + $controller = [$this, 'controllerWithExtendingSession']; self::$resolver->getArguments($request, $controller); } @@ -287,7 +287,7 @@ class ArgumentResolverTest extends TestCase public function testGetSessionMissMatchOnNull() { $request = Request::create('/'); - $controller = array($this, 'controllerWithExtendingSession'); + $controller = [$this, 'controllerWithExtendingSession']; self::$resolver->getArguments($request, $controller); } diff --git a/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php index 1a144eee49..61d8bec32a 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php @@ -137,12 +137,12 @@ class ContainerControllerResolverTest extends ControllerResolverTest $container->expects($this->atLeastOnce()) ->method('getRemovedIds') ->with() - ->will($this->returnValue(array(ControllerTestService::class => true))) + ->will($this->returnValue([ControllerTestService::class => true])) ; $resolver = $this->createControllerResolver(null, $container); $request = Request::create('/'); - $request->attributes->set('_controller', array(ControllerTestService::class, 'action')); + $request->attributes->set('_controller', [ControllerTestService::class, 'action']); $resolver->getController($request); } @@ -165,7 +165,7 @@ class ContainerControllerResolverTest extends ControllerResolverTest $container->expects($this->atLeastOnce()) ->method('getRemovedIds') ->with() - ->will($this->returnValue(array('app.my_controller' => true))) + ->will($this->returnValue(['app.my_controller' => true])) ; $resolver = $this->createControllerResolver(null, $container); @@ -178,23 +178,23 @@ class ContainerControllerResolverTest extends ControllerResolverTest public function getUndefinedControllers() { $tests = parent::getUndefinedControllers(); - $tests[0] = array('foo', \InvalidArgumentException::class, 'Controller "foo" does neither exist as service nor as class'); - $tests[1] = array('oof::bar', \InvalidArgumentException::class, 'Controller "oof" does neither exist as service nor as class'); - $tests[2] = array(array('oof', 'bar'), \InvalidArgumentException::class, 'Controller "oof" does neither exist as service nor as class'); - $tests[] = array( - array(ControllerTestService::class, 'action'), + $tests[0] = ['foo', \InvalidArgumentException::class, 'Controller "foo" does neither exist as service nor as class']; + $tests[1] = ['oof::bar', \InvalidArgumentException::class, 'Controller "oof" does neither exist as service nor as class']; + $tests[2] = [['oof', 'bar'], \InvalidArgumentException::class, 'Controller "oof" does neither exist as service nor as class']; + $tests[] = [ + [ControllerTestService::class, 'action'], \InvalidArgumentException::class, 'Controller "Symfony\Component\HttpKernel\Tests\Controller\ControllerTestService" has required constructor arguments and does not exist in the container. Did you forget to define such a service?', - ); - $tests[] = array( + ]; + $tests[] = [ ControllerTestService::class.'::action', \InvalidArgumentException::class, 'Controller "Symfony\Component\HttpKernel\Tests\Controller\ControllerTestService" has required constructor arguments and does not exist in the container. Did you forget to define such a service?', - ); - $tests[] = array( + ]; + $tests[] = [ InvokableControllerService::class, \InvalidArgumentException::class, 'Controller "Symfony\Component\HttpKernel\Tests\Controller\InvokableControllerService" has required constructor arguments and does not exist in the container. Did you forget to define such a service?', - ); + ]; return $tests; } diff --git a/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php index fe624f7b60..1ba7e9e20a 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php @@ -55,9 +55,9 @@ class ControllerResolverTest extends TestCase $object = new ControllerTest(); $request = Request::create('/'); - $request->attributes->set('_controller', array($object, 'publicAction')); + $request->attributes->set('_controller', [$object, 'publicAction']); $controller = $resolver->getController($request); - $this->assertSame(array($object, 'publicAction'), $controller); + $this->assertSame([$object, 'publicAction'], $controller); } public function testGetControllerWithClassAndMethodAsArray() @@ -65,7 +65,7 @@ class ControllerResolverTest extends TestCase $resolver = $this->createControllerResolver(); $request = Request::create('/'); - $request->attributes->set('_controller', array(ControllerTest::class, 'publicAction')); + $request->attributes->set('_controller', [ControllerTest::class, 'publicAction']); $controller = $resolver->getController($request); $this->assertInstanceOf(ControllerTest::class, $controller[0]); $this->assertSame('publicAction', $controller[1]); @@ -145,12 +145,12 @@ class ControllerResolverTest extends TestCase public function getStaticControllers() { - return array( - array(TestAbstractController::class.'::staticAction', 'foo'), - array(array(TestAbstractController::class, 'staticAction'), 'foo'), - array(PrivateConstructorController::class.'::staticAction', 'bar'), - array(array(PrivateConstructorController::class, 'staticAction'), 'bar'), - ); + return [ + [TestAbstractController::class.'::staticAction', 'foo'], + [[TestAbstractController::class, 'staticAction'], 'foo'], + [PrivateConstructorController::class.'::staticAction', 'bar'], + [[PrivateConstructorController::class, 'staticAction'], 'bar'], + ]; } /** @@ -175,22 +175,22 @@ class ControllerResolverTest extends TestCase { $controller = new ControllerTest(); - return array( - array('foo', \Error::class, 'Class \'foo\' not found'), - array('oof::bar', \Error::class, 'Class \'oof\' not found'), - array(array('oof', 'bar'), \Error::class, 'Class \'oof\' not found'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::staticsAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Expected method "staticsAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest", did you mean "staticAction"?'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::privateAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Method "privateAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::protectedAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Method "protectedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::undefinedAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Expected method "undefinedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest". Available methods: "publicAction", "staticAction"'), - array('Symfony\Component\HttpKernel\Tests\Controller\ControllerTest', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Controller class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" cannot be called without a method name. You need to implement "__invoke" or use one of the available methods: "publicAction", "staticAction".'), - array(array($controller, 'staticsAction'), \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Expected method "staticsAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest", did you mean "staticAction"?'), - array(array($controller, 'privateAction'), \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Method "privateAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'), - array(array($controller, 'protectedAction'), \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Method "protectedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'), - array(array($controller, 'undefinedAction'), \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Expected method "undefinedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest". Available methods: "publicAction", "staticAction"'), - array($controller, \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Controller class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" cannot be called without a method name. You need to implement "__invoke" or use one of the available methods: "publicAction", "staticAction".'), - array(array('a' => 'foo', 'b' => 'bar'), \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Invalid array callable, expected array(controller, method).'), - ); + return [ + ['foo', \Error::class, 'Class \'foo\' not found'], + ['oof::bar', \Error::class, 'Class \'oof\' not found'], + [['oof', 'bar'], \Error::class, 'Class \'oof\' not found'], + ['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::staticsAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Expected method "staticsAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest", did you mean "staticAction"?'], + ['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::privateAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Method "privateAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'], + ['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::protectedAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Method "protectedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'], + ['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest::undefinedAction', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Expected method "undefinedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest". Available methods: "publicAction", "staticAction"'], + ['Symfony\Component\HttpKernel\Tests\Controller\ControllerTest', \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Controller class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" cannot be called without a method name. You need to implement "__invoke" or use one of the available methods: "publicAction", "staticAction".'], + [[$controller, 'staticsAction'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Expected method "staticsAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest", did you mean "staticAction"?'], + [[$controller, 'privateAction'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Method "privateAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'], + [[$controller, 'protectedAction'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Method "protectedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" should be public and non-abstract'], + [[$controller, 'undefinedAction'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Expected method "undefinedAction" on class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest". Available methods: "publicAction", "staticAction"'], + [$controller, \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Controller class "Symfony\Component\HttpKernel\Tests\Controller\ControllerTest" cannot be called without a method name. You need to implement "__invoke" or use one of the available methods: "publicAction", "staticAction".'], + [['a' => 'foo', 'b' => 'bar'], \InvalidArgumentException::class, 'The controller for URI "/" is not callable. Invalid array callable, expected [controller, method].'], + ]; } protected function createControllerResolver(LoggerInterface $logger = null) diff --git a/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php b/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php index a667705f50..199d3a0e4b 100644 --- a/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php +++ b/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php @@ -33,88 +33,88 @@ class ArgumentMetadataFactoryTest extends TestCase public function testSignature1() { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature1')); + $arguments = $this->factory->createArgumentMetadata([$this, 'signature1']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', self::class, false, false, null), new ArgumentMetadata('bar', 'array', false, false, null), new ArgumentMetadata('baz', 'callable', false, false, null), - ), $arguments); + ], $arguments); } public function testSignature2() { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature2')); + $arguments = $this->factory->createArgumentMetadata([$this, 'signature2']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', self::class, false, true, null, true), new ArgumentMetadata('bar', __NAMESPACE__.'\FakeClassThatDoesNotExist', false, true, null, true), new ArgumentMetadata('baz', 'Fake\ImportedAndFake', false, true, null, true), - ), $arguments); + ], $arguments); } public function testSignature3() { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature3')); + $arguments = $this->factory->createArgumentMetadata([$this, 'signature3']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('bar', __NAMESPACE__.'\FakeClassThatDoesNotExist', false, false, null), new ArgumentMetadata('baz', 'Fake\ImportedAndFake', false, false, null), - ), $arguments); + ], $arguments); } public function testSignature4() { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature4')); + $arguments = $this->factory->createArgumentMetadata([$this, 'signature4']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', null, false, true, 'default'), new ArgumentMetadata('bar', null, false, true, 500), - new ArgumentMetadata('baz', null, false, true, array()), - ), $arguments); + new ArgumentMetadata('baz', null, false, true, []), + ], $arguments); } public function testSignature5() { - $arguments = $this->factory->createArgumentMetadata(array($this, 'signature5')); + $arguments = $this->factory->createArgumentMetadata([$this, 'signature5']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', 'array', false, true, null, true), new ArgumentMetadata('bar', null, false, false, null), - ), $arguments); + ], $arguments); } public function testVariadicSignature() { - $arguments = $this->factory->createArgumentMetadata(array(new VariadicController(), 'action')); + $arguments = $this->factory->createArgumentMetadata([new VariadicController(), 'action']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', null, false, false, null), new ArgumentMetadata('bar', null, true, false, null), - ), $arguments); + ], $arguments); } public function testBasicTypesSignature() { - $arguments = $this->factory->createArgumentMetadata(array(new BasicTypesController(), 'action')); + $arguments = $this->factory->createArgumentMetadata([new BasicTypesController(), 'action']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', 'string', false, false, null), new ArgumentMetadata('bar', 'int', false, false, null), new ArgumentMetadata('baz', 'float', false, false, null), - ), $arguments); + ], $arguments); } public function testNullableTypesSignature() { - $arguments = $this->factory->createArgumentMetadata(array(new NullableController(), 'action')); + $arguments = $this->factory->createArgumentMetadata([new NullableController(), 'action']); - $this->assertEquals(array( + $this->assertEquals([ new ArgumentMetadata('foo', 'string', false, false, null, true), new ArgumentMetadata('bar', \stdClass::class, false, false, null, true), new ArgumentMetadata('baz', 'string', false, true, 'value', true), new ArgumentMetadata('mandatory', null, false, false, null, true), - ), $arguments); + ], $arguments); } private function signature1(self $foo, array $bar, callable $baz) @@ -129,7 +129,7 @@ class ArgumentMetadataFactoryTest extends TestCase { } - private function signature4($foo = 'default', $bar = 500, $baz = array()) + private function signature4($foo = 'default', $bar = 500, $baz = []) { } diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php index 10b0585840..add100d47b 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -67,7 +67,7 @@ class KernelForTest extends Kernel public function getBundles() { - return array(); + return []; } public function registerContainerConfiguration(LoaderInterface $loader) diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php index 54fd39e0d8..ae79a3c93c 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/DataCollectorTest.php @@ -30,7 +30,7 @@ class DataCollectorTest extends TestCase public function testCloneVarExistingFilePath() { - $c = new CloneVarDataCollector(array($filePath = tempnam(sys_get_temp_dir(), 'clone_var_data_collector_'))); + $c = new CloneVarDataCollector([$filePath = tempnam(sys_get_temp_dir(), 'clone_var_data_collector_')]); $c->collect(new Request(), new Response()); $this->assertSame($filePath, $c->getData()[0]); diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php index 0f46709049..76c1d96dcc 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php @@ -26,7 +26,7 @@ class DumpDataCollectorTest extends TestCase { public function testDump() { - $data = new Data(array(array(123))); + $data = new Data([[123]]); $collector = new DumpDataCollector(); @@ -41,15 +41,15 @@ class DumpDataCollectorTest extends TestCase $dump[0]['data'] = preg_replace('/^.*?<pre/', '<pre', $dump[0]['data']); $dump[0]['data'] = preg_replace('/sf-dump-\d+/', 'sf-dump', $dump[0]['data']); - $xDump = array( - array( + $xDump = [ + [ 'data' => "<pre class=sf-dump id=sf-dump data-indent-pad=\" \"><span class=sf-dump-num>123</span>\n</pre><script>Sfdump(\"sf-dump\")</script>\n", 'name' => 'DumpDataCollectorTest.php', 'file' => __FILE__, 'line' => $line, 'fileExcerpt' => false, - ), - ); + ], + ]; $this->assertEquals($xDump, $dump); $this->assertStringMatchesFormat('a:3:{i:0;a:5:{s:4:"data";%c:39:"Symfony\Component\VarDumper\Cloner\Data":%a', $collector->serialize()); @@ -59,7 +59,7 @@ class DumpDataCollectorTest extends TestCase public function testDumpWithServerConnection() { - $data = new Data(array(array(123))); + $data = new Data([[123]]); // Server is up, server dumper is used $serverDumper = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock(); @@ -77,7 +77,7 @@ class DumpDataCollectorTest extends TestCase public function testCollectDefault() { - $data = new Data(array(array(123))); + $data = new Data([[123]]); $collector = new DumpDataCollector(); @@ -95,7 +95,7 @@ class DumpDataCollectorTest extends TestCase public function testCollectHtml() { - $data = new Data(array(array(123))); + $data = new Data([[123]]); $collector = new DumpDataCollector(null, 'test://%f:%l'); @@ -123,7 +123,7 @@ EOTXT; public function testFlush() { - $data = new Data(array(array(456))); + $data = new Data([[456]]); $collector = new DumpDataCollector(); $collector->dump($data); $line = __LINE__ - 1; @@ -136,7 +136,7 @@ EOTXT; public function testFlushNothingWhenDataDumperIsProvided() { - $data = new Data(array(array(456))); + $data = new Data([[456]]); $dumper = new CliDumper('php://output'); $collector = new DumpDataCollector(null, null, null, null, $dumper); diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php index b5c7057fd6..e0bcc24bd7 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/LoggerDataCollectorTest.php @@ -25,24 +25,24 @@ class LoggerDataCollectorTest extends TestCase { $logger = $this ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') - ->setMethods(array('countErrors', 'getLogs', 'clear')) + ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); $logger->expects($this->once())->method('countErrors')->will($this->returnValue('foo')); - $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue(array())); + $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue([])); $c = new LoggerDataCollector($logger, __DIR__.'/'); $c->lateCollect(); $compilerLogs = $c->getCompilerLogs()->getValue('message'); - $this->assertSame(array( - array('message' => 'Removed service "Psr\Container\ContainerInterface"; reason: private alias.'), - array('message' => 'Removed service "Symfony\Component\DependencyInjection\ContainerInterface"; reason: private alias.'), - ), $compilerLogs['Symfony\Component\DependencyInjection\Compiler\RemovePrivateAliasesPass']); + $this->assertSame([ + ['message' => 'Removed service "Psr\Container\ContainerInterface"; reason: private alias.'], + ['message' => 'Removed service "Symfony\Component\DependencyInjection\ContainerInterface"; reason: private alias.'], + ], $compilerLogs['Symfony\Component\DependencyInjection\Compiler\RemovePrivateAliasesPass']); - $this->assertSame(array( - array('message' => 'Some custom logging message'), - array('message' => 'With ending :'), - ), $compilerLogs['Unknown Compiler Pass']); + $this->assertSame([ + ['message' => 'Some custom logging message'], + ['message' => 'With ending :'], + ], $compilerLogs['Unknown Compiler Pass']); } public function testWithMasterRequest() @@ -53,10 +53,10 @@ class LoggerDataCollectorTest extends TestCase $logger = $this ->getMockBuilder(DebugLoggerInterface::class) - ->setMethods(array('countErrors', 'getLogs', 'clear')) + ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); $logger->expects($this->once())->method('countErrors')->with(null); - $logger->expects($this->exactly(2))->method('getLogs')->with(null)->will($this->returnValue(array())); + $logger->expects($this->exactly(2))->method('getLogs')->with(null)->will($this->returnValue([])); $c = new LoggerDataCollector($logger, __DIR__.'/', $stack); @@ -74,10 +74,10 @@ class LoggerDataCollectorTest extends TestCase $logger = $this ->getMockBuilder(DebugLoggerInterface::class) - ->setMethods(array('countErrors', 'getLogs', 'clear')) + ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); $logger->expects($this->once())->method('countErrors')->with($subRequest); - $logger->expects($this->exactly(2))->method('getLogs')->with($subRequest)->will($this->returnValue(array())); + $logger->expects($this->exactly(2))->method('getLogs')->with($subRequest)->will($this->returnValue([])); $c = new LoggerDataCollector($logger, __DIR__.'/', $stack); @@ -92,7 +92,7 @@ class LoggerDataCollectorTest extends TestCase { $logger = $this ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') - ->setMethods(array('countErrors', 'getLogs', 'clear')) + ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); $logger->expects($this->once())->method('countErrors')->will($this->returnValue($nb)); $logger->expects($this->exactly(2))->method('getLogs')->will($this->returnValue($logs)); @@ -106,7 +106,7 @@ class LoggerDataCollectorTest extends TestCase $logs = array_map(function ($v) { if (isset($v['context']['exception'])) { $e = &$v['context']['exception']; - $e = isset($e["\0*\0message"]) ? array($e["\0*\0message"], $e["\0*\0severity"]) : array($e["\0Symfony\Component\Debug\Exception\SilencedErrorContext\0severity"]); + $e = isset($e["\0*\0message"]) ? [$e["\0*\0message"], $e["\0*\0severity"]] : [$e["\0Symfony\Component\Debug\Exception\SilencedErrorContext\0severity"]]; } return $v; @@ -124,7 +124,7 @@ class LoggerDataCollectorTest extends TestCase { $logger = $this ->getMockBuilder('Symfony\Component\HttpKernel\Log\DebugLoggerInterface') - ->setMethods(array('countErrors', 'getLogs', 'clear')) + ->setMethods(['countErrors', 'getLogs', 'clear']) ->getMock(); $logger->expects($this->once())->method('clear'); @@ -134,55 +134,55 @@ class LoggerDataCollectorTest extends TestCase public function getCollectTestData() { - yield 'simple log' => array( + yield 'simple log' => [ 1, - array(array('message' => 'foo', 'context' => array(), 'priority' => 100, 'priorityName' => 'DEBUG')), - array(array('message' => 'foo', 'context' => array(), 'priority' => 100, 'priorityName' => 'DEBUG')), + [['message' => 'foo', 'context' => [], 'priority' => 100, 'priorityName' => 'DEBUG']], + [['message' => 'foo', 'context' => [], 'priority' => 100, 'priorityName' => 'DEBUG']], 0, 0, - ); + ]; - yield 'log with a context' => array( + yield 'log with a context' => [ 1, - array(array('message' => 'foo', 'context' => array('foo' => 'bar'), 'priority' => 100, 'priorityName' => 'DEBUG')), - array(array('message' => 'foo', 'context' => array('foo' => 'bar'), 'priority' => 100, 'priorityName' => 'DEBUG')), + [['message' => 'foo', 'context' => ['foo' => 'bar'], 'priority' => 100, 'priorityName' => 'DEBUG']], + [['message' => 'foo', 'context' => ['foo' => 'bar'], 'priority' => 100, 'priorityName' => 'DEBUG']], 0, 0, - ); + ]; if (!class_exists(SilencedErrorContext::class)) { return; } - yield 'logs with some deprecations' => array( + yield 'logs with some deprecations' => [ 1, - array( - array('message' => 'foo3', 'context' => array('exception' => new \ErrorException('warning', 0, E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo', 'context' => array('exception' => new \ErrorException('deprecated', 0, E_DEPRECATED)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo2', 'context' => array('exception' => new \ErrorException('deprecated', 0, E_USER_DEPRECATED)), 'priority' => 100, 'priorityName' => 'DEBUG'), - ), - array( - array('message' => 'foo3', 'context' => array('exception' => array('warning', E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo', 'context' => array('exception' => array('deprecated', E_DEPRECATED)), 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false), - array('message' => 'foo2', 'context' => array('exception' => array('deprecated', E_USER_DEPRECATED)), 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false), - ), + [ + ['message' => 'foo3', 'context' => ['exception' => new \ErrorException('warning', 0, E_USER_WARNING)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo', 'context' => ['exception' => new \ErrorException('deprecated', 0, E_DEPRECATED)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo2', 'context' => ['exception' => new \ErrorException('deprecated', 0, E_USER_DEPRECATED)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ], + [ + ['message' => 'foo3', 'context' => ['exception' => ['warning', E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo', 'context' => ['exception' => ['deprecated', E_DEPRECATED]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false], + ['message' => 'foo2', 'context' => ['exception' => ['deprecated', E_USER_DEPRECATED]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => false], + ], 2, 0, - array(100 => array('count' => 3, 'name' => 'DEBUG')), - ); + [100 => ['count' => 3, 'name' => 'DEBUG']], + ]; - yield 'logs with some silent errors' => array( + yield 'logs with some silent errors' => [ 1, - array( - array('message' => 'foo3', 'context' => array('exception' => new \ErrorException('warning', 0, E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo3', 'context' => array('exception' => new SilencedErrorContext(E_USER_WARNING, __FILE__, __LINE__)), 'priority' => 100, 'priorityName' => 'DEBUG'), - ), - array( - array('message' => 'foo3', 'context' => array('exception' => array('warning', E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG'), - array('message' => 'foo3', 'context' => array('exception' => array(E_USER_WARNING)), 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true), - ), + [ + ['message' => 'foo3', 'context' => ['exception' => new \ErrorException('warning', 0, E_USER_WARNING)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo3', 'context' => ['exception' => new SilencedErrorContext(E_USER_WARNING, __FILE__, __LINE__)], 'priority' => 100, 'priorityName' => 'DEBUG'], + ], + [ + ['message' => 'foo3', 'context' => ['exception' => ['warning', E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG'], + ['message' => 'foo3', 'context' => ['exception' => [E_USER_WARNING]], 'priority' => 100, 'priorityName' => 'DEBUG', 'errorCount' => 1, 'scream' => true], + ], 0, 1, - ); + ]; } } diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php index 1435d05e83..c434ed1e11 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php @@ -39,21 +39,21 @@ class MemoryDataCollectorTest extends TestCase public function getBytesConversionTestData() { - return array( - array('2k', 2048), - array('2 k', 2048), - array('8m', 8 * 1024 * 1024), - array('+2 k', 2048), - array('+2???k', 2048), - array('0x10', 16), - array('0xf', 15), - array('010', 8), - array('+0x10 k', 16 * 1024), - array('1g', 1024 * 1024 * 1024), - array('1G', 1024 * 1024 * 1024), - array('-1', -1), - array('0', 0), - array('2mk', 2048), // the unit must be the last char, so in this case 'k', not 'm' - ); + return [ + ['2k', 2048], + ['2 k', 2048], + ['8m', 8 * 1024 * 1024], + ['+2 k', 2048], + ['+2???k', 2048], + ['0x10', 16], + ['0xf', 15], + ['010', 8], + ['+0x10 k', 16 * 1024], + ['1g', 1024 * 1024 * 1024], + ['1G', 1024 * 1024 * 1024], + ['-1', -1], + ['0', 0], + ['2mk', 2048], // the unit must be the last char, so in this case 'k', not 'm' + ]; } } diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php index 24904f7cca..b5541610f6 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php @@ -48,8 +48,8 @@ class RequestDataCollectorTest extends TestCase $this->assertInstanceOf(ParameterBag::class, $c->getResponseCookies()); $this->assertSame('html', $c->getFormat()); $this->assertEquals('foobar', $c->getRoute()); - $this->assertEquals(array('name' => 'foo'), $c->getRouteParams()); - $this->assertSame(array(), $c->getSessionAttributes()); + $this->assertEquals(['name' => 'foo'], $c->getRouteParams()); + $this->assertSame([], $c->getSessionAttributes()); $this->assertSame('en', $c->getLocale()); $this->assertContains(__FILE__, $attributes->get('resource')); $this->assertSame('stdClass', $attributes->get('object')->getType()); @@ -62,13 +62,13 @@ class RequestDataCollectorTest extends TestCase public function testCollectWithoutRouteParams() { - $request = $this->createRequest(array()); + $request = $this->createRequest([]); $c = new RequestDataCollector(); $c->collect($request, $this->createResponse()); $c->lateCollect(); - $this->assertEquals(array(), $c->getRouteParams()); + $this->assertEquals([], $c->getRouteParams()); } /** @@ -94,95 +94,95 @@ class RequestDataCollectorTest extends TestCase $r3 = new \ReflectionClass($this); // test name, callable, expected - return array( - array( + return [ + [ '"Regular" callable', - array($this, 'testControllerInspection'), - array( + [$this, 'testControllerInspection'], + [ 'class' => __NAMESPACE__.'\RequestDataCollectorTest', 'method' => 'testControllerInspection', 'file' => __FILE__, 'line' => $r1->getStartLine(), - ), - ), + ], + ], - array( + [ 'Closure', function () { return 'foo'; }, - array( + [ 'class' => __NAMESPACE__.'\{closure}', 'method' => null, 'file' => __FILE__, 'line' => __LINE__ - 5, - ), - ), + ], + ], - array( + [ 'Static callback as string', __NAMESPACE__.'\RequestDataCollectorTest::staticControllerMethod', - array( + [ 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'method' => 'staticControllerMethod', 'file' => __FILE__, 'line' => $r2->getStartLine(), - ), - ), + ], + ], - array( + [ 'Static callable with instance', - array($this, 'staticControllerMethod'), - array( + [$this, 'staticControllerMethod'], + [ 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'method' => 'staticControllerMethod', 'file' => __FILE__, 'line' => $r2->getStartLine(), - ), - ), + ], + ], - array( + [ 'Static callable with class name', - array('Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'staticControllerMethod'), - array( + ['Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'staticControllerMethod'], + [ 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'method' => 'staticControllerMethod', 'file' => __FILE__, 'line' => $r2->getStartLine(), - ), - ), + ], + ], - array( + [ 'Callable with instance depending on __call()', - array($this, 'magicMethod'), - array( + [$this, 'magicMethod'], + [ 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'method' => 'magicMethod', 'file' => 'n/a', 'line' => 'n/a', - ), - ), + ], + ], - array( + [ 'Callable with class name depending on __callStatic()', - array('Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'magicMethod'), - array( + ['Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'magicMethod'], + [ 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'method' => 'magicMethod', 'file' => 'n/a', 'line' => 'n/a', - ), - ), + ], + ], - array( + [ 'Invokable controller', $this, - array( + [ 'class' => 'Symfony\Component\HttpKernel\Tests\DataCollector\RequestDataCollectorTest', 'method' => null, 'file' => __FILE__, 'line' => $r3->getStartLine(), - ), - ), - ); + ], + ], + ]; } public function testItIgnoresInvalidCallables() @@ -199,9 +199,9 @@ class RequestDataCollectorTest extends TestCase public function testItAddsRedirectedAttributesWhenRequestContainsSpecificCookie() { $request = $this->createRequest(); - $request->cookies->add(array( + $request->cookies->add([ 'sf_redirect' => '{}', - )); + ]); $kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock(); @@ -235,9 +235,9 @@ class RequestDataCollectorTest extends TestCase $request = $this->createRequest(); $request->attributes->set('_redirected', true); - $request->cookies->add(array( + $request->cookies->add([ 'sf_redirect' => '{"method": "POST"}', - )); + ]); $c->collect($request, $response = $this->createResponse()); $c->lateCollect(); @@ -248,7 +248,7 @@ class RequestDataCollectorTest extends TestCase $this->assertNull($cookie->getValue()); } - protected function createRequest($routeParams = array('name' => 'foo')) + protected function createRequest($routeParams = ['name' => 'foo']) { $request = Request::create('http://test.com/foo?bar=baz'); $request->attributes->set('foo', 'bar'); diff --git a/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php b/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php index 3de147c7f7..8b8e91aeb4 100644 --- a/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php +++ b/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php @@ -31,7 +31,7 @@ class TraceableEventDispatcherTest extends TestCase $kernel->terminate($request, $response); $events = $stopwatch->getSectionEvents($response->headers->get('X-Debug-Token')); - $this->assertEquals(array( + $this->assertEquals([ '__section__', 'kernel.request', 'kernel.controller', @@ -39,13 +39,13 @@ class TraceableEventDispatcherTest extends TestCase 'controller', 'kernel.response', 'kernel.terminate', - ), array_keys($events)); + ], array_keys($events)); } public function testStopwatchCheckControllerOnRequestEvent() { $stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch') - ->setMethods(array('isStarted')) + ->setMethods(['isStarted']) ->getMock(); $stopwatch->expects($this->once()) ->method('isStarted') @@ -61,7 +61,7 @@ class TraceableEventDispatcherTest extends TestCase public function testStopwatchStopControllerOnRequestEvent() { $stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch') - ->setMethods(array('isStarted', 'stop', 'stopSection')) + ->setMethods(['isStarted', 'stop', 'stopSection']) ->getMock(); $stopwatch->expects($this->once()) ->method('isStarted') @@ -114,7 +114,7 @@ class TraceableEventDispatcherTest extends TestCase $controllerResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ControllerResolverInterface')->getMock(); $controllerResolver->expects($this->once())->method('getController')->will($this->returnValue($controller)); $argumentResolver = $this->getMockBuilder('Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface')->getMock(); - $argumentResolver->expects($this->once())->method('getArguments')->will($this->returnValue(array())); + $argumentResolver->expects($this->once())->method('getArguments')->will($this->returnValue([])); return new HttpKernel($dispatcher, $controllerResolver, new RequestStack(), $argumentResolver); } diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php index a2fb6afca4..914b1dd8d6 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/AddAnnotatedClassesToCachePassTest.php @@ -24,76 +24,76 @@ class AddAnnotatedClassesToCachePassTest extends TestCase $r->setAccessible(true); $expand = $r->getClosure($pass); - $this->assertSame('Foo', $expand(array('Foo'), array())[0]); - $this->assertSame('Foo', $expand(array('\\Foo'), array())[0]); - $this->assertSame('Foo', $expand(array('Foo'), array('\\Foo'))[0]); - $this->assertSame('Foo', $expand(array('Foo'), array('Foo'))[0]); - $this->assertSame('Foo', $expand(array('\\Foo'), array('\\Foo\\Bar'))[0]); - $this->assertSame('Foo', $expand(array('Foo'), array('\\Foo\\Bar'))[0]); - $this->assertSame('Foo', $expand(array('\\Foo'), array('\\Foo\\Bar\\Acme'))[0]); + $this->assertSame('Foo', $expand(['Foo'], [])[0]); + $this->assertSame('Foo', $expand(['\\Foo'], [])[0]); + $this->assertSame('Foo', $expand(['Foo'], ['\\Foo'])[0]); + $this->assertSame('Foo', $expand(['Foo'], ['Foo'])[0]); + $this->assertSame('Foo', $expand(['\\Foo'], ['\\Foo\\Bar'])[0]); + $this->assertSame('Foo', $expand(['Foo'], ['\\Foo\\Bar'])[0]); + $this->assertSame('Foo', $expand(['\\Foo'], ['\\Foo\\Bar\\Acme'])[0]); - $this->assertSame('Foo\\Bar', $expand(array('Foo\\'), array('\\Foo\\Bar'))[0]); - $this->assertSame('Foo\\Bar\\Acme', $expand(array('Foo\\'), array('\\Foo\\Bar\\Acme'))[0]); - $this->assertEmpty($expand(array('Foo\\'), array('\\Foo'))); + $this->assertSame('Foo\\Bar', $expand(['Foo\\'], ['\\Foo\\Bar'])[0]); + $this->assertSame('Foo\\Bar\\Acme', $expand(['Foo\\'], ['\\Foo\\Bar\\Acme'])[0]); + $this->assertEmpty($expand(['Foo\\'], ['\\Foo'])); - $this->assertSame('Acme\\Foo\\Bar', $expand(array('**\\Foo\\'), array('\\Acme\\Foo\\Bar'))[0]); - $this->assertEmpty($expand(array('**\\Foo\\'), array('\\Foo\\Bar'))); - $this->assertEmpty($expand(array('**\\Foo\\'), array('\\Acme\\Foo'))); - $this->assertEmpty($expand(array('**\\Foo\\'), array('\\Foo'))); + $this->assertSame('Acme\\Foo\\Bar', $expand(['**\\Foo\\'], ['\\Acme\\Foo\\Bar'])[0]); + $this->assertEmpty($expand(['**\\Foo\\'], ['\\Foo\\Bar'])); + $this->assertEmpty($expand(['**\\Foo\\'], ['\\Acme\\Foo'])); + $this->assertEmpty($expand(['**\\Foo\\'], ['\\Foo'])); - $this->assertSame('Acme\\Foo', $expand(array('**\\Foo'), array('\\Acme\\Foo'))[0]); - $this->assertEmpty($expand(array('**\\Foo'), array('\\Acme\\Foo\\AcmeBundle'))); - $this->assertEmpty($expand(array('**\\Foo'), array('\\Acme\\FooBar\\AcmeBundle'))); + $this->assertSame('Acme\\Foo', $expand(['**\\Foo'], ['\\Acme\\Foo'])[0]); + $this->assertEmpty($expand(['**\\Foo'], ['\\Acme\\Foo\\AcmeBundle'])); + $this->assertEmpty($expand(['**\\Foo'], ['\\Acme\\FooBar\\AcmeBundle'])); - $this->assertSame('Foo\\Acme\\Bar', $expand(array('Foo\\*\\Bar'), array('\\Foo\\Acme\\Bar'))[0]); - $this->assertEmpty($expand(array('Foo\\*\\Bar'), array('\\Foo\\Acme\\Bundle\\Bar'))); + $this->assertSame('Foo\\Acme\\Bar', $expand(['Foo\\*\\Bar'], ['\\Foo\\Acme\\Bar'])[0]); + $this->assertEmpty($expand(['Foo\\*\\Bar'], ['\\Foo\\Acme\\Bundle\\Bar'])); - $this->assertSame('Foo\\Acme\\Bar', $expand(array('Foo\\**\\Bar'), array('\\Foo\\Acme\\Bar'))[0]); - $this->assertSame('Foo\\Acme\\Bundle\\Bar', $expand(array('Foo\\**\\Bar'), array('\\Foo\\Acme\\Bundle\\Bar'))[0]); + $this->assertSame('Foo\\Acme\\Bar', $expand(['Foo\\**\\Bar'], ['\\Foo\\Acme\\Bar'])[0]); + $this->assertSame('Foo\\Acme\\Bundle\\Bar', $expand(['Foo\\**\\Bar'], ['\\Foo\\Acme\\Bundle\\Bar'])[0]); - $this->assertSame('Acme\\Bar', $expand(array('*\\Bar'), array('\\Acme\\Bar'))[0]); - $this->assertEmpty($expand(array('*\\Bar'), array('\\Bar'))); - $this->assertEmpty($expand(array('*\\Bar'), array('\\Foo\\Acme\\Bar'))); + $this->assertSame('Acme\\Bar', $expand(['*\\Bar'], ['\\Acme\\Bar'])[0]); + $this->assertEmpty($expand(['*\\Bar'], ['\\Bar'])); + $this->assertEmpty($expand(['*\\Bar'], ['\\Foo\\Acme\\Bar'])); - $this->assertSame('Foo\\Acme\\Bar', $expand(array('**\\Bar'), array('\\Foo\\Acme\\Bar'))[0]); - $this->assertSame('Foo\\Acme\\Bundle\\Bar', $expand(array('**\\Bar'), array('\\Foo\\Acme\\Bundle\\Bar'))[0]); - $this->assertEmpty($expand(array('**\\Bar'), array('\\Bar'))); + $this->assertSame('Foo\\Acme\\Bar', $expand(['**\\Bar'], ['\\Foo\\Acme\\Bar'])[0]); + $this->assertSame('Foo\\Acme\\Bundle\\Bar', $expand(['**\\Bar'], ['\\Foo\\Acme\\Bundle\\Bar'])[0]); + $this->assertEmpty($expand(['**\\Bar'], ['\\Bar'])); - $this->assertSame('Foo\\Bar', $expand(array('Foo\\*'), array('\\Foo\\Bar'))[0]); - $this->assertEmpty($expand(array('Foo\\*'), array('\\Foo\\Acme\\Bar'))); + $this->assertSame('Foo\\Bar', $expand(['Foo\\*'], ['\\Foo\\Bar'])[0]); + $this->assertEmpty($expand(['Foo\\*'], ['\\Foo\\Acme\\Bar'])); - $this->assertSame('Foo\\Bar', $expand(array('Foo\\**'), array('\\Foo\\Bar'))[0]); - $this->assertSame('Foo\\Acme\\Bar', $expand(array('Foo\\**'), array('\\Foo\\Acme\\Bar'))[0]); + $this->assertSame('Foo\\Bar', $expand(['Foo\\**'], ['\\Foo\\Bar'])[0]); + $this->assertSame('Foo\\Acme\\Bar', $expand(['Foo\\**'], ['\\Foo\\Acme\\Bar'])[0]); - $this->assertSame(array('Foo\\Bar'), $expand(array('Foo\\*'), array('Foo\\Bar', 'Foo\\BarTest'))); - $this->assertSame(array('Foo\\Bar', 'Foo\\BarTest'), $expand(array('Foo\\*', 'Foo\\*Test'), array('Foo\\Bar', 'Foo\\BarTest'))); + $this->assertSame(['Foo\\Bar'], $expand(['Foo\\*'], ['Foo\\Bar', 'Foo\\BarTest'])); + $this->assertSame(['Foo\\Bar', 'Foo\\BarTest'], $expand(['Foo\\*', 'Foo\\*Test'], ['Foo\\Bar', 'Foo\\BarTest'])); $this->assertSame( 'Acme\\FooBundle\\Controller\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\Acme\\FooBundle\\Controller\\DefaultController'))[0] + $expand(['**Bundle\\Controller\\'], ['\\Acme\\FooBundle\\Controller\\DefaultController'])[0] ); $this->assertSame( 'FooBundle\\Controller\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\FooBundle\\Controller\\DefaultController'))[0] + $expand(['**Bundle\\Controller\\'], ['\\FooBundle\\Controller\\DefaultController'])[0] ); $this->assertSame( 'Acme\\FooBundle\\Controller\\Bar\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\Acme\\FooBundle\\Controller\\Bar\\DefaultController'))[0] + $expand(['**Bundle\\Controller\\'], ['\\Acme\\FooBundle\\Controller\\Bar\\DefaultController'])[0] ); $this->assertSame( 'Bundle\\Controller\\Bar\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\Bundle\\Controller\\Bar\\DefaultController'))[0] + $expand(['**Bundle\\Controller\\'], ['\\Bundle\\Controller\\Bar\\DefaultController'])[0] ); $this->assertSame( 'Acme\\Bundle\\Controller\\Bar\\DefaultController', - $expand(array('**Bundle\\Controller\\'), array('\\Acme\\Bundle\\Controller\\Bar\\DefaultController'))[0] + $expand(['**Bundle\\Controller\\'], ['\\Acme\\Bundle\\Controller\\Bar\\DefaultController'])[0] ); - $this->assertSame('Foo\\Bar', $expand(array('Foo\\Bar'), array())[0]); - $this->assertSame('Foo\\Acme\\Bar', $expand(array('Foo\\**'), array('\\Foo\\Acme\\Bar'))[0]); + $this->assertSame('Foo\\Bar', $expand(['Foo\\Bar'], [])[0]); + $this->assertSame('Foo\\Acme\\Bar', $expand(['Foo\\**'], ['\\Foo\\Acme\\Bar'])[0]); } } diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php index 49bbd0f9c1..2694d002cf 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/ControllerArgumentValueResolverPassTest.php @@ -23,19 +23,19 @@ class ControllerArgumentValueResolverPassTest extends TestCase { public function testServicesAreOrderedAccordingToPriority() { - $services = array( - 'n3' => array(array()), - 'n1' => array(array('priority' => 200)), - 'n2' => array(array('priority' => 100)), - ); + $services = [ + 'n3' => [[]], + 'n1' => [['priority' => 200]], + 'n2' => [['priority' => 100]], + ]; - $expected = array( + $expected = [ new Reference('n1'), new Reference('n2'), new Reference('n3'), - ); + ]; - $definition = new Definition(ArgumentResolver::class, array(null, array())); + $definition = new Definition(ArgumentResolver::class, [null, []]); $container = new ContainerBuilder(); $container->setDefinition('argument_resolver', $definition); @@ -55,19 +55,19 @@ class ControllerArgumentValueResolverPassTest extends TestCase public function testInDebugWithStopWatchDefinition() { - $services = array( - 'n3' => array(array()), - 'n1' => array(array('priority' => 200)), - 'n2' => array(array('priority' => 100)), - ); + $services = [ + 'n3' => [[]], + 'n1' => [['priority' => 200]], + 'n2' => [['priority' => 100]], + ]; - $expected = array( + $expected = [ new Reference('n1'), new Reference('n2'), new Reference('n3'), - ); + ]; - $definition = new Definition(ArgumentResolver::class, array(null, array())); + $definition = new Definition(ArgumentResolver::class, [null, []]); $container = new ContainerBuilder(); $container->register('debug.stopwatch', Stopwatch::class); $container->setDefinition('argument_resolver', $definition); @@ -92,9 +92,9 @@ class ControllerArgumentValueResolverPassTest extends TestCase public function testInDebugWithouStopWatchDefinition() { - $expected = array(new Reference('n1')); + $expected = [new Reference('n1')]; - $definition = new Definition(ArgumentResolver::class, array(null, array())); + $definition = new Definition(ArgumentResolver::class, [null, []]); $container = new ContainerBuilder(); $container->register('n1')->addTag('controller.argument_value_resolver'); $container->setDefinition('argument_resolver', $definition); @@ -110,14 +110,14 @@ class ControllerArgumentValueResolverPassTest extends TestCase public function testReturningEmptyArrayWhenNoService() { - $definition = new Definition(ArgumentResolver::class, array(null, array())); + $definition = new Definition(ArgumentResolver::class, [null, []]); $container = new ContainerBuilder(); $container->setDefinition('argument_resolver', $definition); $container->setParameter('kernel.debug', false); (new ControllerArgumentValueResolverPass())->process($container); - $this->assertEquals(array(), $definition->getArgument(1)->getValues()); + $this->assertEquals([], $definition->getArgument(1)->getValues()); } public function testNoArgumentResolver() diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php index e8957bb3cc..087c666596 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/FragmentRendererPassTest.php @@ -33,12 +33,12 @@ class FragmentRendererPassTest extends TestCase $builder = new ContainerBuilder(); $fragmentHandlerDefinition = $builder->register('fragment.handler'); $builder->register('my_content_renderer', 'Symfony\Component\DependencyInjection\Definition') - ->addTag('kernel.fragment_renderer', array('alias' => 'foo')); + ->addTag('kernel.fragment_renderer', ['alias' => 'foo']); $pass = new FragmentRendererPass(); $pass->process($builder); - $this->assertEquals(array(array('addRendererService', array('foo', 'my_content_renderer'))), $fragmentHandlerDefinition->getMethodCalls()); + $this->assertEquals([['addRendererService', ['foo', 'my_content_renderer']]], $fragmentHandlerDefinition->getMethodCalls()); } public function testValidContentRenderer() @@ -47,20 +47,20 @@ class FragmentRendererPassTest extends TestCase $fragmentHandlerDefinition = $builder->register('fragment.handler') ->addArgument(null); $builder->register('my_content_renderer', 'Symfony\Component\HttpKernel\Tests\DependencyInjection\RendererService') - ->addTag('kernel.fragment_renderer', array('alias' => 'foo')); + ->addTag('kernel.fragment_renderer', ['alias' => 'foo']); $pass = new FragmentRendererPass(); $pass->process($builder); $serviceLocatorDefinition = $builder->getDefinition((string) $fragmentHandlerDefinition->getArgument(0)); $this->assertSame(ServiceLocator::class, $serviceLocatorDefinition->getClass()); - $this->assertEquals(array('foo' => new ServiceClosureArgument(new Reference('my_content_renderer'))), $serviceLocatorDefinition->getArgument(0)); + $this->assertEquals(['foo' => new ServiceClosureArgument(new Reference('my_content_renderer'))], $serviceLocatorDefinition->getArgument(0)); } } class RendererService implements FragmentRendererInterface { - public function render($uri, Request $request = null, array $options = array()) + public function render($uri, Request $request = null, array $options = []) { } diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php index ae421d919b..7af756e0b8 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php @@ -23,9 +23,9 @@ class MergeExtensionConfigurationPassTest extends TestCase $container = new ContainerBuilder(); $container->registerExtension(new LoadedExtension()); $container->registerExtension(new NotLoadedExtension()); - $container->loadFromExtension('loaded', array()); + $container->loadFromExtension('loaded', []); - $configPass = new MergeExtensionConfigurationPass(array('loaded', 'not_loaded')); + $configPass = new MergeExtensionConfigurationPass(['loaded', 'not_loaded']); $configPass->process($container); $this->assertTrue($container->hasDefinition('loaded.foo')); diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php index d03ea53a37..cf685b2ae2 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php @@ -32,7 +32,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testInvalidClass() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', NotFound::class) ->addTag('controller.service_arguments') @@ -49,10 +49,10 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testNoAction() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('argument' => 'bar')) + ->addTag('controller.service_arguments', ['argument' => 'bar']) ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -66,10 +66,10 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testNoArgument() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction')) + ->addTag('controller.service_arguments', ['action' => 'fooAction']) ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -83,10 +83,10 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testNoService() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'bar')) + ->addTag('controller.service_arguments', ['action' => 'fooAction', 'argument' => 'bar']) ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -100,10 +100,10 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testInvalidMethod() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'barAction', 'argument' => 'bar', 'id' => 'bar_service')) + ->addTag('controller.service_arguments', ['action' => 'barAction', 'argument' => 'bar', 'id' => 'bar_service']) ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -117,10 +117,10 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testInvalidArgument() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'baz', 'id' => 'bar')) + ->addTag('controller.service_arguments', ['action' => 'fooAction', 'argument' => 'baz', 'id' => 'bar']) ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -130,7 +130,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testAllActions() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) ->addTag('controller.service_arguments') @@ -141,7 +141,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertEquals(array('foo::fooAction'), array_keys($locator)); + $this->assertEquals(['foo::fooAction'], array_keys($locator)); $this->assertInstanceof(ServiceClosureArgument::class, $locator['foo::fooAction']); $locator = $container->getDefinition((string) $locator['foo::fooAction']->getValues()[0]); @@ -149,18 +149,18 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase $this->assertSame(ServiceLocator::class, $locator->getClass()); $this->assertFalse($locator->isPublic()); - $expected = array('bar' => new ServiceClosureArgument(new TypedReference(ControllerDummy::class, ControllerDummy::class, ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE, 'bar'))); + $expected = ['bar' => new ServiceClosureArgument(new TypedReference(ControllerDummy::class, ControllerDummy::class, ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE, 'bar'))]; $this->assertEquals($expected, $locator->getArgument(0)); } public function testExplicitArgument() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'bar', 'id' => 'bar')) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'bar', 'id' => 'baz')) // should be ignored, the first wins + ->addTag('controller.service_arguments', ['action' => 'fooAction', 'argument' => 'bar', 'id' => 'bar']) + ->addTag('controller.service_arguments', ['action' => 'fooAction', 'argument' => 'bar', 'id' => 'baz']) // should be ignored, the first wins ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -169,17 +169,17 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); $locator = $container->getDefinition((string) $locator['foo::fooAction']->getValues()[0]); - $expected = array('bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE))); + $expected = ['bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE))]; $this->assertEquals($expected, $locator->getArgument(0)); } public function testOptionalArgument() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->addTag('controller.service_arguments', array('action' => 'fooAction', 'argument' => 'bar', 'id' => '?bar')) + ->addTag('controller.service_arguments', ['action' => 'fooAction', 'argument' => 'bar', 'id' => '?bar']) ; $pass = new RegisterControllerArgumentLocatorsPass(); @@ -188,14 +188,14 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); $locator = $container->getDefinition((string) $locator['foo::fooAction']->getValues()[0]); - $expected = array('bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE))); + $expected = ['bar' => new ServiceClosureArgument(new TypedReference('bar', ControllerDummy::class, ContainerInterface::IGNORE_ON_INVALID_REFERENCE))]; $this->assertEquals($expected, $locator->getArgument(0)); } public function testSkipSetContainer() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', ContainerAwareRegisterTestController::class) ->addTag('controller.service_arguments'); @@ -204,7 +204,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase $pass->process($container); $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertSame(array('foo::fooAction'), array_keys($locator)); + $this->assertSame(['foo::fooAction'], array_keys($locator)); } /** @@ -214,7 +214,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testExceptionOnNonExistentTypeHint() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', NonExistentClassController::class) ->addTag('controller.service_arguments'); @@ -230,7 +230,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testExceptionOnNonExistentTypeHintDifferentNamespace() { $container = new ContainerBuilder(); - $container->register('argument_resolver.service')->addArgument(array()); + $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', NonExistentClassDifferentNamespaceController::class) ->addTag('controller.service_arguments'); @@ -242,7 +242,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testNoExceptionOnNonExistentTypeHintOptionalArg() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', NonExistentClassOptionalController::class) ->addTag('controller.service_arguments'); @@ -251,13 +251,13 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase $pass->process($container); $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertSame(array('foo::barAction', 'foo::fooAction'), array_keys($locator)); + $this->assertSame(['foo::barAction', 'foo::fooAction'], array_keys($locator)); } public function testArgumentWithNoTypeHintIsOk() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', ArgumentWithoutTypeController::class) ->addTag('controller.service_arguments'); @@ -272,7 +272,7 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testControllersAreMadePublic() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', ArgumentWithoutTypeController::class) ->setPublic(false) @@ -290,10 +290,10 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testBindings($bindingName) { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', RegisterTestController::class) - ->setBindings(array($bindingName => new Reference('foo'))) + ->setBindings([$bindingName => new Reference('foo')]) ->addTag('controller.service_arguments'); $pass = new RegisterControllerArgumentLocatorsPass(); @@ -303,17 +303,17 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase $locator = $container->getDefinition((string) $locator['foo::fooAction']->getValues()[0]); - $expected = array('bar' => new ServiceClosureArgument(new Reference('foo'))); + $expected = ['bar' => new ServiceClosureArgument(new Reference('foo'))]; $this->assertEquals($expected, $locator->getArgument(0)); } public function provideBindings() { - return array( - array(ControllerDummy::class.'$bar'), - array(ControllerDummy::class), - array('$bar'), - ); + return [ + [ControllerDummy::class.'$bar'], + [ControllerDummy::class], + ['$bar'], + ]; } /** @@ -322,10 +322,10 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function testBindScalarValueToControllerArgument($bindingKey) { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('foo', ArgumentWithoutTypeController::class) - ->setBindings(array($bindingKey => '%foo%')) + ->setBindings([$bindingKey => '%foo%']) ->addTag('controller.service_arguments'); $container->setParameter('foo', 'foo_val'); @@ -350,19 +350,19 @@ class RegisterControllerArgumentLocatorsPassTest extends TestCase public function provideBindScalarValueToControllerArgument() { - yield array('$someArg'); - yield array('string $someArg'); + yield ['$someArg']; + yield ['string $someArg']; } public function testBindingsOnChildDefinitions() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('parent', ArgumentWithoutTypeController::class); $container->setDefinition('child', (new ChildDefinition('parent')) - ->setBindings(array('$someArg' => new Reference('parent'))) + ->setBindings(['$someArg' => new Reference('parent')]) ->addTag('controller.service_arguments') ); diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php index dfec38347d..56fe6baf76 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPassTest.php @@ -23,13 +23,13 @@ class RemoveEmptyControllerArgumentLocatorsPassTest extends TestCase public function testProcess() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('stdClass', 'stdClass'); $container->register(parent::class, 'stdClass'); $container->register('c1', RemoveTestController1::class)->addTag('controller.service_arguments'); $container->register('c2', RemoveTestController2::class)->addTag('controller.service_arguments') - ->addMethodCall('setTestCase', array(new Reference('c1'))); + ->addMethodCall('setTestCase', [new Reference('c1')]); $pass = new RegisterControllerArgumentLocatorsPass(); $pass->process($container); @@ -43,19 +43,19 @@ class RemoveEmptyControllerArgumentLocatorsPassTest extends TestCase (new ResolveInvalidReferencesPass())->process($container); $this->assertCount(1, $container->getDefinition((string) $controllers['c2::setTestCase']->getValues()[0])->getArgument(0)); - $this->assertSame(array(), $container->getDefinition((string) $controllers['c2::fooAction']->getValues()[0])->getArgument(0)); + $this->assertSame([], $container->getDefinition((string) $controllers['c2::fooAction']->getValues()[0])->getArgument(0)); (new RemoveEmptyControllerArgumentLocatorsPass())->process($container); $controllers = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); - $this->assertSame(array('c1::fooAction', 'c1:fooAction'), array_keys($controllers)); - $this->assertSame(array('bar'), array_keys($container->getDefinition((string) $controllers['c1::fooAction']->getValues()[0])->getArgument(0))); + $this->assertSame(['c1::fooAction', 'c1:fooAction'], array_keys($controllers)); + $this->assertSame(['bar'], array_keys($container->getDefinition((string) $controllers['c1::fooAction']->getValues()[0])->getArgument(0))); - $expectedLog = array( + $expectedLog = [ 'Symfony\Component\HttpKernel\DependencyInjection\RemoveEmptyControllerArgumentLocatorsPass: Removing service-argument resolver for controller "c2::fooAction": no corresponding services exist for the referenced types.', 'Symfony\Component\HttpKernel\DependencyInjection\RemoveEmptyControllerArgumentLocatorsPass: Removing method "setTestCase" of service "c2" from controller candidates: the method is called at instantiation, thus cannot be an action.', - ); + ]; $this->assertSame($expectedLog, $container->getCompiler()->getLog()); } @@ -63,7 +63,7 @@ class RemoveEmptyControllerArgumentLocatorsPassTest extends TestCase public function testInvoke() { $container = new ContainerBuilder(); - $resolver = $container->register('argument_resolver.service')->addArgument(array()); + $resolver = $container->register('argument_resolver.service')->addArgument([]); $container->register('invokable', InvokableRegisterTestController::class) ->addTag('controller.service_arguments') @@ -73,7 +73,7 @@ class RemoveEmptyControllerArgumentLocatorsPassTest extends TestCase (new RemoveEmptyControllerArgumentLocatorsPass())->process($container); $this->assertEquals( - array('invokable::__invoke', 'invokable:__invoke', 'invokable'), + ['invokable::__invoke', 'invokable:__invoke', 'invokable'], array_keys($container->getDefinition((string) $resolver->getArgument(0))->getArgument(0)) ); } diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php index f7ea16dbfb..9b23ad003d 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/ResettableServicePassTest.php @@ -19,14 +19,14 @@ class ResettableServicePassTest extends TestCase $container = new ContainerBuilder(); $container->register('one', ResettableService::class) ->setPublic(true) - ->addTag('kernel.reset', array('method' => 'reset')); + ->addTag('kernel.reset', ['method' => 'reset']); $container->register('two', ClearableService::class) ->setPublic(true) - ->addTag('kernel.reset', array('method' => 'clear')); + ->addTag('kernel.reset', ['method' => 'clear']); $container->register('services_resetter', ServicesResetter::class) ->setPublic(true) - ->setArguments(array(null, array())); + ->setArguments([null, []]); $container->addCompilerPass(new ResettableServicePass()); $container->compile(); @@ -34,16 +34,16 @@ class ResettableServicePassTest extends TestCase $definition = $container->getDefinition('services_resetter'); $this->assertEquals( - array( - new IteratorArgument(array( + [ + new IteratorArgument([ 'one' => new Reference('one', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE), 'two' => new Reference('two', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE), - )), - array( + ]), + [ 'one' => 'reset', 'two' => 'clear', - ), - ), + ], + ], $definition->getArguments() ); } @@ -58,7 +58,7 @@ class ResettableServicePassTest extends TestCase $container->register(ResettableService::class) ->addTag('kernel.reset'); $container->register('services_resetter', ServicesResetter::class) - ->setArguments(array(null, array())); + ->setArguments([null, []]); $container->addCompilerPass(new ResettableServicePass()); $container->compile(); @@ -68,7 +68,7 @@ class ResettableServicePassTest extends TestCase { $container = new ContainerBuilder(); $container->register('services_resetter', ServicesResetter::class) - ->setArguments(array(null, array())); + ->setArguments([null, []]); $container->addCompilerPass(new ResettableServicePass()); $container->compile(); diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php index 47c62abd0d..86f1abdb05 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/ServicesResetterTest.php @@ -26,13 +26,13 @@ class ServicesResetterTest extends TestCase public function testResetServices() { - $resetter = new ServicesResetter(new \ArrayIterator(array( + $resetter = new ServicesResetter(new \ArrayIterator([ 'id1' => new ResettableService(), 'id2' => new ClearableService(), - )), array( + ]), [ 'id1' => 'reset', 'id2' => 'clear', - )); + ]); $resetter->reset(); diff --git a/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php b/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php index f1e440b2fc..abc51ac51e 100644 --- a/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php +++ b/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php @@ -11,7 +11,7 @@ class FilterControllerArgumentsEventTest extends TestCase { public function testFilterControllerArgumentsEvent() { - $filterController = new FilterControllerArgumentsEvent(new TestHttpKernel(), function () {}, array('test'), new Request(), 1); - $this->assertEquals($filterController->getArguments(), array('test')); + $filterController = new FilterControllerArgumentsEvent(new TestHttpKernel(), function () {}, ['test'], new Request(), 1); + $this->assertEquals($filterController->getArguments(), ['test']); } } diff --git a/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php index 3ffb9f3d63..b4ea2f955b 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php @@ -30,7 +30,7 @@ class AddRequestFormatsListenerTest extends TestCase protected function setUp() { - $this->listener = new AddRequestFormatsListener(array('csv' => array('text/csv', 'text/plain'))); + $this->listener = new AddRequestFormatsListener(['csv' => ['text/csv', 'text/plain']]); } protected function tearDown() @@ -46,7 +46,7 @@ class AddRequestFormatsListenerTest extends TestCase public function testRegisteredEvent() { $this->assertEquals( - array(KernelEvents::REQUEST => array('onKernelRequest', 1)), + [KernelEvents::REQUEST => ['onKernelRequest', 1]], AddRequestFormatsListener::getSubscribedEvents() ); } @@ -58,7 +58,7 @@ class AddRequestFormatsListenerTest extends TestCase $request->expects($this->once()) ->method('setFormat') - ->with('csv', array('text/csv', 'text/plain')); + ->with('csv', ['text/csv', 'text/plain']); $this->listener->onKernelRequest($event); } diff --git a/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php index 9a9c17edab..d9e261d35a 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php @@ -40,11 +40,11 @@ class DebugHandlersListenerTest extends TestCase $listener = new DebugHandlersListener($userHandler, $logger); $xHandler = new ExceptionHandler(); $eHandler = new ErrorHandler(); - $eHandler->setExceptionHandler(array($xHandler, 'handle')); + $eHandler->setExceptionHandler([$xHandler, 'handle']); $exception = null; - set_error_handler(array($eHandler, 'handleError')); - set_exception_handler(array($eHandler, 'handleException')); + set_error_handler([$eHandler, 'handleError']); + set_exception_handler([$eHandler, 'handleException']); try { $listener->configure(); } catch (\Exception $exception) { @@ -58,10 +58,10 @@ class DebugHandlersListenerTest extends TestCase $this->assertSame($userHandler, $xHandler->setHandler('var_dump')); - $loggers = $eHandler->setLoggers(array()); + $loggers = $eHandler->setLoggers([]); $this->assertArrayHasKey(E_DEPRECATED, $loggers); - $this->assertSame(array($logger, LogLevel::INFO), $loggers[E_DEPRECATED]); + $this->assertSame([$logger, LogLevel::INFO], $loggers[E_DEPRECATED]); } public function testConfigureForHttpKernelWithNoTerminateWithException() @@ -75,7 +75,7 @@ class DebugHandlersListenerTest extends TestCase ); $exception = null; - $h = set_exception_handler(array($eHandler, 'handleException')); + $h = set_exception_handler([$eHandler, 'handleException']); try { $listener->configure($event); } catch (\Exception $exception) { @@ -101,16 +101,16 @@ class DebugHandlersListenerTest extends TestCase $dispatcher->addSubscriber($listener); - $xListeners = array( - KernelEvents::REQUEST => array(array($listener, 'configure')), - ConsoleEvents::COMMAND => array(array($listener, 'configure')), - ); + $xListeners = [ + KernelEvents::REQUEST => [[$listener, 'configure']], + ConsoleEvents::COMMAND => [[$listener, 'configure']], + ]; $this->assertSame($xListeners, $dispatcher->getListeners()); $exception = null; $eHandler = new ErrorHandler(); - set_error_handler(array($eHandler, 'handleError')); - set_exception_handler(array($eHandler, 'handleException')); + set_error_handler([$eHandler, 'handleError']); + set_exception_handler([$eHandler, 'handleException']); try { $dispatcher->dispatch(ConsoleEvents::COMMAND, $event); } catch (\Exception $exception) { @@ -139,7 +139,7 @@ class DebugHandlersListenerTest extends TestCase $eHandler->setExceptionHandler('var_dump'); $exception = null; - set_exception_handler(array($eHandler, 'handleException')); + set_exception_handler([$eHandler, 'handleException']); try { $listener->configure(); } catch (\Exception $exception) { diff --git a/vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php index 509f443087..b86a7552f8 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/DumpListenerTest.php @@ -29,7 +29,7 @@ class DumpListenerTest extends TestCase public function testSubscribedEvents() { $this->assertSame( - array(ConsoleEvents::COMMAND => array('configure', 1024)), + [ConsoleEvents::COMMAND => ['configure', 1024]], DumpListener::getSubscribedEvents() ); } @@ -68,7 +68,7 @@ class MockCloner implements ClonerInterface { public function cloneVar($var) { - return new Data(array(array($var.'-'))); + return new Data([[$var.'-']]); } } diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php index 5251976e49..b7224ddcea 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php @@ -98,7 +98,7 @@ class ExceptionListenerTest extends TestCase public function provider() { if (!class_exists('Symfony\Component\HttpFoundation\Request')) { - return array(array(null, null)); + return [[null, null]]; } $request = new Request(); @@ -106,9 +106,9 @@ class ExceptionListenerTest extends TestCase $event = new GetResponseForExceptionEvent(new TestKernel(), $request, HttpKernelInterface::MASTER_REQUEST, $exception); $event2 = new GetResponseForExceptionEvent(new TestKernelThatThrowsException(), $request, HttpKernelInterface::MASTER_REQUEST, $exception); - return array( - array($event, $event2), - ); + return [ + [$event, $event2], + ]; } public function testSubRequestFormat() @@ -146,7 +146,7 @@ class ExceptionListenerTest extends TestCase $event = new GetResponseForExceptionEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, new \Exception('foo')); $dispatcher->dispatch(KernelEvents::EXCEPTION, $event); - $response = new Response('', 200, array('content-security-policy' => "style-src 'self'")); + $response = new Response('', 200, ['content-security-policy' => "style-src 'self'"]); $this->assertTrue($response->headers->has('content-security-policy')); $event = new FilterResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php index edf0498265..6408b1b21c 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php @@ -68,7 +68,7 @@ class FragmentListenerTest extends TestCase */ public function testAccessDeniedWithWrongSignature() { - $request = Request::create('http://example.com/_fragment', 'GET', array(), array(), array(), array('REMOTE_ADDR' => '10.0.0.1')); + $request = Request::create('http://example.com/_fragment', 'GET', [], [], [], ['REMOTE_ADDR' => '10.0.0.1']); $listener = new FragmentListener(new UriSigner('foo')); $event = $this->createGetResponseEvent($request); @@ -79,14 +79,14 @@ class FragmentListenerTest extends TestCase public function testWithSignature() { $signer = new UriSigner('foo'); - $request = Request::create($signer->sign('http://example.com/_fragment?_path=foo%3Dbar%26_controller%3Dfoo'), 'GET', array(), array(), array(), array('REMOTE_ADDR' => '10.0.0.1')); + $request = Request::create($signer->sign('http://example.com/_fragment?_path=foo%3Dbar%26_controller%3Dfoo'), 'GET', [], [], [], ['REMOTE_ADDR' => '10.0.0.1']); $listener = new FragmentListener($signer); $event = $this->createGetResponseEvent($request); $listener->onKernelRequest($event); - $this->assertEquals(array('foo' => 'bar', '_controller' => 'foo'), $request->attributes->get('_route_params')); + $this->assertEquals(['foo' => 'bar', '_controller' => 'foo'], $request->attributes->get('_route_params')); $this->assertFalse($request->query->has('_path')); } @@ -105,7 +105,7 @@ class FragmentListenerTest extends TestCase public function testRemovesPathWithControllerNotDefined() { $signer = new UriSigner('foo'); - $request = Request::create($signer->sign('http://example.com/_fragment?_path=foo%3Dbar'), 'GET', array(), array(), array(), array('REMOTE_ADDR' => '10.0.0.1')); + $request = Request::create($signer->sign('http://example.com/_fragment?_path=foo%3Dbar'), 'GET', [], [], [], ['REMOTE_ADDR' => '10.0.0.1']); $listener = new FragmentListener($signer); $event = $this->createGetResponseEvent($request); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php index f442235ad0..1cf4b72c69 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php @@ -54,7 +54,7 @@ class LocaleListenerTest extends TestCase $context = $this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock(); $context->expects($this->once())->method('setParameter')->with('_locale', 'es'); - $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(array('getContext'))->disableOriginalConstructor()->getMock(); + $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock(); $router->expects($this->once())->method('getContext')->will($this->returnValue($context)); $request = Request::create('/'); @@ -70,7 +70,7 @@ class LocaleListenerTest extends TestCase $context = $this->getMockBuilder('Symfony\Component\Routing\RequestContext')->getMock(); $context->expects($this->once())->method('setParameter')->with('_locale', 'es'); - $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(array('getContext'))->disableOriginalConstructor()->getMock(); + $router = $this->getMockBuilder('Symfony\Component\Routing\Router')->setMethods(['getContext'])->disableOriginalConstructor()->getMock(); $router->expects($this->once())->method('getContext')->will($this->returnValue($context)); $parentRequest = Request::create('/'); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php index 526b3aa75d..392aa2fc35 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php @@ -19,6 +19,7 @@ use Symfony\Component\HttpKernel\Event\PostResponseEvent; use Symfony\Component\HttpKernel\EventListener\ProfilerListener; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\HttpKernel\Profiler\Profile; class ProfilerListenerTest extends TestCase { @@ -27,9 +28,7 @@ class ProfilerListenerTest extends TestCase */ public function testKernelTerminate() { - $profile = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profile') - ->disableOriginalConstructor() - ->getMock(); + $profile = new Profile('token'); $profiler = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profiler') ->disableOriginalConstructor() diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php index 1d8960267d..aeab68f3e9 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php @@ -30,7 +30,7 @@ class ResponseListenerTest extends TestCase { $this->dispatcher = new EventDispatcher(); $listener = new ResponseListener('UTF-8'); - $this->dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); + $this->dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']); $this->kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); } @@ -54,7 +54,7 @@ class ResponseListenerTest extends TestCase public function testFilterSetsNonDefaultCharsetIfNotOverridden() { $listener = new ResponseListener('ISO-8859-15'); - $this->dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse'), 1); + $this->dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse'], 1); $response = new Response('foo'); @@ -67,7 +67,7 @@ class ResponseListenerTest extends TestCase public function testFilterDoesNothingIfCharsetIsOverridden() { $listener = new ResponseListener('ISO-8859-15'); - $this->dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse'), 1); + $this->dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse'], 1); $response = new Response('foo'); $response->setCharset('ISO-8859-1'); @@ -81,7 +81,7 @@ class ResponseListenerTest extends TestCase public function testFiltersSetsNonDefaultCharsetIfNotOverriddenOnNonTextContentType() { $listener = new ResponseListener('ISO-8859-15'); - $this->dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse'), 1); + $this->dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse'], 1); $response = new Response('foo'); $request = Request::create('/'); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php index 92e7272965..c27b341300 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php @@ -62,12 +62,12 @@ class RouterListenerTest extends TestCase public function getPortData() { - return array( - array(80, 443, 'http://localhost/', 80, 443), - array(80, 443, 'http://localhost:90/', 90, 443), - array(80, 443, 'https://localhost/', 80, 443), - array(80, 443, 'https://localhost:90/', 80, 90), - ); + return [ + [80, 443, 'http://localhost/', 80, 443], + [80, 443, 'http://localhost:90/', 90, 443], + [80, 443, 'https://localhost/', 80, 443], + [80, 443, 'https://localhost:90/', 80, 90], + ]; } private function createGetResponseEventForUri(string $uri): GetResponseEvent @@ -97,7 +97,7 @@ class RouterListenerTest extends TestCase $requestMatcher->expects($this->once()) ->method('matchRequest') ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) - ->will($this->returnValue(array())); + ->will($this->returnValue([])); $listener = new RouterListener($requestMatcher, $this->requestStack, new RequestContext()); $listener->onKernelRequest($event); @@ -113,7 +113,7 @@ class RouterListenerTest extends TestCase $requestMatcher->expects($this->any()) ->method('matchRequest') ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) - ->will($this->returnValue(array())); + ->will($this->returnValue([])); $context = new RequestContext(); @@ -154,10 +154,10 @@ class RouterListenerTest extends TestCase public function getLoggingParameterData() { - return array( - array(array('_route' => 'foo'), 'Matched route "{route}".', array('route' => 'foo', 'route_parameters' => array('_route' => 'foo'), 'request_uri' => 'http://localhost/', 'method' => 'GET')), - array(array(), 'Matched route "{route}".', array('route' => 'n/a', 'route_parameters' => array(), 'request_uri' => 'http://localhost/', 'method' => 'GET')), - ); + return [ + [['_route' => 'foo'], 'Matched route "{route}".', ['route' => 'foo', 'route_parameters' => ['_route' => 'foo'], 'request_uri' => 'http://localhost/', 'method' => 'GET']], + [[], 'Matched route "{route}".', ['route' => 'n/a', 'route_parameters' => [], 'request_uri' => 'http://localhost/', 'method' => 'GET']], + ]; } public function testWithBadRequest() diff --git a/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php index e6255a56e1..47ac75e8bc 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php @@ -113,9 +113,9 @@ class SessionListenerTest extends TestCase $response->setSharedMaxAge(60); $response->headers->set(AbstractSessionListener::NO_AUTO_CACHE_CONTROL_HEADER, 'true'); - $container = new ServiceLocator(array( + $container = new ServiceLocator([ 'initialized_session' => function () {}, - )); + ]); $listener = new SessionListener($container); $listener->onKernelResponse(new FilterResponseEvent($kernel, new Request(), HttpKernelInterface::MASTER_REQUEST, $response)); @@ -140,7 +140,7 @@ class SessionListenerTest extends TestCase $request = new Request(); $response = new Response(); - $response->setCache(array('public' => true, 'max_age' => '30')); + $response->setCache(['public' => true, 'max_age' => '30']); $listener->onKernelRequest(new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST)); $this->assertTrue($request->hasSession()); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php index b955c07d47..66e119f123 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php @@ -30,7 +30,7 @@ class SurrogateListenerTest extends TestCase $response = new Response('foo <esi:include src="" />'); $listener = new SurrogateListener(new Esi()); - $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); + $dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']); $event = new FilterResponseEvent($kernel, new Request(), HttpKernelInterface::SUB_REQUEST, $response); $dispatcher->dispatch(KernelEvents::RESPONSE, $event); @@ -44,7 +44,7 @@ class SurrogateListenerTest extends TestCase $response = new Response('foo <esi:include src="" />'); $listener = new SurrogateListener(new Esi()); - $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); + $dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']); $event = new FilterResponseEvent($kernel, new Request(), HttpKernelInterface::MASTER_REQUEST, $response); $dispatcher->dispatch(KernelEvents::RESPONSE, $event); @@ -58,7 +58,7 @@ class SurrogateListenerTest extends TestCase $response = new Response('foo'); $listener = new SurrogateListener(new Esi()); - $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'onKernelResponse')); + $dispatcher->addListener(KernelEvents::RESPONSE, [$listener, 'onKernelResponse']); $event = new FilterResponseEvent($kernel, new Request(), HttpKernelInterface::MASTER_REQUEST, $response); $dispatcher->dispatch(KernelEvents::RESPONSE, $event); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php index cd52bd56e2..9f6a5ef759 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php @@ -86,7 +86,7 @@ class TestSessionListenerTest extends TestCase $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST); - $this->assertSame(array(), $response->headers->getCookies()); + $this->assertSame([], $response->headers->getCookies()); } public function testEmptySessionWithNewSessionIdDoesSendCookie() @@ -96,7 +96,7 @@ class TestSessionListenerTest extends TestCase $this->fixSessionId('456'); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $request = Request::create('/', 'GET', array(), array('MOCKSESSID' => '123')); + $request = Request::create('/', 'GET', [], ['MOCKSESSID' => '123']); $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); $this->listener->onKernelRequest($event); @@ -115,11 +115,11 @@ class TestSessionListenerTest extends TestCase $this->fixSessionId('456'); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $request = Request::create('/', 'GET', array(), array('MOCKSESSID' => '123')); + $request = Request::create('/', 'GET', [], ['MOCKSESSID' => '123']); $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); $this->listener->onKernelRequest($event); - $response = new Response('', 200, array('Set-Cookie' => $existing)); + $response = new Response('', 200, ['Set-Cookie' => $existing]); $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST, $response); @@ -128,11 +128,11 @@ class TestSessionListenerTest extends TestCase public function anotherCookieProvider() { - return array( - 'same' => array('MOCKSESSID=789; path=/', array('MOCKSESSID=789; path=/')), - 'different domain' => array('MOCKSESSID=789; path=/; domain=example.com', array('MOCKSESSID=789; path=/; domain=example.com', 'MOCKSESSID=456; path=/')), - 'different path' => array('MOCKSESSID=789; path=/foo', array('MOCKSESSID=789; path=/foo', 'MOCKSESSID=456; path=/')), - ); + return [ + 'same' => ['MOCKSESSID=789; path=/', ['MOCKSESSID=789; path=/']], + 'different domain' => ['MOCKSESSID=789; path=/; domain=example.com', ['MOCKSESSID=789; path=/; domain=example.com', 'MOCKSESSID=456; path=/']], + 'different path' => ['MOCKSESSID=789; path=/foo', ['MOCKSESSID=789; path=/foo', 'MOCKSESSID=456; path=/']], + ]; } public function testUnstartedSessionIsNotSave() diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php index bdab742ce1..fb7a4379bf 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php @@ -23,7 +23,7 @@ class ValidateRequestListenerTest extends TestCase { protected function tearDown() { - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } /** @@ -35,12 +35,12 @@ class ValidateRequestListenerTest extends TestCase $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); $request = new Request(); - $request->setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED); + $request->setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $request->headers->set('FORWARDED', 'for=2.2.2.2'); $request->headers->set('X_FORWARDED_FOR', '3.3.3.3'); - $dispatcher->addListener(KernelEvents::REQUEST, array(new ValidateRequestListener(), 'onKernelRequest')); + $dispatcher->addListener(KernelEvents::REQUEST, [new ValidateRequestListener(), 'onKernelRequest']); $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); $dispatcher->dispatch(KernelEvents::REQUEST, $event); diff --git a/vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php index b64773551e..f5fe97255b 100644 --- a/vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php +++ b/vendor/symfony/http-kernel/Tests/Exception/HttpExceptionTest.php @@ -9,22 +9,22 @@ class HttpExceptionTest extends TestCase { public function headerDataProvider() { - return array( - array(array('X-Test' => 'Test')), - array(array('X-Test' => 1)), - array( - array( - array('X-Test' => 'Test'), - array('X-Test-2' => 'Test-2'), - ), - ), - ); + return [ + [['X-Test' => 'Test']], + [['X-Test' => 1]], + [ + [ + ['X-Test' => 'Test'], + ['X-Test-2' => 'Test-2'], + ], + ], + ]; } public function testHeadersDefault() { $exception = $this->createException(); - $this->assertSame(array(), $exception->getHeaders()); + $this->assertSame([], $exception->getHeaders()); } /** diff --git a/vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php index ea82014952..991f97582d 100644 --- a/vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php +++ b/vendor/symfony/http-kernel/Tests/Exception/MethodNotAllowedHttpExceptionTest.php @@ -8,17 +8,17 @@ class MethodNotAllowedHttpExceptionTest extends HttpExceptionTest { public function testHeadersDefault() { - $exception = new MethodNotAllowedHttpException(array('GET', 'PUT')); - $this->assertSame(array('Allow' => 'GET, PUT'), $exception->getHeaders()); + $exception = new MethodNotAllowedHttpException(['GET', 'PUT']); + $this->assertSame(['Allow' => 'GET, PUT'], $exception->getHeaders()); } public function testWithHeaderConstruct() { - $headers = array( + $headers = [ 'Cache-Control' => 'public, s-maxage=1200', - ); + ]; - $exception = new MethodNotAllowedHttpException(array('get'), null, null, null, $headers); + $exception = new MethodNotAllowedHttpException(['get'], null, null, null, $headers); $headers['Allow'] = 'GET'; @@ -30,7 +30,7 @@ class MethodNotAllowedHttpExceptionTest extends HttpExceptionTest */ public function testHeadersSetter($headers) { - $exception = new MethodNotAllowedHttpException(array('GET')); + $exception = new MethodNotAllowedHttpException(['GET']); $exception->setHeaders($headers); $this->assertSame($headers, $exception->getHeaders()); } diff --git a/vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php index 83cbdc2bcc..daa4fa407a 100644 --- a/vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php +++ b/vendor/symfony/http-kernel/Tests/Exception/ServiceUnavailableHttpExceptionTest.php @@ -9,14 +9,14 @@ class ServiceUnavailableHttpExceptionTest extends HttpExceptionTest public function testHeadersDefaultRetryAfter() { $exception = new ServiceUnavailableHttpException(10); - $this->assertSame(array('Retry-After' => 10), $exception->getHeaders()); + $this->assertSame(['Retry-After' => 10], $exception->getHeaders()); } public function testWithHeaderConstruct() { - $headers = array( + $headers = [ 'Cache-Control' => 'public, s-maxage=1337', - ); + ]; $exception = new ServiceUnavailableHttpException(1337, null, null, null, $headers); diff --git a/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php index 6ec7f3d079..0048ec85c0 100644 --- a/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php +++ b/vendor/symfony/http-kernel/Tests/Exception/TooManyRequestsHttpExceptionTest.php @@ -9,14 +9,14 @@ class TooManyRequestsHttpExceptionTest extends HttpExceptionTest public function testHeadersDefaultRertyAfter() { $exception = new TooManyRequestsHttpException(10); - $this->assertSame(array('Retry-After' => 10), $exception->getHeaders()); + $this->assertSame(['Retry-After' => 10], $exception->getHeaders()); } public function testWithHeaderConstruct() { - $headers = array( + $headers = [ 'Cache-Control' => 'public, s-maxage=69', - ); + ]; $exception = new TooManyRequestsHttpException(69, null, null, null, $headers); diff --git a/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php index 1e93d25b1a..c7239e70b3 100644 --- a/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php +++ b/vendor/symfony/http-kernel/Tests/Exception/UnauthorizedHttpExceptionTest.php @@ -9,14 +9,14 @@ class UnauthorizedHttpExceptionTest extends HttpExceptionTest public function testHeadersDefault() { $exception = new UnauthorizedHttpException('Challenge'); - $this->assertSame(array('WWW-Authenticate' => 'Challenge'), $exception->getHeaders()); + $this->assertSame(['WWW-Authenticate' => 'Challenge'], $exception->getHeaders()); } public function testWithHeaderConstruct() { - $headers = array( + $headers = [ 'Cache-Control' => 'public, s-maxage=1200', - ); + ]; $exception = new UnauthorizedHttpException('Challenge', null, null, null, $headers); diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php b/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php index 89dec36af4..4f5de182fd 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/DataCollector/CloneVarDataCollector.php @@ -31,7 +31,7 @@ class CloneVarDataCollector extends DataCollector public function reset() { - $this->data = array(); + $this->data = []; } public function getData() diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php b/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php index 9734594b6e..868094a596 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php @@ -23,7 +23,7 @@ class KernelForTest extends Kernel public function registerBundles() { - return array(); + return []; } public function registerContainerConfiguration(LoaderInterface $loader) diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php b/vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php index 0d0881d629..2391557362 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/KernelWithoutBundles.php @@ -19,7 +19,7 @@ class KernelWithoutBundles extends Kernel { public function registerBundles() { - return array(); + return []; } public function registerContainerConfiguration(LoaderInterface $loader) diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php b/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php index d5456fe5dc..a0665ef991 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/TestEventDispatcher.php @@ -17,12 +17,12 @@ class TestEventDispatcher extends TraceableEventDispatcher { public function getCalledListeners() { - return array('foo'); + return ['foo']; } public function getNotCalledListeners() { - return array('bar'); + return ['bar']; } public function reset() @@ -31,6 +31,6 @@ class TestEventDispatcher extends TraceableEventDispatcher public function getOrphanedEvents() { - return array(); + return []; } } diff --git a/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php index 79a9f74da4..d8006e1707 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php @@ -30,7 +30,7 @@ class EsiFragmentRendererTest extends TestCase { $strategy = new EsiFragmentRenderer(new Esi(), $this->getInlineStrategy(true), new UriSigner('foo')); $request = Request::create('/'); - $reference = new ControllerReference('main_controller', array('foo' => array(true)), array()); + $reference = new ControllerReference('main_controller', ['foo' => [true]], []); $strategy->render($reference, $request); } @@ -43,8 +43,8 @@ class EsiFragmentRendererTest extends TestCase $request->headers->set('Surrogate-Capability', 'ESI/1.0'); $this->assertEquals('<esi:include src="/" />', $strategy->render('/', $request)->getContent()); - $this->assertEquals("<esi:comment text=\"This is a comment\" />\n<esi:include src=\"/\" />", $strategy->render('/', $request, array('comment' => 'This is a comment'))->getContent()); - $this->assertEquals('<esi:include src="/" alt="foo" />', $strategy->render('/', $request, array('alt' => 'foo'))->getContent()); + $this->assertEquals("<esi:comment text=\"This is a comment\" />\n<esi:include src=\"/\" />", $strategy->render('/', $request, ['comment' => 'This is a comment'])->getContent()); + $this->assertEquals('<esi:include src="/" alt="foo" />', $strategy->render('/', $request, ['alt' => 'foo'])->getContent()); } public function testRenderControllerReference() @@ -56,12 +56,12 @@ class EsiFragmentRendererTest extends TestCase $request->setLocale('fr'); $request->headers->set('Surrogate-Capability', 'ESI/1.0'); - $reference = new ControllerReference('main_controller', array(), array()); - $altReference = new ControllerReference('alt_controller', array(), array()); + $reference = new ControllerReference('main_controller', [], []); + $altReference = new ControllerReference('alt_controller', [], []); $this->assertEquals( '<esi:include src="/_fragment?_hash=Jz1P8NErmhKTeI6onI1EdAXTB85359MY3RIk5mSJ60w%3D&_path=_format%3Dhtml%26_locale%3Dfr%26_controller%3Dmain_controller" alt="/_fragment?_hash=iPJEdRoUpGrM1ztqByiorpfMPtiW%2FOWwdH1DBUXHhEc%3D&_path=_format%3Dhtml%26_locale%3Dfr%26_controller%3Dalt_controller" />', - $strategy->render($reference, $request, array('alt' => $altReference))->getContent() + $strategy->render($reference, $request, ['alt' => $altReference])->getContent() ); } @@ -90,7 +90,7 @@ class EsiFragmentRendererTest extends TestCase $request->setLocale('fr'); $request->headers->set('Surrogate-Capability', 'ESI/1.0'); - $strategy->render('/', $request, array('alt' => new ControllerReference('alt_controller'))); + $strategy->render('/', $request, ['alt' => new ControllerReference('alt_controller')]); } private function getInlineStrategy($called = false) diff --git a/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php b/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php index 0dfaa79682..bc7236f0a8 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php @@ -68,12 +68,12 @@ class FragmentHandlerTest extends TestCase public function testRender() { - $handler = $this->getHandler($this->returnValue(new Response('foo')), array('/', Request::create('/'), array('foo' => 'foo', 'ignore_errors' => true))); + $handler = $this->getHandler($this->returnValue(new Response('foo')), ['/', Request::create('/'), ['foo' => 'foo', 'ignore_errors' => true]]); - $this->assertEquals('foo', $handler->render('/', 'foo', array('foo' => 'foo'))); + $this->assertEquals('foo', $handler->render('/', 'foo', ['foo' => 'foo'])); } - protected function getHandler($returnValue, $arguments = array()) + protected function getHandler($returnValue, $arguments = []) { $renderer = $this->getMockBuilder('Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface')->getMock(); $renderer diff --git a/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php index 68f8ded4e9..6125d95ff4 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php @@ -25,14 +25,14 @@ class HIncludeFragmentRendererTest extends TestCase public function testRenderExceptionWhenControllerAndNoSigner() { $strategy = new HIncludeFragmentRenderer(); - $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/')); + $strategy->render(new ControllerReference('main_controller', [], []), Request::create('/')); } public function testRenderWithControllerAndSigner() { $strategy = new HIncludeFragmentRenderer(null, new UriSigner('foo')); - $this->assertEquals('<hx:include src="/_fragment?_hash=BP%2BOzCD5MRUI%2BHJpgPDOmoju00FnzLhP3TGcSHbbBLs%3D&_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dmain_controller"></hx:include>', $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/'))->getContent()); + $this->assertEquals('<hx:include src="/_fragment?_hash=BP%2BOzCD5MRUI%2BHJpgPDOmoju00FnzLhP3TGcSHbbBLs%3D&_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dmain_controller"></hx:include>', $strategy->render(new ControllerReference('main_controller', [], []), Request::create('/'))->getContent()); } public function testRenderWithUri() @@ -48,30 +48,30 @@ class HIncludeFragmentRendererTest extends TestCase { // only default $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default'))->getContent()); + $this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default'])->getContent()); // only global default $strategy = new HIncludeFragmentRenderer(null, null, 'global_default'); - $this->assertEquals('<hx:include src="/foo">global_default</hx:include>', $strategy->render('/foo', Request::create('/'), array())->getContent()); + $this->assertEquals('<hx:include src="/foo">global_default</hx:include>', $strategy->render('/foo', Request::create('/'), [])->getContent()); // global default and default $strategy = new HIncludeFragmentRenderer(null, null, 'global_default'); - $this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default'))->getContent()); + $this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default'])->getContent()); } public function testRenderWithAttributesOptions() { // with id $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('<hx:include src="/foo" id="bar">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default', 'id' => 'bar'))->getContent()); + $this->assertEquals('<hx:include src="/foo" id="bar">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default', 'id' => 'bar'])->getContent()); // with attributes $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('<hx:include src="/foo" p1="v1" p2="v2">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default', 'attributes' => array('p1' => 'v1', 'p2' => 'v2')))->getContent()); + $this->assertEquals('<hx:include src="/foo" p1="v1" p2="v2">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default', 'attributes' => ['p1' => 'v1', 'p2' => 'v2']])->getContent()); // with id & attributes $strategy = new HIncludeFragmentRenderer(); - $this->assertEquals('<hx:include src="/foo" p1="v1" p2="v2" id="bar">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default', 'id' => 'bar', 'attributes' => array('p1' => 'v1', 'p2' => 'v2')))->getContent()); + $this->assertEquals('<hx:include src="/foo" p1="v1" p2="v2" id="bar">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default', 'id' => 'bar', 'attributes' => ['p1' => 'v1', 'p2' => 'v2']])->getContent()); } public function testRenderWithDefaultText() @@ -84,7 +84,7 @@ class HIncludeFragmentRendererTest extends TestCase // only default $strategy = new HIncludeFragmentRenderer($engine); - $this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'default'))->getContent()); + $this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default'])->getContent()); } public function testRenderWithEngineAndDefaultText() @@ -97,6 +97,6 @@ class HIncludeFragmentRendererTest extends TestCase // only default $strategy = new HIncludeFragmentRenderer($engine); - $this->assertEquals('<hx:include src="/foo">loading...</hx:include>', $strategy->render('/foo', Request::create('/'), array('default' => 'loading...'))->getContent()); + $this->assertEquals('<hx:include src="/foo">loading...</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'loading...'])->getContent()); } } diff --git a/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php index ceaa249ab6..155493d7f4 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php @@ -34,7 +34,7 @@ class InlineFragmentRendererTest extends TestCase { $strategy = new InlineFragmentRenderer($this->getKernel($this->returnValue(new Response('foo')))); - $this->assertEquals('foo', $strategy->render(new ControllerReference('main_controller', array(), array()), Request::create('/'))->getContent()); + $this->assertEquals('foo', $strategy->render(new ControllerReference('main_controller', [], []), Request::create('/'))->getContent()); } public function testRenderWithObjectsAsAttributes() @@ -42,29 +42,29 @@ class InlineFragmentRendererTest extends TestCase $object = new \stdClass(); $subRequest = Request::create('/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dmain_controller'); - $subRequest->attributes->replace(array('object' => $object, '_format' => 'html', '_controller' => 'main_controller', '_locale' => 'en')); - $subRequest->headers->set('x-forwarded-for', array('127.0.0.1')); - $subRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $subRequest->attributes->replace(['object' => $object, '_format' => 'html', '_controller' => 'main_controller', '_locale' => 'en']); + $subRequest->headers->set('x-forwarded-for', ['127.0.0.1']); + $subRequest->headers->set('forwarded', ['for="127.0.0.1";host="localhost";proto=http']); $subRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); $subRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($subRequest)); - $this->assertSame('foo', $strategy->render(new ControllerReference('main_controller', array('object' => $object), array()), Request::create('/'))->getContent()); + $this->assertSame('foo', $strategy->render(new ControllerReference('main_controller', ['object' => $object], []), Request::create('/'))->getContent()); } public function testRenderWithTrustedHeaderDisabled() { - Request::setTrustedProxies(array(), 0); + Request::setTrustedProxies([], 0); $expectedSubRequest = Request::create('/'); - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $expectedSubRequest->headers->set('x-forwarded-for', ['127.0.0.1']); $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); $this->assertSame('foo', $strategy->render('/', Request::create('/'))->getContent()); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } /** @@ -87,7 +87,7 @@ class InlineFragmentRendererTest extends TestCase $strategy = new InlineFragmentRenderer($this->getKernel($this->throwException(new \RuntimeException('foo'))), $dispatcher); - $this->assertEmpty($strategy->render('/', Request::create('/'), array('ignore_errors' => true))->getContent()); + $this->assertEmpty($strategy->render('/', Request::create('/'), ['ignore_errors' => true])->getContent()); } public function testRenderExceptionIgnoreErrorsWithAlt() @@ -97,7 +97,7 @@ class InlineFragmentRendererTest extends TestCase $this->returnValue(new Response('bar')) ))); - $this->assertEquals('bar', $strategy->render('/', Request::create('/'), array('ignore_errors' => true, 'alt' => '/foo'))->getContent()); + $this->assertEquals('bar', $strategy->render('/', Request::create('/'), ['ignore_errors' => true, 'alt' => '/foo'])->getContent()); } private function getKernel($returnValue) @@ -129,7 +129,7 @@ class InlineFragmentRendererTest extends TestCase $argumentResolver ->expects($this->once()) ->method('getArguments') - ->will($this->returnValue(array())) + ->will($this->returnValue([])) ; $kernel = new HttpKernel(new EventDispatcher(), $controllerResolver, new RequestStack(), $argumentResolver); @@ -140,7 +140,7 @@ class InlineFragmentRendererTest extends TestCase echo 'Foo'; // simulate a sub-request with output buffering and an exception - $renderer->render('/', Request::create('/'), array('ignore_errors' => true)); + $renderer->render('/', Request::create('/'), ['ignore_errors' => true]); $this->assertEquals('Foo', ob_get_clean()); } @@ -151,10 +151,10 @@ class InlineFragmentRendererTest extends TestCase $expectedSubRequest->attributes->set('_format', 'foo'); $expectedSubRequest->setLocale('fr'); if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) { - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $expectedSubRequest->headers->set('x-forwarded-for', ['127.0.0.1']); $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); } - $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->headers->set('forwarded', ['for="127.0.0.1";host="localhost";proto=http']); $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); @@ -171,10 +171,10 @@ class InlineFragmentRendererTest extends TestCase $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) { - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $expectedSubRequest->headers->set('x-forwarded-for', ['127.0.0.1']); $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); } - $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->headers->set('forwarded', ['for="127.0.0.1";host="localhost";proto=http']); $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); @@ -186,35 +186,35 @@ class InlineFragmentRendererTest extends TestCase public function testESIHeaderIsKeptInSubrequestWithTrustedHeaderDisabled() { - Request::setTrustedProxies(array(), Request::HEADER_FORWARDED); + Request::setTrustedProxies([], Request::HEADER_FORWARDED); $this->testESIHeaderIsKeptInSubrequest(); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } public function testHeadersPossiblyResultingIn304AreNotAssignedToSubrequest() { $expectedSubRequest = Request::create('/'); - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); - $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->headers->set('x-forwarded-for', ['127.0.0.1']); + $expectedSubRequest->headers->set('forwarded', ['for="127.0.0.1";host="localhost";proto=http']); $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); - $request = Request::create('/', 'GET', array(), array(), array(), array('HTTP_IF_MODIFIED_SINCE' => 'Fri, 01 Jan 2016 00:00:00 GMT', 'HTTP_IF_NONE_MATCH' => '*')); + $request = Request::create('/', 'GET', [], [], [], ['HTTP_IF_MODIFIED_SINCE' => 'Fri, 01 Jan 2016 00:00:00 GMT', 'HTTP_IF_NONE_MATCH' => '*']); $strategy->render('/', $request); } public function testFirstTrustedProxyIsSetAsRemote() { - Request::setTrustedProxies(array('1.1.1.1'), -1); + Request::setTrustedProxies(['1.1.1.1'], -1); $expectedSubRequest = Request::create('/'); $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); $expectedSubRequest->server->set('REMOTE_ADDR', '127.0.0.1'); - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); - $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->headers->set('x-forwarded-for', ['127.0.0.1']); + $expectedSubRequest->headers->set('forwarded', ['for="127.0.0.1";host="localhost";proto=http']); $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); @@ -224,7 +224,7 @@ class InlineFragmentRendererTest extends TestCase $request->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); $strategy->render('/', $request); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } public function testIpAddressOfRangedTrustedProxyIsSetAsRemote() @@ -232,12 +232,12 @@ class InlineFragmentRendererTest extends TestCase $expectedSubRequest = Request::create('/'); $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); $expectedSubRequest->server->set('REMOTE_ADDR', '127.0.0.1'); - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); - $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->headers->set('x-forwarded-for', ['127.0.0.1']); + $expectedSubRequest->headers->set('forwarded', ['for="127.0.0.1";host="localhost";proto=http']); $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); - Request::setTrustedProxies(array('1.1.1.1/24'), -1); + Request::setTrustedProxies(['1.1.1.1/24'], -1); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); @@ -245,7 +245,7 @@ class InlineFragmentRendererTest extends TestCase $request->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); $strategy->render('/', $request); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } /** diff --git a/vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php index 3a040dedd6..c03e8c4a92 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/RoutableFragmentRendererTest.php @@ -35,14 +35,14 @@ class RoutableFragmentRendererTest extends TestCase public function getGenerateFragmentUriData() { - return array( - array('/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array(), array())), - array('/_fragment?_path=_format%3Dxml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array('_format' => 'xml'), array())), - array('/_fragment?_path=foo%3Dfoo%26_format%3Djson%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array('foo' => 'foo', '_format' => 'json'), array())), - array('/_fragment?bar=bar&_path=foo%3Dfoo%26_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array('foo' => 'foo'), array('bar' => 'bar'))), - array('/_fragment?foo=foo&_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array(), array('foo' => 'foo'))), - array('/_fragment?_path=foo%255B0%255D%3Dfoo%26foo%255B1%255D%3Dbar%26_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', array('foo' => array('foo', 'bar')), array())), - ); + return [ + ['/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', [], [])], + ['/_fragment?_path=_format%3Dxml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', ['_format' => 'xml'], [])], + ['/_fragment?_path=foo%3Dfoo%26_format%3Djson%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', ['foo' => 'foo', '_format' => 'json'], [])], + ['/_fragment?bar=bar&_path=foo%3Dfoo%26_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', ['foo' => 'foo'], ['bar' => 'bar'])], + ['/_fragment?foo=foo&_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', [], ['foo' => 'foo'])], + ['/_fragment?_path=foo%255B0%255D%3Dfoo%26foo%255B1%255D%3Dbar%26_format%3Dhtml%26_locale%3Den%26_controller%3Dcontroller', new ControllerReference('controller', ['foo' => ['foo', 'bar']], [])], + ]; } public function testGenerateFragmentUriWithARequest() @@ -50,7 +50,7 @@ class RoutableFragmentRendererTest extends TestCase $request = Request::create('/'); $request->attributes->set('_format', 'json'); $request->setLocale('fr'); - $controller = new ControllerReference('controller', array(), array()); + $controller = new ControllerReference('controller', [], []); $this->assertEquals('/_fragment?_path=_format%3Djson%26_locale%3Dfr%26_controller%3Dcontroller', $this->callGenerateFragmentUriMethod($controller, $request)); } @@ -66,10 +66,10 @@ class RoutableFragmentRendererTest extends TestCase public function getGenerateFragmentUriDataWithNonScalar() { - return array( - array(new ControllerReference('controller', array('foo' => new Foo(), 'bar' => 'bar'), array())), - array(new ControllerReference('controller', array('foo' => array('foo' => 'foo'), 'bar' => array('bar' => new Foo())), array())), - ); + return [ + [new ControllerReference('controller', ['foo' => new Foo(), 'bar' => 'bar'], [])], + [new ControllerReference('controller', ['foo' => ['foo' => 'foo'], 'bar' => ['bar' => new Foo()]], [])], + ]; } private function callGenerateFragmentUriMethod(ControllerReference $reference, Request $request, $absolute = false) diff --git a/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php index ff98fd2616..b2181725ed 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php @@ -35,7 +35,7 @@ class SsiFragmentRendererTest extends TestCase $request->headers->set('Surrogate-Capability', 'SSI/1.0'); $this->assertEquals('<!--#include virtual="/" -->', $strategy->render('/', $request)->getContent()); - $this->assertEquals('<!--#include virtual="/" -->', $strategy->render('/', $request, array('comment' => 'This is a comment'))->getContent(), 'Strategy options should not impact the ssi include tag'); + $this->assertEquals('<!--#include virtual="/" -->', $strategy->render('/', $request, ['comment' => 'This is a comment'])->getContent(), 'Strategy options should not impact the ssi include tag'); } public function testRenderControllerReference() @@ -47,12 +47,12 @@ class SsiFragmentRendererTest extends TestCase $request->setLocale('fr'); $request->headers->set('Surrogate-Capability', 'SSI/1.0'); - $reference = new ControllerReference('main_controller', array(), array()); - $altReference = new ControllerReference('alt_controller', array(), array()); + $reference = new ControllerReference('main_controller', [], []); + $altReference = new ControllerReference('alt_controller', [], []); $this->assertEquals( '<!--#include virtual="/_fragment?_hash=Jz1P8NErmhKTeI6onI1EdAXTB85359MY3RIk5mSJ60w%3D&_path=_format%3Dhtml%26_locale%3Dfr%26_controller%3Dmain_controller" -->', - $strategy->render($reference, $request, array('alt' => $altReference))->getContent() + $strategy->render($reference, $request, ['alt' => $altReference])->getContent() ); } @@ -81,7 +81,7 @@ class SsiFragmentRendererTest extends TestCase $request->setLocale('fr'); $request->headers->set('Surrogate-Capability', 'SSI/1.0'); - $strategy->render('/', $request, array('alt' => new ControllerReference('alt_controller'))); + $strategy->render('/', $request, ['alt' => new ControllerReference('alt_controller')]); } private function getInlineStrategy($called = false) diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php index 846caee4cc..2049a1771a 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php @@ -220,13 +220,13 @@ class EsiTest extends TestCase $response1 = new Response('foo'); $response1->setStatusCode(404); $response2 = new Response('bar'); - $cache = $this->getCache(Request::create('/'), array($response1, $response2)); + $cache = $this->getCache(Request::create('/'), [$response1, $response2]); $this->assertEquals('bar', $esi->handle($cache, '/', '/alt', false)); } protected function getCache($request, $response) { - $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(array('getRequest', 'handle'))->disableOriginalConstructor()->getMock(); + $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock(); $cache->expects($this->any()) ->method('getRequest') ->will($this->returnValue($request)) diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php index a41d866508..7b3cac78c7 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php @@ -39,7 +39,7 @@ class HttpCacheTest extends HttpCacheTestCase // implements TerminableInterface $kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Kernel') ->disableOriginalConstructor() - ->setMethods(array('terminate', 'registerBundles', 'registerContainerConfiguration')) + ->setMethods(['terminate', 'registerBundles', 'registerContainerConfiguration']) ->getMock(); $kernelMock->expects($this->once()) @@ -61,7 +61,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testInvalidatesOnPostPutDeleteRequests() { - foreach (array('post', 'put', 'delete') as $method) { + foreach (['post', 'put', 'delete'] as $method) { $this->setNextResponse(200); $this->request($method, '/'); @@ -74,8 +74,8 @@ class HttpCacheTest extends HttpCacheTestCase public function testDoesNotCacheWithAuthorizationRequestHeaderAndNonPublicResponse() { - $this->setNextResponse(200, array('ETag' => '"Foo"')); - $this->request('GET', '/', array('HTTP_AUTHORIZATION' => 'basic foobarbaz')); + $this->setNextResponse(200, ['ETag' => '"Foo"']); + $this->request('GET', '/', ['HTTP_AUTHORIZATION' => 'basic foobarbaz']); $this->assertHttpKernelIsCalled(); $this->assertResponseOk(); @@ -88,8 +88,8 @@ class HttpCacheTest extends HttpCacheTestCase public function testDoesCacheWithAuthorizationRequestHeaderAndPublicResponse() { - $this->setNextResponse(200, array('Cache-Control' => 'public', 'ETag' => '"Foo"')); - $this->request('GET', '/', array('HTTP_AUTHORIZATION' => 'basic foobarbaz')); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'ETag' => '"Foo"']); + $this->request('GET', '/', ['HTTP_AUTHORIZATION' => 'basic foobarbaz']); $this->assertHttpKernelIsCalled(); $this->assertResponseOk(); @@ -101,8 +101,8 @@ class HttpCacheTest extends HttpCacheTestCase public function testDoesNotCacheWithCookieHeaderAndNonPublicResponse() { - $this->setNextResponse(200, array('ETag' => '"Foo"')); - $this->request('GET', '/', array(), array('foo' => 'bar')); + $this->setNextResponse(200, ['ETag' => '"Foo"']); + $this->request('GET', '/', [], ['foo' => 'bar']); $this->assertHttpKernelIsCalled(); $this->assertResponseOk(); @@ -115,7 +115,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testDoesNotCacheRequestsWithACookieHeader() { $this->setNextResponse(200); - $this->request('GET', '/', array(), array('foo' => 'bar')); + $this->request('GET', '/', [], ['foo' => 'bar']); $this->assertHttpKernelIsCalled(); $this->assertResponseOk(); @@ -129,8 +129,8 @@ class HttpCacheTest extends HttpCacheTestCase { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Last-Modified' => $time->format(DATE_RFC2822), 'Content-Type' => 'text/plain'), 'Hello World'); - $this->request('GET', '/', array('HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822))); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Last-Modified' => $time->format(DATE_RFC2822), 'Content-Type' => 'text/plain'], 'Hello World'); + $this->request('GET', '/', ['HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822)]); $this->assertHttpKernelIsCalled(); $this->assertEquals(304, $this->response->getStatusCode()); @@ -142,8 +142,8 @@ class HttpCacheTest extends HttpCacheTestCase public function testRespondsWith304WhenIfNoneMatchMatchesETag() { - $this->setNextResponse(200, array('Cache-Control' => 'public', 'ETag' => '12345', 'Content-Type' => 'text/plain'), 'Hello World'); - $this->request('GET', '/', array('HTTP_IF_NONE_MATCH' => '12345')); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'ETag' => '12345', 'Content-Type' => 'text/plain'], 'Hello World'); + $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '12345']); $this->assertHttpKernelIsCalled(); $this->assertEquals(304, $this->response->getStatusCode()); @@ -158,7 +158,7 @@ class HttpCacheTest extends HttpCacheTestCase { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array(), '', function ($request, $response) use ($time) { + $this->setNextResponse(200, [], '', function ($request, $response) use ($time) { $response->setStatusCode(200); $response->headers->set('ETag', '12345'); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); @@ -168,17 +168,17 @@ class HttpCacheTest extends HttpCacheTestCase // only ETag matches $t = \DateTime::createFromFormat('U', time() - 3600); - $this->request('GET', '/', array('HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $t->format(DATE_RFC2822))); + $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $t->format(DATE_RFC2822)]); $this->assertHttpKernelIsCalled(); $this->assertEquals(200, $this->response->getStatusCode()); // only Last-Modified matches - $this->request('GET', '/', array('HTTP_IF_NONE_MATCH' => '1234', 'HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822))); + $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '1234', 'HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822)]); $this->assertHttpKernelIsCalled(); $this->assertEquals(200, $this->response->getStatusCode()); // Both matches - $this->request('GET', '/', array('HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822))); + $this->request('GET', '/', ['HTTP_IF_NONE_MATCH' => '12345', 'HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822)]); $this->assertHttpKernelIsCalled(); $this->assertEquals(304, $this->response->getStatusCode()); } @@ -187,10 +187,10 @@ class HttpCacheTest extends HttpCacheTestCase { $this->setNextResponse( 200, - array( + [ 'ETag' => '1234', 'Cache-Control' => 'public, s-maxage=60', - ) + ] ); $this->request('GET', '/'); @@ -210,7 +210,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testValidatesPrivateResponsesCachedOnTheClient() { - $this->setNextResponse(200, array(), '', function ($request, $response) { + $this->setNextResponse(200, [], '', function ($request, $response) { $etags = preg_split('/\s*,\s*/', $request->headers->get('IF_NONE_MATCH')); if ($request->cookies->has('authenticated')) { $response->headers->set('Cache-Control', 'private, no-store'); @@ -243,7 +243,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertTraceContains('miss'); $this->assertTraceContains('store'); - $this->request('GET', '/', array(), array('authenticated' => '')); + $this->request('GET', '/', [], ['authenticated' => '']); $this->assertHttpKernelIsCalled(); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('"private tag"', $this->response->headers->get('ETag')); @@ -257,8 +257,8 @@ class HttpCacheTest extends HttpCacheTestCase { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822))); - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'no-cache')); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822)]); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'no-cache']); $this->assertHttpKernelIsCalled(); $this->assertTraceContains('store'); @@ -269,7 +269,7 @@ class HttpCacheTest extends HttpCacheTestCase { $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) { + $this->setNextResponse(200, ['Cache-Control' => 'public, max-age=10000'], '', function ($request, $response) use (&$count) { ++$count; $response->setContent(1 == $count ? 'Hello World' : 'Goodbye World'); }); @@ -285,7 +285,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertTraceContains('fresh'); $this->cacheConfig['allow_reload'] = true; - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'no-cache')); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'no-cache']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Goodbye World', $this->response->getContent()); $this->assertTraceContains('reload'); @@ -296,7 +296,7 @@ class HttpCacheTest extends HttpCacheTestCase { $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) { + $this->setNextResponse(200, ['Cache-Control' => 'public, max-age=10000'], '', function ($request, $response) use (&$count) { ++$count; $response->setContent(1 == $count ? 'Hello World' : 'Goodbye World'); }); @@ -312,12 +312,12 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertTraceContains('fresh'); $this->cacheConfig['allow_reload'] = false; - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'no-cache')); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'no-cache']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Hello World', $this->response->getContent()); $this->assertTraceNotContains('reload'); - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'no-cache')); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'no-cache']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Hello World', $this->response->getContent()); $this->assertTraceNotContains('reload'); @@ -327,7 +327,7 @@ class HttpCacheTest extends HttpCacheTestCase { $count = 0; - $this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) { + $this->setNextResponse(200, [], '', function ($request, $response) use (&$count) { ++$count; $response->headers->set('Cache-Control', 'public, max-age=10000'); $response->setETag($count); @@ -345,7 +345,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertTraceContains('fresh'); $this->cacheConfig['allow_revalidate'] = true; - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'max-age=0')); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'max-age=0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Goodbye World', $this->response->getContent()); $this->assertTraceContains('stale'); @@ -357,7 +357,7 @@ class HttpCacheTest extends HttpCacheTestCase { $count = 0; - $this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) { + $this->setNextResponse(200, [], '', function ($request, $response) use (&$count) { ++$count; $response->headers->set('Cache-Control', 'public, max-age=10000'); $response->setETag($count); @@ -375,14 +375,14 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertTraceContains('fresh'); $this->cacheConfig['allow_revalidate'] = false; - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'max-age=0')); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'max-age=0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Hello World', $this->response->getContent()); $this->assertTraceNotContains('stale'); $this->assertTraceNotContains('invalid'); $this->assertTraceContains('fresh'); - $this->request('GET', '/', array('HTTP_CACHE_CONTROL' => 'max-age=0')); + $this->request('GET', '/', ['HTTP_CACHE_CONTROL' => 'max-age=0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Hello World', $this->response->getContent()); $this->assertTraceNotContains('stale'); @@ -393,7 +393,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testFetchesResponseFromBackendWhenCacheMisses() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822))); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822)]); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -405,7 +405,7 @@ class HttpCacheTest extends HttpCacheTestCase { foreach (array_merge(range(201, 202), range(204, 206), range(303, 305), range(400, 403), range(405, 409), range(411, 417), range(500, 505)) as $code) { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse($code, array('Expires' => $time->format(DATE_RFC2822))); + $this->setNextResponse($code, ['Expires' => $time->format(DATE_RFC2822)]); $this->request('GET', '/'); $this->assertEquals($code, $this->response->getStatusCode()); @@ -417,7 +417,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testDoesNotCacheResponsesWithExplicitNoStoreDirective() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Expires' => $time->format(DATE_RFC2822), 'Cache-Control' => 'no-store')); + $this->setNextResponse(200, ['Expires' => $time->format(DATE_RFC2822), 'Cache-Control' => 'no-store']); $this->request('GET', '/'); $this->assertTraceNotContains('store'); @@ -436,7 +436,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testCachesResponsesWithExplicitNoCacheDirective() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Expires' => $time->format(DATE_RFC2822), 'Cache-Control' => 'public, no-cache')); + $this->setNextResponse(200, ['Expires' => $time->format(DATE_RFC2822), 'Cache-Control' => 'public, no-cache']); $this->request('GET', '/'); $this->assertTraceContains('store'); @@ -446,7 +446,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testCachesResponsesWithAnExpirationHeader() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822))); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822)]); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -462,7 +462,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testCachesResponsesWithAMaxAgeDirective() { - $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=5')); + $this->setNextResponse(200, ['Cache-Control' => 'public, max-age=5']); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -478,7 +478,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testCachesResponsesWithASMaxAgeDirective() { - $this->setNextResponse(200, array('Cache-Control' => 's-maxage=5')); + $this->setNextResponse(200, ['Cache-Control' => 's-maxage=5']); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -495,7 +495,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testCachesResponsesWithALastModifiedValidatorButNoFreshnessInformation() { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Last-Modified' => $time->format(DATE_RFC2822))); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Last-Modified' => $time->format(DATE_RFC2822)]); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -506,7 +506,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testCachesResponsesWithAnETagValidatorButNoFreshnessInformation() { - $this->setNextResponse(200, array('Cache-Control' => 'public', 'ETag' => '"123456"')); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'ETag' => '"123456"']); $this->request('GET', '/'); $this->assertEquals(200, $this->response->getStatusCode()); @@ -519,7 +519,7 @@ class HttpCacheTest extends HttpCacheTestCase { $time1 = \DateTime::createFromFormat('U', time() - 5); $time2 = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Date' => $time1->format(DATE_RFC2822), 'Expires' => $time2->format(DATE_RFC2822))); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Date' => $time1->format(DATE_RFC2822), 'Expires' => $time2->format(DATE_RFC2822)]); $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); @@ -543,7 +543,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testHitsCachedResponseWithMaxAgeDirective() { $time = \DateTime::createFromFormat('U', time() - 5); - $this->setNextResponse(200, array('Date' => $time->format(DATE_RFC2822), 'Cache-Control' => 'public, max-age=10')); + $this->setNextResponse(200, ['Date' => $time->format(DATE_RFC2822), 'Cache-Control' => 'public, max-age=10']); $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); @@ -573,7 +573,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->cacheConfig['stale_while_revalidate'] = 10; // The prescence of Last-Modified makes this cacheable (because Response::isValidateable() then). - $this->setNextResponse(200, array('Cache-Control' => 'public, s-maxage=5', 'Last-Modified' => 'some while ago'), 'Old response'); + $this->setNextResponse(200, ['Cache-Control' => 'public, s-maxage=5', 'Last-Modified' => 'some while ago'], 'Old response'); $this->request('GET', '/'); // warm the cache // Now, lock the cache @@ -607,7 +607,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testHitsCachedResponseWithSMaxAgeDirective() { $time = \DateTime::createFromFormat('U', time() - 5); - $this->setNextResponse(200, array('Date' => $time->format(DATE_RFC2822), 'Cache-Control' => 's-maxage=10, max-age=0')); + $this->setNextResponse(200, ['Date' => $time->format(DATE_RFC2822), 'Cache-Control' => 's-maxage=10, max-age=0']); $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); @@ -752,7 +752,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testDoesNotAssignDefaultTtlWhenResponseHasMustRevalidateDirective() { - $this->setNextResponse(200, array('Cache-Control' => 'must-revalidate')); + $this->setNextResponse(200, ['Cache-Control' => 'must-revalidate']); $this->cacheConfig['default_ttl'] = 10; $this->request('GET', '/'); @@ -767,7 +767,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testFetchesFullResponseWhenCacheStaleAndNoValidatorsPresent() { $time = \DateTime::createFromFormat('U', time() + 5); - $this->setNextResponse(200, array('Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822))); + $this->setNextResponse(200, ['Cache-Control' => 'public', 'Expires' => $time->format(DATE_RFC2822)]); // build initial request $this->request('GET', '/'); @@ -807,7 +807,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testValidatesCachedResponsesWithLastModifiedAndNoFreshnessInformation() { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) use ($time) { $response->headers->set('Cache-Control', 'public'); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); if ($time->format(DATE_RFC2822) == $request->headers->get('IF_MODIFIED_SINCE')) { @@ -845,7 +845,7 @@ class HttpCacheTest extends HttpCacheTestCase { $test = $this; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($test) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) use ($test) { $test->assertSame('OPTIONS', $request->getMethod()); }); @@ -858,7 +858,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testValidatesCachedResponsesWithETagAndNoFreshnessInformation() { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) { $response->headers->set('Cache-Control', 'public'); $response->headers->set('ETag', '"12345"'); if ($response->getETag() == $request->headers->get('IF_NONE_MATCH')) { @@ -895,7 +895,7 @@ class HttpCacheTest extends HttpCacheTestCase { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array(), 'Hello World', function (Request $request, Response $response) use ($time) { + $this->setNextResponse(200, [], 'Hello World', function (Request $request, Response $response) use ($time) { $response->setSharedMaxAge(10); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); }); @@ -913,7 +913,7 @@ class HttpCacheTest extends HttpCacheTestCase sleep(15); // expire the cache - $this->setNextResponse(304, array(), '', function (Request $request, Response $response) use ($time) { + $this->setNextResponse(304, [], '', function (Request $request, Response $response) use ($time) { $this->assertEquals($time->format(DATE_RFC2822), $request->headers->get('IF_MODIFIED_SINCE')); }); @@ -929,7 +929,7 @@ class HttpCacheTest extends HttpCacheTestCase { $time = \DateTime::createFromFormat('U', time()); $count = 0; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time, &$count) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) use ($time, &$count) { $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); $response->headers->set('Cache-Control', 'public'); switch (++$count) { @@ -966,20 +966,20 @@ class HttpCacheTest extends HttpCacheTestCase public function testPassesHeadRequestsThroughDirectlyOnPass() { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) { $response->setContent(''); $response->setStatusCode(200); $this->assertEquals('HEAD', $request->getMethod()); }); - $this->request('HEAD', '/', array('HTTP_EXPECT' => 'something ...')); + $this->request('HEAD', '/', ['HTTP_EXPECT' => 'something ...']); $this->assertHttpKernelIsCalled(); $this->assertEquals('', $this->response->getContent()); } public function testUsesCacheToRespondToHeadRequestsWhenFresh() { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) { $response->headers->set('Cache-Control', 'public, max-age=10'); $response->setContent('Hello World'); $response->setStatusCode(200); @@ -1000,7 +1000,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testSendsNoContentWhenFresh() { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) use ($time) { $response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); }); @@ -1009,7 +1009,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertHttpKernelIsCalled(); $this->assertEquals('Hello World', $this->response->getContent()); - $this->request('GET', '/', array('HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822))); + $this->request('GET', '/', ['HTTP_IF_MODIFIED_SINCE' => $time->format(DATE_RFC2822)]); $this->assertHttpKernelIsNotCalled(); $this->assertEquals(304, $this->response->getStatusCode()); $this->assertEquals('', $this->response->getContent()); @@ -1017,7 +1017,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testInvalidatesCachedResponsesOnPost() { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) { if ('GET' == $request->getMethod()) { $response->setStatusCode(200); $response->headers->set('Cache-Control', 'public, max-age=500'); @@ -1066,20 +1066,20 @@ class HttpCacheTest extends HttpCacheTestCase public function testServesFromCacheWhenHeadersMatch() { $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) { + $this->setNextResponse(200, ['Cache-Control' => 'max-age=10000'], '', function ($request, $response) use (&$count) { $response->headers->set('Vary', 'Accept User-Agent Foo'); $response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('X-Response-Count', ++$count); $response->setContent($request->headers->get('USER_AGENT')); }); - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0')); + $this->request('GET', '/', ['HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Bob/1.0', $this->response->getContent()); $this->assertTraceContains('miss'); $this->assertTraceContains('store'); - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0')); + $this->request('GET', '/', ['HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Bob/1.0', $this->response->getContent()); $this->assertTraceContains('fresh'); @@ -1090,36 +1090,36 @@ class HttpCacheTest extends HttpCacheTestCase public function testStoresMultipleResponsesWhenHeadersDiffer() { $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) { + $this->setNextResponse(200, ['Cache-Control' => 'max-age=10000'], '', function ($request, $response) use (&$count) { $response->headers->set('Vary', 'Accept User-Agent Foo'); $response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('X-Response-Count', ++$count); $response->setContent($request->headers->get('USER_AGENT')); }); - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0')); + $this->request('GET', '/', ['HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('Bob/1.0', $this->response->getContent()); $this->assertEquals(1, $this->response->headers->get('X-Response-Count')); - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/2.0')); + $this->request('GET', '/', ['HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/2.0']); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertTraceContains('miss'); $this->assertTraceContains('store'); $this->assertEquals('Bob/2.0', $this->response->getContent()); $this->assertEquals(2, $this->response->headers->get('X-Response-Count')); - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0')); + $this->request('GET', '/', ['HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/1.0']); $this->assertTraceContains('fresh'); $this->assertEquals('Bob/1.0', $this->response->getContent()); $this->assertEquals(1, $this->response->headers->get('X-Response-Count')); - $this->request('GET', '/', array('HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/2.0')); + $this->request('GET', '/', ['HTTP_ACCEPT' => 'text/html', 'HTTP_USER_AGENT' => 'Bob/2.0']); $this->assertTraceContains('fresh'); $this->assertEquals('Bob/2.0', $this->response->getContent()); $this->assertEquals(2, $this->response->headers->get('X-Response-Count')); - $this->request('GET', '/', array('HTTP_USER_AGENT' => 'Bob/2.0')); + $this->request('GET', '/', ['HTTP_USER_AGENT' => 'Bob/2.0']); $this->assertTraceContains('miss'); $this->assertEquals('Bob/2.0', $this->response->getContent()); $this->assertEquals(3, $this->response->headers->get('X-Response-Count')); @@ -1141,7 +1141,7 @@ class HttpCacheTest extends HttpCacheTestCase $this->setNextResponse(); $this->cacheConfig['allow_reload'] = true; - $this->request('GET', '/', array(), array(), false, array('Pragma' => 'no-cache')); + $this->request('GET', '/', [], [], false, ['Pragma' => 'no-cache']); $this->assertExceptionsAreCaught(); } @@ -1158,30 +1158,30 @@ class HttpCacheTest extends HttpCacheTestCase public function testEsiCacheSendsTheLowestTtl() { - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => '<esi:include src="/foo" /> <esi:include src="/bar" />', - 'headers' => array( + 'headers' => [ 'Cache-Control' => 's-maxage=300', 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'Hello World!', - 'headers' => array('Cache-Control' => 's-maxage=200'), - ), - array( + 'headers' => ['Cache-Control' => 's-maxage=200'], + ], + [ 'status' => 200, 'body' => 'My name is Bobby.', - 'headers' => array('Cache-Control' => 's-maxage=100'), - ), - ); + 'headers' => ['Cache-Control' => 's-maxage=100'], + ], + ]; $this->setNextResponses($responses); - $this->request('GET', '/', array(), array(), true); + $this->request('GET', '/', [], [], true); $this->assertEquals('Hello World! My name is Bobby.', $this->response->getContent()); $this->assertEquals(100, $this->response->getTtl()); @@ -1189,25 +1189,25 @@ class HttpCacheTest extends HttpCacheTestCase public function testEsiCacheSendsTheLowestTtlForHeadRequests() { - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => 'I am a long-lived master response, but I embed a short-lived resource: <esi:include src="/foo" />', - 'headers' => array( + 'headers' => [ 'Cache-Control' => 's-maxage=300', 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'I am a short-lived resource', - 'headers' => array('Cache-Control' => 's-maxage=100'), - ), - ); + 'headers' => ['Cache-Control' => 's-maxage=100'], + ], + ]; $this->setNextResponses($responses); - $this->request('HEAD', '/', array(), array(), true); + $this->request('HEAD', '/', [], [], true); $this->assertEmpty($this->response->getContent()); $this->assertEquals(100, $this->response->getTtl()); @@ -1215,30 +1215,30 @@ class HttpCacheTest extends HttpCacheTestCase public function testEsiCacheForceValidation() { - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => '<esi:include src="/foo" /> <esi:include src="/bar" />', - 'headers' => array( + 'headers' => [ 'Cache-Control' => 's-maxage=300', 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'Hello World!', - 'headers' => array('ETag' => 'foobar'), - ), - array( + 'headers' => ['ETag' => 'foobar'], + ], + [ 'status' => 200, 'body' => 'My name is Bobby.', - 'headers' => array('Cache-Control' => 's-maxage=100'), - ), - ); + 'headers' => ['Cache-Control' => 's-maxage=100'], + ], + ]; $this->setNextResponses($responses); - $this->request('GET', '/', array(), array(), true); + $this->request('GET', '/', [], [], true); $this->assertEquals('Hello World! My name is Bobby.', $this->response->getContent()); $this->assertNull($this->response->getTtl()); $this->assertTrue($this->response->mustRevalidate()); @@ -1248,25 +1248,25 @@ class HttpCacheTest extends HttpCacheTestCase public function testEsiCacheForceValidationForHeadRequests() { - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => 'I am the master response and use expiration caching, but I embed another resource: <esi:include src="/foo" />', - 'headers' => array( + 'headers' => [ 'Cache-Control' => 's-maxage=300', 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'I am the embedded resource and use validation caching', - 'headers' => array('ETag' => 'foobar'), - ), - ); + 'headers' => ['ETag' => 'foobar'], + ], + ]; $this->setNextResponses($responses); - $this->request('HEAD', '/', array(), array(), true); + $this->request('HEAD', '/', [], [], true); // The response has been assembled from expiration and validation based resources // This can neither be cached nor revalidated, so it should be private/no cache @@ -1279,50 +1279,50 @@ class HttpCacheTest extends HttpCacheTestCase public function testEsiRecalculateContentLengthHeader() { - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => '<esi:include src="/foo" />', - 'headers' => array( + 'headers' => [ 'Content-Length' => 26, 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'Hello World!', - 'headers' => array(), - ), - ); + 'headers' => [], + ], + ]; $this->setNextResponses($responses); - $this->request('GET', '/', array(), array(), true); + $this->request('GET', '/', [], [], true); $this->assertEquals('Hello World!', $this->response->getContent()); $this->assertEquals(12, $this->response->headers->get('Content-Length')); } public function testEsiRecalculateContentLengthHeaderForHeadRequest() { - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => '<esi:include src="/foo" />', - 'headers' => array( + 'headers' => [ 'Content-Length' => 26, 'Surrogate-Control' => 'content="ESI/1.0"', - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'Hello World!', - 'headers' => array(), - ), - ); + 'headers' => [], + ], + ]; $this->setNextResponses($responses); - $this->request('HEAD', '/', array(), array(), true); + $this->request('HEAD', '/', [], [], true); // https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13 // "The Content-Length entity-header field indicates the size of the entity-body, @@ -1336,7 +1336,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testClientIpIsAlwaysLocalhostForForwardedRequests() { $this->setNextResponse(); - $this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1')); + $this->request('GET', '/', ['REMOTE_ADDR' => '10.0.0.1']); $this->kernel->assert(function ($backendRequest) { $this->assertSame('127.0.0.1', $backendRequest->server->get('REMOTE_ADDR')); @@ -1351,25 +1351,25 @@ class HttpCacheTest extends HttpCacheTestCase Request::setTrustedProxies($existing, Request::HEADER_X_FORWARDED_ALL); $this->setNextResponse(); - $this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1')); + $this->request('GET', '/', ['REMOTE_ADDR' => '10.0.0.1']); $this->assertSame($existing, Request::getTrustedProxies()); - $existing = array_unique(array_merge($existing, array('127.0.0.1'))); + $existing = array_unique(array_merge($existing, ['127.0.0.1'])); $this->kernel->assert(function ($backendRequest) use ($existing) { $this->assertSame($existing, Request::getTrustedProxies()); $this->assertsame('10.0.0.1', $backendRequest->getClientIp()); }); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } public function getTrustedProxyData() { - return array( - array(array()), - array(array('10.0.0.2')), - array(array('10.0.0.2', '127.0.0.1')), - ); + return [ + [[]], + [['10.0.0.2']], + [['10.0.0.2', '127.0.0.1']], + ]; } /** @@ -1378,7 +1378,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testForwarderHeaderForForwardedRequests($forwarded, $expected) { $this->setNextResponse(); - $server = array('REMOTE_ADDR' => '10.0.0.1'); + $server = ['REMOTE_ADDR' => '10.0.0.1']; if (null !== $forwarded) { Request::setTrustedProxies($server, -1); $server['HTTP_FORWARDED'] = $forwarded; @@ -1389,42 +1389,42 @@ class HttpCacheTest extends HttpCacheTestCase $this->assertSame($expected, $backendRequest->headers->get('Forwarded')); }); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } public function getForwardedData() { - return array( - array(null, 'for="10.0.0.1";host="localhost";proto=http'), - array('for=10.0.0.2', 'for="10.0.0.2";host="localhost";proto=http, for="10.0.0.1"'), - array('for=10.0.0.2, for=10.0.0.3', 'for="10.0.0.2";host="localhost";proto=http, for="10.0.0.3", for="10.0.0.1"'), - ); + return [ + [null, 'for="10.0.0.1";host="localhost";proto=http'], + ['for=10.0.0.2', 'for="10.0.0.2";host="localhost";proto=http, for="10.0.0.1"'], + ['for=10.0.0.2, for=10.0.0.3', 'for="10.0.0.2";host="localhost";proto=http, for="10.0.0.3", for="10.0.0.1"'], + ]; } public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponses() { $time = \DateTime::createFromFormat('U', time()); - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => '<esi:include src="/hey" />', - 'headers' => array( + 'headers' => [ 'Surrogate-Control' => 'content="ESI/1.0"', 'ETag' => 'hey', 'Last-Modified' => $time->format(DATE_RFC2822), - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'Hey!', - 'headers' => array(), - ), - ); + 'headers' => [], + ], + ]; $this->setNextResponses($responses); - $this->request('GET', '/', array(), array(), true); + $this->request('GET', '/', [], [], true); $this->assertNull($this->response->getETag()); $this->assertNull($this->response->getLastModified()); } @@ -1433,26 +1433,26 @@ class HttpCacheTest extends HttpCacheTestCase { $time = \DateTime::createFromFormat('U', time()); - $responses = array( - array( + $responses = [ + [ 'status' => 200, 'body' => '<esi:include src="/hey" />', - 'headers' => array( + 'headers' => [ 'Surrogate-Control' => 'content="ESI/1.0"', 'ETag' => 'hey', 'Last-Modified' => $time->format(DATE_RFC2822), - ), - ), - array( + ], + ], + [ 'status' => 200, 'body' => 'Hey!', - 'headers' => array(), - ), - ); + 'headers' => [], + ], + ]; $this->setNextResponses($responses); - $this->request('HEAD', '/', array(), array(), true); + $this->request('HEAD', '/', [], [], true); $this->assertEmpty($this->response->getContent()); $this->assertNull($this->response->getETag()); $this->assertNull($this->response->getLastModified()); @@ -1460,11 +1460,11 @@ class HttpCacheTest extends HttpCacheTestCase public function testDoesNotCacheOptionsRequest() { - $this->setNextResponse(200, array('Cache-Control' => 'public, s-maxage=60'), 'get'); + $this->setNextResponse(200, ['Cache-Control' => 'public, s-maxage=60'], 'get'); $this->request('GET', '/'); $this->assertHttpKernelIsCalled(); - $this->setNextResponse(200, array('Cache-Control' => 'public, s-maxage=60'), 'options'); + $this->setNextResponse(200, ['Cache-Control' => 'public, s-maxage=60'], 'options'); $this->request('OPTIONS', '/'); $this->assertHttpKernelIsCalled(); diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php index b3aa2be2f0..1eb4617447 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php @@ -41,12 +41,12 @@ class HttpCacheTestCase extends TestCase $this->cache = null; $this->esi = null; - $this->caches = array(); - $this->cacheConfig = array(); + $this->caches = []; + $this->cacheConfig = []; $this->request = null; $this->response = null; - $this->responses = array(); + $this->responses = []; $this->catch = false; @@ -112,7 +112,7 @@ class HttpCacheTestCase extends TestCase $this->assertFalse($this->kernel->isCatchingExceptions()); } - public function request($method, $uri = '/', $server = array(), $cookies = array(), $esi = false, $headers = array()) + public function request($method, $uri = '/', $server = [], $cookies = [], $esi = false, $headers = []) { if (null === $this->kernel) { throw new \LogicException('You must call setNextResponse() before calling request().'); @@ -126,7 +126,7 @@ class HttpCacheTestCase extends TestCase $this->esi = $esi ? new Esi() : null; $this->cache = new HttpCache($this->kernel, $this->store, $this->esi, $this->cacheConfig); - $this->request = Request::create($uri, $method, array(), $cookies, array(), $server); + $this->request = Request::create($uri, $method, [], $cookies, [], $server); $this->request->headers->add($headers); $this->response = $this->cache->handle($this->request, HttpKernelInterface::MASTER_REQUEST, $this->catch); @@ -136,7 +136,7 @@ class HttpCacheTestCase extends TestCase public function getMetaStorageValues() { - $values = array(); + $values = []; foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(sys_get_temp_dir().'/http_cache/md', \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) { $values[] = file_get_contents($file); } @@ -145,7 +145,7 @@ class HttpCacheTestCase extends TestCase } // A basic response with 200 status code and a tiny body. - public function setNextResponse($statusCode = 200, array $headers = array(), $body = 'Hello World', \Closure $customizer = null) + public function setNextResponse($statusCode = 200, array $headers = [], $body = 'Hello World', \Closure $customizer = null) { $this->kernel = new TestHttpKernel($body, $statusCode, $headers, $customizer); } @@ -168,7 +168,7 @@ class HttpCacheTestCase extends TestCase $fp = opendir($directory); while (false !== $file = readdir($fp)) { - if (!\in_array($file, array('.', '..'))) { + if (!\in_array($file, ['.', '..'])) { if (is_link($directory.'/'.$file)) { unlink($directory.'/'.$file); } elseif (is_dir($directory.'/'.$file)) { diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php index 1f1fbf8499..2b9d352c7c 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php @@ -187,13 +187,13 @@ class SsiTest extends TestCase $response1 = new Response('foo'); $response1->setStatusCode(404); $response2 = new Response('bar'); - $cache = $this->getCache(Request::create('/'), array($response1, $response2)); + $cache = $this->getCache(Request::create('/'), [$response1, $response2]); $this->assertEquals('bar', $ssi->handle($cache, '/', '/alt', false)); } protected function getCache($request, $response) { - $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(array('getRequest', 'handle'))->disableOriginalConstructor()->getMock(); + $cache = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\HttpCache')->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock(); $cache->expects($this->any()) ->method('getRequest') ->will($this->returnValue($request)) diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php index cef019167a..fc47ff2c88 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/StoreTest.php @@ -29,7 +29,7 @@ class StoreTest extends TestCase protected function setUp() { $this->request = Request::create('/'); - $this->response = new Response('hello world', 200, array()); + $this->response = new Response('hello world', 200, []); HttpCacheTestCase::clearDirectory(sys_get_temp_dir().'/http_cache'); @@ -108,7 +108,7 @@ class StoreTest extends TestCase public function testDoesNotFindAnEntryWithLookupWhenNoneExists() { - $request = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); + $request = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); $this->assertNull($this->store->lookup($request)); } @@ -137,7 +137,7 @@ class StoreTest extends TestCase $this->storeSimpleEntry(); $response = $this->store->lookup($this->request); - $this->assertEquals($response->headers->all(), array_merge(array('content-length' => 4, 'x-body-file' => array($this->getStorePath($response->headers->get('X-Content-Digest')))), $this->response->headers->all())); + $this->assertEquals($response->headers->all(), array_merge(['content-length' => 4, 'x-body-file' => [$this->getStorePath($response->headers->get('X-Content-Digest'))]], $this->response->headers->all())); } public function testRestoresResponseContentFromEntityStoreWithLookup() @@ -165,9 +165,9 @@ class StoreTest extends TestCase public function testDoesNotReturnEntriesThatVaryWithLookup() { - $req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam')); - $res = new Response('test', 200, array('Vary' => 'Foo Bar')); + $req1 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); + $req2 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam']); + $res = new Response('test', 200, ['Vary' => 'Foo Bar']); $this->store->write($req1, $res); $this->assertNull($this->store->lookup($req2)); @@ -175,9 +175,9 @@ class StoreTest extends TestCase public function testDoesNotReturnEntriesThatSlightlyVaryWithLookup() { - $req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bam')); - $res = new Response('test', 200, array('Vary' => array('Foo', 'Bar'))); + $req1 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); + $req2 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bam']); + $res = new Response('test', 200, ['Vary' => ['Foo', 'Bar']]); $this->store->write($req1, $res); $this->assertNull($this->store->lookup($req2)); @@ -185,16 +185,16 @@ class StoreTest extends TestCase public function testStoresMultipleResponsesForEachVaryCombination() { - $req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $res1 = new Response('test 1', 200, array('Vary' => 'Foo Bar')); + $req1 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); + $res1 = new Response('test 1', 200, ['Vary' => 'Foo Bar']); $key = $this->store->write($req1, $res1); - $req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam')); - $res2 = new Response('test 2', 200, array('Vary' => 'Foo Bar')); + $req2 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam']); + $res2 = new Response('test 2', 200, ['Vary' => 'Foo Bar']); $this->store->write($req2, $res2); - $req3 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Baz', 'HTTP_BAR' => 'Boom')); - $res3 = new Response('test 3', 200, array('Vary' => 'Foo Bar')); + $req3 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Baz', 'HTTP_BAR' => 'Boom']); + $res3 = new Response('test 3', 200, ['Vary' => 'Foo Bar']); $this->store->write($req3, $res3); $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 3')), $this->store->lookup($req3)->getContent()); @@ -206,18 +206,18 @@ class StoreTest extends TestCase public function testOverwritesNonVaryingResponseWithStore() { - $req1 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $res1 = new Response('test 1', 200, array('Vary' => 'Foo Bar')); + $req1 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); + $res1 = new Response('test 1', 200, ['Vary' => 'Foo Bar']); $key = $this->store->write($req1, $res1); $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 1')), $this->store->lookup($req1)->getContent()); - $req2 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam')); - $res2 = new Response('test 2', 200, array('Vary' => 'Foo Bar')); + $req2 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Bling', 'HTTP_BAR' => 'Bam']); + $res2 = new Response('test 2', 200, ['Vary' => 'Foo Bar']); $this->store->write($req2, $res2); $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 2')), $this->store->lookup($req2)->getContent()); - $req3 = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); - $res3 = new Response('test 3', 200, array('Vary' => 'Foo Bar')); + $req3 = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); + $res3 = new Response('test 3', 200, ['Vary' => 'Foo Bar']); $key = $this->store->write($req3, $res3); $this->assertEquals($this->getStorePath('en'.hash('sha256', 'test 3')), $this->store->lookup($req3)->getContent()); @@ -226,7 +226,7 @@ class StoreTest extends TestCase public function testLocking() { - $req = Request::create('/test', 'get', array(), array(), array(), array('HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar')); + $req = Request::create('/test', 'get', [], [], [], ['HTTP_FOO' => 'Foo', 'HTTP_BAR' => 'Bar']); $this->assertTrue($this->store->lock($req)); $path = $this->store->lock($req); @@ -263,14 +263,14 @@ class StoreTest extends TestCase $this->assertEmpty($this->getStoreMetadata($requestHttps)); } - protected function storeSimpleEntry($path = null, $headers = array()) + protected function storeSimpleEntry($path = null, $headers = []) { if (null === $path) { $path = '/test'; } - $this->request = Request::create($path, 'get', array(), array(), array(), $headers); - $this->response = new Response('test', 200, array('Cache-Control' => 'max-age=420')); + $this->request = Request::create($path, 'get', [], [], [], $headers); + $this->response = new Response('test', 200, ['Cache-Control' => 'max-age=420']); return $this->store->write($this->request, $this->response); } diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/SubRequestHandlerTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/SubRequestHandlerTest.php index dfe0a734bf..67b637bfe3 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/SubRequestHandlerTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/SubRequestHandlerTest.php @@ -33,7 +33,7 @@ class SubRequestHandlerTest extends TestCase public function testTrustedHeadersAreKept() { - Request::setTrustedProxies(array('10.0.0.1'), -1); + Request::setTrustedProxies(['10.0.0.1'], -1); $globalState = $this->getGlobalState(); $request = Request::create('/'); @@ -82,7 +82,7 @@ class SubRequestHandlerTest extends TestCase public function testTrustedForwardedHeader() { - Request::setTrustedProxies(array('10.0.0.1'), -1); + Request::setTrustedProxies(['10.0.0.1'], -1); $globalState = $this->getGlobalState(); $request = Request::create('/'); @@ -104,7 +104,7 @@ class SubRequestHandlerTest extends TestCase public function testTrustedXForwardedForHeader() { - Request::setTrustedProxies(array('10.0.0.1'), -1); + Request::setTrustedProxies(['10.0.0.1'], -1); $globalState = $this->getGlobalState(); $request = Request::create('/'); @@ -127,10 +127,10 @@ class SubRequestHandlerTest extends TestCase private function getGlobalState() { - return array( + return [ Request::getTrustedProxies(), Request::getTrustedHeaderSet(), - ); + ]; } } diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php b/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php index 5dbf02c992..304ff9d9e4 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php @@ -41,7 +41,7 @@ class TestHttpKernel extends HttpKernel implements ControllerResolverInterface, public function assert(\Closure $callback) { - $trustedConfig = array(Request::getTrustedProxies(), Request::getTrustedHeaderSet()); + $trustedConfig = [Request::getTrustedProxies(), Request::getTrustedHeaderSet()]; list($trustedProxies, $trustedHeaderSet, $backendRequest) = $this->backendRequest; Request::setTrustedProxies($trustedProxies, $trustedHeaderSet); @@ -57,7 +57,7 @@ class TestHttpKernel extends HttpKernel implements ControllerResolverInterface, public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false) { $this->catch = $catch; - $this->backendRequest = array(Request::getTrustedProxies(), Request::getTrustedHeaderSet(), $request); + $this->backendRequest = [Request::getTrustedProxies(), Request::getTrustedHeaderSet(), $request]; return parent::handle($request, $type, $catch); } @@ -69,12 +69,12 @@ class TestHttpKernel extends HttpKernel implements ControllerResolverInterface, public function getController(Request $request) { - return array($this, 'callController'); + return [$this, 'callController']; } public function getArguments(Request $request, $controller) { - return array($request); + return [$request]; } public function callController(Request $request) diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php b/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php index 712132bd13..010bee8689 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php @@ -21,9 +21,9 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; class TestMultipleHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface { - protected $bodies = array(); - protected $statuses = array(); - protected $headers = array(); + protected $bodies = []; + protected $statuses = []; + protected $headers = []; protected $called = false; protected $backendRequest; @@ -52,12 +52,12 @@ class TestMultipleHttpKernel extends HttpKernel implements ControllerResolverInt public function getController(Request $request) { - return array($this, 'callController'); + return [$this, 'callController']; } public function getArguments(Request $request, $controller) { - return array($request); + return [$request]; } public function callController(Request $request) diff --git a/vendor/symfony/http-kernel/Tests/HttpKernelTest.php b/vendor/symfony/http-kernel/Tests/HttpKernelTest.php index 63a276a15e..4d1e267e3a 100644 --- a/vendor/symfony/http-kernel/Tests/HttpKernelTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpKernelTest.php @@ -105,7 +105,7 @@ class HttpKernelTest extends TestCase $event->setResponse(new Response($event->getException()->getMessage())); }); - $kernel = $this->getHttpKernel($dispatcher, function () { throw new MethodNotAllowedHttpException(array('POST')); }); + $kernel = $this->getHttpKernel($dispatcher, function () { throw new MethodNotAllowedHttpException(['POST']); }); $response = $kernel->handle(new Request()); $this->assertEquals('405', $response->getStatusCode()); @@ -114,12 +114,12 @@ class HttpKernelTest extends TestCase public function getStatusCodes() { - return array( - array(200, 404), - array(404, 200), - array(301, 200), - array(500, 200), - ); + return [ + [200, 404], + [404, 200], + [301, 200], + [500, 200], + ]; } /** @@ -141,11 +141,11 @@ class HttpKernelTest extends TestCase public function getSpecificStatusCodes() { - return array( - array(200), - array(302), - array(403), - ); + return [ + [200], + [302], + [403], + ]; } public function testHandleWhenAListenerReturnsAResponse() @@ -199,7 +199,7 @@ class HttpKernelTest extends TestCase public function testHandleWhenTheControllerIsAnArray() { $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, array(new TestController(), 'controller')); + $kernel = $this->getHttpKernel($dispatcher, [new TestController(), 'controller']); $this->assertResponseEquals(new Response('foo'), $kernel->handle(new Request())); } @@ -207,7 +207,7 @@ class HttpKernelTest extends TestCase public function testHandleWhenTheControllerIsAStaticArray() { $dispatcher = new EventDispatcher(); - $kernel = $this->getHttpKernel($dispatcher, array('Symfony\Component\HttpKernel\Tests\TestController', 'staticcontroller')); + $kernel = $this->getHttpKernel($dispatcher, ['Symfony\Component\HttpKernel\Tests\TestController', 'staticcontroller']); $this->assertResponseEquals(new Response('foo'), $kernel->handle(new Request())); } @@ -258,7 +258,7 @@ class HttpKernelTest extends TestCase { $dispatcher = new EventDispatcher(); $dispatcher->addListener(KernelEvents::CONTROLLER_ARGUMENTS, function (FilterControllerArgumentsEvent $event) { - $event->setArguments(array('foo')); + $event->setArguments(['foo']); }); $kernel = $this->getHttpKernel($dispatcher, function ($content) { return new Response($content); }); @@ -282,12 +282,12 @@ class HttpKernelTest extends TestCase }; $event->setController($newController); - $event->setArguments(array('bar')); + $event->setArguments(['bar']); }); - $kernel = $this->getHttpKernel($dispatcher, function ($content) { return new Response($content); }, null, array('foo')); + $kernel = $this->getHttpKernel($dispatcher, function ($content) { return new Response($content); }, null, ['foo']); - $this->assertResponseEquals(new Response('foo', 200, array('X-Id' => 'bar')), $kernel->handle(new Request())); + $this->assertResponseEquals(new Response('foo', 200, ['X-Id' => 'bar']), $kernel->handle(new Request())); } public function testTerminate() @@ -312,7 +312,7 @@ class HttpKernelTest extends TestCase { $request = new Request(); - $stack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->setMethods(array('push', 'pop'))->getMock(); + $stack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->setMethods(['push', 'pop'])->getMock(); $stack->expects($this->at(0))->method('push')->with($this->equalTo($request)); $stack->expects($this->at(1))->method('pop'); @@ -328,7 +328,7 @@ class HttpKernelTest extends TestCase public function testInconsistentClientIpsOnMasterRequests() { $request = new Request(); - $request->setTrustedProxies(array('1.1.1.1'), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED); + $request->setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_FOR | Request::HEADER_FORWARDED); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $request->headers->set('FORWARDED', 'for=2.2.2.2'); $request->headers->set('X_FORWARDED_FOR', '3.3.3.3'); @@ -341,10 +341,10 @@ class HttpKernelTest extends TestCase $kernel = $this->getHttpKernel($dispatcher); $kernel->handle($request, $kernel::MASTER_REQUEST, false); - Request::setTrustedProxies(array(), -1); + Request::setTrustedProxies([], -1); } - private function getHttpKernel(EventDispatcherInterface $eventDispatcher, $controller = null, RequestStack $requestStack = null, array $arguments = array()) + private function getHttpKernel(EventDispatcherInterface $eventDispatcher, $controller = null, RequestStack $requestStack = null, array $arguments = []) { if (null === $controller) { $controller = function () { return new Response('Hello'); }; diff --git a/vendor/symfony/http-kernel/Tests/KernelTest.php b/vendor/symfony/http-kernel/Tests/KernelTest.php index 2b581398c5..57bd704c92 100644 --- a/vendor/symfony/http-kernel/Tests/KernelTest.php +++ b/vendor/symfony/http-kernel/Tests/KernelTest.php @@ -91,7 +91,7 @@ class KernelTest extends TestCase public function testBootInitializesBundlesAndContainer() { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer')); + $kernel = $this->getKernel(['initializeBundles', 'initializeContainer']); $kernel->expects($this->once()) ->method('initializeBundles'); $kernel->expects($this->once()) @@ -106,10 +106,10 @@ class KernelTest extends TestCase $bundle->expects($this->once()) ->method('setContainer'); - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'getBundles')); + $kernel = $this->getKernel(['initializeBundles', 'initializeContainer', 'getBundles']); $kernel->expects($this->once()) ->method('getBundles') - ->will($this->returnValue(array($bundle))); + ->will($this->returnValue([$bundle])); $kernel->boot(); } @@ -117,7 +117,7 @@ class KernelTest extends TestCase public function testBootSetsTheBootedFlagToTrue() { // use test kernel to access isBooted() - $kernel = $this->getKernelForTest(array('initializeBundles', 'initializeContainer')); + $kernel = $this->getKernelForTest(['initializeBundles', 'initializeContainer']); $kernel->boot(); $this->assertTrue($kernel->isBooted()); @@ -125,7 +125,7 @@ class KernelTest extends TestCase public function testClassCacheIsNotLoadedByDefault() { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache')); + $kernel = $this->getKernel(['initializeBundles', 'initializeContainer', 'doLoadClassCache']); $kernel->expects($this->never()) ->method('doLoadClassCache'); @@ -134,7 +134,7 @@ class KernelTest extends TestCase public function testBootKernelSeveralTimesOnlyInitializesBundlesOnce() { - $kernel = $this->getKernel(array('initializeBundles', 'initializeContainer')); + $kernel = $this->getKernel(['initializeBundles', 'initializeContainer']); $kernel->expects($this->once()) ->method('initializeBundles'); @@ -148,7 +148,7 @@ class KernelTest extends TestCase $bundle->expects($this->once()) ->method('shutdown'); - $kernel = $this->getKernel(array(), array($bundle)); + $kernel = $this->getKernel([], [$bundle]); $kernel->boot(); $kernel->shutdown(); @@ -161,10 +161,10 @@ class KernelTest extends TestCase ->method('setContainer') ->with(null); - $kernel = $this->getKernel(array('getBundles')); + $kernel = $this->getKernel(['getBundles']); $kernel->expects($this->any()) ->method('getBundles') - ->will($this->returnValue(array($bundle))); + ->will($this->returnValue([$bundle])); $kernel->boot(); $kernel->shutdown(); @@ -184,7 +184,7 @@ class KernelTest extends TestCase ->method('handle') ->with($request, $type, $catch); - $kernel = $this->getKernel(array('getHttpKernel')); + $kernel = $this->getKernel(['getHttpKernel']); $kernel->expects($this->once()) ->method('getHttpKernel') ->will($this->returnValue($httpKernelMock)); @@ -202,7 +202,7 @@ class KernelTest extends TestCase ->disableOriginalConstructor() ->getMock(); - $kernel = $this->getKernel(array('getHttpKernel', 'boot')); + $kernel = $this->getKernel(['getHttpKernel', 'boot']); $kernel->expects($this->once()) ->method('getHttpKernel') ->will($this->returnValue($httpKernelMock)); @@ -331,7 +331,7 @@ EOF; $debug = true; $kernel = new KernelForTest($env, $debug); - $expected = serialize(array($env, $debug)); + $expected = serialize([$env, $debug]); $this->assertEquals($expected, $kernel->serialize()); } @@ -364,7 +364,7 @@ EOF; */ public function testLocateResourceThrowsExceptionWhenResourceDoesNotExist() { - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->once()) ->method('getBundle') @@ -376,7 +376,7 @@ EOF; public function testLocateResourceReturnsTheFirstThatMatches() { - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->once()) ->method('getBundle') @@ -388,7 +388,7 @@ EOF; public function testLocateResourceIgnoresDirOnNonResource() { - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->once()) ->method('getBundle') @@ -403,7 +403,7 @@ EOF; public function testLocateResourceReturnsTheDirOneForResources() { - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->once()) ->method('getBundle') @@ -418,7 +418,7 @@ EOF; public function testLocateResourceOnDirectories() { - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->exactly(2)) ->method('getBundle') @@ -434,7 +434,7 @@ EOF; $kernel->locateResource('@FooBundle/Resources', __DIR__.'/Fixtures/Resources') ); - $kernel = $this->getKernel(array('getBundle')); + $kernel = $this->getKernel(['getBundle']); $kernel ->expects($this->exactly(2)) ->method('getBundle') @@ -460,13 +460,13 @@ EOF; $fooBundle = $this->getBundle(null, null, 'FooBundle', 'DuplicateName'); $barBundle = $this->getBundle(null, null, 'BarBundle', 'DuplicateName'); - $kernel = $this->getKernel(array(), array($fooBundle, $barBundle)); + $kernel = $this->getKernel([], [$fooBundle, $barBundle]); $kernel->boot(); } public function testTerminateReturnsSilentlyIfKernelIsNotBooted() { - $kernel = $this->getKernel(array('getHttpKernel')); + $kernel = $this->getKernel(['getHttpKernel']); $kernel->expects($this->never()) ->method('getHttpKernel'); @@ -478,7 +478,7 @@ EOF; // does not implement TerminableInterface $httpKernel = new TestKernel(); - $kernel = $this->getKernel(array('getHttpKernel')); + $kernel = $this->getKernel(['getHttpKernel']); $kernel->expects($this->once()) ->method('getHttpKernel') ->willReturn($httpKernel); @@ -491,14 +491,14 @@ EOF; // implements TerminableInterface $httpKernelMock = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernel') ->disableOriginalConstructor() - ->setMethods(array('terminate')) + ->setMethods(['terminate']) ->getMock(); $httpKernelMock ->expects($this->once()) ->method('terminate'); - $kernel = $this->getKernel(array('getHttpKernel')); + $kernel = $this->getKernel(['getHttpKernel']); $kernel->expects($this->exactly(2)) ->method('getHttpKernel') ->will($this->returnValue($httpKernelMock)); @@ -571,7 +571,7 @@ EOF; $container->addCompilerPass(new ResettableServicePass()); $container->register('one', ResettableService::class) ->setPublic(true) - ->addTag('kernel.reset', array('method' => 'reset')); + ->addTag('kernel.reset', ['method' => 'reset']); $container->register('services_resetter', ServicesResetter::class)->setPublic(true); }, $httpKernelMock, 'resetting'); @@ -595,7 +595,7 @@ EOF; */ public function testKernelStartTimeIsResetWhileBootingAlreadyBootedKernel() { - $kernel = $this->getKernelForTest(array('initializeBundles'), true); + $kernel = $this->getKernelForTest(['initializeBundles'], true); $kernel->boot(); $preReBoot = $kernel->getStartTime(); @@ -614,7 +614,7 @@ EOF; { $bundle = $this ->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface') - ->setMethods(array('getPath', 'getParent', 'getName')) + ->setMethods(['getPath', 'getParent', 'getName']) ->disableOriginalConstructor() ; @@ -653,14 +653,14 @@ EOF; * * @return Kernel */ - protected function getKernel(array $methods = array(), array $bundles = array()) + protected function getKernel(array $methods = [], array $bundles = []) { $methods[] = 'registerBundles'; $kernel = $this ->getMockBuilder('Symfony\Component\HttpKernel\Kernel') ->setMethods($methods) - ->setConstructorArgs(array('test', false)) + ->setConstructorArgs(['test', false]) ->getMockForAbstractClass() ; $kernel->expects($this->any()) @@ -674,10 +674,10 @@ EOF; return $kernel; } - protected function getKernelForTest(array $methods = array(), $debug = false) + protected function getKernelForTest(array $methods = [], $debug = false) { $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest') - ->setConstructorArgs(array('test', $debug)) + ->setConstructorArgs(['test', $debug]) ->setMethods($methods) ->getMock(); $p = new \ReflectionProperty($kernel, 'rootDir'); @@ -718,7 +718,7 @@ class CustomProjectDirKernel extends Kernel public function registerBundles() { - return array(); + return []; } public function registerContainerConfiguration(LoaderInterface $loader) diff --git a/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php b/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php index a5d070c8a7..7354000b16 100644 --- a/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php +++ b/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php @@ -72,39 +72,39 @@ class LoggerTest extends TestCase */ public function testLogsAtAllLevels($level, $message) { - $this->logger->{$level}($message, array('user' => 'Bob')); - $this->logger->log($level, $message, array('user' => 'Bob')); + $this->logger->{$level}($message, ['user' => 'Bob']); + $this->logger->log($level, $message, ['user' => 'Bob']); - $expected = array( + $expected = [ "[$level] message of level $level with context: Bob", "[$level] message of level $level with context: Bob", - ); + ]; $this->assertLogsMatch($expected, $this->getLogs()); } public function provideLevelsAndMessages() { - return array( - LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), - LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), - LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), - LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), - LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), - LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), - LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), - LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), - ); + return [ + LogLevel::EMERGENCY => [LogLevel::EMERGENCY, 'message of level emergency with context: {user}'], + LogLevel::ALERT => [LogLevel::ALERT, 'message of level alert with context: {user}'], + LogLevel::CRITICAL => [LogLevel::CRITICAL, 'message of level critical with context: {user}'], + LogLevel::ERROR => [LogLevel::ERROR, 'message of level error with context: {user}'], + LogLevel::WARNING => [LogLevel::WARNING, 'message of level warning with context: {user}'], + LogLevel::NOTICE => [LogLevel::NOTICE, 'message of level notice with context: {user}'], + LogLevel::INFO => [LogLevel::INFO, 'message of level info with context: {user}'], + LogLevel::DEBUG => [LogLevel::DEBUG, 'message of level debug with context: {user}'], + ]; } public function testLogLevelDisabled() { $this->logger = new Logger(LogLevel::INFO, $this->tmpFile); - $this->logger->debug('test', array('user' => 'Bob')); - $this->logger->log(LogLevel::DEBUG, 'test', array('user' => 'Bob')); + $this->logger->debug('test', ['user' => 'Bob']); + $this->logger->log(LogLevel::DEBUG, 'test', ['user' => 'Bob']); // Will always be true, but asserts than an exception isn't thrown - $this->assertSame(array(), $this->getLogs()); + $this->assertSame([], $this->getLogs()); } /** @@ -134,18 +134,18 @@ class LoggerTest extends TestCase public function testContextReplacement() { $logger = $this->logger; - $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); + $logger->info('{Message {nothing} {user} {foo.bar} a}', ['user' => 'Bob', 'foo.bar' => 'Bar']); - $expected = array('[info] {Message {nothing} Bob Bar a}'); + $expected = ['[info] {Message {nothing} Bob Bar a}']; $this->assertLogsMatch($expected, $this->getLogs()); } public function testObjectCastToString() { if (method_exists($this, 'createPartialMock')) { - $dummy = $this->createPartialMock(DummyTest::class, array('__toString')); + $dummy = $this->createPartialMock(DummyTest::class, ['__toString']); } else { - $dummy = $this->getMock(DummyTest::class, array('__toString')); + $dummy = $this->getMock(DummyTest::class, ['__toString']); } $dummy->expects($this->atLeastOnce()) ->method('__toString') @@ -153,54 +153,54 @@ class LoggerTest extends TestCase $this->logger->warning($dummy); - $expected = array('[warning] DUMMY'); + $expected = ['[warning] DUMMY']; $this->assertLogsMatch($expected, $this->getLogs()); } public function testContextCanContainAnything() { - $context = array( + $context = [ 'bool' => true, 'null' => null, 'string' => 'Foo', 'int' => 0, 'float' => 0.5, - 'nested' => array('with object' => new DummyTest()), + 'nested' => ['with object' => new DummyTest()], 'object' => new \DateTime(), 'resource' => fopen('php://memory', 'r'), - ); + ]; $this->logger->warning('Crazy context data', $context); - $expected = array('[warning] Crazy context data'); + $expected = ['[warning] Crazy context data']; $this->assertLogsMatch($expected, $this->getLogs()); } public function testContextExceptionKeyCanBeExceptionOrOtherValues() { $logger = $this->logger; - $logger->warning('Random message', array('exception' => 'oops')); - $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); + $logger->warning('Random message', ['exception' => 'oops']); + $logger->critical('Uncaught Exception!', ['exception' => new \LogicException('Fail')]); - $expected = array( + $expected = [ '[warning] Random message', '[critical] Uncaught Exception!', - ); + ]; $this->assertLogsMatch($expected, $this->getLogs()); } public function testFormatter() { $this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile, function ($level, $message, $context) { - return json_encode(array('level' => $level, 'message' => $message, 'context' => $context)).\PHP_EOL; + return json_encode(['level' => $level, 'message' => $message, 'context' => $context]).\PHP_EOL; }); - $this->logger->error('An error', array('foo' => 'bar')); - $this->logger->warning('A warning', array('baz' => 'bar')); - $this->assertSame(array( + $this->logger->error('An error', ['foo' => 'bar']); + $this->logger->warning('A warning', ['baz' => 'bar']); + $this->assertSame([ '{"level":"error","message":"An error","context":{"foo":"bar"}}', '{"level":"warning","message":"A warning","context":{"baz":"bar"}}', - ), $this->getLogs()); + ], $this->getLogs()); } } diff --git a/vendor/symfony/http-kernel/Tests/Logger.php b/vendor/symfony/http-kernel/Tests/Logger.php index 63c70bf67a..8ae756132c 100644 --- a/vendor/symfony/http-kernel/Tests/Logger.php +++ b/vendor/symfony/http-kernel/Tests/Logger.php @@ -29,59 +29,59 @@ class Logger implements LoggerInterface public function clear() { - $this->logs = array( - 'emergency' => array(), - 'alert' => array(), - 'critical' => array(), - 'error' => array(), - 'warning' => array(), - 'notice' => array(), - 'info' => array(), - 'debug' => array(), - ); + $this->logs = [ + 'emergency' => [], + 'alert' => [], + 'critical' => [], + 'error' => [], + 'warning' => [], + 'notice' => [], + 'info' => [], + 'debug' => [], + ]; } - public function log($level, $message, array $context = array()) + public function log($level, $message, array $context = []) { $this->logs[$level][] = $message; } - public function emergency($message, array $context = array()) + public function emergency($message, array $context = []) { $this->log('emergency', $message, $context); } - public function alert($message, array $context = array()) + public function alert($message, array $context = []) { $this->log('alert', $message, $context); } - public function critical($message, array $context = array()) + public function critical($message, array $context = []) { $this->log('critical', $message, $context); } - public function error($message, array $context = array()) + public function error($message, array $context = []) { $this->log('error', $message, $context); } - public function warning($message, array $context = array()) + public function warning($message, array $context = []) { $this->log('warning', $message, $context); } - public function notice($message, array $context = array()) + public function notice($message, array $context = []) { $this->log('notice', $message, $context); } - public function info($message, array $context = array()) + public function info($message, array $context = []) { $this->log('info', $message, $context); } - public function debug($message, array $context = array()) + public function debug($message, array $context = []) { $this->log('debug', $message, $context); } diff --git a/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php b/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php index e64c622c37..bf4cd17d16 100644 --- a/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php +++ b/vendor/symfony/http-kernel/Tests/Profiler/FileProfilerStorageTest.php @@ -226,7 +226,7 @@ class FileProfilerStorageTest extends TestCase public function testRetrieveByMethodAndLimit() { - foreach (array('POST', 'GET') as $method) { + foreach (['POST', 'GET'] as $method) { for ($i = 0; $i < 5; ++$i) { $profile = new Profile('token_'.$i.$method); $profile->setMethod($method); @@ -293,8 +293,8 @@ class FileProfilerStorageTest extends TestCase $tokens = $this->storage->find('', '', 10, ''); $this->assertCount(2, $tokens); - $this->assertContains($tokens[0]['status_code'], array(200, 404)); - $this->assertContains($tokens[1]['status_code'], array(200, 404)); + $this->assertContains($tokens[0]['status_code'], [200, 404]); + $this->assertContains($tokens[1]['status_code'], [200, 404]); } public function testMultiRowIndexFile() diff --git a/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php b/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php index 2f7e8dd284..35aa8ea5dc 100644 --- a/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php +++ b/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php @@ -44,7 +44,7 @@ class ProfilerTest extends TestCase public function testReset() { $collector = $this->getMockBuilder(DataCollectorInterface::class) - ->setMethods(array('collect', 'getName', 'reset')) + ->setMethods(['collect', 'getName', 'reset']) ->getMock(); $collector->expects($this->any())->method('getName')->willReturn('mock'); $collector->expects($this->once())->method('reset'); diff --git a/vendor/symfony/http-kernel/Tests/TestHttpKernel.php b/vendor/symfony/http-kernel/Tests/TestHttpKernel.php index fb95aa033b..27ba2d6f89 100644 --- a/vendor/symfony/http-kernel/Tests/TestHttpKernel.php +++ b/vendor/symfony/http-kernel/Tests/TestHttpKernel.php @@ -27,12 +27,12 @@ class TestHttpKernel extends HttpKernel implements ControllerResolverInterface, public function getController(Request $request) { - return array($this, 'callController'); + return [$this, 'callController']; } public function getArguments(Request $request, $controller) { - return array($request); + return [$request]; } public function callController(Request $request) diff --git a/vendor/symfony/http-kernel/UriSigner.php b/vendor/symfony/http-kernel/UriSigner.php index 210f731735..1dd56ffd76 100644 --- a/vendor/symfony/http-kernel/UriSigner.php +++ b/vendor/symfony/http-kernel/UriSigner.php @@ -47,7 +47,7 @@ class UriSigner if (isset($url['query'])) { parse_str($url['query'], $params); } else { - $params = array(); + $params = []; } $uri = $this->buildUrl($url, $params); @@ -69,7 +69,7 @@ class UriSigner if (isset($url['query'])) { parse_str($url['query'], $params); } else { - $params = array(); + $params = []; } if (empty($params[$this->parameter])) { @@ -87,7 +87,7 @@ class UriSigner return base64_encode(hash_hmac('sha256', $uri, $this->secret, true)); } - private function buildUrl(array $url, array $params = array()) + private function buildUrl(array $url, array $params = []) { ksort($params, SORT_STRING); $url['query'] = http_build_query($params, '', '&'); diff --git a/vendor/symfony/translation/Catalogue/AbstractOperation.php b/vendor/symfony/translation/Catalogue/AbstractOperation.php index a0765ddd66..919bab8fff 100644 --- a/vendor/symfony/translation/Catalogue/AbstractOperation.php +++ b/vendor/symfony/translation/Catalogue/AbstractOperation.php @@ -40,19 +40,19 @@ abstract class AbstractOperation implements OperationInterface * * The data structure of this array is as follows: * - * array( - * 'domain 1' => array( - * 'all' => array(...), - * 'new' => array(...), - * 'obsolete' => array(...) - * ), - * 'domain 2' => array( - * 'all' => array(...), - * 'new' => array(...), - * 'obsolete' => array(...) - * ), + * [ + * 'domain 1' => [ + * 'all' => [...], + * 'new' => [...], + * 'obsolete' => [...] + * ], + * 'domain 2' => [ + * 'all' => [...], + * 'new' => [...], + * 'obsolete' => [...] + * ], * ... - * ) + * ] * * @var array The array that stores 'all', 'new' and 'obsolete' messages */ @@ -70,7 +70,7 @@ abstract class AbstractOperation implements OperationInterface $this->source = $source; $this->target = $target; $this->result = new MessageCatalogue($source->getLocale()); - $this->messages = array(); + $this->messages = []; } /** diff --git a/vendor/symfony/translation/Catalogue/MergeOperation.php b/vendor/symfony/translation/Catalogue/MergeOperation.php index 8dd4026176..d2f4abd13f 100644 --- a/vendor/symfony/translation/Catalogue/MergeOperation.php +++ b/vendor/symfony/translation/Catalogue/MergeOperation.php @@ -29,16 +29,16 @@ class MergeOperation extends AbstractOperation */ protected function processDomain($domain) { - $this->messages[$domain] = array( - 'all' => array(), - 'new' => array(), - 'obsolete' => array(), - ); + $this->messages[$domain] = [ + 'all' => [], + 'new' => [], + 'obsolete' => [], + ]; $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; foreach ($this->source->all($domain) as $id => $message) { $this->messages[$domain]['all'][$id] = $message; - $this->result->add(array($id => $message), $this->source->defines($id, $intlDomain) ? $intlDomain : $domain); + $this->result->add([$id => $message], $this->source->defines($id, $intlDomain) ? $intlDomain : $domain); if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } @@ -48,7 +48,7 @@ class MergeOperation extends AbstractOperation if (!$this->source->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; $this->messages[$domain]['new'][$id] = $message; - $this->result->add(array($id => $message), $this->target->defines($id, $intlDomain) ? $intlDomain : $domain); + $this->result->add([$id => $message], $this->target->defines($id, $intlDomain) ? $intlDomain : $domain); if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } diff --git a/vendor/symfony/translation/Catalogue/TargetOperation.php b/vendor/symfony/translation/Catalogue/TargetOperation.php index 523022550a..22aa9a3911 100644 --- a/vendor/symfony/translation/Catalogue/TargetOperation.php +++ b/vendor/symfony/translation/Catalogue/TargetOperation.php @@ -30,11 +30,11 @@ class TargetOperation extends AbstractOperation */ protected function processDomain($domain) { - $this->messages[$domain] = array( - 'all' => array(), - 'new' => array(), - 'obsolete' => array(), - ); + $this->messages[$domain] = [ + 'all' => [], + 'new' => [], + 'obsolete' => [], + ]; $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; // For 'all' messages, the code can't be simplified as ``$this->messages[$domain]['all'] = $target->all($domain);``, @@ -49,7 +49,7 @@ class TargetOperation extends AbstractOperation foreach ($this->source->all($domain) as $id => $message) { if ($this->target->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; - $this->result->add(array($id => $message), $this->target->defines($id, $intlDomain) ? $intlDomain : $domain); + $this->result->add([$id => $message], $this->target->defines($id, $intlDomain) ? $intlDomain : $domain); if (null !== $keyMetadata = $this->source->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } @@ -62,7 +62,7 @@ class TargetOperation extends AbstractOperation if (!$this->source->has($id, $domain)) { $this->messages[$domain]['all'][$id] = $message; $this->messages[$domain]['new'][$id] = $message; - $this->result->add(array($id => $message), $this->target->defines($id, $intlDomain) ? $intlDomain : $domain); + $this->result->add([$id => $message], $this->target->defines($id, $intlDomain) ? $intlDomain : $domain); if (null !== $keyMetadata = $this->target->getMetadata($id, $domain)) { $this->result->setMetadata($id, $keyMetadata, $domain); } diff --git a/vendor/symfony/translation/Command/XliffLintCommand.php b/vendor/symfony/translation/Command/XliffLintCommand.php index 17e1a72bb4..f8791a490e 100644 --- a/vendor/symfony/translation/Command/XliffLintCommand.php +++ b/vendor/symfony/translation/Command/XliffLintCommand.php @@ -89,10 +89,10 @@ EOF throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); } - return $this->display($io, array($this->validate($stdin))); + return $this->display($io, [$this->validate($stdin)]); } - $filesInfo = array(); + $filesInfo = []; foreach ($filenames as $filename) { if (!$this->isReadable($filename)) { throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); @@ -108,11 +108,11 @@ EOF private function validate($content, $file = null) { - $errors = array(); + $errors = []; // Avoid: Warning DOMDocument::loadXML(): Empty string supplied as input if ('' === trim($content)) { - return array('file' => $file, 'valid' => true); + return ['file' => $file, 'valid' => true]; } libxml_use_internal_errors(true); @@ -127,23 +127,23 @@ EOF $expectedFilenamePattern = $this->requireStrictFileNames ? sprintf('/^.*\.%s\.xlf/', $normalizedLocale) : sprintf('/^(.*\.%s\.xlf|%s\..*\.xlf)/', $normalizedLocale, $normalizedLocale); if (0 === preg_match($expectedFilenamePattern, basename($file))) { - $errors[] = array( + $errors[] = [ 'line' => -1, 'column' => -1, 'message' => sprintf('There is a mismatch between the language included in the file name ("%s") and the "%s" value used in the "target-language" attribute of the file.', basename($file), $targetLanguage), - ); + ]; } } foreach (XliffUtils::validateSchema($document) as $xmlError) { - $errors[] = array( + $errors[] = [ 'line' => $xmlError['line'], 'column' => $xmlError['column'], 'message' => $xmlError['message'], - ); + ]; } - return array('file' => $file, 'valid' => 0 === \count($errors), 'messages' => $errors); + return ['file' => $file, 'valid' => 0 === \count($errors), 'messages' => $errors]; } private function display(SymfonyStyle $io, array $files) @@ -210,7 +210,7 @@ EOF } foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) { - if (!\in_array($file->getExtension(), array('xlf', 'xliff'))) { + if (!\in_array($file->getExtension(), ['xlf', 'xliff'])) { continue; } @@ -263,7 +263,7 @@ EOF private function getTargetLanguageFromFile(\DOMDocument $xliffContents): ?string { - foreach ($xliffContents->getElementsByTagName('file')[0]->attributes ?? array() as $attribute) { + foreach ($xliffContents->getElementsByTagName('file')[0]->attributes ?? [] as $attribute) { if ('target-language' === $attribute->nodeName) { return $attribute->nodeValue; } diff --git a/vendor/symfony/translation/DataCollector/TranslationDataCollector.php b/vendor/symfony/translation/DataCollector/TranslationDataCollector.php index b281519140..d99b493ac6 100755 --- a/vendor/symfony/translation/DataCollector/TranslationDataCollector.php +++ b/vendor/symfony/translation/DataCollector/TranslationDataCollector.php @@ -57,7 +57,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto */ public function reset() { - $this->data = array(); + $this->data = []; } /** @@ -65,7 +65,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto */ public function getMessages() { - return isset($this->data['messages']) ? $this->data['messages'] : array(); + return isset($this->data['messages']) ? $this->data['messages'] : []; } /** @@ -102,7 +102,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto */ public function getFallbackLocales() { - return (isset($this->data['fallback_locales']) && \count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : array(); + return (isset($this->data['fallback_locales']) && \count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : []; } /** @@ -115,13 +115,13 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto private function sanitizeCollectedMessages($messages) { - $result = array(); + $result = []; foreach ($messages as $key => $message) { $messageId = $message['locale'].$message['domain'].$message['id']; if (!isset($result[$messageId])) { $message['count'] = 1; - $message['parameters'] = !empty($message['parameters']) ? array($message['parameters']) : array(); + $message['parameters'] = !empty($message['parameters']) ? [$message['parameters']] : []; $messages[$key]['translation'] = $this->sanitizeString($message['translation']); $result[$messageId] = $message; } else { @@ -140,11 +140,11 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto private function computeCount($messages) { - $count = array( + $count = [ DataCollectorTranslator::MESSAGE_DEFINED => 0, DataCollectorTranslator::MESSAGE_MISSING => 0, DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK => 0, - ); + ]; foreach ($messages as $message) { ++$count[$message['state']]; diff --git a/vendor/symfony/translation/DataCollectorTranslator.php b/vendor/symfony/translation/DataCollectorTranslator.php index ca6bedc71b..39561ec92e 100644 --- a/vendor/symfony/translation/DataCollectorTranslator.php +++ b/vendor/symfony/translation/DataCollectorTranslator.php @@ -30,7 +30,7 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn */ private $translator; - private $messages = array(); + private $messages = []; /** * @param TranslatorInterface $translator The translator must implement TranslatorBagInterface @@ -50,7 +50,7 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn /** * {@inheritdoc} */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) + public function trans($id, array $parameters = [], $domain = null, $locale = null) { $trans = $this->translator->trans($id, $parameters, $domain, $locale); $this->collectMessage($locale, $domain, $id, $trans, $parameters); @@ -63,15 +63,15 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn * * @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) + public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { if ($this->translator instanceof TranslatorInterface) { - $trans = $this->translator->trans($id, array('%count%' => $number) + $parameters, $domain, $locale); + $trans = $this->translator->trans($id, ['%count%' => $number] + $parameters, $domain, $locale); } $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); - $this->collectMessage($locale, $domain, $id, $trans, array('%count%' => $number) + $parameters); + $this->collectMessage($locale, $domain, $id, $trans, ['%count%' => $number] + $parameters); return $trans; } @@ -111,7 +111,7 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn return $this->translator->getFallbackLocales(); } - return array(); + return []; } /** @@ -137,7 +137,7 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn * @param string $translation * @param array|null $parameters */ - private function collectMessage($locale, $domain, $id, $translation, $parameters = array()) + private function collectMessage($locale, $domain, $id, $translation, $parameters = []) { if (null === $domain) { $domain = 'messages'; @@ -164,7 +164,7 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn $state = self::MESSAGE_MISSING; } - $this->messages[] = array( + $this->messages[] = [ 'locale' => $locale, 'domain' => $domain, 'id' => $id, @@ -172,6 +172,6 @@ class DataCollectorTranslator implements LegacyTranslatorInterface, TranslatorIn 'parameters' => $parameters, 'state' => $state, 'transChoiceNumber' => isset($parameters['%count%']) && is_numeric($parameters['%count%']) ? $parameters['%count%'] : null, - ); + ]; } } diff --git a/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php b/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php index 31d791dc26..930f36d721 100644 --- a/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php +++ b/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php @@ -38,7 +38,7 @@ class TranslationDumperPass implements CompilerPassInterface $definition = $container->getDefinition($this->writerServiceId); foreach ($container->findTaggedServiceIds($this->dumperTag, true) as $id => $attributes) { - $definition->addMethodCall('addDumper', array($attributes[0]['alias'], new Reference($id))); + $definition->addMethodCall('addDumper', [$attributes[0]['alias'], new Reference($id)]); } } } diff --git a/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php b/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php index b7e6f73458..d08b2ba5ff 100644 --- a/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php +++ b/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php @@ -43,7 +43,7 @@ class TranslationExtractorPass implements CompilerPassInterface throw new RuntimeException(sprintf('The alias for the tag "translation.extractor" of service "%s" must be set.', $id)); } - $definition->addMethodCall('addExtractor', array($attributes[0]['alias'], new Reference($id))); + $definition->addMethodCall('addExtractor', [$attributes[0]['alias'], new Reference($id)]); } } } diff --git a/vendor/symfony/translation/DependencyInjection/TranslatorPass.php b/vendor/symfony/translation/DependencyInjection/TranslatorPass.php index cbaa43db96..fc1c08fc32 100644 --- a/vendor/symfony/translation/DependencyInjection/TranslatorPass.php +++ b/vendor/symfony/translation/DependencyInjection/TranslatorPass.php @@ -39,8 +39,8 @@ class TranslatorPass implements CompilerPassInterface return; } - $loaders = array(); - $loaderRefs = array(); + $loaders = []; + $loaderRefs = []; foreach ($container->findTaggedServiceIds($this->loaderTag, true) as $id => $attributes) { $loaderRefs[$id] = new Reference($id); $loaders[$id][] = $attributes[0]['alias']; @@ -53,7 +53,7 @@ class TranslatorPass implements CompilerPassInterface $definition = $container->getDefinition($this->readerServiceId); foreach ($loaders as $id => $formats) { foreach ($formats as $format) { - $definition->addMethodCall('addLoader', array($format, $loaderRefs[$id])); + $definition->addMethodCall('addLoader', [$format, $loaderRefs[$id]]); } } } diff --git a/vendor/symfony/translation/Dumper/CsvFileDumper.php b/vendor/symfony/translation/Dumper/CsvFileDumper.php index 0880528dc9..bfa8db61ad 100644 --- a/vendor/symfony/translation/Dumper/CsvFileDumper.php +++ b/vendor/symfony/translation/Dumper/CsvFileDumper.php @@ -26,12 +26,12 @@ class CsvFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $handle = fopen('php://memory', 'r+b'); foreach ($messages->all($domain) as $source => $target) { - fputcsv($handle, array($source, $target), $this->delimiter, $this->enclosure); + fputcsv($handle, [$source, $target], $this->delimiter, $this->enclosure); } rewind($handle); diff --git a/vendor/symfony/translation/Dumper/DumperInterface.php b/vendor/symfony/translation/Dumper/DumperInterface.php index cebc65ed89..9965e8091f 100644 --- a/vendor/symfony/translation/Dumper/DumperInterface.php +++ b/vendor/symfony/translation/Dumper/DumperInterface.php @@ -27,5 +27,5 @@ interface DumperInterface * @param MessageCatalogue $messages The message catalogue * @param array $options Options that are used by the dumper */ - public function dump(MessageCatalogue $messages, $options = array()); + public function dump(MessageCatalogue $messages, $options = []); } diff --git a/vendor/symfony/translation/Dumper/FileDumper.php b/vendor/symfony/translation/Dumper/FileDumper.php index 8afcf60898..57ce9d2141 100644 --- a/vendor/symfony/translation/Dumper/FileDumper.php +++ b/vendor/symfony/translation/Dumper/FileDumper.php @@ -61,7 +61,7 @@ abstract class FileDumper implements DumperInterface /** * {@inheritdoc} */ - public function dump(MessageCatalogue $messages, $options = array()) + public function dump(MessageCatalogue $messages, $options = []) { if (!array_key_exists('path', $options)) { throw new InvalidArgumentException('The file dumper needs a path option.'); @@ -84,7 +84,7 @@ abstract class FileDumper implements DumperInterface $intlPath = $options['path'].'/'.$this->getRelativePath($intlDomain, $messages->getLocale()); file_put_contents($intlPath, $this->formatCatalogue($messages, $intlDomain, $options)); - $messages->replace(array(), $intlDomain); + $messages->replace([], $intlDomain); try { if ($messages->all($domain)) { @@ -109,7 +109,7 @@ abstract class FileDumper implements DumperInterface * * @return string representation */ - abstract public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()); + abstract public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []); /** * Gets the file extension of the dumper. @@ -123,10 +123,10 @@ abstract class FileDumper implements DumperInterface */ private function getRelativePath(string $domain, string $locale): string { - return strtr($this->relativePathTemplate, array( + return strtr($this->relativePathTemplate, [ '%domain%' => $domain, '%locale%' => $locale, '%extension%' => $this->getExtension(), - )); + ]); } } diff --git a/vendor/symfony/translation/Dumper/IcuResFileDumper.php b/vendor/symfony/translation/Dumper/IcuResFileDumper.php index efa9d7fee6..48d0befdf9 100644 --- a/vendor/symfony/translation/Dumper/IcuResFileDumper.php +++ b/vendor/symfony/translation/Dumper/IcuResFileDumper.php @@ -28,7 +28,7 @@ class IcuResFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $data = $indexes = $resources = ''; diff --git a/vendor/symfony/translation/Dumper/IniFileDumper.php b/vendor/symfony/translation/Dumper/IniFileDumper.php index 9ed3754037..45ff9614b1 100644 --- a/vendor/symfony/translation/Dumper/IniFileDumper.php +++ b/vendor/symfony/translation/Dumper/IniFileDumper.php @@ -23,7 +23,7 @@ class IniFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $output = ''; diff --git a/vendor/symfony/translation/Dumper/JsonFileDumper.php b/vendor/symfony/translation/Dumper/JsonFileDumper.php index a4db4d6ab8..2af8231bd6 100644 --- a/vendor/symfony/translation/Dumper/JsonFileDumper.php +++ b/vendor/symfony/translation/Dumper/JsonFileDumper.php @@ -23,7 +23,7 @@ class JsonFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $flags = $options['json_encoding'] ?? JSON_PRETTY_PRINT; diff --git a/vendor/symfony/translation/Dumper/MoFileDumper.php b/vendor/symfony/translation/Dumper/MoFileDumper.php index 32ed0ac268..27be16d573 100644 --- a/vendor/symfony/translation/Dumper/MoFileDumper.php +++ b/vendor/symfony/translation/Dumper/MoFileDumper.php @@ -24,20 +24,20 @@ class MoFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $sources = $targets = $sourceOffsets = $targetOffsets = ''; - $offsets = array(); + $offsets = []; $size = 0; foreach ($messages->all($domain) as $source => $target) { - $offsets[] = array_map('strlen', array($sources, $source, $targets, $target)); + $offsets[] = array_map('strlen', [$sources, $source, $targets, $target]); $sources .= "\0".$source; $targets .= "\0".$target; ++$size; } - $header = array( + $header = [ 'magicNumber' => MoFileLoader::MO_LITTLE_ENDIAN_MAGIC, 'formatRevision' => 0, 'count' => $size, @@ -45,7 +45,7 @@ class MoFileDumper extends FileDumper 'offsetTranslated' => MoFileLoader::MO_HEADER_SIZE + (8 * $size), 'sizeHashes' => 0, 'offsetHashes' => MoFileLoader::MO_HEADER_SIZE + (16 * $size), - ); + ]; $sourcesSize = \strlen($sources); $sourcesStart = $header['offsetHashes'] + 1; @@ -57,7 +57,7 @@ class MoFileDumper extends FileDumper .$this->writeLong($offset[2] + $sourcesStart + $sourcesSize); } - $output = implode('', array_map(array($this, 'writeLong'), $header)) + $output = implode('', array_map([$this, 'writeLong'], $header)) .$sourceOffsets .$targetOffsets .$sources diff --git a/vendor/symfony/translation/Dumper/PhpFileDumper.php b/vendor/symfony/translation/Dumper/PhpFileDumper.php index c7c37aac92..e77afc2fbf 100644 --- a/vendor/symfony/translation/Dumper/PhpFileDumper.php +++ b/vendor/symfony/translation/Dumper/PhpFileDumper.php @@ -23,7 +23,7 @@ class PhpFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { return "<?php\n\nreturn ".var_export($messages->all($domain), true).";\n"; } diff --git a/vendor/symfony/translation/Dumper/PoFileDumper.php b/vendor/symfony/translation/Dumper/PoFileDumper.php index ed4418b148..e9673b6d29 100644 --- a/vendor/symfony/translation/Dumper/PoFileDumper.php +++ b/vendor/symfony/translation/Dumper/PoFileDumper.php @@ -23,7 +23,7 @@ class PoFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $output = 'msgid ""'."\n"; $output .= 'msgstr ""'."\n"; diff --git a/vendor/symfony/translation/Dumper/QtFileDumper.php b/vendor/symfony/translation/Dumper/QtFileDumper.php index a9073f26df..ec93f92e4a 100644 --- a/vendor/symfony/translation/Dumper/QtFileDumper.php +++ b/vendor/symfony/translation/Dumper/QtFileDumper.php @@ -23,7 +23,7 @@ class QtFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $dom = new \DOMDocument('1.0', 'utf-8'); $dom->formatOutput = true; diff --git a/vendor/symfony/translation/Dumper/XliffFileDumper.php b/vendor/symfony/translation/Dumper/XliffFileDumper.php index c12454cd84..8ee8d5a009 100644 --- a/vendor/symfony/translation/Dumper/XliffFileDumper.php +++ b/vendor/symfony/translation/Dumper/XliffFileDumper.php @@ -24,7 +24,7 @@ class XliffFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { $xliffVersion = '1.2'; if (array_key_exists('xliff_version', $options)) { @@ -55,9 +55,9 @@ class XliffFileDumper extends FileDumper return 'xlf'; } - private function dumpXliff1($defaultLocale, MessageCatalogue $messages, $domain, array $options = array()) + private function dumpXliff1($defaultLocale, MessageCatalogue $messages, $domain, array $options = []) { - $toolInfo = array('tool-id' => 'symfony', 'tool-name' => 'Symfony'); + $toolInfo = ['tool-id' => 'symfony', 'tool-name' => 'Symfony']; if (array_key_exists('tool_info', $options)) { $toolInfo = array_merge($toolInfo, $options['tool_info']); } @@ -129,7 +129,7 @@ class XliffFileDumper extends FileDumper return $dom->saveXML(); } - private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain, array $options = array()) + private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain, array $options = []) { $dom = new \DOMDocument('1.0', 'utf-8'); $dom->formatOutput = true; diff --git a/vendor/symfony/translation/Dumper/YamlFileDumper.php b/vendor/symfony/translation/Dumper/YamlFileDumper.php index b19b9ae1fd..d6e4af8fb6 100644 --- a/vendor/symfony/translation/Dumper/YamlFileDumper.php +++ b/vendor/symfony/translation/Dumper/YamlFileDumper.php @@ -33,7 +33,7 @@ class YamlFileDumper extends FileDumper /** * {@inheritdoc} */ - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { if (!class_exists('Symfony\Component\Yaml\Yaml')) { throw new LogicException('Dumping translations in the YAML format requires the Symfony Yaml component.'); diff --git a/vendor/symfony/translation/Extractor/AbstractFileExtractor.php b/vendor/symfony/translation/Extractor/AbstractFileExtractor.php index bebd6d9162..8d722dad81 100644 --- a/vendor/symfony/translation/Extractor/AbstractFileExtractor.php +++ b/vendor/symfony/translation/Extractor/AbstractFileExtractor.php @@ -28,14 +28,14 @@ abstract class AbstractFileExtractor protected function extractFiles($resource) { if (\is_array($resource) || $resource instanceof \Traversable) { - $files = array(); + $files = []; foreach ($resource as $file) { if ($this->canBeExtracted($file)) { $files[] = $this->toSplFileInfo($file); } } } elseif (is_file($resource)) { - $files = $this->canBeExtracted($resource) ? array($this->toSplFileInfo($resource)) : array(); + $files = $this->canBeExtracted($resource) ? [$this->toSplFileInfo($resource)] : []; } else { $files = $this->extractFromDirectory($resource); } diff --git a/vendor/symfony/translation/Extractor/ChainExtractor.php b/vendor/symfony/translation/Extractor/ChainExtractor.php index 50e3c84579..69ee2dfc39 100644 --- a/vendor/symfony/translation/Extractor/ChainExtractor.php +++ b/vendor/symfony/translation/Extractor/ChainExtractor.php @@ -25,7 +25,7 @@ class ChainExtractor implements ExtractorInterface * * @var ExtractorInterface[] */ - private $extractors = array(); + private $extractors = []; /** * Adds a loader to the translation extractor. diff --git a/vendor/symfony/translation/Extractor/PhpExtractor.php b/vendor/symfony/translation/Extractor/PhpExtractor.php index b4b32361ff..5f6aecd50a 100644 --- a/vendor/symfony/translation/Extractor/PhpExtractor.php +++ b/vendor/symfony/translation/Extractor/PhpExtractor.php @@ -37,8 +37,8 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface * * @var array */ - protected $sequences = array( - array( + protected $sequences = [ + [ '->', 'trans', '(', @@ -47,8 +47,8 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface self::METHOD_ARGUMENTS_TOKEN, ',', self::DOMAIN_TOKEN, - ), - array( + ], + [ '->', 'transChoice', '(', @@ -59,20 +59,20 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface self::METHOD_ARGUMENTS_TOKEN, ',', self::DOMAIN_TOKEN, - ), - array( + ], + [ '->', 'trans', '(', self::MESSAGE_TOKEN, - ), - array( + ], + [ '->', 'transChoice', '(', self::MESSAGE_TOKEN, - ), - ); + ], + ]; /** * {@inheritdoc} @@ -154,9 +154,14 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface { $message = ''; $docToken = ''; + $docPart = ''; for (; $tokenIterator->valid(); $tokenIterator->next()) { $t = $tokenIterator->current(); + if ('.' === $t) { + // Concatenate with next token + continue; + } if (!isset($t[1])) { break; } @@ -167,19 +172,24 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface break; case T_ENCAPSED_AND_WHITESPACE: case T_CONSTANT_ENCAPSED_STRING: - $message .= $t[1]; + if ('' === $docToken) { + $message .= PhpStringTokenParser::parse($t[1]); + } else { + $docPart = $t[1]; + } break; case T_END_HEREDOC: - return PhpStringTokenParser::parseDocString($docToken, $message); + $message .= PhpStringTokenParser::parseDocString($docToken, $docPart); + $docToken = ''; + $docPart = ''; + break; + case T_WHITESPACE: + break; default: break 2; } } - if ($message) { - $message = PhpStringTokenParser::parse($message); - } - return $message; } diff --git a/vendor/symfony/translation/Extractor/PhpStringTokenParser.php b/vendor/symfony/translation/Extractor/PhpStringTokenParser.php index e8094e6c08..8a8ccb1f1a 100644 --- a/vendor/symfony/translation/Extractor/PhpStringTokenParser.php +++ b/vendor/symfony/translation/Extractor/PhpStringTokenParser.php @@ -49,7 +49,7 @@ namespace Symfony\Component\Translation\Extractor; class PhpStringTokenParser { - protected static $replacements = array( + protected static $replacements = [ '\\' => '\\', '$' => '$', 'n' => "\n", @@ -58,7 +58,7 @@ class PhpStringTokenParser 'f' => "\f", 'v' => "\v", 'e' => "\x1B", - ); + ]; /** * Parses a string token. @@ -76,8 +76,8 @@ class PhpStringTokenParser if ('\'' === $str[$bLength]) { return str_replace( - array('\\\\', '\\\''), - array('\\', '\''), + ['\\\\', '\\\''], + ['\\', '\''], substr($str, $bLength + 1, -1) ); } else { @@ -101,7 +101,7 @@ class PhpStringTokenParser return preg_replace_callback( '~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3})~', - array(__CLASS__, 'parseCallback'), + [__CLASS__, 'parseCallback'], $str ); } diff --git a/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php b/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php index 6bc68384af..621dbb292d 100644 --- a/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php +++ b/vendor/symfony/translation/Formatter/ChoiceMessageFormatterInterface.php @@ -28,5 +28,5 @@ interface ChoiceMessageFormatterInterface * * @return string */ - public function choiceFormat($message, $number, $locale, array $parameters = array()); + public function choiceFormat($message, $number, $locale, array $parameters = []); } diff --git a/vendor/symfony/translation/Formatter/IntlFormatter.php b/vendor/symfony/translation/Formatter/IntlFormatter.php index 338d5151f5..1d5f468d46 100644 --- a/vendor/symfony/translation/Formatter/IntlFormatter.php +++ b/vendor/symfony/translation/Formatter/IntlFormatter.php @@ -21,12 +21,12 @@ use Symfony\Component\Translation\Exception\LogicException; class IntlFormatter implements IntlFormatterInterface { private $hasMessageFormatter; - private $cache = array(); + private $cache = []; /** * {@inheritdoc} */ - public function formatIntl(string $message, string $locale, array $parameters = array()): string + public function formatIntl(string $message, string $locale, array $parameters = []): string { if (!$formatter = $this->cache[$locale][$message] ?? null) { if (!($this->hasMessageFormatter ?? $this->hasMessageFormatter = class_exists(\MessageFormatter::class))) { @@ -40,7 +40,7 @@ class IntlFormatter implements IntlFormatterInterface } foreach ($parameters as $key => $value) { - if (\in_array($key[0] ?? null, array('%', '{'), true)) { + if (\in_array($key[0] ?? null, ['%', '{'], true)) { unset($parameters[$key]); $parameters[trim($key, '%{ }')] = $value; } diff --git a/vendor/symfony/translation/Formatter/IntlFormatterInterface.php b/vendor/symfony/translation/Formatter/IntlFormatterInterface.php index 5fc5d97d24..02fc6acbdf 100644 --- a/vendor/symfony/translation/Formatter/IntlFormatterInterface.php +++ b/vendor/symfony/translation/Formatter/IntlFormatterInterface.php @@ -23,5 +23,5 @@ interface IntlFormatterInterface * * @see http://icu-project.org/apiref/icu4c/classMessageFormat.html#details */ - public function formatIntl(string $message, string $locale, array $parameters = array()): string; + public function formatIntl(string $message, string $locale, array $parameters = []): string; } diff --git a/vendor/symfony/translation/Formatter/MessageFormatter.php b/vendor/symfony/translation/Formatter/MessageFormatter.php index e36f242c89..030d7a5c3e 100644 --- a/vendor/symfony/translation/Formatter/MessageFormatter.php +++ b/vendor/symfony/translation/Formatter/MessageFormatter.php @@ -42,7 +42,7 @@ class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterf /** * {@inheritdoc} */ - public function format($message, $locale, array $parameters = array()) + public function format($message, $locale, array $parameters = []) { if ($this->translator instanceof TranslatorInterface) { return $this->translator->trans($message, $parameters, null, $locale); @@ -54,7 +54,7 @@ class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterf /** * {@inheritdoc} */ - public function formatIntl(string $message, string $locale, array $parameters = array()): string + public function formatIntl(string $message, string $locale, array $parameters = []): string { return $this->intlFormatter->formatIntl($message, $locale, $parameters); } @@ -64,16 +64,16 @@ class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterf * * @deprecated since Symfony 4.2, use format() with a %count% parameter instead */ - public function choiceFormat($message, $number, $locale, array $parameters = array()) + public function choiceFormat($message, $number, $locale, array $parameters = []) { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the format() one instead with a %%count%% parameter.', __METHOD__), E_USER_DEPRECATED); - $parameters = array('%count%' => $number) + $parameters; + $parameters = ['%count%' => $number] + $parameters; if ($this->translator instanceof TranslatorInterface) { return $this->format($message, $locale, $parameters); } - return $this->format($this->translator->transChoice($message, $number, array(), null, $locale), $locale, $parameters); + return $this->format($this->translator->transChoice($message, $number, [], null, $locale), $locale, $parameters); } } diff --git a/vendor/symfony/translation/Formatter/MessageFormatterInterface.php b/vendor/symfony/translation/Formatter/MessageFormatterInterface.php index 86937fb2f0..370c055866 100644 --- a/vendor/symfony/translation/Formatter/MessageFormatterInterface.php +++ b/vendor/symfony/translation/Formatter/MessageFormatterInterface.php @@ -26,5 +26,5 @@ interface MessageFormatterInterface * * @return string */ - public function format($message, $locale, array $parameters = array()); + public function format($message, $locale, array $parameters = []); } diff --git a/vendor/symfony/translation/IdentityTranslator.php b/vendor/symfony/translation/IdentityTranslator.php index 31abdaab12..b15792a9b5 100644 --- a/vendor/symfony/translation/IdentityTranslator.php +++ b/vendor/symfony/translation/IdentityTranslator.php @@ -34,7 +34,7 @@ class IdentityTranslator implements LegacyTranslatorInterface, TranslatorInterfa $this->selector = $selector; if (__CLASS__ !== \get_class($this)) { - @trigger_error(sprintf('Calling "%s()" is deprecated since Symfony 4.2.'), E_USER_DEPRECATED); + @trigger_error(sprintf('Calling "%s()" is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); } } @@ -43,15 +43,15 @@ class IdentityTranslator implements LegacyTranslatorInterface, TranslatorInterfa * * @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) + public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%count%" parameter.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), E_USER_DEPRECATED); if ($this->selector) { return strtr($this->selector->choose((string) $id, $number, $locale ?: $this->getLocale()), $parameters); } - return $this->trans($id, array('%count%' => $number) + $parameters, $domain, $locale); + return $this->trans($id, ['%count%' => $number] + $parameters, $domain, $locale); } private function getPluralizationRule(int $number, string $locale): int diff --git a/vendor/symfony/translation/Loader/ArrayLoader.php b/vendor/symfony/translation/Loader/ArrayLoader.php index 7bbfca68a4..0a6f9f089d 100644 --- a/vendor/symfony/translation/Loader/ArrayLoader.php +++ b/vendor/symfony/translation/Loader/ArrayLoader.php @@ -36,7 +36,7 @@ class ArrayLoader implements LoaderInterface * Flattens an nested array of translations. * * The scheme used is: - * 'key' => array('key2' => array('key3' => 'value')) + * 'key' => ['key2' => ['key3' => 'value']] * Becomes: * 'key.key2.key3' => 'value' * diff --git a/vendor/symfony/translation/Loader/CsvFileLoader.php b/vendor/symfony/translation/Loader/CsvFileLoader.php index 8a763e725d..18cc83ed68 100644 --- a/vendor/symfony/translation/Loader/CsvFileLoader.php +++ b/vendor/symfony/translation/Loader/CsvFileLoader.php @@ -29,7 +29,7 @@ class CsvFileLoader extends FileLoader */ protected function loadResource($resource) { - $messages = array(); + $messages = []; try { $file = new \SplFileObject($resource, 'rb'); diff --git a/vendor/symfony/translation/Loader/FileLoader.php b/vendor/symfony/translation/Loader/FileLoader.php index 9a02f52506..7ec54a3c87 100644 --- a/vendor/symfony/translation/Loader/FileLoader.php +++ b/vendor/symfony/translation/Loader/FileLoader.php @@ -37,7 +37,7 @@ abstract class FileLoader extends ArrayLoader // empty resource if (null === $messages) { - $messages = array(); + $messages = []; } // not an array diff --git a/vendor/symfony/translation/Loader/IcuResFileLoader.php b/vendor/symfony/translation/Loader/IcuResFileLoader.php index 28ace29775..005f26084d 100644 --- a/vendor/symfony/translation/Loader/IcuResFileLoader.php +++ b/vendor/symfony/translation/Loader/IcuResFileLoader.php @@ -75,7 +75,7 @@ class IcuResFileLoader implements LoaderInterface * * @return array the flattened ResourceBundle */ - protected function flatten(\ResourceBundle $rb, array &$messages = array(), $path = null) + protected function flatten(\ResourceBundle $rb, array &$messages = [], $path = null) { foreach ($rb as $key => $value) { $nodePath = $path ? $path.'.'.$key : $key; diff --git a/vendor/symfony/translation/Loader/JsonFileLoader.php b/vendor/symfony/translation/Loader/JsonFileLoader.php index ce4e91ff4f..526721277d 100644 --- a/vendor/symfony/translation/Loader/JsonFileLoader.php +++ b/vendor/symfony/translation/Loader/JsonFileLoader.php @@ -25,7 +25,7 @@ class JsonFileLoader extends FileLoader */ protected function loadResource($resource) { - $messages = array(); + $messages = []; if ($data = file_get_contents($resource)) { $messages = json_decode($data, true); diff --git a/vendor/symfony/translation/Loader/MoFileLoader.php b/vendor/symfony/translation/Loader/MoFileLoader.php index a1d7c4aef5..16a3dfc618 100644 --- a/vendor/symfony/translation/Loader/MoFileLoader.php +++ b/vendor/symfony/translation/Loader/MoFileLoader.php @@ -71,7 +71,7 @@ class MoFileLoader extends FileLoader // offsetHashes $this->readLong($stream, $isBigEndian); - $messages = array(); + $messages = []; for ($i = 0; $i < $count; ++$i) { $pluralId = null; @@ -108,13 +108,13 @@ class MoFileLoader extends FileLoader $translated = explode("\000", $translated); } - $ids = array('singular' => $singularId, 'plural' => $pluralId); + $ids = ['singular' => $singularId, 'plural' => $pluralId]; $item = compact('ids', 'translated'); if (\is_array($item['translated'])) { $messages[$item['ids']['singular']] = stripcslashes($item['translated'][0]); if (isset($item['ids']['plural'])) { - $plurals = array(); + $plurals = []; foreach ($item['translated'] as $plural => $translated) { $plurals[] = sprintf('{%d} %s', $plural, $translated); } diff --git a/vendor/symfony/translation/Loader/PoFileLoader.php b/vendor/symfony/translation/Loader/PoFileLoader.php index 066168dc71..1412a786a7 100644 --- a/vendor/symfony/translation/Loader/PoFileLoader.php +++ b/vendor/symfony/translation/Loader/PoFileLoader.php @@ -64,14 +64,14 @@ class PoFileLoader extends FileLoader { $stream = fopen($resource, 'r'); - $defaults = array( - 'ids' => array(), + $defaults = [ + 'ids' => [], 'translated' => null, - ); + ]; - $messages = array(); + $messages = []; $item = $defaults; - $flags = array(); + $flags = []; while ($line = fgets($stream)) { $line = trim($line); @@ -82,7 +82,7 @@ class PoFileLoader extends FileLoader $this->addMessage($messages, $item); } $item = $defaults; - $flags = array(); + $flags = []; } elseif ('#,' === substr($line, 0, 2)) { $flags = array_map('trim', explode(',', substr($line, 2))); } elseif ('msgid "' === substr($line, 0, 7)) { diff --git a/vendor/symfony/translation/Loader/XliffFileLoader.php b/vendor/symfony/translation/Loader/XliffFileLoader.php index 1106ec65f0..99306b86b1 100644 --- a/vendor/symfony/translation/Loader/XliffFileLoader.php +++ b/vendor/symfony/translation/Loader/XliffFileLoader.php @@ -97,13 +97,13 @@ class XliffFileLoader implements LoaderInterface $catalogue->set((string) $source, $target, $domain); - $metadata = array(); + $metadata = []; if ($notes = $this->parseNotesMetadata($translation->note, $encoding)) { $metadata['notes'] = $notes; } if (isset($translation->target) && $translation->target->attributes()) { - $metadata['target-attributes'] = array(); + $metadata['target-attributes'] = []; foreach ($translation->target->attributes() as $key => $value) { $metadata['target-attributes'][$key] = (string) $value; } @@ -134,18 +134,18 @@ class XliffFileLoader implements LoaderInterface $catalogue->set((string) $source, $target, $domain); - $metadata = array(); + $metadata = []; if (isset($segment->target) && $segment->target->attributes()) { - $metadata['target-attributes'] = array(); + $metadata['target-attributes'] = []; foreach ($segment->target->attributes() as $key => $value) { $metadata['target-attributes'][$key] = (string) $value; } } if (isset($unit->notes)) { - $metadata['notes'] = array(); + $metadata['notes'] = []; foreach ($unit->notes->note as $noteNode) { - $note = array(); + $note = []; foreach ($noteNode->attributes() as $key => $value) { $note[$key] = (string) $value; } @@ -173,7 +173,7 @@ class XliffFileLoader implements LoaderInterface private function parseNotesMetadata(\SimpleXMLElement $noteElement = null, string $encoding = null): array { - $notes = array(); + $notes = []; if (null === $noteElement) { return $notes; @@ -182,7 +182,7 @@ class XliffFileLoader implements LoaderInterface /** @var \SimpleXMLElement $xmlNote */ foreach ($noteElement as $xmlNote) { $noteAttributes = $xmlNote->attributes(); - $note = array('content' => $this->utf8ToCharset((string) $xmlNote, $encoding)); + $note = ['content' => $this->utf8ToCharset((string) $xmlNote, $encoding)]; if (isset($noteAttributes['priority'])) { $note['priority'] = (int) $noteAttributes['priority']; } diff --git a/vendor/symfony/translation/LoggingTranslator.php b/vendor/symfony/translation/LoggingTranslator.php index 4fe756d7a7..d6b711d27e 100644 --- a/vendor/symfony/translation/LoggingTranslator.php +++ b/vendor/symfony/translation/LoggingTranslator.php @@ -49,7 +49,7 @@ class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterfac /** * {@inheritdoc} */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) + public function trans($id, array $parameters = [], $domain = null, $locale = null) { $trans = $this->translator->trans($id, $parameters, $domain, $locale); $this->log($id, $domain, $locale); @@ -62,12 +62,12 @@ class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterfac * * @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) + public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%count%" parameter.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), E_USER_DEPRECATED); if ($this->translator instanceof TranslatorInterface) { - $trans = $this->translator->trans($id, array('%count%' => $number) + $parameters, $domain, $locale); + $trans = $this->translator->trans($id, ['%count%' => $number] + $parameters, $domain, $locale); } else { $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale); } @@ -112,7 +112,7 @@ class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterfac return $this->translator->getFallbackLocales(); } - return array(); + return []; } /** @@ -143,9 +143,9 @@ class LoggingTranslator implements TranslatorInterface, LegacyTranslatorInterfac } if ($catalogue->has($id, $domain)) { - $this->logger->debug('Translation use fallback catalogue.', array('id' => $id, 'domain' => $domain, 'locale' => $catalogue->getLocale())); + $this->logger->debug('Translation use fallback catalogue.', ['id' => $id, 'domain' => $domain, 'locale' => $catalogue->getLocale()]); } else { - $this->logger->warning('Translation not found.', array('id' => $id, 'domain' => $domain, 'locale' => $catalogue->getLocale())); + $this->logger->warning('Translation not found.', ['id' => $id, 'domain' => $domain, 'locale' => $catalogue->getLocale()]); } } } diff --git a/vendor/symfony/translation/MessageCatalogue.php b/vendor/symfony/translation/MessageCatalogue.php index 7a7657c0a4..19afb903f7 100644 --- a/vendor/symfony/translation/MessageCatalogue.php +++ b/vendor/symfony/translation/MessageCatalogue.php @@ -19,9 +19,9 @@ use Symfony\Component\Translation\Exception\LogicException; */ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterface { - private $messages = array(); - private $metadata = array(); - private $resources = array(); + private $messages = []; + private $metadata = []; + private $resources = []; private $locale; private $fallbackCatalogue; private $parent; @@ -30,7 +30,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf * @param string $locale The locale * @param array $messages An array of messages classified by domain */ - public function __construct(?string $locale, array $messages = array()) + public function __construct(?string $locale, array $messages = []) { $this->locale = $locale; $this->messages = $messages; @@ -49,7 +49,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf */ public function getDomains() { - $domains = array(); + $domains = []; $suffixLength = \strlen(self::INTL_DOMAIN_SUFFIX); foreach ($this->messages as $domain => $messages) { @@ -68,18 +68,18 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf public function all($domain = null) { if (null !== $domain) { - return ($this->messages[$domain.self::INTL_DOMAIN_SUFFIX] ?? array()) + ($this->messages[$domain] ?? array()); + return ($this->messages[$domain.self::INTL_DOMAIN_SUFFIX] ?? []) + ($this->messages[$domain] ?? []); } - $allMessages = array(); + $allMessages = []; $suffixLength = \strlen(self::INTL_DOMAIN_SUFFIX); foreach ($this->messages as $domain => $messages) { if (\strlen($domain) > $suffixLength && false !== $i = strpos($domain, self::INTL_DOMAIN_SUFFIX, -$suffixLength)) { $domain = substr($domain, 0, $i); - $allMessages[$domain] = $messages + ($allMessages[$domain] ?? array()); + $allMessages[$domain] = $messages + ($allMessages[$domain] ?? []); } else { - $allMessages[$domain] = ($allMessages[$domain] ?? array()) + $messages; + $allMessages[$domain] = ($allMessages[$domain] ?? []) + $messages; } } @@ -91,7 +91,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf */ public function set($id, $translation, $domain = 'messages') { - $this->add(array($id => $translation), $domain); + $this->add([$id => $translation], $domain); } /** @@ -277,7 +277,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf public function deleteMetadata($key = '', $domain = 'messages') { if ('' == $domain) { - $this->metadata = array(); + $this->metadata = []; } elseif ('' == $key) { unset($this->metadata[$domain]); } else { diff --git a/vendor/symfony/translation/MessageSelector.php b/vendor/symfony/translation/MessageSelector.php index 06639417b6..0f0febb8b2 100644 --- a/vendor/symfony/translation/MessageSelector.php +++ b/vendor/symfony/translation/MessageSelector.php @@ -53,15 +53,15 @@ class MessageSelector */ public function choose($message, $number, $locale) { - $parts = array(); + $parts = []; if (preg_match('/^\|++$/', $message)) { $parts = explode('|', $message); } elseif (preg_match_all('/(?:\|\||[^\|])++/', $message, $matches)) { $parts = $matches[0]; } - $explicitRules = array(); - $standardRules = array(); + $explicitRules = []; + $standardRules = []; foreach ($parts as $part) { $part = trim(str_replace('||', '|', $part)); diff --git a/vendor/symfony/translation/PluralizationRules.php b/vendor/symfony/translation/PluralizationRules.php index efbfd7f225..ee8609fada 100644 --- a/vendor/symfony/translation/PluralizationRules.php +++ b/vendor/symfony/translation/PluralizationRules.php @@ -20,7 +20,7 @@ namespace Symfony\Component\Translation; */ class PluralizationRules { - private static $rules = array(); + private static $rules = []; /** * Returns the plural position to use for the given locale and number. diff --git a/vendor/symfony/translation/Reader/TranslationReader.php b/vendor/symfony/translation/Reader/TranslationReader.php index 948edec492..e4554f39b4 100644 --- a/vendor/symfony/translation/Reader/TranslationReader.php +++ b/vendor/symfony/translation/Reader/TranslationReader.php @@ -27,7 +27,7 @@ class TranslationReader implements TranslationReaderInterface * * @var array */ - private $loaders = array(); + private $loaders = []; /** * Adds a loader to the translation extractor. diff --git a/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php b/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php index 90cf4a5dc3..e39ef39ec5 100644 --- a/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php +++ b/vendor/symfony/translation/Tests/Catalogue/AbstractOperationTest.php @@ -20,7 +20,7 @@ abstract class AbstractOperationTest extends TestCase public function testGetEmptyDomains() { $this->assertEquals( - array(), + [], $this->createOperation( new MessageCatalogue('en'), new MessageCatalogue('en') @@ -31,10 +31,10 @@ abstract class AbstractOperationTest extends TestCase public function testGetMergedDomains() { $this->assertEquals( - array('a', 'b', 'c'), + ['a', 'b', 'c'], $this->createOperation( - new MessageCatalogue('en', array('a' => array(), 'b' => array())), - new MessageCatalogue('en', array('b' => array(), 'c' => array())) + new MessageCatalogue('en', ['a' => [], 'b' => []]), + new MessageCatalogue('en', ['b' => [], 'c' => []]) )->getDomains() ); } @@ -51,9 +51,9 @@ abstract class AbstractOperationTest extends TestCase public function testGetEmptyMessages() { $this->assertEquals( - array(), + [], $this->createOperation( - new MessageCatalogue('en', array('a' => array())), + new MessageCatalogue('en', ['a' => []]), new MessageCatalogue('en') )->getMessages('a') ); diff --git a/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php b/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php index 9a68847882..22af86e906 100644 --- a/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php +++ b/vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php @@ -20,22 +20,22 @@ class MergeOperationTest extends AbstractOperationTest public function testGetMessagesFromSingleDomain() { $operation = $this->createOperation( - new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))), - new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c'))) + new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]), + new MessageCatalogue('en', ['messages' => ['a' => 'new_a', 'c' => 'new_c']]) ); $this->assertEquals( - array('a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'), + ['a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'], $operation->getMessages('messages') ); $this->assertEquals( - array('c' => 'new_c'), + ['c' => 'new_c'], $operation->getNewMessages('messages') ); $this->assertEquals( - array(), + [], $operation->getObsoleteMessages('messages') ); } @@ -43,12 +43,12 @@ class MergeOperationTest extends AbstractOperationTest public function testGetResultFromSingleDomain() { $this->assertEquals( - new MessageCatalogue('en', array( - 'messages' => array('a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'), - )), + new MessageCatalogue('en', [ + 'messages' => ['a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'], + ]), $this->createOperation( - new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))), - new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c'))) + new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]), + new MessageCatalogue('en', ['messages' => ['a' => 'new_a', 'c' => 'new_c']]) )->getResult() ); } @@ -56,27 +56,27 @@ class MergeOperationTest extends AbstractOperationTest public function testGetResultFromIntlDomain() { $this->assertEquals( - new MessageCatalogue('en', array( - 'messages' => array('a' => 'old_a', 'b' => 'old_b'), - 'messages+intl-icu' => array('d' => 'old_d', 'c' => 'new_c'), - )), + new MessageCatalogue('en', [ + 'messages' => ['a' => 'old_a', 'b' => 'old_b'], + 'messages+intl-icu' => ['d' => 'old_d', 'c' => 'new_c'], + ]), $this->createOperation( - new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'), 'messages+intl-icu' => array('d' => 'old_d'))), - new MessageCatalogue('en', array('messages+intl-icu' => array('a' => 'new_a', 'c' => 'new_c'))) + new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b'], 'messages+intl-icu' => ['d' => 'old_d']]), + new MessageCatalogue('en', ['messages+intl-icu' => ['a' => 'new_a', 'c' => 'new_c']]) )->getResult() ); } public function testGetResultWithMetadata() { - $leftCatalogue = new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))); + $leftCatalogue = new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]); $leftCatalogue->setMetadata('a', 'foo', 'messages'); $leftCatalogue->setMetadata('b', 'bar', 'messages'); - $rightCatalogue = new MessageCatalogue('en', array('messages' => array('b' => 'new_b', 'c' => 'new_c'))); + $rightCatalogue = new MessageCatalogue('en', ['messages' => ['b' => 'new_b', 'c' => 'new_c']]); $rightCatalogue->setMetadata('b', 'baz', 'messages'); $rightCatalogue->setMetadata('c', 'qux', 'messages'); - $mergedCatalogue = new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'))); + $mergedCatalogue = new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c']]); $mergedCatalogue->setMetadata('a', 'foo', 'messages'); $mergedCatalogue->setMetadata('b', 'bar', 'messages'); $mergedCatalogue->setMetadata('c', 'qux', 'messages'); diff --git a/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php b/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php index 83b0550d45..570b503aea 100644 --- a/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php +++ b/vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php @@ -20,22 +20,22 @@ class TargetOperationTest extends AbstractOperationTest public function testGetMessagesFromSingleDomain() { $operation = $this->createOperation( - new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))), - new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c'))) + new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]), + new MessageCatalogue('en', ['messages' => ['a' => 'new_a', 'c' => 'new_c']]) ); $this->assertEquals( - array('a' => 'old_a', 'c' => 'new_c'), + ['a' => 'old_a', 'c' => 'new_c'], $operation->getMessages('messages') ); $this->assertEquals( - array('c' => 'new_c'), + ['c' => 'new_c'], $operation->getNewMessages('messages') ); $this->assertEquals( - array('b' => 'old_b'), + ['b' => 'old_b'], $operation->getObsoleteMessages('messages') ); } @@ -43,12 +43,12 @@ class TargetOperationTest extends AbstractOperationTest public function testGetResultFromSingleDomain() { $this->assertEquals( - new MessageCatalogue('en', array( - 'messages' => array('a' => 'old_a', 'c' => 'new_c'), - )), + new MessageCatalogue('en', [ + 'messages' => ['a' => 'old_a', 'c' => 'new_c'], + ]), $this->createOperation( - new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))), - new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c'))) + new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]), + new MessageCatalogue('en', ['messages' => ['a' => 'new_a', 'c' => 'new_c']]) )->getResult() ); } @@ -56,27 +56,27 @@ class TargetOperationTest extends AbstractOperationTest public function testGetResultFromIntlDomain() { $this->assertEquals( - new MessageCatalogue('en', array( - 'messages' => array('a' => 'old_a'), - 'messages+intl-icu' => array('c' => 'new_c'), - )), + new MessageCatalogue('en', [ + 'messages' => ['a' => 'old_a'], + 'messages+intl-icu' => ['c' => 'new_c'], + ]), $this->createOperation( - new MessageCatalogue('en', array('messages' => array('a' => 'old_a'), 'messages+intl-icu' => array('b' => 'old_b'))), - new MessageCatalogue('en', array('messages' => array('a' => 'new_a'), 'messages+intl-icu' => array('c' => 'new_c'))) + new MessageCatalogue('en', ['messages' => ['a' => 'old_a'], 'messages+intl-icu' => ['b' => 'old_b']]), + new MessageCatalogue('en', ['messages' => ['a' => 'new_a'], 'messages+intl-icu' => ['c' => 'new_c']]) )->getResult() ); } public function testGetResultWithMetadata() { - $leftCatalogue = new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))); + $leftCatalogue = new MessageCatalogue('en', ['messages' => ['a' => 'old_a', 'b' => 'old_b']]); $leftCatalogue->setMetadata('a', 'foo', 'messages'); $leftCatalogue->setMetadata('b', 'bar', 'messages'); - $rightCatalogue = new MessageCatalogue('en', array('messages' => array('b' => 'new_b', 'c' => 'new_c'))); + $rightCatalogue = new MessageCatalogue('en', ['messages' => ['b' => 'new_b', 'c' => 'new_c']]); $rightCatalogue->setMetadata('b', 'baz', 'messages'); $rightCatalogue->setMetadata('c', 'qux', 'messages'); - $diffCatalogue = new MessageCatalogue('en', array('messages' => array('b' => 'old_b', 'c' => 'new_c'))); + $diffCatalogue = new MessageCatalogue('en', ['messages' => ['b' => 'old_b', 'c' => 'new_c']]); $diffCatalogue->setMetadata('b', 'bar', 'messages'); $diffCatalogue->setMetadata('c', 'qux', 'messages'); diff --git a/vendor/symfony/translation/Tests/Command/XliffLintCommandTest.php b/vendor/symfony/translation/Tests/Command/XliffLintCommandTest.php index 758ac981ac..516d98af53 100644 --- a/vendor/symfony/translation/Tests/Command/XliffLintCommandTest.php +++ b/vendor/symfony/translation/Tests/Command/XliffLintCommandTest.php @@ -32,8 +32,8 @@ class XliffLintCommandTest extends TestCase $filename = $this->createFile(); $tester->execute( - array('filename' => $filename), - array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false) + ['filename' => $filename], + ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false] ); $this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success'); @@ -47,8 +47,8 @@ class XliffLintCommandTest extends TestCase $filename2 = $this->createFile(); $tester->execute( - array('filename' => array($filename1, $filename2)), - array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false) + ['filename' => [$filename1, $filename2]], + ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false] ); $this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success'); @@ -64,8 +64,8 @@ class XliffLintCommandTest extends TestCase $filename = $this->createFile('note', $targetLanguage, $fileNamePattern); $tester->execute( - array('filename' => $filename), - array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false) + ['filename' => $filename], + ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false] ); $this->assertEquals($mustFail ? 1 : 0, $tester->getStatusCode()); @@ -77,7 +77,7 @@ class XliffLintCommandTest extends TestCase $tester = $this->createCommandTester(); $filename = $this->createFile('note <target>'); - $tester->execute(array('filename' => $filename), array('decorated' => false)); + $tester->execute(['filename' => $filename], ['decorated' => false]); $this->assertEquals(1, $tester->getStatusCode(), 'Returns 1 in case of error'); $this->assertContains('Opening and ending tag mismatch: target line 6 and source', trim($tester->getDisplay())); @@ -88,7 +88,7 @@ class XliffLintCommandTest extends TestCase $tester = $this->createCommandTester(); $filename = $this->createFile('note', 'es'); - $tester->execute(array('filename' => $filename), array('decorated' => false)); + $tester->execute(['filename' => $filename], ['decorated' => false]); $this->assertEquals(1, $tester->getStatusCode(), 'Returns 1 in case of error'); $this->assertContains('There is a mismatch between the language included in the file name ("messages.en.xlf") and the "es" value used in the "target-language" attribute of the file.', trim($tester->getDisplay())); @@ -103,7 +103,7 @@ class XliffLintCommandTest extends TestCase $filename = $this->createFile(); unlink($filename); - $tester->execute(array('filename' => $filename), array('decorated' => false)); + $tester->execute(['filename' => $filename], ['decorated' => false]); } public function testGetHelp() @@ -179,7 +179,7 @@ XLIFF; protected function setUp() { - $this->files = array(); + $this->files = []; @mkdir(sys_get_temp_dir().'/translation-xliff-lint-test'); } @@ -195,13 +195,13 @@ XLIFF; public function provideStrictFilenames() { - yield array(false, 'messages.%locale%.xlf', 'en', false); - yield array(false, 'messages.%locale%.xlf', 'es', true); - yield array(false, '%locale%.messages.xlf', 'en', false); - yield array(false, '%locale%.messages.xlf', 'es', true); - yield array(true, 'messages.%locale%.xlf', 'en', false); - yield array(true, 'messages.%locale%.xlf', 'es', true); - yield array(true, '%locale%.messages.xlf', 'en', true); - yield array(true, '%locale%.messages.xlf', 'es', true); + yield [false, 'messages.%locale%.xlf', 'en', false]; + yield [false, 'messages.%locale%.xlf', 'es', true]; + yield [false, '%locale%.messages.xlf', 'en', false]; + yield [false, '%locale%.messages.xlf', 'es', true]; + yield [true, 'messages.%locale%.xlf', 'en', false]; + yield [true, 'messages.%locale%.xlf', 'es', true]; + yield [true, '%locale%.messages.xlf', 'en', true]; + yield [true, '%locale%.messages.xlf', 'es', true]; } } diff --git a/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php b/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php index 6665eca499..b4d350ef86 100644 --- a/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php +++ b/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php @@ -27,7 +27,7 @@ class TranslationDataCollectorTest extends TestCase public function testCollectEmptyMessages() { $translator = $this->getTranslator(); - $translator->expects($this->any())->method('getCollectedMessages')->will($this->returnValue(array())); + $translator->expects($this->any())->method('getCollectedMessages')->will($this->returnValue([])); $dataCollector = new TranslationDataCollector($translator); $dataCollector->lateCollect(); @@ -35,94 +35,94 @@ class TranslationDataCollectorTest extends TestCase $this->assertEquals(0, $dataCollector->getCountMissings()); $this->assertEquals(0, $dataCollector->getCountFallbacks()); $this->assertEquals(0, $dataCollector->getCountDefines()); - $this->assertEquals(array(), $dataCollector->getMessages()->getValue()); + $this->assertEquals([], $dataCollector->getMessages()->getValue()); } public function testCollect() { - $collectedMessages = array( - array( + $collectedMessages = [ + [ 'id' => 'foo', 'translation' => 'foo (en)', 'locale' => 'en', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'parameters' => array(), + 'parameters' => [], 'transChoiceNumber' => null, - ), - array( + ], + [ 'id' => 'bar', 'translation' => 'bar (fr)', 'locale' => 'fr', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array(), + 'parameters' => [], 'transChoiceNumber' => null, - ), - array( + ], + [ 'id' => 'choice', 'translation' => 'choice', 'locale' => 'en', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 3), + 'parameters' => ['%count%' => 3], 'transChoiceNumber' => 3, - ), - array( + ], + [ 'id' => 'choice', 'translation' => 'choice', 'locale' => 'en', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 3), + 'parameters' => ['%count%' => 3], 'transChoiceNumber' => 3, - ), - array( + ], + [ 'id' => 'choice', 'translation' => 'choice', 'locale' => 'en', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 4, '%foo%' => 'bar'), + 'parameters' => ['%count%' => 4, '%foo%' => 'bar'], 'transChoiceNumber' => 4, - ), - ); - $expectedMessages = array( - array( + ], + ]; + $expectedMessages = [ + [ 'id' => 'foo', 'translation' => 'foo (en)', 'locale' => 'en', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_DEFINED, 'count' => 1, - 'parameters' => array(), + 'parameters' => [], 'transChoiceNumber' => null, - ), - array( + ], + [ 'id' => 'bar', 'translation' => 'bar (fr)', 'locale' => 'fr', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, 'count' => 1, - 'parameters' => array(), + 'parameters' => [], 'transChoiceNumber' => null, - ), - array( + ], + [ 'id' => 'choice', 'translation' => 'choice', 'locale' => 'en', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_MISSING, 'count' => 3, - 'parameters' => array( - array('%count%' => 3), - array('%count%' => 3), - array('%count%' => 4, '%foo%' => 'bar'), - ), + 'parameters' => [ + ['%count%' => 3], + ['%count%' => 3], + ['%count%' => 4, '%foo%' => 'bar'], + ], 'transChoiceNumber' => 3, - ), - ); + ], + ]; $translator = $this->getTranslator(); $translator->expects($this->any())->method('getCollectedMessages')->will($this->returnValue($collectedMessages)); diff --git a/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php b/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php index 19e056c12e..138172e21d 100644 --- a/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php +++ b/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php @@ -21,60 +21,60 @@ class DataCollectorTranslatorTest extends TestCase public function testCollectMessages() { $collector = $this->createCollector(); - $collector->setFallbackLocales(array('fr', 'ru')); + $collector->setFallbackLocales(['fr', 'ru']); $collector->trans('foo'); $collector->trans('bar'); - $collector->trans('choice', array('%count%' => 0)); + $collector->trans('choice', ['%count%' => 0]); $collector->trans('bar_ru'); - $collector->trans('bar_ru', array('foo' => 'bar')); + $collector->trans('bar_ru', ['foo' => 'bar']); - $expectedMessages = array(); - $expectedMessages[] = array( + $expectedMessages = []; + $expectedMessages[] = [ 'id' => 'foo', 'translation' => 'foo (en)', 'locale' => 'en', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'parameters' => array(), + 'parameters' => [], 'transChoiceNumber' => null, - ); - $expectedMessages[] = array( + ]; + $expectedMessages[] = [ 'id' => 'bar', 'translation' => 'bar (fr)', 'locale' => 'fr', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array(), + 'parameters' => [], 'transChoiceNumber' => null, - ); - $expectedMessages[] = array( + ]; + $expectedMessages[] = [ 'id' => 'choice', 'translation' => 'choice', 'locale' => 'en', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 0), + 'parameters' => ['%count%' => 0], 'transChoiceNumber' => 0, - ); - $expectedMessages[] = array( + ]; + $expectedMessages[] = [ 'id' => 'bar_ru', 'translation' => 'bar (ru)', 'locale' => 'ru', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array(), + 'parameters' => [], 'transChoiceNumber' => null, - ); - $expectedMessages[] = array( + ]; + $expectedMessages[] = [ 'id' => 'bar_ru', 'translation' => 'bar (ru)', 'locale' => 'ru', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array('foo' => 'bar'), + 'parameters' => ['foo' => 'bar'], 'transChoiceNumber' => null, - ); + ]; $this->assertEquals($expectedMessages, $collector->getCollectedMessages()); } @@ -85,20 +85,20 @@ class DataCollectorTranslatorTest extends TestCase public function testCollectMessagesTransChoice() { $collector = $this->createCollector(); - $collector->setFallbackLocales(array('fr', 'ru')); + $collector->setFallbackLocales(['fr', 'ru']); $collector->transChoice('choice', 0); - $expectedMessages = array(); + $expectedMessages = []; - $expectedMessages[] = array( + $expectedMessages[] = [ 'id' => 'choice', 'translation' => 'choice', 'locale' => 'en', 'domain' => 'messages', 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 0), + 'parameters' => ['%count%' => 0], 'transChoiceNumber' => 0, - ); + ]; $this->assertEquals($expectedMessages, $collector->getCollectedMessages()); } @@ -107,9 +107,9 @@ class DataCollectorTranslatorTest extends TestCase { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (en)'), 'en'); - $translator->addResource('array', array('bar' => 'bar (fr)'), 'fr'); - $translator->addResource('array', array('bar_ru' => 'bar (ru)'), 'ru'); + $translator->addResource('array', ['foo' => 'foo (en)'], 'en'); + $translator->addResource('array', ['bar' => 'bar (fr)'], 'fr'); + $translator->addResource('array', ['bar_ru' => 'bar (ru)'], 'ru'); return new DataCollectorTranslator($translator); } diff --git a/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php b/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php index 759bb0e97d..94769e9dae 100644 --- a/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php +++ b/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php @@ -23,12 +23,12 @@ class TranslationDumperPassTest extends TestCase $container = new ContainerBuilder(); $writerDefinition = $container->register('translation.writer'); $container->register('foo.id') - ->addTag('translation.dumper', array('alias' => 'bar.alias')); + ->addTag('translation.dumper', ['alias' => 'bar.alias']); $translationDumperPass = new TranslationDumperPass(); $translationDumperPass->process($container); - $this->assertEquals(array(array('addDumper', array('bar.alias', new Reference('foo.id')))), $writerDefinition->getMethodCalls()); + $this->assertEquals([['addDumper', ['bar.alias', new Reference('foo.id')]]], $writerDefinition->getMethodCalls()); } public function testProcessNoDefinitionFound() diff --git a/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php b/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php index 14d164d0ee..a638498b6b 100644 --- a/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php +++ b/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php @@ -23,12 +23,12 @@ class TranslationExtractorPassTest extends TestCase $container = new ContainerBuilder(); $extractorDefinition = $container->register('translation.extractor'); $container->register('foo.id') - ->addTag('translation.extractor', array('alias' => 'bar.alias')); + ->addTag('translation.extractor', ['alias' => 'bar.alias']); $translationDumperPass = new TranslationExtractorPass(); $translationDumperPass->process($container); - $this->assertEquals(array(array('addExtractor', array('bar.alias', new Reference('foo.id')))), $extractorDefinition->getMethodCalls()); + $this->assertEquals([['addExtractor', ['bar.alias', new Reference('foo.id')]]], $extractorDefinition->getMethodCalls()); } public function testProcessNoDefinitionFound() @@ -56,7 +56,7 @@ class TranslationExtractorPassTest extends TestCase $container = new ContainerBuilder(); $container->register('translation.extractor'); $container->register('foo.id') - ->addTag('translation.extractor', array()); + ->addTag('translation.extractor', []); $definition->expects($this->never())->method('addMethodCall'); diff --git a/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php b/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php index 4082d169c4..8b9c03d991 100644 --- a/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php +++ b/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php @@ -23,12 +23,12 @@ class TranslationPassTest extends TestCase public function testValidCollector() { $loader = (new Definition()) - ->addTag('translation.loader', array('alias' => 'xliff', 'legacy-alias' => 'xlf')); + ->addTag('translation.loader', ['alias' => 'xliff', 'legacy-alias' => 'xlf']); $reader = new Definition(); $translator = (new Definition()) - ->setArguments(array(null, null, null, null)); + ->setArguments([null, null, null, null]); $container = new ContainerBuilder(); $container->setDefinition('translator.default', $translator); @@ -39,19 +39,19 @@ class TranslationPassTest extends TestCase $pass->process($container); $expectedReader = (new Definition()) - ->addMethodCall('addLoader', array('xliff', new Reference('translation.xliff_loader'))) - ->addMethodCall('addLoader', array('xlf', new Reference('translation.xliff_loader'))) + ->addMethodCall('addLoader', ['xliff', new Reference('translation.xliff_loader')]) + ->addMethodCall('addLoader', ['xlf', new Reference('translation.xliff_loader')]) ; $this->assertEquals($expectedReader, $reader); $expectedLoader = (new Definition()) - ->addTag('translation.loader', array('alias' => 'xliff', 'legacy-alias' => 'xlf')) + ->addTag('translation.loader', ['alias' => 'xliff', 'legacy-alias' => 'xlf']) ; $this->assertEquals($expectedLoader, $loader); - $this->assertSame(array('translation.xliff_loader' => array('xliff', 'xlf')), $translator->getArgument(3)); + $this->assertSame(['translation.xliff_loader' => ['xliff', 'xlf']], $translator->getArgument(3)); - $expected = array('translation.xliff_loader' => new ServiceClosureArgument(new Reference('translation.xliff_loader'))); + $expected = ['translation.xliff_loader' => new ServiceClosureArgument(new Reference('translation.xliff_loader'))]; $this->assertEquals($expected, $container->getDefinition((string) $translator->getArgument(0))->getArgument(0)); } } diff --git a/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php index 9a7a059a4e..0d1cf2c628 100644 --- a/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php @@ -20,8 +20,8 @@ class CsvFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar', 'bar' => 'foo -foo', 'foo;foo' => 'bar')); + $catalogue->add(['foo' => 'bar', 'bar' => 'foo +foo', 'foo;foo' => 'bar']); $dumper = new CsvFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php index 908f22d748..20fa918bd6 100644 --- a/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php @@ -22,10 +22,10 @@ class FileDumperTest extends TestCase $tempDir = sys_get_temp_dir(); $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new ConcreteFileDumper(); - $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, ['path' => $tempDir]); $this->assertFileExists($tempDir.'/messages.en.concrete'); @@ -37,13 +37,13 @@ class FileDumperTest extends TestCase $tempDir = sys_get_temp_dir(); $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar'), 'd1'); - $catalogue->add(array('bar' => 'foo'), 'd1+intl-icu'); - $catalogue->add(array('bar' => 'foo'), 'd2+intl-icu'); + $catalogue->add(['foo' => 'bar'], 'd1'); + $catalogue->add(['bar' => 'foo'], 'd1+intl-icu'); + $catalogue->add(['bar' => 'foo'], 'd2+intl-icu'); $dumper = new ConcreteFileDumper(); @unlink($tempDir.'/d2.en.concrete'); - $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, ['path' => $tempDir]); $this->assertStringEqualsFile($tempDir.'/d1.en.concrete', 'foo=bar'); @unlink($tempDir.'/d1.en.concrete'); @@ -63,11 +63,11 @@ class FileDumperTest extends TestCase $file = $translationsDir.'/messages.en.concrete'; $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new ConcreteFileDumper(); $dumper->setRelativePathTemplate('test/translations/%domain%.%locale%.%extension%'); - $dumper->dump($catalogue, array('path' => $tempDir)); + $dumper->dump($catalogue, ['path' => $tempDir]); $this->assertFileExists($file); @@ -78,7 +78,7 @@ class FileDumperTest extends TestCase class ConcreteFileDumper extends FileDumper { - public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = []) { return http_build_query($messages->all($domain), '', '&'); } diff --git a/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php index 78d0abb6e4..dcb9c2c38f 100644 --- a/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php @@ -20,7 +20,7 @@ class IcuResFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new IcuResFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php index 5f3c1236c7..1ed168bdc3 100644 --- a/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php @@ -20,7 +20,7 @@ class IniFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new IniFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php index b134ce4f23..04e3d86bec 100644 --- a/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php @@ -20,7 +20,7 @@ class JsonFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new JsonFileDumper(); @@ -30,10 +30,10 @@ class JsonFileDumperTest extends TestCase public function testDumpWithCustomEncoding() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => '"bar"')); + $catalogue->add(['foo' => '"bar"']); $dumper = new JsonFileDumper(); - $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.dump.json', $dumper->formatCatalogue($catalogue, 'messages', array('json_encoding' => JSON_HEX_QUOT))); + $this->assertStringEqualsFile(__DIR__.'/../fixtures/resources.dump.json', $dumper->formatCatalogue($catalogue, 'messages', ['json_encoding' => JSON_HEX_QUOT])); } } diff --git a/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php index d0519675bc..fbbd75dc3b 100644 --- a/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php @@ -20,7 +20,7 @@ class MoFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new MoFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php index 22a39dd43d..00e535da39 100644 --- a/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php @@ -20,7 +20,7 @@ class PhpFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new PhpFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php index 5d75247103..d694a6dd3f 100644 --- a/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php @@ -20,7 +20,7 @@ class PoFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new PoFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php index 8e4a6f43fc..edfad6005c 100644 --- a/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php @@ -20,7 +20,7 @@ class QtFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar'), 'resources'); + $catalogue->add(['foo' => 'bar'], 'resources'); $dumper = new QtFileDumper(); diff --git a/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php index 443dccf2bc..c634a27936 100644 --- a/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php @@ -20,49 +20,49 @@ class XliffFileDumperTest extends TestCase public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array( + $catalogue->add([ 'foo' => 'bar', 'key' => '', 'key.with.cdata' => '<source> & <target>', - )); - $catalogue->setMetadata('foo', array('notes' => array(array('priority' => 1, 'from' => 'bar', 'content' => 'baz')))); - $catalogue->setMetadata('key', array('notes' => array(array('content' => 'baz'), array('content' => 'qux')))); + ]); + $catalogue->setMetadata('foo', ['notes' => [['priority' => 1, 'from' => 'bar', 'content' => 'baz']]]); + $catalogue->setMetadata('key', ['notes' => [['content' => 'baz'], ['content' => 'qux']]]); $dumper = new XliffFileDumper(); $this->assertStringEqualsFile( __DIR__.'/../fixtures/resources-clean.xlf', - $dumper->formatCatalogue($catalogue, 'messages', array('default_locale' => 'fr_FR')) + $dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR']) ); } public function testFormatCatalogueXliff2() { $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array( + $catalogue->add([ 'foo' => 'bar', 'key' => '', 'key.with.cdata' => '<source> & <target>', - )); - $catalogue->setMetadata('key', array('target-attributes' => array('order' => 1))); + ]); + $catalogue->setMetadata('key', ['target-attributes' => ['order' => 1]]); $dumper = new XliffFileDumper(); $this->assertStringEqualsFile( __DIR__.'/../fixtures/resources-2.0-clean.xlf', - $dumper->formatCatalogue($catalogue, 'messages', array('default_locale' => 'fr_FR', 'xliff_version' => '2.0')) + $dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR', 'xliff_version' => '2.0']) ); } public function testFormatCatalogueWithCustomToolInfo() { - $options = array( + $options = [ 'default_locale' => 'en_US', - 'tool_info' => array('tool-id' => 'foo', 'tool-name' => 'foo', 'tool-version' => '0.0', 'tool-company' => 'Foo'), - ); + 'tool_info' => ['tool-id' => 'foo', 'tool-name' => 'foo', 'tool-version' => '0.0', 'tool-company' => 'Foo'], + ]; $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array('foo' => 'bar')); + $catalogue->add(['foo' => 'bar']); $dumper = new XliffFileDumper(); @@ -75,41 +75,41 @@ class XliffFileDumperTest extends TestCase public function testFormatCatalogueWithTargetAttributesMetadata() { $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array( + $catalogue->add([ 'foo' => 'bar', - )); - $catalogue->setMetadata('foo', array('target-attributes' => array('state' => 'needs-translation'))); + ]); + $catalogue->setMetadata('foo', ['target-attributes' => ['state' => 'needs-translation']]); $dumper = new XliffFileDumper(); $this->assertStringEqualsFile( __DIR__.'/../fixtures/resources-target-attributes.xlf', - $dumper->formatCatalogue($catalogue, 'messages', array('default_locale' => 'fr_FR')) + $dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR']) ); } public function testFormatCatalogueWithNotesMetadata() { $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array( + $catalogue->add([ 'foo' => 'bar', 'baz' => 'biz', - )); - $catalogue->setMetadata('foo', array('notes' => array( - array('category' => 'state', 'content' => 'new'), - array('category' => 'approved', 'content' => 'true'), - array('category' => 'section', 'content' => 'user login', 'priority' => '1'), - ))); - $catalogue->setMetadata('baz', array('notes' => array( - array('id' => 'x', 'content' => 'x_content'), - array('appliesTo' => 'target', 'category' => 'quality', 'content' => 'Fuzzy'), - ))); + ]); + $catalogue->setMetadata('foo', ['notes' => [ + ['category' => 'state', 'content' => 'new'], + ['category' => 'approved', 'content' => 'true'], + ['category' => 'section', 'content' => 'user login', 'priority' => '1'], + ]]); + $catalogue->setMetadata('baz', ['notes' => [ + ['id' => 'x', 'content' => 'x_content'], + ['appliesTo' => 'target', 'category' => 'quality', 'content' => 'Fuzzy'], + ]]); $dumper = new XliffFileDumper(); $this->assertStringEqualsFile( __DIR__.'/../fixtures/resources-notes-meta.xlf', - $dumper->formatCatalogue($catalogue, 'messages', array('default_locale' => 'fr_FR', 'xliff_version' => '2.0')) + $dumper->formatCatalogue($catalogue, 'messages', ['default_locale' => 'fr_FR', 'xliff_version' => '2.0']) ); } } diff --git a/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php index a5549a2e93..24bc65ba24 100644 --- a/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php @@ -21,24 +21,24 @@ class YamlFileDumperTest extends TestCase { $catalogue = new MessageCatalogue('en'); $catalogue->add( - array( + [ 'foo.bar1' => 'value1', 'foo.bar2' => 'value2', - )); + ]); $dumper = new YamlFileDumper(); - $this->assertStringEqualsFile(__DIR__.'/../fixtures/messages.yml', $dumper->formatCatalogue($catalogue, 'messages', array('as_tree' => true, 'inline' => 999))); + $this->assertStringEqualsFile(__DIR__.'/../fixtures/messages.yml', $dumper->formatCatalogue($catalogue, 'messages', ['as_tree' => true, 'inline' => 999])); } public function testLinearFormatCatalogue() { $catalogue = new MessageCatalogue('en'); $catalogue->add( - array( + [ 'foo.bar1' => 'value1', 'foo.bar2' => 'value2', - )); + ]); $dumper = new YamlFileDumper(); diff --git a/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php b/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php index 3487dd6248..73ccb07cfb 100644 --- a/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php +++ b/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php @@ -39,8 +39,8 @@ EOF; nowdoc key with whitespace and nonescaped \$\n sequences EOF; // Assert - $expectedCatalogue = array( - 'messages' => array( + $expectedCatalogue = [ + 'messages' => [ 'single-quoted key' => 'prefixsingle-quoted key', 'double-quoted key' => 'prefixdouble-quoted key', 'heredoc key' => 'prefixheredoc key', @@ -51,8 +51,9 @@ EOF; $expectedHeredoc => 'prefix'.$expectedHeredoc, $expectedNowdoc => 'prefix'.$expectedNowdoc, '{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples' => 'prefix{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples', - ), - 'not_messages' => array( + 'concatenated message with heredoc and nowdoc' => 'prefixconcatenated message with heredoc and nowdoc', + ], + 'not_messages' => [ 'other-domain-test-no-params-short-array' => 'prefixother-domain-test-no-params-short-array', 'other-domain-test-no-params-long-array' => 'prefixother-domain-test-no-params-long-array', 'other-domain-test-params-short-array' => 'prefixother-domain-test-params-short-array', @@ -62,8 +63,8 @@ EOF; 'typecast' => 'prefixtypecast', 'msg1' => 'prefixmsg1', 'msg2' => 'prefixmsg2', - ), - ); + ], + ]; $actualCatalogue = $catalogue->all(); $this->assertEquals($expectedCatalogue, $actualCatalogue); @@ -72,7 +73,7 @@ EOF; public function resourcesProvider() { $directory = __DIR__.'/../fixtures/extractor/'; - $splFiles = array(); + $splFiles = []; foreach (new \DirectoryIterator($directory) as $fileInfo) { if ($fileInfo->isDot()) { continue; @@ -83,13 +84,13 @@ EOF; $splFiles[] = $fileInfo->getFileInfo(); } - return array( - array($directory), - array($phpFile), - array(glob($directory.'*')), - array($splFiles), - array(new \ArrayObject(glob($directory.'*'))), - array(new \ArrayObject($splFiles)), - ); + return [ + [$directory], + [$phpFile], + [glob($directory.'*')], + [$splFiles], + [new \ArrayObject(glob($directory.'*'))], + [new \ArrayObject($splFiles)], + ]; } } diff --git a/vendor/symfony/translation/Tests/Formatter/IntlFormatterTest.php b/vendor/symfony/translation/Tests/Formatter/IntlFormatterTest.php index 89eaa18f32..45ce6d4f6e 100644 --- a/vendor/symfony/translation/Tests/Formatter/IntlFormatterTest.php +++ b/vendor/symfony/translation/Tests/Formatter/IntlFormatterTest.php @@ -31,7 +31,7 @@ class IntlFormatterTest extends \PHPUnit\Framework\TestCase public function testInvalidFormat() { $this->expectException(InvalidArgumentException::class); - (new IntlFormatter())->formatIntl('{foo', 'en', array(2)); + (new IntlFormatter())->formatIntl('{foo', 'en', [2]); } public function testFormatWithNamedArguments() @@ -59,38 +59,38 @@ class IntlFormatterTest extends \PHPUnit\Framework\TestCase other {{host} invites {guest} as one of the # people invited to their party.}}}} _MSG_; - $message = (new IntlFormatter())->formatIntl($chooseMessage, 'en', array( + $message = (new IntlFormatter())->formatIntl($chooseMessage, 'en', [ 'gender_of_host' => 'male', 'num_guests' => 10, 'host' => 'Fabien', 'guest' => 'Guilherme', - )); + ]); $this->assertEquals('Fabien invites Guilherme as one of the 9 people invited to his party.', $message); } public function provideDataForFormat() { - return array( - array( + return [ + [ 'There is one apple', 'There is one apple', - array(), - ), - array( + [], + ], + [ '4,560 monkeys on 123 trees make 37.073 monkeys per tree', '{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree', - array(4560, 123, 4560 / 123), - ), - ); + [4560, 123, 4560 / 123], + ], + ]; } public function testPercentsAndBracketsAreTrimmed() { $formatter = new IntlFormatter(); $this->assertInstanceof(IntlFormatterInterface::class, $formatter); - $this->assertSame('Hello Fab', $formatter->formatIntl('Hello {name}', 'en', array('name' => 'Fab'))); - $this->assertSame('Hello Fab', $formatter->formatIntl('Hello {name}', 'en', array('%name%' => 'Fab'))); - $this->assertSame('Hello Fab', $formatter->formatIntl('Hello {name}', 'en', array('{{ name }}' => 'Fab'))); + $this->assertSame('Hello Fab', $formatter->formatIntl('Hello {name}', 'en', ['name' => 'Fab'])); + $this->assertSame('Hello Fab', $formatter->formatIntl('Hello {name}', 'en', ['%name%' => 'Fab'])); + $this->assertSame('Hello Fab', $formatter->formatIntl('Hello {name}', 'en', ['{{ name }}' => 'Fab'])); } } diff --git a/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php b/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php index f4c96aa12f..232bcf9043 100644 --- a/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php +++ b/vendor/symfony/translation/Tests/Formatter/MessageFormatterTest.php @@ -19,7 +19,7 @@ class MessageFormatterTest extends TestCase /** * @dataProvider getTransMessages */ - public function testFormat($expected, $message, $parameters = array()) + public function testFormat($expected, $message, $parameters = []) { $this->assertEquals($expected, $this->getMessageFormatter()->format($message, 'en', $parameters)); } @@ -35,45 +35,45 @@ class MessageFormatterTest extends TestCase public function getTransMessages() { - return array( - array( + return [ + [ 'There is one apple', 'There is one apple', - ), - array( + ], + [ 'There are 5 apples', 'There are %count% apples', - array('%count%' => 5), - ), - array( + ['%count%' => 5], + ], + [ 'There are 5 apples', 'There are {{count}} apples', - array('{{count}}' => 5), - ), - ); + ['{{count}}' => 5], + ], + ]; } public function getTransChoiceMessages() { - return array( - array('Il y a 0 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array('%count%' => 0)), - array('Il y a 1 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 1, array('%count%' => 1)), - array('Il y a 10 pommes', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 10, array('%count%' => 10)), + return [ + ['Il y a 0 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, ['%count%' => 0]], + ['Il y a 1 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 1, ['%count%' => 1]], + ['Il y a 10 pommes', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 10, ['%count%' => 10]], - array('Il y a 0 pomme', 'Il y a %count% pomme|Il y a %count% pommes', 0, array('%count%' => 0)), - array('Il y a 1 pomme', 'Il y a %count% pomme|Il y a %count% pommes', 1, array('%count%' => 1)), - array('Il y a 10 pommes', 'Il y a %count% pomme|Il y a %count% pommes', 10, array('%count%' => 10)), + ['Il y a 0 pomme', 'Il y a %count% pomme|Il y a %count% pommes', 0, ['%count%' => 0]], + ['Il y a 1 pomme', 'Il y a %count% pomme|Il y a %count% pommes', 1, ['%count%' => 1]], + ['Il y a 10 pommes', 'Il y a %count% pomme|Il y a %count% pommes', 10, ['%count%' => 10]], - array('Il y a 0 pomme', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 0, array('%count%' => 0)), - array('Il y a 1 pomme', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array('%count%' => 1)), - array('Il y a 10 pommes', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array('%count%' => 10)), + ['Il y a 0 pomme', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 0, ['%count%' => 0]], + ['Il y a 1 pomme', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 1, ['%count%' => 1]], + ['Il y a 10 pommes', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 10, ['%count%' => 10]], - array('Il n\'y a aucune pomme', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 0, array('%count%' => 0)), - array('Il y a 1 pomme', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array('%count%' => 1)), - array('Il y a 10 pommes', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array('%count%' => 10)), + ['Il n\'y a aucune pomme', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 0, ['%count%' => 0]], + ['Il y a 1 pomme', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, ['%count%' => 1]], + ['Il y a 10 pommes', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, ['%count%' => 10]], - array('Il y a 0 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array('%count%' => 0)), - ); + ['Il y a 0 pomme', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, ['%count%' => 0]], + ]; } private function getMessageFormatter() diff --git a/vendor/symfony/translation/Tests/IntervalTest.php b/vendor/symfony/translation/Tests/IntervalTest.php index a8dd18caa2..bfd90a2867 100644 --- a/vendor/symfony/translation/Tests/IntervalTest.php +++ b/vendor/symfony/translation/Tests/IntervalTest.php @@ -37,16 +37,16 @@ class IntervalTest extends TestCase public function getTests() { - return array( - array(true, 3, '{1,2, 3 ,4}'), - array(false, 10, '{1,2, 3 ,4}'), - array(false, 3, '[1,2]'), - array(true, 1, '[1,2]'), - array(true, 2, '[1,2]'), - array(false, 1, ']1,2['), - array(false, 2, ']1,2['), - array(true, log(0), '[-Inf,2['), - array(true, -log(0), '[-2,+Inf]'), - ); + return [ + [true, 3, '{1,2, 3 ,4}'], + [false, 10, '{1,2, 3 ,4}'], + [false, 3, '[1,2]'], + [true, 1, '[1,2]'], + [true, 2, '[1,2]'], + [false, 1, ']1,2['], + [false, 2, ']1,2['], + [true, log(0), '[-Inf,2['], + [true, -log(0), '[-2,+Inf]'], + ]; } } diff --git a/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php index 29efdef00d..4fd5752db2 100644 --- a/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php @@ -23,9 +23,9 @@ class CsvFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/resources.csv'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadDoesNothingIfEmpty() @@ -34,9 +34,9 @@ class CsvFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/empty.csv'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array(), $catalogue->all('domain1')); + $this->assertEquals([], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php index e28db60135..601680af8a 100644 --- a/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php @@ -37,9 +37,9 @@ class IcuDatFileLoaderTest extends LocalizedTestCase $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('symfony' => 'Symfony 2 is great'), $catalogue->all('domain1')); + $this->assertEquals(['symfony' => 'Symfony 2 is great'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource.'.dat')), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource.'.dat')], $catalogue->getResources()); } public function testDatFrenchLoad() @@ -48,9 +48,9 @@ class IcuDatFileLoaderTest extends LocalizedTestCase $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; $catalogue = $loader->load($resource, 'fr', 'domain1'); - $this->assertEquals(array('symfony' => 'Symfony 2 est génial'), $catalogue->all('domain1')); + $this->assertEquals(['symfony' => 'Symfony 2 est génial'], $catalogue->all('domain1')); $this->assertEquals('fr', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource.'.dat')), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource.'.dat')], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php index 92d8933c8e..962c3af2ef 100644 --- a/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php @@ -26,9 +26,9 @@ class IcuResFileLoaderTest extends LocalizedTestCase $resource = __DIR__.'/../fixtures/resourcebundle/res'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new DirectoryResource($resource)), $catalogue->getResources()); + $this->assertEquals([new DirectoryResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php index d9dcc5e8f0..e0d8b2f4c4 100644 --- a/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php @@ -23,9 +23,9 @@ class IniFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/resources.ini'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadDoesNothingIfEmpty() @@ -34,9 +34,9 @@ class IniFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/empty.ini'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array(), $catalogue->all('domain1')); + $this->assertEquals([], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php index cea0aef4bb..4c507da5ab 100644 --- a/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php @@ -23,9 +23,9 @@ class JsonFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/resources.json'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadDoesNothingIfEmpty() @@ -34,9 +34,9 @@ class JsonFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/empty.json'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array(), $catalogue->all('domain1')); + $this->assertEquals([], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php index 6ad3d44d21..63de5cebaa 100644 --- a/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php @@ -23,9 +23,9 @@ class MoFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/resources.mo'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadPlurals() @@ -34,9 +34,9 @@ class MoFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/plurals.mo'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar', 'foos' => '{0} bar|{1} bars'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar', 'foos' => '{0} bar|{1} bars'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** @@ -65,8 +65,8 @@ class MoFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/empty-translation.mo'; $catalogue = $loader->load($resource, 'en', 'message'); - $this->assertEquals(array(), $catalogue->all('message')); + $this->assertEquals([], $catalogue->all('message')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } } diff --git a/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php index 01b7a5feab..68cb2d0b72 100644 --- a/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php @@ -23,9 +23,9 @@ class PhpFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/resources.php'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php index 4176cb7ffc..4bf2ee6545 100644 --- a/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php @@ -23,9 +23,9 @@ class PoFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/resources.po'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadPlurals() @@ -34,9 +34,9 @@ class PoFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/plurals.po'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar', 'foos' => 'bar|bars'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar', 'foos' => 'bar|bars'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadDoesNothingIfEmpty() @@ -45,9 +45,9 @@ class PoFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/empty.po'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array(), $catalogue->all('domain1')); + $this->assertEquals([], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** @@ -66,9 +66,9 @@ class PoFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/empty-translation.po'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => ''), $catalogue->all('domain1')); + $this->assertEquals(['foo' => ''], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testEscapedId() diff --git a/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php index 8a00fdedcf..08f55e9022 100644 --- a/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php @@ -23,9 +23,9 @@ class QtFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/resources.ts'; $catalogue = $loader->load($resource, 'en', 'resources'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('resources')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('resources')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php index c6958486c1..7cb9f54fde 100644 --- a/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php @@ -24,8 +24,8 @@ class XliffFileLoaderTest extends TestCase $catalogue = $loader->load($resource, 'en', 'domain1'); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); - $this->assertSame(array(), libxml_get_errors()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); + $this->assertSame([], libxml_get_errors()); $this->assertContainsOnly('string', $catalogue->all('domain1')); } @@ -33,15 +33,15 @@ class XliffFileLoaderTest extends TestCase { $internalErrors = libxml_use_internal_errors(true); - $this->assertSame(array(), libxml_get_errors()); + $this->assertSame([], libxml_get_errors()); $loader = new XliffFileLoader(); $resource = __DIR__.'/../fixtures/resources.xlf'; $catalogue = $loader->load($resource, 'en', 'domain1'); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); - $this->assertSame(array(), libxml_get_errors()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); + $this->assertSame([], libxml_get_errors()); libxml_clear_errors(); libxml_use_internal_errors($internalErrors); @@ -58,7 +58,7 @@ class XliffFileLoaderTest extends TestCase libxml_disable_entity_loader($disableEntities); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadWithResname() @@ -66,7 +66,7 @@ class XliffFileLoaderTest extends TestCase $loader = new XliffFileLoader(); $catalogue = $loader->load(__DIR__.'/../fixtures/resname.xlf', 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo', 'qux' => 'qux source'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo', 'qux' => 'qux source'], $catalogue->all('domain1')); } public function testIncompleteResource() @@ -74,7 +74,7 @@ class XliffFileLoaderTest extends TestCase $loader = new XliffFileLoader(); $catalogue = $loader->load(__DIR__.'/../fixtures/resources.xlf', 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar', 'extra' => 'extra', 'key' => '', 'test' => 'with'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar', 'extra' => 'extra', 'key' => '', 'test' => 'with'], $catalogue->all('domain1')); } public function testEncoding() @@ -84,7 +84,7 @@ class XliffFileLoaderTest extends TestCase $this->assertEquals(utf8_decode('föö'), $catalogue->get('bar', 'domain1')); $this->assertEquals(utf8_decode('bär'), $catalogue->get('foo', 'domain1')); - $this->assertEquals(array('notes' => array(array('content' => utf8_decode('bäz'))), 'id' => '1'), $catalogue->getMetadata('foo', 'domain1')); + $this->assertEquals(['notes' => [['content' => utf8_decode('bäz')]], 'id' => '1'], $catalogue->getMetadata('foo', 'domain1')); } public function testTargetAttributesAreStoredCorrectly() @@ -164,11 +164,11 @@ class XliffFileLoaderTest extends TestCase $loader = new XliffFileLoader(); $catalogue = $loader->load(__DIR__.'/../fixtures/withnote.xlf', 'en', 'domain1'); - $this->assertEquals(array('notes' => array(array('priority' => 1, 'content' => 'foo')), 'id' => '1'), $catalogue->getMetadata('foo', 'domain1')); + $this->assertEquals(['notes' => [['priority' => 1, 'content' => 'foo']], 'id' => '1'], $catalogue->getMetadata('foo', 'domain1')); // message without target - $this->assertEquals(array('notes' => array(array('content' => 'bar', 'from' => 'foo')), 'id' => '2'), $catalogue->getMetadata('extra', 'domain1')); + $this->assertEquals(['notes' => [['content' => 'bar', 'from' => 'foo']], 'id' => '2'], $catalogue->getMetadata('extra', 'domain1')); // message with empty target - $this->assertEquals(array('notes' => array(array('content' => 'baz'), array('priority' => 2, 'from' => 'bar', 'content' => 'qux')), 'id' => '123'), $catalogue->getMetadata('key', 'domain1')); + $this->assertEquals(['notes' => [['content' => 'baz'], ['priority' => 2, 'from' => 'bar', 'content' => 'qux']], 'id' => '123'], $catalogue->getMetadata('key', 'domain1')); } public function testLoadVersion2() @@ -178,15 +178,15 @@ class XliffFileLoaderTest extends TestCase $catalogue = $loader->load($resource, 'en', 'domain1'); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); - $this->assertSame(array(), libxml_get_errors()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); + $this->assertSame([], libxml_get_errors()); $domains = $catalogue->all(); $this->assertCount(3, $domains['domain1']); $this->assertContainsOnly('string', $catalogue->all('domain1')); // target attributes - $this->assertEquals(array('target-attributes' => array('order' => 1)), $catalogue->getMetadata('bar', 'domain1')); + $this->assertEquals(['target-attributes' => ['order' => 1]], $catalogue->getMetadata('bar', 'domain1')); } public function testLoadVersion2WithNoteMeta() @@ -196,8 +196,8 @@ class XliffFileLoaderTest extends TestCase $catalogue = $loader->load($resource, 'en', 'domain1'); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); - $this->assertSame(array(), libxml_get_errors()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); + $this->assertSame([], libxml_get_errors()); // test for "foo" metadata $this->assertTrue($catalogue->defines('foo', 'domain1')); @@ -236,7 +236,7 @@ class XliffFileLoaderTest extends TestCase $catalog = $loader->load($resource, 'en', 'domain1'); $this->assertSame('en', $catalog->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalog->getResources()); + $this->assertEquals([new FileResource($resource)], $catalog->getResources()); $this->assertFalse(libxml_get_last_error()); // test for "foo" metadata diff --git a/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php index bb3c1a99a7..a535db56fc 100644 --- a/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php @@ -23,9 +23,9 @@ class YamlFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/resources.yml'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } public function testLoadDoesNothingIfEmpty() @@ -34,9 +34,9 @@ class YamlFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/empty.yml'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(array(), $catalogue->all('domain1')); + $this->assertEquals([], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); - $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); + $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } /** diff --git a/vendor/symfony/translation/Tests/LoggingTranslatorTest.php b/vendor/symfony/translation/Tests/LoggingTranslatorTest.php index 0e43cbecf4..450e060aab 100644 --- a/vendor/symfony/translation/Tests/LoggingTranslatorTest.php +++ b/vendor/symfony/translation/Tests/LoggingTranslatorTest.php @@ -43,11 +43,11 @@ class LoggingTranslatorTest extends TestCase ; $translator = new Translator('ar'); - $translator->setFallbackLocales(array('en')); + $translator->setFallbackLocales(['en']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('some_message2' => 'one thing|%count% things'), 'en'); + $translator->addResource('array', ['some_message2' => 'one thing|%count% things'], 'en'); $loggableTranslator = new LoggingTranslator($translator, $logger); - $loggableTranslator->transChoice('some_message2', 10, array('%count%' => 10)); + $loggableTranslator->transChoice('some_message2', 10, ['%count%' => 10]); } /** @@ -63,6 +63,6 @@ class LoggingTranslatorTest extends TestCase $translator = new Translator('ar'); $loggableTranslator = new LoggingTranslator($translator, $logger); - $loggableTranslator->transChoice('some_message2', 10, array('%count%' => 10)); + $loggableTranslator->transChoice('some_message2', 10, ['%count%' => 10]); } } diff --git a/vendor/symfony/translation/Tests/MessageCatalogueTest.php b/vendor/symfony/translation/Tests/MessageCatalogueTest.php index 3339f3db20..6fe9368f5c 100644 --- a/vendor/symfony/translation/Tests/MessageCatalogueTest.php +++ b/vendor/symfony/translation/Tests/MessageCatalogueTest.php @@ -25,40 +25,40 @@ class MessageCatalogueTest extends TestCase public function testGetDomains() { - $catalogue = new MessageCatalogue('en', array('domain1' => array(), 'domain2' => array(), 'domain2+intl-icu' => array(), 'domain3+intl-icu' => array())); + $catalogue = new MessageCatalogue('en', ['domain1' => [], 'domain2' => [], 'domain2+intl-icu' => [], 'domain3+intl-icu' => []]); - $this->assertEquals(array('domain1', 'domain2', 'domain3'), $catalogue->getDomains()); + $this->assertEquals(['domain1', 'domain2', 'domain3'], $catalogue->getDomains()); } public function testAll() { - $catalogue = new MessageCatalogue('en', $messages = array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); + $catalogue = new MessageCatalogue('en', $messages = ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); - $this->assertEquals(array('foo' => 'foo'), $catalogue->all('domain1')); - $this->assertEquals(array(), $catalogue->all('domain88')); + $this->assertEquals(['foo' => 'foo'], $catalogue->all('domain1')); + $this->assertEquals([], $catalogue->all('domain88')); $this->assertEquals($messages, $catalogue->all()); - $messages = array('domain1+intl-icu' => array('foo' => 'bar')) + $messages + array( - 'domain2+intl-icu' => array('bar' => 'foo'), - 'domain3+intl-icu' => array('biz' => 'biz'), - ); + $messages = ['domain1+intl-icu' => ['foo' => 'bar']] + $messages + [ + 'domain2+intl-icu' => ['bar' => 'foo'], + 'domain3+intl-icu' => ['biz' => 'biz'], + ]; $catalogue = new MessageCatalogue('en', $messages); - $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); - $this->assertEquals(array('bar' => 'foo'), $catalogue->all('domain2')); - $this->assertEquals(array('biz' => 'biz'), $catalogue->all('domain3')); + $this->assertEquals(['foo' => 'bar'], $catalogue->all('domain1')); + $this->assertEquals(['bar' => 'foo'], $catalogue->all('domain2')); + $this->assertEquals(['biz' => 'biz'], $catalogue->all('domain3')); - $messages = array( - 'domain1' => array('foo' => 'bar'), - 'domain2' => array('bar' => 'foo'), - 'domain3' => array('biz' => 'biz'), - ); + $messages = [ + 'domain1' => ['foo' => 'bar'], + 'domain2' => ['bar' => 'foo'], + 'domain3' => ['biz' => 'biz'], + ]; $this->assertEquals($messages, $catalogue->all()); } public function testHas() { - $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2+intl-icu' => array('bar' => 'bar'))); + $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2+intl-icu' => ['bar' => 'bar']]); $this->assertTrue($catalogue->has('foo', 'domain1')); $this->assertTrue($catalogue->has('bar', 'domain2')); @@ -68,7 +68,7 @@ class MessageCatalogueTest extends TestCase public function testGetSet() { - $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'), 'domain2+intl-icu' => array('bar' => 'foo'))); + $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar'], 'domain2+intl-icu' => ['bar' => 'foo']]); $catalogue->set('foo1', 'foo1', 'domain1'); $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); @@ -78,24 +78,24 @@ class MessageCatalogueTest extends TestCase public function testAdd() { - $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); - $catalogue->add(array('foo1' => 'foo1'), 'domain1'); + $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); + $catalogue->add(['foo1' => 'foo1'], 'domain1'); $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - $catalogue->add(array('foo' => 'bar'), 'domain1'); + $catalogue->add(['foo' => 'bar'], 'domain1'); $this->assertEquals('bar', $catalogue->get('foo', 'domain1')); $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - $catalogue->add(array('foo' => 'bar'), 'domain88'); + $catalogue->add(['foo' => 'bar'], 'domain88'); $this->assertEquals('bar', $catalogue->get('foo', 'domain88')); } public function testReplace() { - $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain1+intl-icu' => array('bar' => 'bar'))); - $catalogue->replace($messages = array('foo1' => 'foo1'), 'domain1'); + $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo'], 'domain1+intl-icu' => ['bar' => 'bar']]); + $catalogue->replace($messages = ['foo1' => 'foo1'], 'domain1'); $this->assertEquals($messages, $catalogue->all('domain1')); } @@ -108,10 +108,10 @@ class MessageCatalogueTest extends TestCase $r1 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); - $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'))); + $catalogue = new MessageCatalogue('en', ['domain1' => ['foo' => 'foo']]); $catalogue->addResource($r); - $catalogue1 = new MessageCatalogue('en', array('domain1' => array('foo1' => 'foo1'), 'domain2+intl-icu' => array('bar' => 'bar'))); + $catalogue1 = new MessageCatalogue('en', ['domain1' => ['foo1' => 'foo1'], 'domain2+intl-icu' => ['bar' => 'bar']]); $catalogue1->addResource($r1); $catalogue->addCatalogue($catalogue1); @@ -121,7 +121,7 @@ class MessageCatalogueTest extends TestCase $this->assertEquals('bar', $catalogue->get('bar', 'domain2')); $this->assertEquals('bar', $catalogue->get('bar', 'domain2+intl-icu')); - $this->assertEquals(array($r, $r1), $catalogue->getResources()); + $this->assertEquals([$r, $r1], $catalogue->getResources()); } public function testAddFallbackCatalogue() @@ -135,10 +135,10 @@ class MessageCatalogueTest extends TestCase $r2 = $this->getMockBuilder('Symfony\Component\Config\Resource\ResourceInterface')->getMock(); $r2->expects($this->any())->method('__toString')->will($this->returnValue('r2')); - $catalogue = new MessageCatalogue('fr_FR', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); + $catalogue = new MessageCatalogue('fr_FR', ['domain1' => ['foo' => 'foo'], 'domain2' => ['bar' => 'bar']]); $catalogue->addResource($r); - $catalogue1 = new MessageCatalogue('fr', array('domain1' => array('foo' => 'bar', 'foo1' => 'foo1'))); + $catalogue1 = new MessageCatalogue('fr', ['domain1' => ['foo' => 'bar', 'foo1' => 'foo1']]); $catalogue1->addResource($r1); $catalogue2 = new MessageCatalogue('en'); @@ -150,7 +150,7 @@ class MessageCatalogueTest extends TestCase $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); - $this->assertEquals(array($r, $r1, $r2), $catalogue->getResources()); + $this->assertEquals([$r, $r1, $r2], $catalogue->getResources()); } /** @@ -185,7 +185,7 @@ class MessageCatalogueTest extends TestCase public function testAddCatalogueWhenLocaleIsNotTheSameAsTheCurrentOne() { $catalogue = new MessageCatalogue('en'); - $catalogue->addCatalogue(new MessageCatalogue('fr', array())); + $catalogue->addCatalogue(new MessageCatalogue('fr', [])); } public function testGetAddResource() @@ -199,13 +199,13 @@ class MessageCatalogueTest extends TestCase $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1')); $catalogue->addResource($r1); - $this->assertEquals(array($r, $r1), $catalogue->getResources()); + $this->assertEquals([$r, $r1], $catalogue->getResources()); } public function testMetadataDelete() { $catalogue = new MessageCatalogue('en'); - $this->assertEquals(array(), $catalogue->getMetadata('', ''), 'Metadata is empty'); + $this->assertEquals([], $catalogue->getMetadata('', ''), 'Metadata is empty'); $catalogue->deleteMetadata('key', 'messages'); $catalogue->deleteMetadata('', 'messages'); $catalogue->deleteMetadata(); @@ -217,8 +217,8 @@ class MessageCatalogueTest extends TestCase $catalogue->setMetadata('key', 'value'); $this->assertEquals('value', $catalogue->getMetadata('key', 'messages'), "Metadata 'key' = 'value'"); - $catalogue->setMetadata('key2', array()); - $this->assertEquals(array(), $catalogue->getMetadata('key2', 'messages'), 'Metadata key2 is array'); + $catalogue->setMetadata('key2', []); + $this->assertEquals([], $catalogue->getMetadata('key2', 'messages'), 'Metadata key2 is array'); $catalogue->deleteMetadata('key2', 'messages'); $this->assertNull($catalogue->getMetadata('key2', 'messages'), 'Metadata key2 should is deleted.'); @@ -231,13 +231,13 @@ class MessageCatalogueTest extends TestCase { $cat1 = new MessageCatalogue('en'); $cat1->setMetadata('a', 'b'); - $this->assertEquals(array('messages' => array('a' => 'b')), $cat1->getMetadata('', ''), 'Cat1 contains messages metadata.'); + $this->assertEquals(['messages' => ['a' => 'b']], $cat1->getMetadata('', ''), 'Cat1 contains messages metadata.'); $cat2 = new MessageCatalogue('en'); $cat2->setMetadata('b', 'c', 'domain'); - $this->assertEquals(array('domain' => array('b' => 'c')), $cat2->getMetadata('', ''), 'Cat2 contains domain metadata.'); + $this->assertEquals(['domain' => ['b' => 'c']], $cat2->getMetadata('', ''), 'Cat2 contains domain metadata.'); $cat1->addCatalogue($cat2); - $this->assertEquals(array('messages' => array('a' => 'b'), 'domain' => array('b' => 'c')), $cat1->getMetadata('', ''), 'Cat1 contains merged metadata.'); + $this->assertEquals(['messages' => ['a' => 'b'], 'domain' => ['b' => 'c']], $cat1->getMetadata('', ''), 'Cat1 contains merged metadata.'); } } diff --git a/vendor/symfony/translation/Tests/MessageSelectorTest.php b/vendor/symfony/translation/Tests/MessageSelectorTest.php index 5f85c5b235..f099716176 100644 --- a/vendor/symfony/translation/Tests/MessageSelectorTest.php +++ b/vendor/symfony/translation/Tests/MessageSelectorTest.php @@ -49,92 +49,92 @@ class MessageSelectorTest extends TestCase public function getNonMatchingMessages() { - return array( - array('{0} There are no apples|{1} There is one apple', 2), - array('{1} There is one apple|]1,Inf] There are %count% apples', 0), - array('{1} There is one apple|]2,Inf] There are %count% apples', 2), - array('{0} There are no apples|There is one apple', 2), - ); + return [ + ['{0} There are no apples|{1} There is one apple', 2], + ['{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['{1} There is one apple|]2,Inf] There are %count% apples', 2], + ['{0} There are no apples|There is one apple', 2], + ]; } public function getChooseTests() { - return array( - array('There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0), - array('There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0), - array('There are no apples', '{0}There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0), + return [ + ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['There are no apples', '{0}There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], - array('There is one apple', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 1), + ['There is one apple', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 1], - array('There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10), - array('There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf]There are %count% apples', 10), - array('There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10), + ['There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10], + ['There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf]There are %count% apples', 10], + ['There are %count% apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 10], - array('There are %count% apples', 'There is one apple|There are %count% apples', 0), - array('There is one apple', 'There is one apple|There are %count% apples', 1), - array('There are %count% apples', 'There is one apple|There are %count% apples', 10), + ['There are %count% apples', 'There is one apple|There are %count% apples', 0], + ['There is one apple', 'There is one apple|There are %count% apples', 1], + ['There are %count% apples', 'There is one apple|There are %count% apples', 10], - array('There are %count% apples', 'one: There is one apple|more: There are %count% apples', 0), - array('There is one apple', 'one: There is one apple|more: There are %count% apples', 1), - array('There are %count% apples', 'one: There is one apple|more: There are %count% apples', 10), + ['There are %count% apples', 'one: There is one apple|more: There are %count% apples', 0], + ['There is one apple', 'one: There is one apple|more: There are %count% apples', 1], + ['There are %count% apples', 'one: There is one apple|more: There are %count% apples', 10], - array('There are no apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 0), - array('There is one apple', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 1), - array('There are %count% apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 10), + ['There are no apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 0], + ['There is one apple', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 1], + ['There are %count% apples', '{0} There are no apples|one: There is one apple|more: There are %count% apples', 10], - array('', '{0}|{1} There is one apple|]1,Inf] There are %count% apples', 0), - array('', '{0} There are no apples|{1}|]1,Inf] There are %count% apples', 1), + ['', '{0}|{1} There is one apple|]1,Inf] There are %count% apples', 0], + ['', '{0} There are no apples|{1}|]1,Inf] There are %count% apples', 1], // Indexed only tests which are Gettext PoFile* compatible strings. - array('There are %count% apples', 'There is one apple|There are %count% apples', 0), - array('There is one apple', 'There is one apple|There are %count% apples', 1), - array('There are %count% apples', 'There is one apple|There are %count% apples', 2), + ['There are %count% apples', 'There is one apple|There are %count% apples', 0], + ['There is one apple', 'There is one apple|There are %count% apples', 1], + ['There are %count% apples', 'There is one apple|There are %count% apples', 2], // Tests for float numbers - array('There is almost one apple', '{0} There are no apples|]0,1[ There is almost one apple|{1} There is one apple|[1,Inf] There is more than one apple', 0.7), - array('There is one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1), - array('There is more than one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1.7), - array('There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0), - array('There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0.0), - array('There are no apples', '{0.0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0), + ['There is almost one apple', '{0} There are no apples|]0,1[ There is almost one apple|{1} There is one apple|[1,Inf] There is more than one apple', 0.7], + ['There is one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1], + ['There is more than one apple', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 1.7], + ['There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0], + ['There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0.0], + ['There are no apples', '{0.0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0], // Test texts with new-lines // with double-quotes and \n in id & double-quotes and actual newlines in text - array("This is a text with a\n new-line in it. Selector = 0.", '{0}This is a text with a + ["This is a text with a\n new-line in it. Selector = 0.", '{0}This is a text with a new-line in it. Selector = 0.|{1}This is a text with a new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 0), + new-line in it. Selector > 1.', 0], // with double-quotes and \n in id and single-quotes and actual newlines in text - array("This is a text with a\n new-line in it. Selector = 1.", '{0}This is a text with a + ["This is a text with a\n new-line in it. Selector = 1.", '{0}This is a text with a new-line in it. Selector = 0.|{1}This is a text with a new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 1), - array("This is a text with a\n new-line in it. Selector > 1.", '{0}This is a text with a + new-line in it. Selector > 1.', 1], + ["This is a text with a\n new-line in it. Selector > 1.", '{0}This is a text with a new-line in it. Selector = 0.|{1}This is a text with a new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 5), + new-line in it. Selector > 1.', 5], // with double-quotes and id split accros lines - array('This is a text with a + ['This is a text with a new-line in it. Selector = 1.', '{0}This is a text with a new-line in it. Selector = 0.|{1}This is a text with a new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 1), + new-line in it. Selector > 1.', 1], // with single-quotes and id split accros lines - array('This is a text with a + ['This is a text with a new-line in it. Selector > 1.', '{0}This is a text with a new-line in it. Selector = 0.|{1}This is a text with a new-line in it. Selector = 1.|[1,Inf]This is a text with a - new-line in it. Selector > 1.', 5), + new-line in it. Selector > 1.', 5], // with single-quotes and \n in text - array('This is a text with a\nnew-line in it. Selector = 0.', '{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.', 0), + ['This is a text with a\nnew-line in it. Selector = 0.', '{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.', 0], // with double-quotes and id split accros lines - array("This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1), + ["This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1], // esacape pipe - array('This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0), + ['This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0], // Empty plural set (2 plural forms) from a .PO file - array('', '|', 1), + ['', '|', 1], // Empty plural set (3 plural forms) from a .PO file - array('', '||', 1), - ); + ['', '||', 1], + ]; } } diff --git a/vendor/symfony/translation/Tests/PluralizationRulesTest.php b/vendor/symfony/translation/Tests/PluralizationRulesTest.php index 0da8757aaa..696c92b2dd 100644 --- a/vendor/symfony/translation/Tests/PluralizationRulesTest.php +++ b/vendor/symfony/translation/Tests/PluralizationRulesTest.php @@ -62,13 +62,13 @@ class PluralizationRulesTest extends TestCase */ public function successLangcodes() { - return array( - array('1', array('ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky')), - array('2', array('nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM')), - array('3', array('be', 'bs', 'cs', 'hr')), - array('4', array('cy', 'mt', 'sl')), - array('6', array('ar')), - ); + return [ + ['1', ['ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky']], + ['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM']], + ['3', ['be', 'bs', 'cs', 'hr']], + ['4', ['cy', 'mt', 'sl']], + ['6', ['ar']], + ]; } /** @@ -81,13 +81,13 @@ class PluralizationRulesTest extends TestCase */ public function failingLangcodes() { - return array( - array('1', array('fa')), - array('2', array('jbo')), - array('3', array('cbs')), - array('4', array('gd', 'kw')), - array('5', array('ga')), - ); + return [ + ['1', ['fa']], + ['2', ['jbo']], + ['3', ['cbs']], + ['4', ['gd', 'kw']], + ['5', ['ga']], + ]; } /** @@ -111,7 +111,7 @@ class PluralizationRulesTest extends TestCase protected function generateTestData($langCodes) { - $matrix = array(); + $matrix = []; foreach ($langCodes as $langCode) { for ($count = 0; $count < 200; ++$count) { $plural = PluralizationRules::get($count, $langCode); diff --git a/vendor/symfony/translation/Tests/TranslatorCacheTest.php b/vendor/symfony/translation/Tests/TranslatorCacheTest.php index 77c264b491..58e1936ed3 100644 --- a/vendor/symfony/translation/Tests/TranslatorCacheTest.php +++ b/vendor/symfony/translation/Tests/TranslatorCacheTest.php @@ -65,18 +65,18 @@ class TranslatorCacheTest extends TestCase // Prime the cache $translator = new Translator($locale, null, $this->tmpDir, $debug); $translator->addLoader($format, new ArrayLoader()); - $translator->addResource($format, array($msgid => 'OK'), $locale); - $translator->addResource($format, array($msgid.'+intl' => 'OK'), $locale, 'messages+intl-icu'); + $translator->addResource($format, [$msgid => 'OK'], $locale); + $translator->addResource($format, [$msgid.'+intl' => 'OK'], $locale, 'messages+intl-icu'); $translator->trans($msgid); - $translator->trans($msgid.'+intl', array(), 'messages+intl-icu'); + $translator->trans($msgid.'+intl', [], 'messages+intl-icu'); // Try again and see we get a valid result whilst no loader can be used $translator = new Translator($locale, null, $this->tmpDir, $debug); $translator->addLoader($format, $this->createFailingLoader()); - $translator->addResource($format, array($msgid => 'OK'), $locale); - $translator->addResource($format, array($msgid.'+intl' => 'OK'), $locale, 'messages+intl-icu'); + $translator->addResource($format, [$msgid => 'OK'], $locale); + $translator->addResource($format, [$msgid.'+intl' => 'OK'], $locale, 'messages+intl-icu'); $this->assertEquals('OK', $translator->trans($msgid), '-> caching does not work in '.($debug ? 'debug' : 'production')); - $this->assertEquals('OK', $translator->trans($msgid.'+intl', array(), 'messages+intl-icu')); + $this->assertEquals('OK', $translator->trans($msgid.'+intl', [], 'messages+intl-icu')); } public function testCatalogueIsReloadedWhenResourcesAreNoLongerFresh() @@ -96,7 +96,7 @@ class TranslatorCacheTest extends TestCase $format = 'some_format'; $msgid = 'test'; - $catalogue = new MessageCatalogue($locale, array()); + $catalogue = new MessageCatalogue($locale, []); $catalogue->addResource(new StaleResource()); // better use a helper class than a mock, because it gets serialized in the cache and re-loaded /** @var LoaderInterface|\PHPUnit_Framework_MockObject_MockObject $loader */ @@ -137,26 +137,26 @@ class TranslatorCacheTest extends TestCase // Create a Translator and prime its cache $translator = new Translator($locale, null, $this->tmpDir, $debug); $translator->addLoader($format, new ArrayLoader()); - $translator->addResource($format, array($msgid => 'OK'), $locale); + $translator->addResource($format, [$msgid => 'OK'], $locale); $translator->trans($msgid); // Create another Translator with a different catalogue for the same locale $translator = new Translator($locale, null, $this->tmpDir, $debug); $translator->addLoader($format, new ArrayLoader()); - $translator->addResource($format, array($msgid => 'FAIL'), $locale); + $translator->addResource($format, [$msgid => 'FAIL'], $locale); $translator->trans($msgid); // Now the first translator must still have a usable cache. $translator = new Translator($locale, null, $this->tmpDir, $debug); $translator->addLoader($format, $this->createFailingLoader()); - $translator->addResource($format, array($msgid => 'OK'), $locale); + $translator->addResource($format, [$msgid => 'OK'], $locale); $this->assertEquals('OK', $translator->trans($msgid), '-> the cache was overwritten by another translator instance in '.($debug ? 'debug' : 'production')); } public function testGeneratedCacheFilesAreOnlyBelongRequestedLocales() { $translator = new Translator('a', null, $this->tmpDir); - $translator->setFallbackLocales(array('b')); + $translator->setFallbackLocales(['b']); $translator->trans('bar'); $cachedFiles = glob($this->tmpDir.'/*.php'); @@ -172,24 +172,24 @@ class TranslatorCacheTest extends TestCase * loading a catalogue from the cache. */ $translator = new Translator('a', null, $this->tmpDir); - $translator->setFallbackLocales(array('b')); + $translator->setFallbackLocales(['b']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (a)'), 'a'); - $translator->addResource('array', array('bar' => 'bar (b)'), 'b'); + $translator->addResource('array', ['foo' => 'foo (a)'], 'a'); + $translator->addResource('array', ['bar' => 'bar (b)'], 'b'); $this->assertEquals('bar (b)', $translator->trans('bar')); // Remove fallback locale - $translator->setFallbackLocales(array()); + $translator->setFallbackLocales([]); $this->assertEquals('bar', $translator->trans('bar')); // Use a fresh translator with no fallback locales, result should be the same $translator = new Translator('a', null, $this->tmpDir); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (a)'), 'a'); - $translator->addResource('array', array('bar' => 'bar (b)'), 'b'); + $translator->addResource('array', ['foo' => 'foo (a)'], 'a'); + $translator->addResource('array', ['bar' => 'bar (b)'], 'b'); $this->assertEquals('bar', $translator->trans('bar')); } @@ -210,13 +210,13 @@ class TranslatorCacheTest extends TestCase * The catalogues contain distinct sets of messages. */ $translator = new Translator('a', null, $this->tmpDir); - $translator->setFallbackLocales(array('b')); + $translator->setFallbackLocales(['b']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (a)'), 'a'); - $translator->addResource('array', array('foo' => 'foo (b)'), 'b'); - $translator->addResource('array', array('bar' => 'bar (b)'), 'b'); - $translator->addResource('array', array('baz' => 'baz (b)'), 'b', 'messages+intl-icu'); + $translator->addResource('array', ['foo' => 'foo (a)'], 'a'); + $translator->addResource('array', ['foo' => 'foo (b)'], 'b'); + $translator->addResource('array', ['bar' => 'bar (b)'], 'b'); + $translator->addResource('array', ['baz' => 'baz (b)'], 'b', 'messages+intl-icu'); $catalogue = $translator->getCatalogue('a'); $this->assertFalse($catalogue->defines('bar')); // Sure, the "a" catalogue does not contain that message. @@ -229,13 +229,13 @@ class TranslatorCacheTest extends TestCase * Behind the scenes, the cache is used. But that should not matter, right? */ $translator = new Translator('a', null, $this->tmpDir); - $translator->setFallbackLocales(array('b')); + $translator->setFallbackLocales(['b']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (a)'), 'a'); - $translator->addResource('array', array('foo' => 'foo (b)'), 'b'); - $translator->addResource('array', array('bar' => 'bar (b)'), 'b'); - $translator->addResource('array', array('baz' => 'baz (b)'), 'b', 'messages+intl-icu'); + $translator->addResource('array', ['foo' => 'foo (a)'], 'a'); + $translator->addResource('array', ['foo' => 'foo (b)'], 'b'); + $translator->addResource('array', ['bar' => 'bar (b)'], 'b'); + $translator->addResource('array', ['baz' => 'baz (b)'], 'b', 'messages+intl-icu'); $catalogue = $translator->getCatalogue('a'); $this->assertFalse($catalogue->defines('bar')); @@ -253,7 +253,7 @@ class TranslatorCacheTest extends TestCase $loader ->expects($this->exactly(2)) ->method('load') - ->will($this->returnValue($this->getCatalogue('fr', array(), array($resource)))); + ->will($this->returnValue($this->getCatalogue('fr', [], [$resource]))); // prime the cache $translator = new Translator('fr', null, $this->tmpDir, true); @@ -268,7 +268,7 @@ class TranslatorCacheTest extends TestCase $translator->trans('foo'); } - protected function getCatalogue($locale, $messages, $resources = array()) + protected function getCatalogue($locale, $messages, $resources = []) { $catalogue = new MessageCatalogue($locale); foreach ($messages as $key => $translation) { @@ -283,7 +283,7 @@ class TranslatorCacheTest extends TestCase public function runForDebugAndProduction() { - return array(array(true), array(false)); + return [[true], [false]]; } /** diff --git a/vendor/symfony/translation/Tests/TranslatorTest.php b/vendor/symfony/translation/Tests/TranslatorTest.php index bbc8ce2d21..51c4a0a048 100644 --- a/vendor/symfony/translation/Tests/TranslatorTest.php +++ b/vendor/symfony/translation/Tests/TranslatorTest.php @@ -97,8 +97,8 @@ class TranslatorTest extends TestCase $translator = new Translator($locale); $translator->addLoader('loader-a', new ArrayLoader()); $translator->addLoader('loader-b', new ArrayLoader()); - $translator->addResource('loader-a', array('foo' => 'foofoo'), $locale, 'domain-a'); - $translator->addResource('loader-b', array('bar' => 'foobar'), $locale, 'domain-b'); + $translator->addResource('loader-a', ['foo' => 'foofoo'], $locale, 'domain-a'); + $translator->addResource('loader-b', ['bar' => 'foobar'], $locale, 'domain-b'); /* * Test that we get a single catalogue comprising messages @@ -113,13 +113,13 @@ class TranslatorTest extends TestCase { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'en'); - $translator->addResource('array', array('bar' => 'foobar'), 'fr'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en'); + $translator->addResource('array', ['bar' => 'foobar'], 'fr'); // force catalogue loading $translator->trans('bar'); - $translator->setFallbackLocales(array('fr')); + $translator->setFallbackLocales(['fr']); $this->assertEquals('foobar', $translator->trans('bar')); } @@ -127,13 +127,13 @@ class TranslatorTest extends TestCase { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (en)'), 'en'); - $translator->addResource('array', array('bar' => 'bar (fr)'), 'fr'); + $translator->addResource('array', ['foo' => 'foo (en)'], 'en'); + $translator->addResource('array', ['bar' => 'bar (fr)'], 'fr'); // force catalogue loading $translator->trans('bar'); - $translator->setFallbackLocales(array('fr_FR', 'fr')); + $translator->setFallbackLocales(['fr_FR', 'fr']); $this->assertEquals('bar (fr)', $translator->trans('bar')); } @@ -144,7 +144,7 @@ class TranslatorTest extends TestCase public function testSetFallbackInvalidLocales($locale) { $translator = new Translator('fr'); - $translator->setFallbackLocales(array('fr', $locale)); + $translator->setFallbackLocales(['fr', $locale]); } /** @@ -153,7 +153,7 @@ class TranslatorTest extends TestCase public function testSetFallbackValidLocales($locale) { $translator = new Translator($locale); - $translator->setFallbackLocales(array('fr', $locale)); + $translator->setFallbackLocales(['fr', $locale]); // no assertion. this method just asserts that no exception is thrown $this->addToAssertionCount(1); } @@ -161,10 +161,10 @@ class TranslatorTest extends TestCase public function testTransWithFallbackLocale() { $translator = new Translator('fr_FR'); - $translator->setFallbackLocales(array('en')); + $translator->setFallbackLocales(['en']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('bar' => 'foobar'), 'en'); + $translator->addResource('array', ['bar' => 'foobar'], 'en'); $this->assertEquals('foobar', $translator->trans('bar')); } @@ -176,7 +176,7 @@ class TranslatorTest extends TestCase public function testAddResourceInvalidLocales($locale) { $translator = new Translator('fr'); - $translator->addResource('array', array('foo' => 'foofoo'), $locale); + $translator->addResource('array', ['foo' => 'foofoo'], $locale); } /** @@ -185,7 +185,7 @@ class TranslatorTest extends TestCase public function testAddResourceValidLocales($locale) { $translator = new Translator('fr'); - $translator->addResource('array', array('foo' => 'foofoo'), $locale); + $translator->addResource('array', ['foo' => 'foofoo'], $locale); // no assertion. this method just asserts that no exception is thrown $this->addToAssertionCount(1); } @@ -195,12 +195,12 @@ class TranslatorTest extends TestCase $translator = new Translator('fr'); $translator->addLoader('array', new ArrayLoader()); - $translator->setFallbackLocales(array('en')); + $translator->setFallbackLocales(['en']); - $translator->addResource('array', array('foo' => 'foofoo'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en'); $this->assertEquals('foofoo', $translator->trans('foo')); - $translator->addResource('array', array('bar' => 'foobar'), 'en'); + $translator->addResource('array', ['bar' => 'foobar'], 'en'); $this->assertEquals('foobar', $translator->trans('bar')); } @@ -231,16 +231,16 @@ class TranslatorTest extends TestCase $translator->addResource($format, __DIR__.'/fixtures/non-existing', 'en_GB'); $translator->addResource($format, __DIR__.'/fixtures/resources.'.$format, 'en', 'resources'); - $this->assertEquals('bar', $translator->trans('foo', array(), 'resources')); + $this->assertEquals('bar', $translator->trans('foo', [], 'resources')); } public function testTransWithIcuFallbackLocale() { $translator = new Translator('en_GB'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'en_GB'); - $translator->addResource('array', array('bar' => 'foobar'), 'en_001'); - $translator->addResource('array', array('baz' => 'foobaz'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en_GB'); + $translator->addResource('array', ['bar' => 'foobar'], 'en_001'); + $translator->addResource('array', ['baz' => 'foobaz'], 'en'); $this->assertSame('foofoo', $translator->trans('foo')); $this->assertSame('foobar', $translator->trans('bar')); $this->assertSame('foobaz', $translator->trans('baz')); @@ -250,10 +250,10 @@ class TranslatorTest extends TestCase { $translator = new Translator('en_GB_scouse'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'en_GB_scouse'); - $translator->addResource('array', array('bar' => 'foobar'), 'en_GB'); - $translator->addResource('array', array('baz' => 'foobaz'), 'en_001'); - $translator->addResource('array', array('qux' => 'fooqux'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en_GB_scouse'); + $translator->addResource('array', ['bar' => 'foobar'], 'en_GB'); + $translator->addResource('array', ['baz' => 'foobaz'], 'en_001'); + $translator->addResource('array', ['qux' => 'fooqux'], 'en'); $this->assertSame('foofoo', $translator->trans('foo')); $this->assertSame('foobar', $translator->trans('bar')); $this->assertSame('foobaz', $translator->trans('baz')); @@ -264,8 +264,8 @@ class TranslatorTest extends TestCase { $translator = new Translator('az_Cyrl'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'az_Cyrl'); - $translator->addResource('array', array('bar' => 'foobar'), 'az'); + $translator->addResource('array', ['foo' => 'foofoo'], 'az_Cyrl'); + $translator->addResource('array', ['bar' => 'foobar'], 'az'); $this->assertSame('foofoo', $translator->trans('foo')); $this->assertSame('bar', $translator->trans('bar')); } @@ -274,8 +274,8 @@ class TranslatorTest extends TestCase { $translator = new Translator('en_US'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'en_US'); - $translator->addResource('array', array('bar' => 'foobar'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en_US'); + $translator->addResource('array', ['bar' => 'foobar'], 'en'); $this->assertEquals('foobar', $translator->trans('bar')); } @@ -283,10 +283,10 @@ class TranslatorTest extends TestCase { $translator = new Translator('fr_FR'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foo (en_US)'), 'en_US'); - $translator->addResource('array', array('bar' => 'bar (en)'), 'en'); + $translator->addResource('array', ['foo' => 'foo (en_US)'], 'en_US'); + $translator->addResource('array', ['bar' => 'bar (en)'], 'en'); - $translator->setFallbackLocales(array('en_US', 'en')); + $translator->setFallbackLocales(['en_US', 'en']); $this->assertEquals('foo (en_US)', $translator->trans('foo')); $this->assertEquals('bar (en)', $translator->trans('bar')); @@ -295,7 +295,7 @@ class TranslatorTest extends TestCase public function testTransNonExistentWithFallback() { $translator = new Translator('fr'); - $translator->setFallbackLocales(array('en')); + $translator->setFallbackLocales(['en']); $translator->addLoader('array', new ArrayLoader()); $this->assertEquals('non-existent', $translator->trans('non-existent')); } @@ -306,7 +306,7 @@ class TranslatorTest extends TestCase public function testWhenAResourceHasNoRegisteredLoader() { $translator = new Translator('en'); - $translator->addResource('array', array('foo' => 'foofoo'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en'); $translator->trans('foo'); } @@ -314,7 +314,7 @@ class TranslatorTest extends TestCase public function testNestedFallbackCatalogueWhenUsingMultipleLocales() { $translator = new Translator('fr'); - $translator->setFallbackLocales(array('ru', 'en')); + $translator->setFallbackLocales(['ru', 'en']); $translator->getCatalogue('fr'); @@ -329,7 +329,7 @@ class TranslatorTest extends TestCase $translator->addResource('yml', __DIR__.'/fixtures/resources.yml', 'en'); // force catalogue loading - $this->assertEquals('bar', $translator->trans('foo', array())); + $this->assertEquals('bar', $translator->trans('foo', [])); $resources = $translator->getCatalogue('en')->getResources(); $this->assertCount(1, $resources); @@ -348,7 +348,7 @@ class TranslatorTest extends TestCase { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array((string) $id => $translation), $locale, $domain); + $translator->addResource('array', [(string) $id => $translation], $locale, $domain); $this->assertEquals($expected, $translator->trans($id, $parameters, $domain, $locale)); } @@ -361,9 +361,9 @@ class TranslatorTest extends TestCase { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en'); - $translator->trans('foo', array(), '', $locale); + $translator->trans('foo', [], '', $locale); } /** @@ -373,10 +373,10 @@ class TranslatorTest extends TestCase { $translator = new Translator($locale); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('test' => 'OK'), $locale); + $translator->addResource('array', ['test' => 'OK'], $locale); $this->assertEquals('OK', $translator->trans('test')); - $this->assertEquals('OK', $translator->trans('test', array(), null, $locale)); + $this->assertEquals('OK', $translator->trans('test', [], null, $locale)); } /** @@ -388,7 +388,7 @@ class TranslatorTest extends TestCase $translator->addLoader('array', new ArrayLoader()); $translator->addResource('array', $messages, 'fr', ''); - $this->assertEquals($expected, $translator->trans($id, array(), '', 'fr')); + $this->assertEquals($expected, $translator->trans($id, [], '', 'fr')); } /** @@ -399,7 +399,7 @@ class TranslatorTest extends TestCase { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array((string) $id => $translation), $locale, $domain); + $translator->addResource('array', [(string) $id => $translation], $locale, $domain); $this->assertEquals($expected, $translator->transChoice($id, $number, $parameters, $domain, $locale)); } @@ -413,9 +413,9 @@ class TranslatorTest extends TestCase { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en'); - $translator->transChoice('foo', 1, array(), '', $locale); + $translator->transChoice('foo', 1, [], '', $locale); } /** @@ -426,118 +426,118 @@ class TranslatorTest extends TestCase { $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('foo' => 'foofoo'), 'en'); + $translator->addResource('array', ['foo' => 'foofoo'], 'en'); - $translator->transChoice('foo', 1, array(), '', $locale); + $translator->transChoice('foo', 1, [], '', $locale); // no assertion. this method just asserts that no exception is thrown $this->addToAssertionCount(1); } public function getTransFileTests() { - return array( - array('csv', 'CsvFileLoader'), - array('ini', 'IniFileLoader'), - array('mo', 'MoFileLoader'), - array('po', 'PoFileLoader'), - array('php', 'PhpFileLoader'), - array('ts', 'QtFileLoader'), - array('xlf', 'XliffFileLoader'), - array('yml', 'YamlFileLoader'), - array('json', 'JsonFileLoader'), - ); + return [ + ['csv', 'CsvFileLoader'], + ['ini', 'IniFileLoader'], + ['mo', 'MoFileLoader'], + ['po', 'PoFileLoader'], + ['php', 'PhpFileLoader'], + ['ts', 'QtFileLoader'], + ['xlf', 'XliffFileLoader'], + ['yml', 'YamlFileLoader'], + ['json', 'JsonFileLoader'], + ]; } public function getTransTests() { - return array( - array('Symfony est super !', 'Symfony is great!', 'Symfony est super !', array(), 'fr', ''), - array('Symfony est awesome !', 'Symfony is %what%!', 'Symfony est %what% !', array('%what%' => 'awesome'), 'fr', ''), - array('Symfony est super !', new StringClass('Symfony is great!'), 'Symfony est super !', array(), 'fr', ''), - ); + return [ + ['Symfony est super !', 'Symfony is great!', 'Symfony est super !', [], 'fr', ''], + ['Symfony est awesome !', 'Symfony is %what%!', 'Symfony est %what% !', ['%what%' => 'awesome'], 'fr', ''], + ['Symfony est super !', new StringClass('Symfony is great!'), 'Symfony est super !', [], 'fr', ''], + ]; } public function getFlattenedTransTests() { - $messages = array( - 'symfony' => array( - 'is' => array( + $messages = [ + 'symfony' => [ + 'is' => [ 'great' => 'Symfony est super!', - ), - ), - 'foo' => array( - 'bar' => array( + ], + ], + 'foo' => [ + 'bar' => [ 'baz' => 'Foo Bar Baz', - ), + ], 'baz' => 'Foo Baz', - ), - ); + ], + ]; - return array( - array('Symfony est super!', $messages, 'symfony.is.great'), - array('Foo Bar Baz', $messages, 'foo.bar.baz'), - array('Foo Baz', $messages, 'foo.baz'), - ); + return [ + ['Symfony est super!', $messages, 'symfony.is.great'], + ['Foo Bar Baz', $messages, 'foo.bar.baz'], + ['Foo Baz', $messages, 'foo.baz'], + ]; } public function getTransChoiceTests() { - return array( - array('Il y a 0 pomme', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array(), 'fr', ''), - array('Il y a 1 pomme', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 1, array(), 'fr', ''), - array('Il y a 10 pommes', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 10, array(), 'fr', ''), + return [ + ['Il y a 0 pomme', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, [], 'fr', ''], + ['Il y a 1 pomme', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 1, [], 'fr', ''], + ['Il y a 10 pommes', '{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples', '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 10, [], 'fr', ''], - array('Il y a 0 pomme', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 0, array(), 'fr', ''), - array('Il y a 1 pomme', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 1, array(), 'fr', ''), - array('Il y a 10 pommes', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 10, array(), 'fr', ''), + ['Il y a 0 pomme', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 0, [], 'fr', ''], + ['Il y a 1 pomme', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 1, [], 'fr', ''], + ['Il y a 10 pommes', 'There is one apple|There is %count% apples', 'Il y a %count% pomme|Il y a %count% pommes', 10, [], 'fr', ''], - array('Il y a 0 pomme', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 0, array(), 'fr', ''), - array('Il y a 1 pomme', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array(), 'fr', ''), - array('Il y a 10 pommes', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array(), 'fr', ''), + ['Il y a 0 pomme', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 0, [], 'fr', ''], + ['Il y a 1 pomme', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 1, [], 'fr', ''], + ['Il y a 10 pommes', 'one: There is one apple|more: There is %count% apples', 'one: Il y a %count% pomme|more: Il y a %count% pommes', 10, [], 'fr', ''], - array('Il n\'y a aucune pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 0, array(), 'fr', ''), - array('Il y a 1 pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, array(), 'fr', ''), - array('Il y a 10 pommes', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, array(), 'fr', ''), + ['Il n\'y a aucune pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 0, [], 'fr', ''], + ['Il y a 1 pomme', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 1, [], 'fr', ''], + ['Il y a 10 pommes', '{0} There are no apples|one: There is one apple|more: There is %count% apples', '{0} Il n\'y a aucune pomme|one: Il y a %count% pomme|more: Il y a %count% pommes', 10, [], 'fr', ''], - array('Il y a 0 pomme', new StringClass('{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples'), '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, array(), 'fr', ''), + ['Il y a 0 pomme', new StringClass('{0} There are no appless|{1} There is one apple|]1,Inf] There is %count% apples'), '[0,1] Il y a %count% pomme|]1,Inf] Il y a %count% pommes', 0, [], 'fr', ''], // Override %count% with a custom value - array('Il y a quelques pommes', 'one: There is one apple|more: There are %count% apples', 'one: Il y a %count% pomme|more: Il y a quelques pommes', 2, array('%count%' => 'quelques'), 'fr', ''), - ); + ['Il y a quelques pommes', 'one: There is one apple|more: There are %count% apples', 'one: Il y a %count% pomme|more: Il y a quelques pommes', 2, ['%count%' => 'quelques'], 'fr', ''], + ]; } public function getInvalidLocalesTests() { - return array( - array('fr FR'), - array('français'), - array('fr+en'), - array('utf#8'), - array('fr&en'), - array('fr~FR'), - array(' fr'), - array('fr '), - array('fr*'), - array('fr/FR'), - array('fr\\FR'), - ); + return [ + ['fr FR'], + ['français'], + ['fr+en'], + ['utf#8'], + ['fr&en'], + ['fr~FR'], + [' fr'], + ['fr '], + ['fr*'], + ['fr/FR'], + ['fr\\FR'], + ]; } public function getValidLocalesTests() { - return array( - array(''), - array(null), - array('fr'), - array('francais'), - array('FR'), - array('frFR'), - array('fr-FR'), - array('fr_FR'), - array('fr.FR'), - array('fr-FR.UTF8'), - array('sr@latin'), - ); + return [ + [''], + [null], + ['fr'], + ['francais'], + ['FR'], + ['frFR'], + ['fr-FR'], + ['fr_FR'], + ['fr.FR'], + ['fr-FR.UTF8'], + ['sr@latin'], + ]; } /** @@ -548,11 +548,11 @@ class TranslatorTest extends TestCase $translator = new Translator('en'); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('some_message' => 'Hello %name%'), 'en'); - $this->assertSame('Hello Bob', $translator->trans('some_message', array('%name%' => 'Bob'))); + $translator->addResource('array', ['some_message' => 'Hello %name%'], 'en'); + $this->assertSame('Hello Bob', $translator->trans('some_message', ['%name%' => 'Bob'])); - $translator->addResource('array', array('some_message' => 'Hi {name}'), 'en', 'messages+intl-icu'); - $this->assertSame('Hi Bob', $translator->trans('some_message', array('%name%' => 'Bob'))); + $translator->addResource('array', ['some_message' => 'Hi {name}'], 'en', 'messages+intl-icu'); + $this->assertSame('Hi Bob', $translator->trans('some_message', ['%name%' => 'Bob'])); } /** @@ -561,11 +561,11 @@ class TranslatorTest extends TestCase public function testTransChoiceFallback() { $translator = new Translator('ru'); - $translator->setFallbackLocales(array('en')); + $translator->setFallbackLocales(['en']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('some_message2' => 'one thing|%count% things'), 'en'); + $translator->addResource('array', ['some_message2' => 'one thing|%count% things'], 'en'); - $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, array('%count%' => 10))); + $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, ['%count%' => 10])); } /** @@ -574,11 +574,11 @@ class TranslatorTest extends TestCase public function testTransChoiceFallbackBis() { $translator = new Translator('ru'); - $translator->setFallbackLocales(array('en_US', 'en')); + $translator->setFallbackLocales(['en_US', 'en']); $translator->addLoader('array', new ArrayLoader()); - $translator->addResource('array', array('some_message2' => 'one thing|%count% things'), 'en_US'); + $translator->addResource('array', ['some_message2' => 'one thing|%count% things'], 'en_US'); - $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, array('%count%' => 10))); + $this->assertEquals('10 things', $translator->transChoice('some_message2', 10, ['%count%' => 10])); } /** @@ -587,12 +587,12 @@ class TranslatorTest extends TestCase public function testTransChoiceFallbackWithNoTranslation() { $translator = new Translator('ru'); - $translator->setFallbackLocales(array('en')); + $translator->setFallbackLocales(['en']); $translator->addLoader('array', new ArrayLoader()); // consistent behavior with Translator::trans(), which returns the string // unchanged if it can't be found - $this->assertEquals('some_message2', $translator->transChoice('some_message2', 10, array('%count%' => 10))); + $this->assertEquals('some_message2', $translator->transChoice('some_message2', 10, ['%count%' => 10])); } } diff --git a/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php b/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php index dbb5424f1c..b0335415e1 100644 --- a/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php +++ b/vendor/symfony/translation/Tests/Util/ArrayConverterTest.php @@ -26,49 +26,49 @@ class ArrayConverterTest extends TestCase public function messagesData() { - return array( - array( + return [ + [ // input - array( + [ 'foo1' => 'bar', 'foo.bar' => 'value', - ), + ], // expected output - array( + [ 'foo1' => 'bar', - 'foo' => array('bar' => 'value'), - ), - ), - array( + 'foo' => ['bar' => 'value'], + ], + ], + [ // input - array( + [ 'foo.bar' => 'value1', 'foo.bar.test' => 'value2', - ), + ], // expected output - array( - 'foo' => array( + [ + 'foo' => [ 'bar' => 'value1', 'bar.test' => 'value2', - ), - ), - ), - array( + ], + ], + ], + [ // input - array( + [ 'foo.level2.level3.level4' => 'value1', 'foo.level2' => 'value2', 'foo.bar' => 'value3', - ), + ], // expected output - array( - 'foo' => array( + [ + 'foo' => [ 'level2' => 'value2', 'level2.level3.level4' => 'value1', 'bar' => 'value3', - ), - ), - ), - ); + ], + ], + ], + ]; } } diff --git a/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php b/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php index ab66af13e7..d3b6754d33 100644 --- a/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php +++ b/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php @@ -49,7 +49,7 @@ class TranslationWriterTest extends TestCase class NonBackupDumper implements DumperInterface { - public function dump(MessageCatalogue $messages, $options = array()) + public function dump(MessageCatalogue $messages, $options = []) { } } @@ -58,7 +58,7 @@ class BackupDumper implements DumperInterface { public $backup = true; - public function dump(MessageCatalogue $messages, $options = array()) + public function dump(MessageCatalogue $messages, $options = []) { } diff --git a/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php b/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php index 1ce8ea94fd..55520203c6 100644 --- a/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php +++ b/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php @@ -1,7 +1,7 @@ This template is used for translation message extraction tests <?php echo $view['translator']->trans('single-quoted key'); ?> <?php echo $view['translator']->trans('double-quoted key'); ?> -<?php echo $view['translator']->trans(<<<'EOF' +<?php echo $view['translator']->trans(<<<EOF heredoc key EOF ); ?> @@ -29,21 +29,29 @@ EOF <?php echo $view['translator']->transChoice( '{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples', 10, - array('%count%' => 10) + ['%count%' => 10] +); ?> + +<?php echo $view['translator']->trans('concatenated'.' message'.<<<EOF + with heredoc +EOF +.<<<'EOF' + and nowdoc +EOF ); ?> -<?php echo $view['translator']->trans('other-domain-test-no-params-short-array', array(), 'not_messages'); ?> +<?php echo $view['translator']->trans('other-domain-test-no-params-short-array', [], 'not_messages'); ?> -<?php echo $view['translator']->trans('other-domain-test-no-params-long-array', array(), 'not_messages'); ?> +<?php echo $view['translator']->trans('other-domain-test-no-params-long-array', [], 'not_messages'); ?> -<?php echo $view['translator']->trans('other-domain-test-params-short-array', array('foo' => 'bar'), 'not_messages'); ?> +<?php echo $view['translator']->trans('other-domain-test-params-short-array', ['foo' => 'bar'], 'not_messages'); ?> -<?php echo $view['translator']->trans('other-domain-test-params-long-array', array('foo' => 'bar'), 'not_messages'); ?> +<?php echo $view['translator']->trans('other-domain-test-params-long-array', ['foo' => 'bar'], 'not_messages'); ?> -<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-short-array-%count%', 10, array('%count%' => 10), 'not_messages'); ?> +<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-short-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?> -<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-long-array-%count%', 10, array('%count%' => 10), 'not_messages'); ?> +<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-long-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?> -<?php echo $view['translator']->trans('typecast', array('a' => (int) '123'), 'not_messages'); ?> -<?php echo $view['translator']->transChoice('msg1', 10 + 1, array(), 'not_messages'); ?> -<?php echo $view['translator']->transChoice('msg2', ceil(4.5), array(), 'not_messages'); ?> +<?php echo $view['translator']->trans('typecast', ['a' => (int) '123'], 'not_messages'); ?> +<?php echo $view['translator']->transChoice('msg1', 10 + 1, [], 'not_messages'); ?> +<?php echo $view['translator']->transChoice('msg2', ceil(4.5), [], 'not_messages'); ?> diff --git a/vendor/symfony/translation/Translator.php b/vendor/symfony/translation/Translator.php index 7fcb77853d..8a2b2dd9d0 100644 --- a/vendor/symfony/translation/Translator.php +++ b/vendor/symfony/translation/Translator.php @@ -34,7 +34,7 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran /** * @var MessageCatalogueInterface[] */ - protected $catalogues = array(); + protected $catalogues = []; /** * @var string @@ -44,17 +44,17 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran /** * @var array */ - private $fallbackLocales = array(); + private $fallbackLocales = []; /** * @var LoaderInterface[] */ - private $loaders = array(); + private $loaders = []; /** * @var array */ - private $resources = array(); + private $resources = []; /** * @var MessageFormatterInterface @@ -134,10 +134,10 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran $this->assertValidLocale($locale); - $this->resources[$locale][] = array($format, $resource, $domain); + $this->resources[$locale][] = [$format, $resource, $domain]; if (\in_array($locale, $this->fallbackLocales)) { - $this->catalogues = array(); + $this->catalogues = []; } else { unset($this->catalogues[$locale]); } @@ -170,7 +170,7 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran public function setFallbackLocales(array $locales) { // needed as the fallback locales are linked to the already loaded catalogues - $this->catalogues = array(); + $this->catalogues = []; foreach ($locales as $locale) { $this->assertValidLocale($locale); @@ -194,7 +194,7 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran /** * {@inheritdoc} */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null) + public function trans($id, array $parameters = [], $domain = null, $locale = null) { if (null === $domain) { $domain = 'messages'; @@ -224,7 +224,7 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran * * @deprecated since Symfony 4.2, use the trans() method instead with a %count% parameter */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) + public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null) { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the trans() one instead with a "%%count%%" parameter.', __METHOD__), E_USER_DEPRECATED); @@ -249,7 +249,7 @@ class Translator implements LegacyTranslatorInterface, TranslatorInterface, Tran } if ($this->hasIntlFormatter && $catalogue->defines($id, $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX)) { - return $this->formatter->formatIntl($catalogue->get($id, $domain), $locale, array('%count%' => $number) + $parameters); + return $this->formatter->formatIntl($catalogue->get($id, $domain), $locale, ['%count%' => $number] + $parameters); } return $this->formatter->choiceFormat($catalogue->get($id, $domain), $number, $locale, $parameters); @@ -433,7 +433,7 @@ EOF $parentLocales = \json_decode(\file_get_contents(__DIR__.'/Resources/data/parents.json'), true); } - $locales = array(); + $locales = []; foreach ($this->fallbackLocales as $fallback) { if ($fallback === $locale) { continue; @@ -490,7 +490,7 @@ EOF private function getAllMessages(MessageCatalogueInterface $catalogue): array { - $allMessages = array(); + $allMessages = []; foreach ($catalogue->all() as $domain => $messages) { if ($intlMessages = $catalogue->all($domain.MessageCatalogue::INTL_DOMAIN_SUFFIX)) { diff --git a/vendor/symfony/translation/TranslatorInterface.php b/vendor/symfony/translation/TranslatorInterface.php index 77f14868e6..f677d2455f 100644 --- a/vendor/symfony/translation/TranslatorInterface.php +++ b/vendor/symfony/translation/TranslatorInterface.php @@ -35,7 +35,7 @@ interface TranslatorInterface extends LocaleAwareInterface * * @throws InvalidArgumentException If the locale contains invalid characters */ - public function trans($id, array $parameters = array(), $domain = null, $locale = null); + public function trans($id, array $parameters = [], $domain = null, $locale = null); /** * Translates the given choice message by choosing a translation according to a number. @@ -50,7 +50,7 @@ interface TranslatorInterface extends LocaleAwareInterface * * @throws InvalidArgumentException If the locale contains invalid characters */ - public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null); + public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null); /** * Sets the current locale. diff --git a/vendor/symfony/translation/Util/ArrayConverter.php b/vendor/symfony/translation/Util/ArrayConverter.php index e8b7559dfb..0276294f62 100644 --- a/vendor/symfony/translation/Util/ArrayConverter.php +++ b/vendor/symfony/translation/Util/ArrayConverter.php @@ -27,7 +27,7 @@ class ArrayConverter { /** * Converts linear messages array to tree-like array. - * For example this rray('foo.bar' => 'value') will be converted to array('foo' => array('bar' => 'value')). + * For example this rray('foo.bar' => 'value') will be converted to ['foo' => ['bar' => 'value']]. * * @param array $messages Linear messages array * @@ -35,7 +35,7 @@ class ArrayConverter */ public static function expandToTree(array $messages) { - $tree = array(); + $tree = []; foreach ($messages as $id => $value) { $referenceToElement = &self::getElementByPath($tree, explode('.', $id)); diff --git a/vendor/symfony/translation/Util/XliffUtils.php b/vendor/symfony/translation/Util/XliffUtils.php index 9f024e5985..3ace285bfa 100644 --- a/vendor/symfony/translation/Util/XliffUtils.php +++ b/vendor/symfony/translation/Util/XliffUtils.php @@ -77,7 +77,7 @@ class XliffUtils libxml_clear_errors(); libxml_use_internal_errors($internalErrors); - return array(); + return []; } public static function getErrorsAsString(array $xmlErrors): string @@ -143,16 +143,16 @@ class XliffUtils */ private static function getXmlErrors(bool $internalErrors): array { - $errors = array(); + $errors = []; foreach (libxml_get_errors() as $error) { - $errors[] = array( + $errors[] = [ 'level' => LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', 'code' => $error->code, 'message' => trim($error->message), 'file' => $error->file ?: 'n/a', 'line' => $error->line, 'column' => $error->column, - ); + ]; } libxml_clear_errors(); diff --git a/vendor/symfony/translation/Writer/TranslationWriter.php b/vendor/symfony/translation/Writer/TranslationWriter.php index 762733b4f2..a44d24c136 100644 --- a/vendor/symfony/translation/Writer/TranslationWriter.php +++ b/vendor/symfony/translation/Writer/TranslationWriter.php @@ -23,7 +23,7 @@ use Symfony\Component\Translation\MessageCatalogue; */ class TranslationWriter implements TranslationWriterInterface { - private $dumpers = array(); + private $dumpers = []; /** * Adds a dumper to the writer. @@ -71,7 +71,7 @@ class TranslationWriter implements TranslationWriterInterface * * @throws InvalidArgumentException */ - public function write(MessageCatalogue $catalogue, $format, $options = array()) + public function write(MessageCatalogue $catalogue, $format, $options = []) { if (!isset($this->dumpers[$format])) { throw new InvalidArgumentException(sprintf('There is no dumper associated with format "%s".', $format)); diff --git a/vendor/symfony/translation/Writer/TranslationWriterInterface.php b/vendor/symfony/translation/Writer/TranslationWriterInterface.php index 992ab769a0..b07c08e236 100644 --- a/vendor/symfony/translation/Writer/TranslationWriterInterface.php +++ b/vendor/symfony/translation/Writer/TranslationWriterInterface.php @@ -30,5 +30,5 @@ interface TranslationWriterInterface * * @throws InvalidArgumentException */ - public function write(MessageCatalogue $catalogue, $format, $options = array()); + public function write(MessageCatalogue $catalogue, $format, $options = []); } diff --git a/vendor/symfony/var-exporter/Instantiator.php b/vendor/symfony/var-exporter/Instantiator.php index 0061d76e78..7eefc3c2d2 100644 --- a/vendor/symfony/var-exporter/Instantiator.php +++ b/vendor/symfony/var-exporter/Instantiator.php @@ -57,20 +57,20 @@ final class Instantiator * * @throws ExceptionInterface When the instance cannot be created */ - public static function instantiate(string $class, array $properties = array(), array $privateProperties = array()) + public static function instantiate(string $class, array $properties = [], array $privateProperties = []) { $reflector = Registry::$reflectors[$class] ?? Registry::getClassReflector($class); if (Registry::$cloneable[$class]) { - $wrappedInstance = array(clone Registry::$prototypes[$class]); + $wrappedInstance = [clone Registry::$prototypes[$class]]; } elseif (Registry::$instantiableWithoutConstructor[$class]) { - $wrappedInstance = array($reflector->newInstanceWithoutConstructor()); + $wrappedInstance = [$reflector->newInstanceWithoutConstructor()]; } elseif (null === Registry::$prototypes[$class]) { throw new NotInstantiableTypeException($class); } elseif ($reflector->implementsInterface('Serializable')) { - $wrappedInstance = array(unserialize('C:'.\strlen($class).':"'.$class.'":0:{}')); + $wrappedInstance = [unserialize('C:'.\strlen($class).':"'.$class.'":0:{}')]; } else { - $wrappedInstance = array(unserialize('O:'.\strlen($class).':"'.$class.'":0:{}')); + $wrappedInstance = [unserialize('O:'.\strlen($class).':"'.$class.'":0:{}')]; } if ($properties) { @@ -84,7 +84,7 @@ final class Instantiator foreach ($properties as $name => $value) { // because they're also used for "unserialization", hydrators // deal with array of instances, so we need to wrap values - $properties[$name] = array($value); + $properties[$name] = [$value]; } (Hydrator::$hydrators[$class] ?? Hydrator::getHydrator($class))($properties, $wrappedInstance); } diff --git a/vendor/symfony/var-exporter/Internal/Exporter.php b/vendor/symfony/var-exporter/Internal/Exporter.php index 38a8e25088..fae9084ca0 100644 --- a/vendor/symfony/var-exporter/Internal/Exporter.php +++ b/vendor/symfony/var-exporter/Internal/Exporter.php @@ -53,7 +53,7 @@ class Exporter ++$value->count; continue; } - $refsPool[] = array(&$refs[$k], $value, &$value); + $refsPool[] = [&$refs[$k], $value, &$value]; $refs[$k] = $values[$k] = new Reference(-\count($refsPool), $value); } @@ -74,7 +74,7 @@ class Exporter } $class = \get_class($value); - $properties = array(); + $properties = []; $sleep = null; $arrayValue = (array) $value; $reflector = Registry::$reflectors[$class] ?? Registry::getClassReflector($class); @@ -94,10 +94,10 @@ class Exporter $properties[] = $v; $properties[] = $value[$v]; } - $properties = array('SplObjectStorage' => array("\0" => $properties)); + $properties = ['SplObjectStorage' => ["\0" => $properties]]; } elseif ($value instanceof \Serializable || $value instanceof \__PHP_Incomplete_Class) { ++$objectsCount; - $objectsPool[$value] = array($id = \count($objectsPool), serialize($value), array(), 0); + $objectsPool[$value] = [$id = \count($objectsPool), serialize($value), [], 0]; $value = new Reference($id); goto handle_value; } @@ -154,10 +154,10 @@ class Exporter } } - $objectsPool[$value] = array($id = \count($objectsPool)); + $objectsPool[$value] = [$id = \count($objectsPool)]; $properties = self::prepare($properties, $objectsPool, $refsPool, $objectsCount, $valueIsStatic); ++$objectsCount; - $objectsPool[$value] = array($id, $class, $properties, \method_exists($class, '__wakeup') ? $objectsCount : 0); + $objectsPool[$value] = [$id, $class, $properties, \method_exists($class, '__wakeup') ? $objectsCount : 0]; $value = new Reference($id); @@ -177,7 +177,7 @@ class Exporter { switch (true) { case \is_int($value) || \is_float($value): return var_export($value, true); - case array() === $value: return '[]'; + case [] === $value: return '[]'; case false === $value: return 'false'; case true === $value: return 'true'; case null === $value: return 'null'; @@ -201,11 +201,11 @@ class Exporter $code = var_export($value, true); if (false !== strpos($value, "\n") || false !== strpos($value, "\r")) { - $code = strtr($code, array( + $code = strtr($code, [ "\r\n" => "'.\"\\r\\n\"\n".$subIndent.".'", "\r" => "'.\"\\r\"\n".$subIndent.".'", "\n" => "'.\"\\n\"\n".$subIndent.".'", - )); + ]); } if (false !== strpos($value, "\0")) { @@ -264,8 +264,8 @@ class Exporter private static function exportRegistry(Registry $value, string $indent, string $subIndent): string { $code = ''; - $serializables = array(); - $seen = array(); + $serializables = []; + $seen = []; $prototypesAccess = 0; $factoriesAccess = 0; $r = '\\'.Registry::class; @@ -340,13 +340,13 @@ class Exporter $code .= $subIndent.' '.self::export($class).' => '.self::export($properties, $subIndent.' ').",\n"; } - $code = array( + $code = [ self::export($value->registry, $subIndent), self::export($value->values, $subIndent), '' !== $code ? "[\n".$code.$subIndent.']' : '[]', self::export($value->value, $subIndent), self::export($value->wakeups, $subIndent), - ); + ]; return '\\'.\get_class($value)."::hydrate(\n".$subIndent.implode(",\n".$subIndent, $code)."\n".$indent.')'; } @@ -360,11 +360,11 @@ class Exporter $reflector = $value instanceof \ArrayIterator ? 'ArrayIterator' : 'ArrayObject'; $reflector = Registry::$reflectors[$reflector] ?? Registry::getClassReflector($reflector); - $properties = array( + $properties = [ $arrayValue, $reflector->getMethod('getFlags')->invoke($value), $value instanceof \ArrayObject ? $reflector->getMethod('getIteratorClass')->invoke($value) : 'ArrayIterator', - ); + ]; $reflector = $reflector->getMethod('setFlags'); $reflector->invoke($proto, \ArrayObject::STD_PROP_LIST); @@ -378,13 +378,13 @@ class Exporter } $reflector->invoke($value, $properties[1]); - if (array(array(), 0, 'ArrayIterator') === $properties) { - $properties = array(); + if ([[], 0, 'ArrayIterator'] === $properties) { + $properties = []; } else { if ('ArrayIterator' === $properties[2]) { unset($properties[2]); } - $properties = array($reflector->class => array("\0" => $properties)); + $properties = [$reflector->class => ["\0" => $properties]]; } return $properties; diff --git a/vendor/symfony/var-exporter/Internal/Hydrator.php b/vendor/symfony/var-exporter/Internal/Hydrator.php index a1a60112d9..07721df428 100644 --- a/vendor/symfony/var-exporter/Internal/Hydrator.php +++ b/vendor/symfony/var-exporter/Internal/Hydrator.php @@ -20,7 +20,7 @@ use Symfony\Component\VarExporter\Exception\ClassNotFoundException; */ class Hydrator { - public static $hydrators = array(); + public static $hydrators = []; public $registry; public $values; @@ -77,7 +77,7 @@ class Hydrator switch ($class) { case 'ArrayIterator': case 'ArrayObject': - $constructor = \Closure::fromCallable(array($classReflector->getConstructor(), 'invokeArgs')); + $constructor = \Closure::fromCallable([$classReflector->getConstructor(), 'invokeArgs']); return self::$hydrators[$class] = static function ($properties, $objects) use ($constructor) { foreach ($properties as $name => $values) { @@ -87,7 +87,7 @@ class Hydrator } } } - foreach ($properties["\0"] ?? array() as $i => $v) { + foreach ($properties["\0"] ?? [] as $i => $v) { $constructor($objects[$i], $v); } }; @@ -118,11 +118,11 @@ class Hydrator }; } - $propertySetters = array(); + $propertySetters = []; foreach ($classReflector->getProperties() as $propertyReflector) { if (!$propertyReflector->isStatic()) { $propertyReflector->setAccessible(true); - $propertySetters[$propertyReflector->name] = \Closure::fromCallable(array($propertyReflector, 'setValue')); + $propertySetters[$propertyReflector->name] = \Closure::fromCallable([$propertyReflector, 'setValue']); } } diff --git a/vendor/symfony/var-exporter/Internal/Registry.php b/vendor/symfony/var-exporter/Internal/Registry.php index 705722650a..629836b00b 100644 --- a/vendor/symfony/var-exporter/Internal/Registry.php +++ b/vendor/symfony/var-exporter/Internal/Registry.php @@ -21,11 +21,11 @@ use Symfony\Component\VarExporter\Exception\NotInstantiableTypeException; */ class Registry { - public static $reflectors = array(); - public static $prototypes = array(); - public static $factories = array(); - public static $cloneable = array(); - public static $instantiableWithoutConstructor = array(); + public static $reflectors = []; + public static $prototypes = []; + public static $factories = []; + public static $cloneable = []; + public static $instantiableWithoutConstructor = []; public function __construct(array $classes) { @@ -60,7 +60,7 @@ class Registry { $reflector = self::$reflectors[$class] ?? self::getClassReflector($class, true, false); - return self::$factories[$class] = \Closure::fromCallable(array($reflector, 'newInstanceWithoutConstructor')); + return self::$factories[$class] = \Closure::fromCallable([$reflector, 'newInstanceWithoutConstructor']); } public static function getClassReflector($class, $instantiableWithoutConstructor = false, $cloneable = null) @@ -118,17 +118,17 @@ class Registry static $setTrace; if (null === $setTrace) { - $setTrace = array( + $setTrace = [ new \ReflectionProperty(\Error::class, 'trace'), new \ReflectionProperty(\Exception::class, 'trace'), - ); + ]; $setTrace[0]->setAccessible(true); $setTrace[1]->setAccessible(true); - $setTrace[0] = \Closure::fromCallable(array($setTrace[0], 'setValue')); - $setTrace[1] = \Closure::fromCallable(array($setTrace[1], 'setValue')); + $setTrace[0] = \Closure::fromCallable([$setTrace[0], 'setValue']); + $setTrace[1] = \Closure::fromCallable([$setTrace[1], 'setValue']); } - $setTrace[$proto instanceof \Exception]($proto, array()); + $setTrace[$proto instanceof \Exception]($proto, []); } return self::$reflectors[$class] = $reflector; diff --git a/vendor/symfony/var-exporter/Tests/InstantiatorTest.php b/vendor/symfony/var-exporter/Tests/InstantiatorTest.php index 2cb8e7a359..cae10e3b44 100644 --- a/vendor/symfony/var-exporter/Tests/InstantiatorTest.php +++ b/vendor/symfony/var-exporter/Tests/InstantiatorTest.php @@ -37,30 +37,30 @@ class InstantiatorTest extends TestCase public function provideFailingInstantiation() { - yield array('ReflectionClass'); - yield array('SplHeap'); - yield array('Throwable'); - yield array('Closure'); - yield array('SplFileInfo'); + yield ['ReflectionClass']; + yield ['SplHeap']; + yield ['Throwable']; + yield ['Closure']; + yield ['SplFileInfo']; } public function testInstantiate() { - $this->assertEquals((object) array('p' => 123), Instantiator::instantiate('stdClass', array('p' => 123))); - $this->assertEquals((object) array('p' => 123), Instantiator::instantiate('STDcLASS', array('p' => 123))); - $this->assertEquals(new \ArrayObject(array(123)), Instantiator::instantiate(\ArrayObject::class, array("\0" => array(array(123))))); + $this->assertEquals((object) ['p' => 123], Instantiator::instantiate('stdClass', ['p' => 123])); + $this->assertEquals((object) ['p' => 123], Instantiator::instantiate('STDcLASS', ['p' => 123])); + $this->assertEquals(new \ArrayObject([123]), Instantiator::instantiate(\ArrayObject::class, ["\0" => [[123]]])); - $expected = array( + $expected = [ "\0".__NAMESPACE__."\Bar\0priv" => 123, "\0".__NAMESPACE__."\Foo\0priv" => 234, - ); + ]; - $this->assertSame($expected, (array) Instantiator::instantiate(Bar::class, array('priv' => 123), array(Foo::class => array('priv' => 234)))); + $this->assertSame($expected, (array) Instantiator::instantiate(Bar::class, ['priv' => 123], [Foo::class => ['priv' => 234]])); - $e = Instantiator::instantiate('Exception', array('foo' => 123, 'trace' => array(234))); + $e = Instantiator::instantiate('Exception', ['foo' => 123, 'trace' => [234]]); $this->assertSame(123, $e->foo); - $this->assertSame(array(234), $e->getTrace()); + $this->assertSame([234], $e->getTrace()); } } diff --git a/vendor/symfony/var-exporter/Tests/VarExporterTest.php b/vendor/symfony/var-exporter/Tests/VarExporterTest.php index c34a7e4fb7..5bb03d8ce1 100644 --- a/vendor/symfony/var-exporter/Tests/VarExporterTest.php +++ b/vendor/symfony/var-exporter/Tests/VarExporterTest.php @@ -28,7 +28,7 @@ class VarExporterTest extends TestCase { $unserializeCallback = ini_set('unserialize_callback_func', 'var_dump'); try { - Registry::unserialize(array(), array('O:20:"SomeNotExistingClass":0:{}')); + Registry::unserialize([], ['O:20:"SomeNotExistingClass":0:{}']); } finally { $this->assertSame('var_dump', ini_set('unserialize_callback_func', $unserializeCallback)); } @@ -51,25 +51,25 @@ class VarExporterTest extends TestCase public function provideFailingSerialization() { - yield array(hash_init('md5')); - yield array(new \ReflectionClass('stdClass')); - yield array((new \ReflectionFunction(function (): int {}))->getReturnType()); - yield array(new \ReflectionGenerator((function () { yield 123; })())); - yield array(function () {}); - yield array(function () { yield 123; }); - yield array(new \SplFileInfo(__FILE__)); - yield array($h = fopen(__FILE__, 'r')); - yield array(array($h)); + yield [hash_init('md5')]; + yield [new \ReflectionClass('stdClass')]; + yield [(new \ReflectionFunction(function (): int {}))->getReturnType()]; + yield [new \ReflectionGenerator((function () { yield 123; })())]; + yield [function () {}]; + yield [function () { yield 123; }]; + yield [new \SplFileInfo(__FILE__)]; + yield [$h = fopen(__FILE__, 'r')]; + yield [[$h]]; $a = new class() { }; - yield array($a); + yield [$a]; - $a = array(null, $h); + $a = [null, $h]; $a[0] = &$a; - yield array($a); + yield [$a]; } /** @@ -108,26 +108,26 @@ class VarExporterTest extends TestCase public function provideExport() { - yield array('multiline-string', array("\0\0\r\nA" => "B\rC\n\n"), true); + yield ['multiline-string', ["\0\0\r\nA" => "B\rC\n\n"], true]; - yield array('bool', true, true); - yield array('simple-array', array(123, array('abc')), true); - yield array('partially-indexed-array', array(5 => true, 1 => true, 2 => true, 6 => true), true); - yield array('datetime', \DateTime::createFromFormat('U', 0)); + yield ['bool', true, true]; + yield ['simple-array', [123, ['abc']], true]; + yield ['partially-indexed-array', [5 => true, 1 => true, 2 => true, 6 => true], true]; + yield ['datetime', \DateTime::createFromFormat('U', 0)]; $value = new \ArrayObject(); $value[0] = 1; $value->foo = new \ArrayObject(); $value[1] = $value; - yield array('array-object', $value); + yield ['array-object', $value]; - yield array('array-iterator', new \ArrayIterator(array(123), 1)); - yield array('array-object-custom', new MyArrayObject(array(234))); + yield ['array-iterator', new \ArrayIterator([123], 1)]; + yield ['array-object-custom', new MyArrayObject([234])]; $value = new MySerializable(); - yield array('serializable', array($value, $value)); + yield ['serializable', [$value, $value]]; $value = new MyWakeup(); $value->sub = new MyWakeup(); @@ -135,33 +135,33 @@ class VarExporterTest extends TestCase $value->sub->bis = 123; $value->sub->baz = 123; - yield array('wakeup', $value); + yield ['wakeup', $value]; - yield array('clone', array(new MyCloneable(), new MyNotCloneable())); + yield ['clone', [new MyCloneable(), new MyNotCloneable()]]; - yield array('private', array(new MyPrivateValue(123, 234), new MyPrivateChildValue(123, 234))); + yield ['private', [new MyPrivateValue(123, 234), new MyPrivateChildValue(123, 234)]]; $value = new \SplObjectStorage(); $value[new \stdClass()] = 345; - yield array('spl-object-storage', $value); + yield ['spl-object-storage', $value]; - yield array('incomplete-class', unserialize('O:20:"SomeNotExistingClass":0:{}')); + yield ['incomplete-class', unserialize('O:20:"SomeNotExistingClass":0:{}')]; - $value = array((object) array()); + $value = [(object) []]; $value[1] = &$value[0]; $value[2] = $value[0]; - yield array('hard-references', $value); + yield ['hard-references', $value]; - $value = array(); + $value = []; $value[0] = &$value; - yield array('hard-references-recursive', $value); + yield ['hard-references-recursive', $value]; - static $value = array(123); + static $value = [123]; - yield array('external-references', array(&$value), true); + yield ['external-references', [&$value], true]; unset($value); @@ -169,34 +169,34 @@ class VarExporterTest extends TestCase $rt = new \ReflectionProperty('Error', 'trace'); $rt->setAccessible(true); - $rt->setValue($value, array('file' => __FILE__, 'line' => 123)); + $rt->setValue($value, ['file' => __FILE__, 'line' => 123]); $rl = new \ReflectionProperty('Error', 'line'); $rl->setAccessible(true); $rl->setValue($value, 234); - yield array('error', $value); + yield ['error', $value]; - yield array('var-on-sleep', new GoodNight()); + yield ['var-on-sleep', new GoodNight()]; $value = new FinalError(false); - $rt->setValue($value, array()); + $rt->setValue($value, []); $rl->setValue($value, 123); - yield array('final-error', $value); + yield ['final-error', $value]; - yield array('final-array-iterator', new FinalArrayIterator()); + yield ['final-array-iterator', new FinalArrayIterator()]; - yield array('final-stdclass', new FinalStdClass()); + yield ['final-stdclass', new FinalStdClass()]; $value = new MyWakeup(); $value->bis = new \ReflectionClass($value); - yield array('wakeup-refl', $value); + yield ['wakeup-refl', $value]; - yield array('abstract-parent', new ConcreteClass()); + yield ['abstract-parent', new ConcreteClass()]; - yield array('foo-serializable', new FooSerializable('bar')); + yield ['foo-serializable', new FooSerializable('bar')]; } } @@ -222,7 +222,7 @@ class MyWakeup public function __sleep() { - return array('sub', 'baz'); + return ['sub', 'baz']; } public function __wakeup() @@ -287,7 +287,7 @@ class GoodNight { $this->good = 'night'; - return array('good'); + return ['good']; } } @@ -305,7 +305,7 @@ final class FinalArrayIterator extends \ArrayIterator { public function serialize() { - return serialize(array(123, parent::serialize())); + return serialize([123, parent::serialize()]); } public function unserialize($data) @@ -362,7 +362,7 @@ class FooSerializable implements \Serializable public function serialize(): string { - return serialize(array($this->getFoo())); + return serialize([$this->getFoo()]); } public function unserialize($str) diff --git a/vendor/symfony/var-exporter/VarExporter.php b/vendor/symfony/var-exporter/VarExporter.php index ffe44a3db1..45ef7446b1 100644 --- a/vendor/symfony/var-exporter/VarExporter.php +++ b/vendor/symfony/var-exporter/VarExporter.php @@ -48,13 +48,13 @@ final class VarExporter } $objectsPool = new \SplObjectStorage(); - $refsPool = array(); + $refsPool = []; $objectsCount = 0; try { - $value = Exporter::prepare(array($value), $objectsPool, $refsPool, $objectsCount, $isStaticValue)[0]; + $value = Exporter::prepare([$value], $objectsPool, $refsPool, $objectsCount, $isStaticValue)[0]; } finally { - $references = array(); + $references = []; foreach ($refsPool as $i => $v) { if ($v[0]->count) { $references[1 + $i] = $v[2]; @@ -67,9 +67,9 @@ final class VarExporter return Exporter::export($value); } - $classes = array(); - $values = array(); - $wakeups = array(); + $classes = []; + $values = []; + $wakeups = []; foreach ($objectsPool as $i => $v) { list(, $classes[], $values[], $wakeup) = $objectsPool[$v]; if ($wakeup) { @@ -78,7 +78,7 @@ final class VarExporter } ksort($wakeups); - $properties = array(); + $properties = []; foreach ($values as $i => $vars) { foreach ($vars as $class => $values) { foreach ($values as $name => $v) { |
