From 1ac0672ab1bf9a731cda629f8882a4ace3c23699 Mon Sep 17 00:00:00 2001 From: thePanz Date: Wed, 13 Mar 2024 16:51:17 +0100 Subject: [PATCH] Update: php-cs-fixer, enable short array syntax --- .php-cs-fixer.dist.php | 2 +- data/bin/changelog.php | 4 +- data/bin/release.php | 6 +- data/bin/sandbox_installer.php | 2 +- lib/action/sfAction.class.php | 14 +- lib/action/sfActionStack.class.php | 2 +- lib/action/sfActions.class.php | 4 +- lib/action/sfComponent.class.php | 8 +- lib/addon/sfData.class.php | 8 +- lib/addon/sfPager.class.php | 4 +- lib/autoload/sfAutoload.class.php | 8 +- lib/autoload/sfAutoloadAgain.class.php | 6 +- lib/autoload/sfCoreAutoload.class.php | 8 +- lib/autoload/sfSimpleAutoload.class.php | 18 +- lib/cache/sfAPCCache.class.php | 2 +- lib/cache/sfAPCuCache.class.php | 2 +- lib/cache/sfCache.class.php | 16 +- lib/cache/sfEAcceleratorCache.class.php | 2 +- lib/cache/sfFileCache.class.php | 4 +- lib/cache/sfFunctionCache.class.php | 6 +- lib/cache/sfMemcacheCache.class.php | 10 +- lib/cache/sfSQLiteCache.class.php | 14 +- lib/cache/sfXCacheCache.class.php | 6 +- lib/command/cli.php | 2 +- lib/command/sfAnsiColorFormatter.class.php | 24 +- lib/command/sfCommandApplication.class.php | 46 +- lib/command/sfCommandArgument.class.php | 2 +- lib/command/sfCommandArgumentSet.class.php | 12 +- lib/command/sfCommandLogger.class.php | 4 +- lib/command/sfCommandManager.class.php | 16 +- lib/command/sfCommandOption.class.php | 2 +- lib/command/sfCommandOptionSet.class.php | 16 +- lib/command/sfFormatter.class.php | 4 +- .../sfSymfonyCommandApplication.class.php | 8 +- .../sfApplicationConfiguration.class.php | 56 +- lib/config/sfAutoloadConfigHandler.class.php | 14 +- lib/config/sfCacheConfigHandler.class.php | 10 +- lib/config/sfCompileConfigHandler.class.php | 6 +- lib/config/sfConfig.class.php | 6 +- lib/config/sfConfigCache.class.php | 20 +- lib/config/sfDatabaseConfigHandler.class.php | 14 +- ...sfDefineEnvironmentConfigHandler.class.php | 8 +- lib/config/sfFactoryConfigHandler.class.php | 10 +- lib/config/sfFilterConfigHandler.class.php | 6 +- lib/config/sfGeneratorConfigHandler.class.php | 4 +- lib/config/sfPluginConfiguration.class.php | 28 +- lib/config/sfProjectConfiguration.class.php | 58 +- lib/config/sfRootConfigHandler.class.php | 4 +- lib/config/sfRoutingConfigHandler.class.php | 24 +- lib/config/sfServiceConfigHandler.class.php | 4 +- lib/config/sfViewConfigHandler.class.php | 22 +- lib/config/sfYamlConfigHandler.class.php | 18 +- .../default/templates/defaultLayout.php | 2 +- .../default/templates/disabledSuccess.php | 2 +- .../default/templates/error404Success.php | 2 +- .../default/templates/indexSuccess.php | 2 +- .../default/templates/loginSuccess.php | 2 +- .../default/templates/moduleSuccess.php | 2 +- .../default/templates/secureSuccess.php | 2 +- lib/controller/sfController.class.php | 14 +- lib/controller/sfFrontWebController.class.php | 2 +- lib/controller/sfWebController.class.php | 8 +- lib/database/sfDatabase.class.php | 4 +- lib/database/sfDatabaseManager.class.php | 8 +- lib/database/sfPDODatabase.class.php | 4 +- lib/debug/sfDebug.class.php | 58 +- lib/debug/sfTimerManager.class.php | 4 +- lib/debug/sfWebDebug.class.php | 14 +- lib/debug/sfWebDebugPanel.class.php | 2 +- lib/debug/sfWebDebugPanelConfig.class.php | 4 +- lib/debug/sfWebDebugPanelLogs.class.php | 8 +- lib/debug/sfWebDebugPanelMailer.class.php | 6 +- lib/debug/sfWebDebugPanelTimer.class.php | 4 +- lib/debug/sfWebDebugPanelView.class.php | 30 +- lib/escaper/sfOutputEscaper.class.php | 4 +- .../sfOutputEscaperObjectDecorator.class.php | 4 +- lib/escaper/sfOutputEscaperSafe.class.php | 2 +- lib/event/sfEvent.class.php | 2 +- lib/event/sfEventDispatcher.class.php | 10 +- lib/exception/data/error.json.php | 6 +- lib/exception/data/exception.json.php | 10 +- lib/exception/sfException.class.php | 24 +- lib/filter/sfBasicSecurityFilter.class.php | 4 +- lib/filter/sfCacheFilter.class.php | 8 +- lib/filter/sfCommonFilter.class.php | 2 +- lib/filter/sfFilter.class.php | 6 +- lib/filter/sfFilterChain.class.php | 4 +- lib/form/addon/sfFormObject.class.php | 4 +- lib/form/addon/sfFormSymfony.class.php | 6 +- lib/form/sfForm.class.php | 72 +-- lib/form/sfFormField.class.php | 10 +- lib/form/sfFormFieldSchema.class.php | 6 +- lib/generator/sfGenerator.class.php | 6 +- lib/generator/sfModelGenerator.class.php | 24 +- .../sfModelGeneratorConfiguration.class.php | 154 ++--- ...ModelGeneratorConfigurationField.class.php | 6 +- .../sfModelGeneratorHelper.class.php | 12 +- lib/helper/AssetHelper.php | 34 +- lib/helper/DateHelper.php | 4 +- lib/helper/DebugHelper.php | 2 +- lib/helper/EscapingHelper.php | 4 +- lib/helper/I18NHelper.php | 6 +- lib/helper/JavascriptBaseHelper.php | 8 +- lib/helper/PartialHelper.php | 22 +- lib/helper/TagHelper.php | 10 +- lib/helper/TextHelper.php | 10 +- lib/helper/UrlHelper.php | 30 +- lib/i18n/Gettext/MO.php | 14 +- lib/i18n/Gettext/TGettext.class.php | 16 +- .../sfI18nApplicationExtract.class.php | 8 +- lib/i18n/extract/sfI18nExtract.class.php | 22 +- .../extract/sfI18nModuleExtract.class.php | 4 +- lib/i18n/extract/sfI18nPhpExtractor.class.php | 2 +- .../sfI18nYamlGeneratorExtractor.class.php | 10 +- .../sfI18nYamlValidateExtractor.class.php | 2 +- lib/i18n/sfChoiceFormat.class.php | 8 +- lib/i18n/sfCultureInfo.class.php | 28 +- lib/i18n/sfDateFormat.class.php | 16 +- lib/i18n/sfDateTimeFormatInfo.class.php | 8 +- lib/i18n/sfI18N.class.php | 36 +- lib/i18n/sfMessageFormat.class.php | 14 +- lib/i18n/sfMessageSource.class.php | 10 +- lib/i18n/sfMessageSource_Aggregate.class.php | 10 +- lib/i18n/sfMessageSource_Database.class.php | 8 +- lib/i18n/sfMessageSource_File.class.php | 6 +- lib/i18n/sfMessageSource_MySQL.class.php | 6 +- lib/i18n/sfMessageSource_SQLite.class.php | 6 +- lib/i18n/sfMessageSource_SQLite3.class.php | 6 +- lib/i18n/sfMessageSource_XLIFF.class.php | 6 +- lib/i18n/sfMessageSource_gettext.class.php | 10 +- lib/i18n/sfNumberFormatInfo.class.php | 16 +- lib/log/sfAggregateLogger.class.php | 10 +- lib/log/sfConsoleLogger.class.php | 2 +- lib/log/sfEventLogger.class.php | 4 +- lib/log/sfFileLogger.class.php | 14 +- lib/log/sfLogger.class.php | 14 +- lib/log/sfNoLogger.class.php | 2 +- lib/log/sfPsrLoggerAdapter.class.php | 12 +- lib/log/sfStreamLogger.class.php | 2 +- lib/log/sfVarLogger.class.php | 16 +- lib/log/sfWebDebugLogger.class.php | 24 +- lib/mailer/sfMailer.class.php | 12 +- .../sfMailerMessageLoggerPlugin.class.php | 6 +- lib/plugin/sfPearConfig.class.php | 2 +- lib/plugin/sfPearEnvironment.class.php | 8 +- lib/plugin/sfPearFrontendPlugin.class.php | 2 +- lib/plugin/sfPearRest.class.php | 2 +- lib/plugin/sfPearRest10.class.php | 2 +- lib/plugin/sfPearRest11.class.php | 2 +- lib/plugin/sfPearRestPlugin.class.php | 10 +- lib/plugin/sfPluginManager.class.php | 56 +- lib/plugin/sfSymfonyPluginManager.class.php | 8 +- .../sfDoctrinePluginConfiguration.class.php | 16 +- .../lib/cli/sfDoctrineCli.class.php | 2 +- .../sfDoctrineConnectionProfiler.class.php | 20 +- .../lib/database/sfDoctrineDatabase.class.php | 12 +- .../debug/sfWebDebugPanelDoctrine.class.php | 4 +- .../lib/form/sfFormDoctrine.class.php | 10 +- .../lib/form/sfFormFilterDoctrine.class.php | 6 +- .../lib/generator/sfDoctrineColumn.class.php | 6 +- .../sfDoctrineFormFilterGenerator.class.php | 12 +- .../sfDoctrineFormGenerator.class.php | 38 +- .../generator/sfDoctrineGenerator.class.php | 32 +- .../lib/pager/sfDoctrinePager.class.php | 2 +- .../lib/record/sfDoctrineRecord.class.php | 10 +- .../lib/routing/sfDoctrineRoute.class.php | 6 +- .../lib/task/sfDoctrineBaseTask.class.php | 16 +- .../lib/task/sfDoctrineBuildDbTask.class.php | 12 +- .../task/sfDoctrineBuildFiltersTask.class.php | 14 +- .../task/sfDoctrineBuildFormsTask.class.php | 14 +- .../task/sfDoctrineBuildModelTask.class.php | 20 +- .../task/sfDoctrineBuildSchemaTask.class.php | 6 +- .../lib/task/sfDoctrineBuildSqlTask.class.php | 6 +- .../lib/task/sfDoctrineBuildTask.class.php | 26 +- .../sfDoctrineCleanModelFilesTask.class.php | 14 +- .../lib/task/sfDoctrineCompileTask.class.php | 12 +- .../sfDoctrineConfigureDatabaseTask.class.php | 18 +- .../sfDoctrineCreateModelTablesTask.class.php | 14 +- .../lib/task/sfDoctrineDataDumpTask.class.php | 14 +- .../lib/task/sfDoctrineDataLoadTask.class.php | 14 +- .../sfDoctrineDeleteModelFilesTask.class.php | 24 +- .../lib/task/sfDoctrineDqlTask.class.php | 18 +- .../lib/task/sfDoctrineDropDbTask.class.php | 14 +- .../sfDoctrineGenerateAdminTask.class.php | 16 +- .../sfDoctrineGenerateMigrationTask.class.php | 16 +- ...DoctrineGenerateMigrationsDbTask.class.php | 10 +- ...ctrineGenerateMigrationsDiffTask.class.php | 12 +- ...rineGenerateMigrationsModelsTask.class.php | 6 +- ...ctrineGenerateModuleForRouteTask.class.php | 14 +- .../sfDoctrineGenerateModuleTask.class.php | 24 +- .../task/sfDoctrineInsertSqlTask.class.php | 6 +- .../lib/task/sfDoctrineMigrateTask.class.php | 12 +- .../lib/test/sfTesterDoctrine.class.php | 2 +- .../sfValidatorDoctrineChoice.class.php | 12 +- .../sfValidatorDoctrineUnique.class.php | 12 +- .../sfWidgetFormDoctrineArrayChoice.class.php | 10 +- .../sfWidgetFormDoctrineChoice.class.php | 10 +- .../sfDoctrinePlugin/test/bin/prove.php | 4 +- .../test/functional/AdminGenBrowser.class.php | 46 +- .../test/functional/FormGeneratorTest.php | 2 +- .../test/functional/FormTest.php | 48 +- .../test/functional/I18nTest.php | 102 ++-- .../test/functional/RouteTest.php | 30 +- .../test/functional/SchemaMergeTest.php | 8 +- .../test/functional/Ticket/5269Test.php | 4 +- .../test/functional/UniqueTest.php | 4 +- .../test/functional/UploadTest.php | 12 +- .../articles/templates/editSuccess.php | 2 +- .../config/ProjectConfiguration.class.php | 12 +- .../lib/form/doctrine/ArticleForm.class.php | 2 +- .../form/doctrine/AttachmentForm.class.php | 10 +- .../lib/model/doctrine/AuthorTable.class.php | 2 +- .../test/unit/form/sfFormDoctrineTest.php | 46 +- .../unit/form/sfFormFilterDoctrineTest.php | 56 +- .../test/unit/sfDoctrineColumnTest.php | 8 +- .../test/unit/sfDoctrineDatabaseTest.php | 8 +- .../sfValidatorDoctrineChoiceTest.php | 2 +- .../sfWidgetFormDoctrineArrayChoiceTest.php | 8 +- .../widget/sfWidgetFormDoctrineChoiceTest.php | 14 +- lib/request/sfRequest.class.php | 12 +- lib/request/sfWebRequest.class.php | 38 +- lib/response/sfResponse.class.php | 12 +- lib/response/sfWebResponse.class.php | 58 +- lib/routing/sfObjectRoute.class.php | 20 +- lib/routing/sfObjectRouteCollection.class.php | 84 +-- lib/routing/sfPatternRouting.class.php | 46 +- lib/routing/sfRequestRoute.class.php | 10 +- lib/routing/sfRoute.class.php | 60 +- lib/routing/sfRouteCollection.class.php | 4 +- lib/routing/sfRouting.class.php | 18 +- lib/service/sfServiceContainer.class.php | 16 +- .../sfServiceContainerBuilder.class.php | 18 +- .../sfServiceContainerDumper.class.php | 2 +- ...sfServiceContainerDumperGraphviz.class.php | 42 +- ...fServiceContainerDumperInterface.class.php | 2 +- .../sfServiceContainerDumperPhp.class.php | 18 +- .../sfServiceContainerLoaderArray.class.php | 12 +- lib/service/sfServiceDefinition.class.php | 14 +- lib/storage/sfCacheSessionStorage.class.php | 24 +- .../sfDatabaseSessionStorage.class.php | 18 +- lib/storage/sfSessionStorage.class.php | 4 +- lib/storage/sfSessionTestStorage.class.php | 12 +- lib/storage/sfStorage.class.php | 12 +- lib/task/app/sfAppRoutesTask.class.php | 8 +- lib/task/cache/sfCacheClearTask.class.php | 18 +- .../configure/sfConfigureAuthorTask.class.php | 8 +- .../generator/sfGenerateAppTask.class.php | 24 +- .../generator/sfGenerateModuleTask.class.php | 10 +- .../generator/sfGenerateProjectTask.class.php | 18 +- .../generator/sfGenerateTaskTask.class.php | 10 +- lib/task/help/sfHelpTask.class.php | 12 +- lib/task/help/sfListTask.class.php | 16 +- lib/task/i18n/sfI18nExtractTask.class.php | 10 +- lib/task/i18n/sfI18nFindTask.class.php | 18 +- lib/task/log/sfLogClearTask.class.php | 2 +- lib/task/log/sfLogRotateTask.class.php | 10 +- .../plugin/sfPluginAddChannelTask.class.php | 6 +- lib/task/plugin/sfPluginInstallTask.class.php | 12 +- lib/task/plugin/sfPluginListTask.class.php | 2 +- .../sfPluginPublishAssetsTask.class.php | 14 +- .../plugin/sfPluginUninstallTask.class.php | 10 +- lib/task/plugin/sfPluginUpgradeTask.class.php | 10 +- .../sfProjectClearControllersTask.class.php | 2 +- .../project/sfProjectDeployTask.class.php | 12 +- .../project/sfProjectDisableTask.class.php | 8 +- .../project/sfProjectEnableTask.class.php | 10 +- .../project/sfProjectOptimizeTask.class.php | 24 +- .../sfProjectPermissionsTask.class.php | 12 +- .../project/sfProjectSendEmailsTask.class.php | 6 +- .../project/sfProjectValidateTask.class.php | 6 +- .../sfDeprecatedClassesValidation.class.php | 16 +- ...atedConfigurationFilesValidation.class.php | 10 +- .../sfDeprecatedHelpersValidation.class.php | 16 +- .../sfDeprecatedMethodsValidation.class.php | 22 +- .../sfDeprecatedPluginsValidation.class.php | 8 +- .../sfDeprecatedSettingsValidation.class.php | 16 +- .../sfParameterHolderValidation.class.php | 10 +- .../project/validation/sfValidation.class.php | 6 +- lib/task/sfBaseTask.class.php | 22 +- lib/task/sfCommandApplicationTask.class.php | 4 +- lib/task/sfFilesystem.class.php | 26 +- lib/task/sfTask.class.php | 48 +- lib/task/symfony/lime_symfony.php | 4 +- lib/task/symfony/sfSymfonyTestTask.class.php | 16 +- lib/task/test/sfLimeHarness.class.php | 4 +- lib/task/test/sfTestAllTask.class.php | 12 +- lib/task/test/sfTestBaseTask.class.php | 2 +- lib/task/test/sfTestCoverageTask.class.php | 18 +- lib/task/test/sfTestFunctionalTask.class.php | 18 +- lib/task/test/sfTestPluginTask.class.php | 12 +- lib/task/test/sfTestUnitTask.class.php | 18 +- lib/test/sfTestBrowser.class.php | 2 +- lib/test/sfTestFunctional.class.php | 6 +- lib/test/sfTestFunctionalBase.class.php | 34 +- lib/test/sfTester.class.php | 2 +- lib/test/sfTesterForm.class.php | 2 +- lib/test/sfTesterMailer.class.php | 2 +- lib/test/sfTesterResponse.class.php | 14 +- lib/user/sfBasicSecurityUser.class.php | 16 +- lib/user/sfUser.class.php | 22 +- lib/util/sfBrowser.class.php | 8 +- lib/util/sfBrowserBase.class.php | 92 +-- lib/util/sfClassManipulator.class.php | 10 +- lib/util/sfContext.class.php | 18 +- lib/util/sfDomCssSelector.class.php | 42 +- lib/util/sfFinder.class.php | 32 +- lib/util/sfInflector.class.php | 6 +- .../sfNamespacedParameterHolder.class.php | 18 +- lib/util/sfParameterHolder.class.php | 4 +- lib/util/sfToolkit.class.php | 22 +- .../sfValidatorI18nChoiceCountry.class.php | 2 +- .../sfValidatorI18nChoiceLanguage.class.php | 2 +- .../sfValidatorI18nChoiceTimezone.class.php | 2 +- lib/validator/sfValidatedFile.class.php | 4 +- lib/validator/sfValidatorAnd.class.php | 8 +- lib/validator/sfValidatorBase.class.php | 26 +- lib/validator/sfValidatorBoolean.class.php | 8 +- lib/validator/sfValidatorCSRFToken.class.php | 2 +- lib/validator/sfValidatorCallback.class.php | 4 +- lib/validator/sfValidatorChoice.class.php | 14 +- lib/validator/sfValidatorDate.class.php | 22 +- lib/validator/sfValidatorDateRange.class.php | 4 +- lib/validator/sfValidatorDateTime.class.php | 2 +- lib/validator/sfValidatorDecorator.class.php | 2 +- lib/validator/sfValidatorEmail.class.php | 2 +- lib/validator/sfValidatorEqual.class.php | 4 +- lib/validator/sfValidatorError.class.php | 8 +- .../sfValidatorErrorSchema.class.php | 14 +- lib/validator/sfValidatorFile.class.php | 28 +- lib/validator/sfValidatorFileMulti.class.php | 2 +- .../sfValidatorFromDescription.class.php | 38 +- lib/validator/sfValidatorInteger.class.php | 8 +- lib/validator/sfValidatorIp.class.php | 4 +- lib/validator/sfValidatorNumber.class.php | 8 +- lib/validator/sfValidatorOr.class.php | 8 +- lib/validator/sfValidatorRegex.class.php | 4 +- lib/validator/sfValidatorSchema.class.php | 16 +- .../sfValidatorSchemaCompare.class.php | 8 +- .../sfValidatorSchemaFilter.class.php | 4 +- lib/validator/sfValidatorString.class.php | 6 +- lib/validator/sfValidatorTime.class.php | 16 +- lib/validator/sfValidatorUrl.class.php | 6 +- lib/view/sfPHPView.class.php | 8 +- lib/view/sfPartialView.class.php | 2 +- lib/view/sfView.class.php | 20 +- lib/view/sfViewCacheManager.class.php | 72 +-- lib/view/sfViewParameterHolder.class.php | 12 +- .../sfWidgetFormI18nChoiceCountry.class.php | 4 +- .../sfWidgetFormI18nChoiceCurrency.class.php | 4 +- .../sfWidgetFormI18nChoiceLanguage.class.php | 4 +- .../sfWidgetFormI18nChoiceTimezone.class.php | 4 +- .../i18n/sfWidgetFormI18nDate.class.php | 6 +- .../i18n/sfWidgetFormI18nDateTime.class.php | 12 +- .../i18n/sfWidgetFormI18nTime.class.php | 6 +- lib/widget/sfWidget.class.php | 20 +- lib/widget/sfWidgetForm.class.php | 18 +- lib/widget/sfWidgetFormChoice.class.php | 8 +- lib/widget/sfWidgetFormChoiceBase.class.php | 4 +- lib/widget/sfWidgetFormDate.class.php | 18 +- lib/widget/sfWidgetFormDateRange.class.php | 12 +- lib/widget/sfWidgetFormDateTime.class.php | 20 +- lib/widget/sfWidgetFormFilterDate.class.php | 14 +- lib/widget/sfWidgetFormFilterInput.class.php | 16 +- lib/widget/sfWidgetFormInput.class.php | 6 +- .../sfWidgetFormInputCheckbox.class.php | 6 +- lib/widget/sfWidgetFormInputFile.class.php | 2 +- .../sfWidgetFormInputFileEditable.class.php | 12 +- .../sfWidgetFormInputFileMulti.class.php | 4 +- lib/widget/sfWidgetFormInputHidden.class.php | 2 +- .../sfWidgetFormInputPassword.class.php | 4 +- lib/widget/sfWidgetFormInputRead.class.php | 12 +- lib/widget/sfWidgetFormInputText.class.php | 2 +- lib/widget/sfWidgetFormSchema.class.php | 44 +- .../sfWidgetFormSchemaDecorator.class.php | 6 +- .../sfWidgetFormSchemaFormatter.class.php | 24 +- lib/widget/sfWidgetFormSelect.class.php | 18 +- .../sfWidgetFormSelectCheckbox.class.php | 28 +- lib/widget/sfWidgetFormSelectMany.class.php | 2 +- lib/widget/sfWidgetFormSelectRadio.class.php | 26 +- lib/widget/sfWidgetFormTextarea.class.php | 6 +- lib/widget/sfWidgetFormTime.class.php | 18 +- lib/yaml/sfYaml.class.php | 4 +- lib/yaml/sfYamlInline.class.php | 40 +- lib/yaml/sfYamlParser.class.php | 14 +- test/bin/loc.php | 4 +- test/bootstrap/functional.php | 2 +- test/bootstrap/task.php | 4 +- test/bootstrap/unit.php | 4 +- test/functional/cacheTest.php | 50 +- .../modules/cache/templates/multiSuccess.php | 12 +- .../templates/specificCacheKeySuccess.php | 8 +- .../config/frontendConfiguration.class.php | 6 +- .../modules/escaping/templates/_partial1.php | 2 +- .../escaping/templates/indexSuccess.php | 2 +- .../modules/i18n/actions/actions.class.php | 4 +- .../i18n/modules/i18n/lib/I18nForm.class.php | 16 +- .../modules/i18n/templates/indexSuccess.php | 4 +- .../config/ProjectConfiguration.class.php | 2 +- test/functional/i18nFormTest.php | 30 +- test/functional/sfTestBrowserTest.php | 4 +- .../fixtures/task/myPluginTask.class.php | 2 +- test/unit/action/sfComponentTest.php | 8 +- test/unit/addon/sfPagerTest.php | 2 +- test/unit/cache/sfCacheDriverTests.class.php | 26 +- test/unit/cache/sfCacheTest.php | 2 +- test/unit/cache/sfFileCacheTest.php | 2 +- test/unit/cache/sfFunctionCacheTest.php | 18 +- test/unit/cache/sfMemcacheCacheTest.php | 4 +- test/unit/cache/sfSQLiteCacheTest.php | 6 +- .../unit/command/sfCommandArgumentSetTest.php | 44 +- test/unit/command/sfCommandArgumentTest.php | 4 +- test/unit/command/sfCommandManagerTest.php | 28 +- test/unit/command/sfCommandOptionSetTest.php | 48 +- test/unit/command/sfCommandOptionTest.php | 6 +- .../config/sfCompileConfigHandlerTest.php | 4 +- test/unit/config/sfConfigHandlerTest.php | 10 +- test/unit/config/sfConfigTest.php | 4 +- .../sfDefineEnvironmentConfigHandlerTest.php | 6 +- .../unit/config/sfFilterConfigHandlerTest.php | 26 +- .../config/sfGeneratorConfigHandlerTest.php | 20 +- .../unit/config/sfPluginConfigurationTest.php | 28 +- .../config/sfProjectConfigurationTest.php | 8 +- .../config/sfSimpleYamlConfigHandlerTest.php | 4 +- test/unit/config/sfViewConfigHandlerTest.php | 328 +++++------ test/unit/config/sfYamlConfigHandlerTest.php | 32 +- test/unit/controller/sfWebControllerTest.php | 122 ++-- test/unit/debug/sfDebugTest.php | 4 +- test/unit/debug/sfWebDebugTest.php | 2 +- .../sfOutputEscaperArrayDecoratorTest.php | 4 +- .../sfOutputEscaperObjectDecoratorTest.php | 2 +- test/unit/escaper/sfOutputEscaperSafeTest.php | 6 +- test/unit/escaper/sfOutputEscaperTest.php | 20 +- test/unit/event/sfEventDispatcherTest.php | 36 +- test/unit/event/sfEventTest.php | 2 +- test/unit/exception/sfExceptionsTest.php | 10 +- test/unit/filter/sfFilterTest.php | 2 +- test/unit/form/addon/sfFormSymfonyTest.php | 20 +- test/unit/form/sfFormFieldSchemaTest.php | 26 +- test/unit/form/sfFormFieldTest.php | 26 +- test/unit/form/sfFormTest.php | 556 +++++++++--------- test/unit/generator/sfGeneratorTest.php | 2 +- ...sfModelGeneratorConfigurationFieldTest.php | 8 +- test/unit/helper/AssetHelperTest.php | 54 +- test/unit/helper/DateHelperTest.php | 2 +- test/unit/helper/JavascriptBaseHelperTest.php | 6 +- test/unit/helper/TagHelperTest.php | 8 +- test/unit/helper/TextHelperTest.php | 4 +- test/unit/helper/UrlHelperTest.php | 46 +- test/unit/i18n/dataTest.php | 22 +- test/unit/i18n/extract/sfI18nExtractTest.php | 4 +- .../i18n/extract/sfI18nPhpExtractorTest.php | 12 +- .../sfI18nYamlGeneratorExtractorTest.php | 6 +- .../sfI18nYamlValidateExtractorTest.php | 4 +- test/unit/i18n/sfChoiceFormatTest.php | 98 +-- test/unit/i18n/sfCultureInfoTest.php | 20 +- test/unit/i18n/sfI18NTest.php | 46 +- .../i18n/sfMessageSource_AggregateTest.php | 2 +- test/unit/i18n/sfMessageSource_FileTest.php | 4 +- test/unit/i18n/sfMessageSource_SQLiteTest.php | 4 +- test/unit/i18n/sfNumberFormatInfoTest.php | 26 +- test/unit/log/sfAggregateLoggerTest.php | 18 +- test/unit/log/sfFileLoggerTest.php | 10 +- test/unit/log/sfLoggerTest.php | 12 +- test/unit/log/sfStreamLoggerTest.php | 2 +- test/unit/log/sfWebDebugLoggerTest.php | 2 +- test/unit/mailer/fixtures/TestSpool.class.php | 6 +- test/unit/mailer/sfMailerTest.php | 66 +-- .../plugin/sfPearDownloaderTest.class.php | 2 +- test/unit/plugin/sfPearEnvironmentTest.php | 6 +- test/unit/plugin/sfPearRestPluginTest.php | 10 +- test/unit/plugin/sfPearRestTest.class.php | 6 +- test/unit/plugin/sfPluginManagerTest.php | 28 +- test/unit/plugin/sfPluginTestHelper.class.php | 2 +- test/unit/request/sfRequestTest.php | 12 +- test/unit/request/sfWebRequestTest.php | 122 ++-- test/unit/response/sfResponseTest.php | 2 +- test/unit/response/sfWebResponseTest.php | 64 +- .../routing/sfObjectRouteCollectionTest.php | 46 +- test/unit/routing/sfObjectRouteTest.php | 6 +- test/unit/routing/sfPatternRoutingTest.php | 340 +++++------ test/unit/routing/sfRequestRouteTest.php | 30 +- test/unit/routing/sfRouteTest.php | 172 +++--- .../fixtures/containers/container8.php | 6 +- .../fixtures/containers/container9.php | 14 +- test/unit/service/fixtures/includes/foo.php | 6 +- .../service/sfServiceContainerBuilderTest.php | 38 +- .../sfServiceContainerDumperGraphvizTest.php | 16 +- .../sfServiceContainerDumperPhpTest.php | 2 +- .../sfServiceContainerLoaderArrayTest.php | 18 +- .../service/sfServiceContainerLoaderTest.php | 36 +- test/unit/service/sfServiceContainerTest.php | 34 +- test/unit/service/sfServiceDefinitionTest.php | 18 +- test/unit/sfContextMock.class.php | 6 +- test/unit/sfEventDispatcherTest.class.php | 2 +- test/unit/sfNoRouting.class.php | 8 +- .../storage/sfCacheSessionStorageTest.php | 2 +- test/unit/storage/sfMySQLStorageTest.php | 8 +- test/unit/storage/sfMySQLiStorageTest.php | 8 +- test/unit/storage/sfPDOSessionStorageTest.php | 4 +- test/unit/task/cache/sfCacheClearTaskTest.php | 4 +- test/unit/task/sfBaseTaskTest.php | 4 +- test/unit/task/sfTaskTest.php | 72 +-- test/unit/test/limeTestTest.php | 4 +- test/unit/test/sfTestFunctionalTest.php | 6 +- test/unit/user/sfBasicSecurityUserTest.php | 32 +- test/unit/user/sfUserTest.php | 16 +- test/unit/util/sfBrowserTest.php | 54 +- test/unit/util/sfCallableTest.php | 4 +- test/unit/util/sfClassManipulatorTest.php | 42 +- test/unit/util/sfDomCssSelectorTest.php | 138 ++--- test/unit/util/sfFinderTest.php | 52 +- .../util/sfNamespacedParameterHolderTest.php | 16 +- test/unit/util/sfParameterHolderTest.php | 12 +- test/unit/util/sfToolkitTest.php | 84 +-- .../i18n/sfValidatorI18nChoiceCountryTest.php | 8 +- .../sfValidatorI18nChoiceLanguageTest.php | 8 +- test/unit/validator/sfValidatorAndTest.php | 24 +- test/unit/validator/sfValidatorBaseTest.php | 32 +- .../validator/sfValidatorCSRFTokenTest.php | 2 +- .../validator/sfValidatorCallbackTest.php | 6 +- test/unit/validator/sfValidatorChoiceTest.php | 18 +- .../validator/sfValidatorDateRangeTest.php | 28 +- test/unit/validator/sfValidatorDateTest.php | 46 +- .../validator/sfValidatorDateTimeTest.php | 2 +- .../validator/sfValidatorDecoratorTest.php | 18 +- test/unit/validator/sfValidatorEmailTest.php | 8 +- test/unit/validator/sfValidatorEqualTest.php | 2 +- .../validator/sfValidatorErrorSchemaTest.php | 26 +- test/unit/validator/sfValidatorErrorTest.php | 10 +- .../validator/sfValidatorFileMultiTest.php | 8 +- test/unit/validator/sfValidatorFileTest.php | 26 +- .../sfValidatorFromDescriptionTest.php | 4 +- test/unit/validator/sfValidatorIpTest.php | 42 +- test/unit/validator/sfValidatorOrTest.php | 24 +- test/unit/validator/sfValidatorRegexTest.php | 12 +- .../sfValidatorSchemaCompareTest.php | 102 ++-- .../validator/sfValidatorSchemaFilterTest.php | 6 +- test/unit/validator/sfValidatorSchemaTest.php | 170 +++--- test/unit/validator/sfValidatorTimeTest.php | 24 +- test/unit/validator/sfValidatorUrlTest.php | 10 +- test/unit/view/sfViewCacheManagerTest.php | 26 +- test/unit/view/sfViewParameterHolderTest.php | 12 +- test/unit/view/sfViewTest.php | 6 +- .../sfWidgetFormI18nChoiceCountryTest.php | 12 +- .../sfWidgetFormI18nChoiceCurrencyTest.php | 12 +- .../sfWidgetFormI18nChoiceLanguageTest.php | 12 +- .../sfWidgetFormI18nChoiceTimezoneTest.php | 4 +- .../widget/i18n/sfWidgetFormI18nDateTest.php | 14 +- .../i18n/sfWidgetFormI18nDateTimeTest.php | 2 +- .../widget/i18n/sfWidgetFormI18nTimeTest.php | 4 +- test/unit/widget/sfWidgetFormChoiceTest.php | 28 +- .../unit/widget/sfWidgetFormDateRangeTest.php | 10 +- test/unit/widget/sfWidgetFormDateTest.php | 28 +- test/unit/widget/sfWidgetFormDateTimeTest.php | 34 +- .../widget/sfWidgetFormFilterDateTest.php | 6 +- .../widget/sfWidgetFormFilterInputTest.php | 2 +- .../widget/sfWidgetFormInputCheckboxTest.php | 6 +- .../sfWidgetFormInputFileEditableTest.php | 26 +- .../unit/widget/sfWidgetFormInputReadTest.php | 8 +- .../unit/widget/sfWidgetFormInputTextTest.php | 6 +- .../sfWidgetFormSchemaDecoratorTest.php | 6 +- .../sfWidgetFormSchemaFormatterListTest.php | 4 +- .../sfWidgetFormSchemaFormatterTableTest.php | 4 +- .../sfWidgetFormSchemaFormatterTest.php | 34 +- test/unit/widget/sfWidgetFormSchemaTest.php | 166 +++--- .../widget/sfWidgetFormSelectCheckboxTest.php | 40 +- .../widget/sfWidgetFormSelectManyTest.php | 2 +- .../widget/sfWidgetFormSelectRadioTest.php | 28 +- test/unit/widget/sfWidgetFormSelectTest.php | 38 +- test/unit/widget/sfWidgetFormTest.php | 30 +- test/unit/widget/sfWidgetFormTimeTest.php | 22 +- test/unit/widget/sfWidgetTest.php | 44 +- test/unit/yaml/sfYamlDumperTest.php | 22 +- test/unit/yaml/sfYamlInlineTest.php | 62 +- test/unit/yaml/sfYamlParserTest.php | 6 +- 575 files changed, 5188 insertions(+), 5188 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index f5e11f987..dae6b4fd5 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -19,7 +19,7 @@ '@PhpCsFixer' => true, '@Symfony' => true, 'array_syntax' => array( - 'syntax' => 'long', + 'syntax' => 'short', ), )) ->setCacheFile('.php-cs-fixer.cache') diff --git a/data/bin/changelog.php b/data/bin/changelog.php index 4eaf5868a..6a3218a4b 100644 --- a/data/bin/changelog.php +++ b/data/bin/changelog.php @@ -36,10 +36,10 @@ list($out, $err) = $filesystem->execute('svn info --xml'); $info = new SimpleXMLElement($out); -list($out, $err) = $filesystem->execute(vsprintf('svn log %s --xml %s', array_map('escapeshellarg', array( +list($out, $err) = $filesystem->execute(vsprintf('svn log %s --xml %s', array_map('escapeshellarg', [ $argv[1], (string) $info->entry->repository->root.$argv[2], -)))); +]))); $log = new SimpleXMLElement($out); foreach ($log->logentry as $logentry) { diff --git a/data/bin/release.php b/data/bin/release.php index df6dec94f..ad652a3bf 100644 --- a/data/bin/release.php +++ b/data/bin/release.php @@ -73,7 +73,7 @@ // add class files $finder = sfFinder::type('file')->relative(); $xml_classes = ''; -$dirs = array('lib' => 'php', 'data' => 'data'); +$dirs = ['lib' => 'php', 'data' => 'data']; foreach ($dirs as $dir => $role) { $class_files = $finder->in($dir); foreach ($class_files as $file) { @@ -82,12 +82,12 @@ } // replace tokens -$filesystem->replaceTokens(getcwd().DIRECTORY_SEPARATOR.'package.xml', '##', '##', array( +$filesystem->replaceTokens(getcwd().DIRECTORY_SEPARATOR.'package.xml', '##', '##', [ 'SYMFONY_VERSION' => $version, 'CURRENT_DATE' => date('Y-m-d'), 'CLASS_FILES' => $xml_classes, 'STABILITY' => $stability, -)); +]); list($results) = $filesystem->execute('pear package'); echo $results; diff --git a/data/bin/sandbox_installer.php b/data/bin/sandbox_installer.php index 576b28c01..3f35604aa 100644 --- a/data/bin/sandbox_installer.php +++ b/data/bin/sandbox_installer.php @@ -23,7 +23,7 @@ chmod(sfConfig::get('sf_data_dir').'/sandbox.db', 0777); $this->logSection('install', 'add an empty file in empty directories'); -$seen = array(); +$seen = []; foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator(sfConfig::get('sf_root_dir')), RecursiveIteratorIterator::CHILD_FIRST) as $path => $item) { if (!isset($seen[$path]) && $item->isDir() && !$item->isLink()) { touch($item->getRealPath().'/.sf'); diff --git a/lib/action/sfAction.class.php b/lib/action/sfAction.class.php index ae969441e..cabab27f0 100644 --- a/lib/action/sfAction.class.php +++ b/lib/action/sfAction.class.php @@ -20,7 +20,7 @@ */ abstract class sfAction extends sfComponent { - protected $security = array(); + protected $security = []; /** * Initializes this action. @@ -122,7 +122,7 @@ public function redirect404() public function forward($module, $action) { if (sfConfig::get('sf_logging_enabled')) { - $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Forward to action "%s/%s"', $module, $action)))); + $this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Forward to action "%s/%s"', $module, $action)])); } $this->getController()->forward($module, $action); @@ -184,7 +184,7 @@ public function redirect($url, $statusCode = 302) { // compatibility with url_for2() style signature if (is_object($statusCode) || is_array($statusCode)) { - $url = array_merge(array('sf_route' => $url), is_object($statusCode) ? array('sf_subject' => $statusCode) : $statusCode); + $url = array_merge(['sf_route' => $url], is_object($statusCode) ? ['sf_subject' => $statusCode] : $statusCode); $statusCode = func_num_args() >= 3 ? func_get_arg(2) : 302; } @@ -211,7 +211,7 @@ public function redirectIf($condition, $url, $statusCode = 302) if ($condition) { // compatibility with url_for2() style signature $arguments = func_get_args(); - call_user_func_array(array($this, 'redirect'), array_slice($arguments, 1)); + call_user_func_array([$this, 'redirect'], array_slice($arguments, 1)); } } @@ -233,7 +233,7 @@ public function redirectUnless($condition, $url, $statusCode = 302) if (!$condition) { // compatibility with url_for2() style signature $arguments = func_get_args(); - call_user_func_array(array($this, 'redirect'), array_slice($arguments, 1)); + call_user_func_array([$this, 'redirect'], array_slice($arguments, 1)); } } @@ -430,7 +430,7 @@ public function getCredential() public function setTemplate($name, $module = null) { if (sfConfig::get('sf_logging_enabled')) { - $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Change template to "%s/%s"', null === $module ? 'CURRENT' : $module, $name)))); + $this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Change template to "%s/%s"', null === $module ? 'CURRENT' : $module, $name)])); } if (null !== $module) { @@ -468,7 +468,7 @@ public function getTemplate() public function setLayout($name) { if (sfConfig::get('sf_logging_enabled')) { - $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Change layout to "%s"', $name)))); + $this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Change layout to "%s"', $name)])); } sfConfig::set('symfony.view.'.$this->getModuleName().'_'.$this->getActionName().'_layout', $name); diff --git a/lib/action/sfActionStack.class.php b/lib/action/sfActionStack.class.php index bdb812a40..09242f6ef 100644 --- a/lib/action/sfActionStack.class.php +++ b/lib/action/sfActionStack.class.php @@ -19,7 +19,7 @@ class sfActionStack { /** @var sfActionStackEntry[] */ - protected $stack = array(); + protected $stack = []; /** * Adds an entry to the action stack. diff --git a/lib/action/sfActions.class.php b/lib/action/sfActions.class.php index d6a571e13..2950780fc 100644 --- a/lib/action/sfActions.class.php +++ b/lib/action/sfActions.class.php @@ -41,13 +41,13 @@ public function execute($request) throw new sfInitializationException(sprintf('sfAction initialization failed for module "%s". There was no action given.', $this->getModuleName())); } - if (!is_callable(array($this, $actionToRun))) { + if (!is_callable([$this, $actionToRun])) { // action not found throw new sfInitializationException(sprintf('sfAction initialization failed for module "%s", action "%s". You must create a "%s" method.', $this->getModuleName(), $this->getActionName(), $actionToRun)); } if (sfConfig::get('sf_logging_enabled')) { - $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Call "%s->%s()"', get_class($this), $actionToRun)))); + $this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Call "%s->%s()"', get_class($this), $actionToRun)])); } // run action diff --git a/lib/action/sfComponent.class.php b/lib/action/sfComponent.class.php index c25299521..fb7ee72ed 100644 --- a/lib/action/sfComponent.class.php +++ b/lib/action/sfComponent.class.php @@ -62,7 +62,7 @@ public function __construct($context, $moduleName, $actionName) * * @return string The translated string */ - public function __($string, $args = array(), $catalogue = 'messages') + public function __($string, $args = [], $catalogue = 'messages') { return $this->context->getI18N()->__($string, $args, $catalogue); } @@ -128,7 +128,7 @@ public function __unset($name) */ public function __call($method, $arguments) { - $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'component.method_not_found', array('method' => $method, 'arguments' => $arguments))); + $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'component.method_not_found', ['method' => $method, 'arguments' => $arguments])); if (!$event->isProcessed()) { throw new sfException(sprintf('Call to undefined method %s::%s.', get_class($this), $method)); } @@ -247,7 +247,7 @@ final public function getLogger() public function logMessage($message, $priority = 'info') { if (sfConfig::get('sf_logging_enabled')) { - $this->dispatcher->notify(new sfEvent($this, 'application.log', array($message, 'priority' => constant('sfLogger::'.strtoupper($priority))))); + $this->dispatcher->notify(new sfEvent($this, 'application.log', [$message, 'priority' => constant('sfLogger::'.strtoupper($priority))])); } } @@ -339,7 +339,7 @@ public function getController() * * @return string The URL */ - public function generateUrl($route, $params = array(), $absolute = false) + public function generateUrl($route, $params = [], $absolute = false) { return $this->context->getRouting()->generate($route, $params, $absolute); } diff --git a/lib/addon/sfData.class.php b/lib/addon/sfData.class.php index 0af1760b4..4d5e4e448 100644 --- a/lib/addon/sfData.class.php +++ b/lib/addon/sfData.class.php @@ -17,7 +17,7 @@ abstract class sfData { protected $deleteCurrentData = true; - protected $object_references = array(); + protected $object_references = []; /** * Sets a flag to indicate if the current data in the database @@ -66,7 +66,7 @@ public function getFiles($element = null) $element = sfConfig::get('sf_data_dir').'/fixtures'; } - $files = array(); + $files = []; if (is_array($element)) { foreach ($element as $e) { $files = array_merge($files, $this->getFiles($e)); @@ -106,8 +106,8 @@ protected function doLoadDataFromFile($file) */ protected function doLoadData(array $files) { - $this->object_references = array(); - $this->maps = array(); + $this->object_references = []; + $this->maps = []; foreach ($files as $file) { $this->doLoadDataFromFile($file); diff --git a/lib/addon/sfPager.class.php b/lib/addon/sfPager.class.php index acb547842..9f97829ea 100644 --- a/lib/addon/sfPager.class.php +++ b/lib/addon/sfPager.class.php @@ -23,7 +23,7 @@ abstract class sfPager implements Iterator, Countable protected $tableName = ''; protected $objects; protected $cursor = 1; - protected $parameters = array(); + protected $parameters = []; protected $currentMaxLink = 1; protected $parameterHolder; protected $maxRecordLimit = false; @@ -97,7 +97,7 @@ public function setMaxRecordLimit($limit) */ public function getLinks($nb_links = 5) { - $links = array(); + $links = []; $tmp = $this->page - floor($nb_links / 2); $check = $this->lastPage - $nb_links + 1; $limit = $check > 0 ? $check : 1; diff --git a/lib/autoload/sfAutoload.class.php b/lib/autoload/sfAutoload.class.php index f3f5843f2..de53e724c 100644 --- a/lib/autoload/sfAutoload.class.php +++ b/lib/autoload/sfAutoload.class.php @@ -21,8 +21,8 @@ class sfAutoload protected static $freshCache = false; protected static $instance; - protected $overriden = array(); - protected $classes = array(); + protected $overriden = []; + protected $classes = []; protected function __construct() { @@ -51,7 +51,7 @@ public static function register() { ini_set('unserialize_callback_func', 'spl_autoload_call'); - if (false === spl_autoload_register(array(self::getInstance(), 'autoload'))) { + if (false === spl_autoload_register([self::getInstance(), 'autoload'])) { throw new sfException(sprintf('Unable to register %s::autoload as an autoloading method.', get_class(self::getInstance()))); } } @@ -61,7 +61,7 @@ public static function register() */ public static function unregister() { - spl_autoload_unregister(array(self::getInstance(), 'autoload')); + spl_autoload_unregister([self::getInstance(), 'autoload']); } /** diff --git a/lib/autoload/sfAutoloadAgain.class.php b/lib/autoload/sfAutoloadAgain.class.php index 29f6c4b72..a2771e604 100644 --- a/lib/autoload/sfAutoloadAgain.class.php +++ b/lib/autoload/sfAutoloadAgain.class.php @@ -65,7 +65,7 @@ public function autoload($class) } } } else { - $position = array_search(array(__CLASS__, 'autoload'), $autoloads, true); + $position = array_search([__CLASS__, 'autoload'], $autoloads, true); } if (isset($autoloads[$position + 1])) { @@ -102,7 +102,7 @@ public function isRegistered() public function register() { if (!$this->isRegistered()) { - spl_autoload_register(array($this, 'autoload')); + spl_autoload_register([$this, 'autoload']); $this->registered = true; } } @@ -112,7 +112,7 @@ public function register() */ public function unregister() { - spl_autoload_unregister(array($this, 'autoload')); + spl_autoload_unregister([$this, 'autoload']); $this->registered = false; } } diff --git a/lib/autoload/sfCoreAutoload.class.php b/lib/autoload/sfCoreAutoload.class.php index 35783e603..14dd57418 100755 --- a/lib/autoload/sfCoreAutoload.class.php +++ b/lib/autoload/sfCoreAutoload.class.php @@ -28,7 +28,7 @@ class sfCoreAutoload // Don't edit this property by hand. // To update it, use sfCoreAutoload::make() - protected $classes = array( + protected $classes = [ 'sfaction' => 'action/sfAction.class.php', 'sfactionstack' => 'action/sfActionStack.class.php', 'sfactionstackentry' => 'action/sfActionStackEntry.class.php', @@ -392,7 +392,7 @@ class sfCoreAutoload 'sfyamldumper' => 'yaml/sfYamlDumper.class.php', 'sfyamlinline' => 'yaml/sfYamlInline.class.php', 'sfyamlparser' => 'yaml/sfYamlParser.class.php', - ); + ]; protected function __construct() { @@ -425,7 +425,7 @@ public static function register() } ini_set('unserialize_callback_func', 'spl_autoload_call'); - if (false === spl_autoload_register(array(self::getInstance(), 'autoload'))) { + if (false === spl_autoload_register([self::getInstance(), 'autoload'])) { throw new sfException(sprintf('Unable to register %s::autoload as an autoloading method.', get_class(self::getInstance()))); } @@ -437,7 +437,7 @@ public static function register() */ public static function unregister() { - spl_autoload_unregister(array(self::getInstance(), 'autoload')); + spl_autoload_unregister([self::getInstance(), 'autoload']); self::$registered = false; } diff --git a/lib/autoload/sfSimpleAutoload.class.php b/lib/autoload/sfSimpleAutoload.class.php index f65804d6b..85674e7a0 100755 --- a/lib/autoload/sfSimpleAutoload.class.php +++ b/lib/autoload/sfSimpleAutoload.class.php @@ -24,10 +24,10 @@ class sfSimpleAutoload protected $cacheFile; protected $cacheLoaded = false; protected $cacheChanged = false; - protected $dirs = array(); - protected $files = array(); - protected $classes = array(); - protected $overriden = array(); + protected $dirs = []; + protected $files = []; + protected $classes = []; + protected $overriden = []; protected function __construct($cacheFile = null) { @@ -66,12 +66,12 @@ public static function register() } ini_set('unserialize_callback_func', 'spl_autoload_call'); - if (false === spl_autoload_register(array(self::getInstance(), 'autoload'))) { + if (false === spl_autoload_register([self::getInstance(), 'autoload'])) { throw new sfException(sprintf('Unable to register %s::autoload as an autoloading method.', get_class(self::getInstance()))); } if (self::getInstance()->cacheFile) { - register_shutdown_function(array(self::getInstance(), 'saveCache')); + register_shutdown_function([self::getInstance(), 'saveCache']); } self::$registered = true; @@ -82,7 +82,7 @@ public static function register() */ public static function unregister() { - spl_autoload_unregister(array(self::getInstance(), 'autoload')); + spl_autoload_unregister([self::getInstance(), 'autoload']); self::$registered = false; } @@ -140,7 +140,7 @@ public function saveCache() { if ($this->cacheChanged) { if (is_writable(dirname($this->cacheFile))) { - file_put_contents($this->cacheFile, serialize(array($this->classes, $this->dirs, $this->files))); + file_put_contents($this->cacheFile, serialize([$this->classes, $this->dirs, $this->files])); } $this->cacheChanged = false; @@ -152,7 +152,7 @@ public function saveCache() */ public function reload() { - $this->classes = array(); + $this->classes = []; $this->cacheLoaded = false; foreach ($this->dirs as $dir) { diff --git a/lib/cache/sfAPCCache.class.php b/lib/cache/sfAPCCache.class.php index 374560a7d..a337bfa51 100644 --- a/lib/cache/sfAPCCache.class.php +++ b/lib/cache/sfAPCCache.class.php @@ -26,7 +26,7 @@ class sfAPCCache extends sfCache * * @see sfCache */ - public function initialize($options = array()) + public function initialize($options = []) { parent::initialize($options); diff --git a/lib/cache/sfAPCuCache.class.php b/lib/cache/sfAPCuCache.class.php index 34c51ec3a..0afaddfa4 100644 --- a/lib/cache/sfAPCuCache.class.php +++ b/lib/cache/sfAPCuCache.class.php @@ -27,7 +27,7 @@ class sfAPCuCache extends sfCache * * @see sfCache */ - public function initialize($options = array()) + public function initialize($options = []) { parent::initialize($options); diff --git a/lib/cache/sfCache.class.php b/lib/cache/sfCache.class.php index 4f0c022ac..60b9a2858 100644 --- a/lib/cache/sfCache.class.php +++ b/lib/cache/sfCache.class.php @@ -19,7 +19,7 @@ abstract class sfCache public const ALL = 2; public const SEPARATOR = ':'; - protected $options = array(); + protected $options = []; /** * Class constructor. @@ -28,7 +28,7 @@ abstract class sfCache * * @param array $options */ - public function __construct($options = array()) + public function __construct($options = []) { $this->initialize($options); } @@ -50,13 +50,13 @@ public function __construct($options = array()) * * @throws sfInitializationException If an error occurs while initializing this sfCache instance */ - public function initialize($options = array()) + public function initialize($options = []) { - $this->options = array_merge(array( + $this->options = array_merge([ 'automatic_cleaning_factor' => 1000, 'lifetime' => 86400, 'prefix' => md5(__DIR__), - ), $options); + ], $options); $this->options['prefix'] .= self::SEPARATOR; } @@ -149,7 +149,7 @@ abstract public function getLastModified($key); */ public function getMany($keys) { - $data = array(); + $data = []; foreach ($keys as $key) { $data[$key] = $this->get($key); } @@ -220,8 +220,8 @@ public function setOption($name, $value) protected function patternToRegexp($pattern) { $regexp = str_replace( - array('\\*\\*', '\\*'), - array('.+?', '[^'.preg_quote(sfCache::SEPARATOR, '#').']+'), + ['\\*\\*', '\\*'], + ['.+?', '[^'.preg_quote(sfCache::SEPARATOR, '#').']+'], preg_quote($pattern, '#') ); diff --git a/lib/cache/sfEAcceleratorCache.class.php b/lib/cache/sfEAcceleratorCache.class.php index cd3846d6c..96b7643c9 100644 --- a/lib/cache/sfEAcceleratorCache.class.php +++ b/lib/cache/sfEAcceleratorCache.class.php @@ -28,7 +28,7 @@ class sfEAcceleratorCache extends sfCache * * @throws sfInitializationException */ - public function initialize($options = array()) + public function initialize($options = []) { parent::initialize($options); diff --git a/lib/cache/sfFileCache.class.php b/lib/cache/sfFileCache.class.php index 659baeee7..cace55f59 100644 --- a/lib/cache/sfFileCache.class.php +++ b/lib/cache/sfFileCache.class.php @@ -32,7 +32,7 @@ class sfFileCache extends sfCache * * @see sfCache */ - public function initialize($options = array()) + public function initialize($options = []) { parent::initialize($options); @@ -105,7 +105,7 @@ public function removePattern($pattern) $pattern = str_replace(sfCache::SEPARATOR, DIRECTORY_SEPARATOR, $pattern).self::EXTENSION; $regexp = self::patternToRegexp($pattern); - $paths = array(); + $paths = []; foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->getOption('cache_dir'))) as $path) { if (preg_match($regexp, str_replace($this->getOption('cache_dir').DIRECTORY_SEPARATOR, '', $path))) { $paths[] = $path; diff --git a/lib/cache/sfFunctionCache.class.php b/lib/cache/sfFunctionCache.class.php index e0508fe66..8d890099d 100644 --- a/lib/cache/sfFunctionCache.class.php +++ b/lib/cache/sfFunctionCache.class.php @@ -45,7 +45,7 @@ public function __construct(sfCache $cache) * @throws Exception * @throws sfException */ - public function call($callable, $arguments = array()) + public function call($callable, $arguments = []) { // Generate a cache id $key = $this->computeCacheKey($callable, $arguments); @@ -54,7 +54,7 @@ public function call($callable, $arguments = array()) if (null !== $serialized) { $data = unserialize($serialized); } else { - $data = array(); + $data = []; if (!is_callable($callable)) { throw new sfException('The first argument to call() must be a valid callable.'); @@ -99,7 +99,7 @@ public function getCache() * * @return string The associated cache key */ - public function computeCacheKey($callable, $arguments = array()) + public function computeCacheKey($callable, $arguments = []) { return md5(serialize($callable).serialize($arguments)); } diff --git a/lib/cache/sfMemcacheCache.class.php b/lib/cache/sfMemcacheCache.class.php index 3886a3452..1d948877e 100644 --- a/lib/cache/sfMemcacheCache.class.php +++ b/lib/cache/sfMemcacheCache.class.php @@ -35,7 +35,7 @@ class sfMemcacheCache extends sfCache * * @see sfCache */ - public function initialize($options = array()) + public function initialize($options = []) { parent::initialize($options); @@ -195,7 +195,7 @@ public function removePattern($pattern) */ public function getMany($keys) { - $values = array(); + $values = []; $prefix = $this->getOption('prefix'); $prefixed_keys = array_map(function ($k) use ($prefix) { return $prefix.$k; }, $keys); @@ -226,7 +226,7 @@ protected function getMetadata($key) */ protected function setMetadata($key, $lifetime) { - $this->memcache->set($this->getOption('prefix').'_metadata'.self::SEPARATOR.$key, array('lastModified' => time(), 'timeout' => time() + $lifetime), false, time() + $lifetime); + $this->memcache->set($this->getOption('prefix').'_metadata'.self::SEPARATOR.$key, ['lastModified' => time(), 'timeout' => time() + $lifetime], false, time() + $lifetime); } /** @@ -239,7 +239,7 @@ protected function setCacheInfo($key, $delete = false) { $keys = $this->memcache->get($this->getOption('prefix').'_metadata'); if (!is_array($keys)) { - $keys = array(); + $keys = []; } if ($delete) { @@ -264,7 +264,7 @@ protected function getCacheInfo() { $keys = $this->memcache->get($this->getOption('prefix').'_metadata'); if (!is_array($keys)) { - return array(); + return []; } return $keys; diff --git a/lib/cache/sfSQLiteCache.class.php b/lib/cache/sfSQLiteCache.class.php index ef7376eed..44a1f053d 100644 --- a/lib/cache/sfSQLiteCache.class.php +++ b/lib/cache/sfSQLiteCache.class.php @@ -30,7 +30,7 @@ class sfSQLiteCache extends sfCache * * @see sfCache */ - public function initialize($options = array()) + public function initialize($options = []) { if (!extension_loaded('SQLite') && !extension_loaded('pdo_SQLite')) { throw new sfConfigurationException('sfSQLiteCache class needs "sqlite" or "pdo_sqlite" extension to be loaded.'); @@ -196,8 +196,8 @@ public function removePatternRegexpCallback($regexp, $key) public function getMany($keys) { if ($this->isSqLite3()) { - $data = array(); - if ($results = $this->dbh->query(sprintf("SELECT key, data FROM cache WHERE key IN ('%s') AND timeout > %d", implode('\', \'', array_map(array($this->dbh, 'escapeString'), $keys)), time()))) { + $data = []; + if ($results = $this->dbh->query(sprintf("SELECT key, data FROM cache WHERE key IN ('%s') AND timeout > %d", implode('\', \'', array_map([$this->dbh, 'escapeString'], $keys)), time()))) { while ($row = $results->fetchArray()) { $data[$row['key']] = $row['data']; } @@ -208,7 +208,7 @@ public function getMany($keys) $rows = $this->dbh->arrayQuery(sprintf("SELECT key, data FROM cache WHERE key IN ('%s') AND timeout > %d", implode('\', \'', array_map('sqlite_escape_string', $keys)), time())); - $data = array(); + $data = []; foreach ($rows as $row) { $data[$row['key']] = $row['data']; } @@ -255,7 +255,7 @@ protected function setDatabase($database) } } - $this->dbh->createFunction('regexp', array($this, 'removePatternRegexpCallback'), 2); + $this->dbh->createFunction('regexp', [$this, 'removePatternRegexpCallback'], 2); if ($new) { $this->createSchema(); @@ -269,7 +269,7 @@ protected function setDatabase($database) */ protected function createSchema() { - $statements = array( + $statements = [ 'CREATE TABLE [cache] ( [key] VARCHAR(255), [data] LONGVARCHAR, @@ -277,7 +277,7 @@ protected function createSchema() [last_modified] TIMESTAMP )', 'CREATE UNIQUE INDEX [cache_unique] ON [cache] ([key])', - ); + ]; foreach ($statements as $statement) { if (false === $this->dbh->query($statement)) { diff --git a/lib/cache/sfXCacheCache.class.php b/lib/cache/sfXCacheCache.class.php index 3165dc9d7..aaecf81ef 100644 --- a/lib/cache/sfXCacheCache.class.php +++ b/lib/cache/sfXCacheCache.class.php @@ -24,7 +24,7 @@ class sfXCacheCache extends sfCache * * @see sfCache */ - public function initialize($options = array()) + public function initialize($options = []) { parent::initialize($options); @@ -70,11 +70,11 @@ public function set($key, $data, $lifetime = null) { $lifetime = $this->getLifetime($lifetime); - $set = array( + $set = [ 'timeout' => time() + $lifetime, 'data' => $data, 'ctime' => time(), - ); + ]; return xcache_set($this->getOption('prefix').$key, $set, $lifetime); } diff --git a/lib/command/cli.php b/lib/command/cli.php index 8b423443c..e5f6904e9 100644 --- a/lib/command/cli.php +++ b/lib/command/cli.php @@ -25,7 +25,7 @@ $dispatcher = new sfEventDispatcher(); $logger = new sfCommandLogger($dispatcher); - $application = new sfSymfonyCommandApplication($dispatcher, null, array('symfony_lib_dir' => realpath(__DIR__.'/..'))); + $application = new sfSymfonyCommandApplication($dispatcher, null, ['symfony_lib_dir' => realpath(__DIR__.'/..')]); $statusCode = $application->run(); } catch (Exception $e) { if (!isset($application)) { diff --git a/lib/command/sfAnsiColorFormatter.class.php b/lib/command/sfAnsiColorFormatter.class.php index 14ce12586..6bb298b84 100644 --- a/lib/command/sfAnsiColorFormatter.class.php +++ b/lib/command/sfAnsiColorFormatter.class.php @@ -15,15 +15,15 @@ */ class sfAnsiColorFormatter extends sfFormatter { - protected $styles = array( - 'ERROR' => array('bg' => 'red', 'fg' => 'white', 'bold' => true), - 'INFO' => array('fg' => 'green', 'bold' => true), - 'COMMENT' => array('fg' => 'yellow'), - 'QUESTION' => array('bg' => 'cyan', 'fg' => 'black', 'bold' => false), - ); - protected $options = array('bold' => 1, 'underscore' => 4, 'blink' => 5, 'reverse' => 7, 'conceal' => 8); - protected $foreground = array('black' => 30, 'red' => 31, 'green' => 32, 'yellow' => 33, 'blue' => 34, 'magenta' => 35, 'cyan' => 36, 'white' => 37); - protected $background = array('black' => 40, 'red' => 41, 'green' => 42, 'yellow' => 43, 'blue' => 44, 'magenta' => 45, 'cyan' => 46, 'white' => 47); + protected $styles = [ + 'ERROR' => ['bg' => 'red', 'fg' => 'white', 'bold' => true], + 'INFO' => ['fg' => 'green', 'bold' => true], + 'COMMENT' => ['fg' => 'yellow'], + 'QUESTION' => ['bg' => 'cyan', 'fg' => 'black', 'bold' => false], + ]; + protected $options = ['bold' => 1, 'underscore' => 4, 'blink' => 5, 'reverse' => 7, 'conceal' => 8]; + protected $foreground = ['black' => 30, 'red' => 31, 'green' => 32, 'yellow' => 33, 'blue' => 34, 'magenta' => 35, 'cyan' => 36, 'white' => 37]; + protected $background = ['black' => 40, 'red' => 41, 'green' => 42, 'yellow' => 43, 'blue' => 44, 'magenta' => 45, 'cyan' => 46, 'white' => 47]; /** * Sets a new style. @@ -31,7 +31,7 @@ class sfAnsiColorFormatter extends sfFormatter * @param string $name The style name * @param array $options An array of options */ - public function setStyle($name, $options = array()) + public function setStyle($name, $options = []) { $this->styles[$name] = $options; } @@ -44,7 +44,7 @@ public function setStyle($name, $options = array()) * * @return string The styled text */ - public function format($text = '', $parameters = array()) + public function format($text = '', $parameters = []) { if (!is_array($parameters) && 'NONE' == $parameters) { return $text; @@ -54,7 +54,7 @@ public function format($text = '', $parameters = array()) $parameters = $this->styles[$parameters]; } - $codes = array(); + $codes = []; if (isset($parameters['fg'])) { $codes[] = $this->foreground[$parameters['fg']]; } diff --git a/lib/command/sfCommandApplication.class.php b/lib/command/sfCommandApplication.class.php index fa13831f4..15bad631d 100644 --- a/lib/command/sfCommandApplication.class.php +++ b/lib/command/sfCommandApplication.class.php @@ -37,7 +37,7 @@ abstract class sfCommandApplication protected $version = 'UNKNOWN'; /** @var array */ - protected $tasks = array(); + protected $tasks = []; /** @var sfTask */ protected $currentTask; @@ -46,7 +46,7 @@ abstract class sfCommandApplication protected $dispatcher; /** @var array */ - protected $options = array(); + protected $options = []; /** @var sfFormatter */ protected $formatter; @@ -60,7 +60,7 @@ abstract class sfCommandApplication * @param sfFormatter $formatter A sfFormatter instance * @param array $options An array of options */ - public function __construct(sfEventDispatcher $dispatcher, ?sfFormatter $formatter = null, $options = array()) + public function __construct(sfEventDispatcher $dispatcher, ?sfFormatter $formatter = null, $options = []) { $this->dispatcher = $dispatcher; $this->formatter = null === $formatter ? $this->guessBestFormatter(STDOUT) : $formatter; @@ -68,17 +68,17 @@ public function __construct(sfEventDispatcher $dispatcher, ?sfFormatter $formatt $this->fixCgi(); - $argumentSet = new sfCommandArgumentSet(array( + $argumentSet = new sfCommandArgumentSet([ new sfCommandArgument('task', sfCommandArgument::REQUIRED, 'The task to execute'), - )); - $optionSet = new sfCommandOptionSet(array( + ]); + $optionSet = new sfCommandOptionSet([ new sfCommandOption('--help', '-H', sfCommandOption::PARAMETER_NONE, 'Display this help message.'), new sfCommandOption('--quiet', '-q', sfCommandOption::PARAMETER_NONE, 'Do not log messages to standard output.'), new sfCommandOption('--trace', '-t', sfCommandOption::PARAMETER_NONE, 'Turn on invoke/execute tracing, enable full backtrace.'), new sfCommandOption('--version', '-V', sfCommandOption::PARAMETER_NONE, 'Display the program version.'), new sfCommandOption('--color', '', sfCommandOption::PARAMETER_NONE, 'Forces ANSI color output.'), new sfCommandOption('--no-debug', '', sfCommandOption::PARAMETER_NONE, 'Disable debug'), - )); + ]); $this->commandManager = new sfCommandManager($argumentSet, $optionSet); $this->configure(); @@ -129,7 +129,7 @@ public function setFormatter(sfFormatter $formatter) public function clearTasks() { - $this->tasks = array(); + $this->tasks = []; } /** @@ -181,7 +181,7 @@ public function registerTask(sfTask $task) */ public function autodiscoverTasks() { - $tasks = array(); + $tasks = []; foreach (get_declared_classes() as $class) { $r = new ReflectionClass($class); @@ -327,11 +327,11 @@ public function isDebug() */ public function help() { - $messages = array( + $messages = [ $this->formatter->format('Usage:', 'COMMENT'), sprintf(" %s [options] task_name [arguments]\n", $this->getName()), $this->formatter->format('Options:', 'COMMENT'), - ); + ]; foreach ($this->commandManager->getOptionSet()->getOptions() as $option) { $messages[] = sprintf( @@ -354,13 +354,13 @@ public function renderException($e) { $title = sprintf(' [%s] ', get_class($e)); $len = $this->strlen($title); - $lines = array(); + $lines = []; foreach (explode("\n", $e->getMessage()) as $line) { $lines[] = sprintf(' %s ', $line); $len = max($this->strlen($line) + 4, $len); } - $messages = array(str_repeat(' ', $len)); + $messages = [str_repeat(' ', $len)]; if ($this->trace) { $messages[] = $title.str_repeat(' ', $len - $this->strlen($title)); @@ -388,12 +388,12 @@ public function renderException($e) // exception related properties $trace = $e->getTrace(); - array_unshift($trace, array( + array_unshift($trace, [ 'function' => '', 'file' => null != $e->getFile() ? $e->getFile() : 'n/a', 'line' => null != $e->getLine() ? $e->getLine() : 'n/a', - 'args' => array(), - )); + 'args' => [], + ]); for ($i = 0, $count = count($trace); $i < $count; ++$i) { $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : ''; @@ -427,7 +427,7 @@ public function getTaskToExecute($name) $namespace = substr($name, 0, $pos); $name = substr($name, $pos + 1); - $namespaces = array(); + $namespaces = []; foreach ($this->tasks as $task) { if ($task->getNamespace() && !in_array($task->getNamespace(), $namespaces)) { $namespaces[] = $task->getNamespace(); @@ -448,7 +448,7 @@ public function getTaskToExecute($name) } // name - $tasks = array(); + $tasks = []; foreach ($this->tasks as $taskName => $task) { if ($taskName == $task->getFullName() && $task->getNamespace() == $namespace) { $tasks[] = $task->getName(); @@ -461,7 +461,7 @@ public function getTaskToExecute($name) } // aliases - $aliases = array(); + $aliases = []; foreach ($this->tasks as $taskName => $task) { if ($taskName == $task->getFullName()) { foreach ($task->getAliases() as $alias) { @@ -592,8 +592,8 @@ protected function fixCgi() */ protected function getAbbreviations($names) { - $abbrevs = array(); - $table = array(); + $abbrevs = []; + $table = []; foreach ($names as $name) { for ($len = strlen($name) - 1; $len > 0; --$len) { @@ -607,7 +607,7 @@ protected function getAbbreviations($names) $seen = $table[$abbrev]; if (1 == $seen) { // We're the first word so far to have this abbreviation. - $abbrevs[$abbrev] = array($name); + $abbrevs[$abbrev] = [$name]; } elseif (2 == $seen) { // We're the second word to have this abbreviation, so we can't use it. // unset($abbrevs[$abbrev]); @@ -621,7 +621,7 @@ protected function getAbbreviations($names) // Non-abbreviations always get entered, even if they aren't unique foreach ($names as $name) { - $abbrevs[$name] = array($name); + $abbrevs[$name] = [$name]; } return $abbrevs; diff --git a/lib/command/sfCommandArgument.class.php b/lib/command/sfCommandArgument.class.php index 470a9e707..3d6d2515c 100644 --- a/lib/command/sfCommandArgument.class.php +++ b/lib/command/sfCommandArgument.class.php @@ -95,7 +95,7 @@ public function setDefault($default = null) if ($this->isArray()) { if (null === $default) { - $default = array(); + $default = []; } elseif (!is_array($default)) { throw new sfCommandException('A default value for an array argument must be an array.'); } diff --git a/lib/command/sfCommandArgumentSet.class.php b/lib/command/sfCommandArgumentSet.class.php index efdd0b012..3e7f882d3 100644 --- a/lib/command/sfCommandArgumentSet.class.php +++ b/lib/command/sfCommandArgumentSet.class.php @@ -15,7 +15,7 @@ */ class sfCommandArgumentSet { - protected $arguments = array(); + protected $arguments = []; protected $requiredCount = 0; protected $hasAnArrayArgument = false; protected $hasOptional = false; @@ -25,7 +25,7 @@ class sfCommandArgumentSet * * @param array $arguments An array of sfCommandArgument objects */ - public function __construct($arguments = array()) + public function __construct($arguments = []) { $this->setArguments($arguments); } @@ -35,9 +35,9 @@ public function __construct($arguments = array()) * * @param array $arguments An array of sfCommandArgument objects */ - public function setArguments($arguments = array()) + public function setArguments($arguments = []) { - $this->arguments = array(); + $this->arguments = []; $this->requiredCount = 0; $this->hasOptional = false; $this->addArguments($arguments); @@ -48,7 +48,7 @@ public function setArguments($arguments = array()) * * @param array $arguments An array of sfCommandArgument objects */ - public function addArguments($arguments = array()) + public function addArguments($arguments = []) { if (null !== $arguments) { foreach ($arguments as $argument) { @@ -158,7 +158,7 @@ public function getArgumentRequiredCount() */ public function getDefaults() { - $values = array(); + $values = []; foreach ($this->arguments as $argument) { $values[$argument->getName()] = $argument->getDefault(); } diff --git a/lib/command/sfCommandLogger.class.php b/lib/command/sfCommandLogger.class.php index 2233d2637..77673b5c1 100644 --- a/lib/command/sfCommandLogger.class.php +++ b/lib/command/sfCommandLogger.class.php @@ -19,9 +19,9 @@ class sfCommandLogger extends sfConsoleLogger * @param sfEventDispatcher $dispatcher A sfEventDispatcher instance * @param array $options an array of options */ - public function initialize(sfEventDispatcher $dispatcher, $options = array()) + public function initialize(sfEventDispatcher $dispatcher, $options = []) { - $dispatcher->connect('command.log', array($this, 'listenToLogEvent')); + $dispatcher->connect('command.log', [$this, 'listenToLogEvent']); return parent::initialize($dispatcher, $options); } diff --git a/lib/command/sfCommandManager.class.php b/lib/command/sfCommandManager.class.php index 7e7fcfb02..aea4b6bf3 100644 --- a/lib/command/sfCommandManager.class.php +++ b/lib/command/sfCommandManager.class.php @@ -19,22 +19,22 @@ class sfCommandManager protected $arguments = ''; /** @var string[] */ - protected $errors = array(); + protected $errors = []; /** @var sfCommandOptionSet */ protected $optionSet; /** @var sfCommandArgumentSet */ - protected $argumentSet = array(); + protected $argumentSet = []; /** @var array */ - protected $optionValues = array(); + protected $optionValues = []; /** @var array */ - protected $argumentValues = array(); + protected $argumentValues = []; /** @var array */ - protected $parsedArgumentValues = array(); + protected $parsedArgumentValues = []; /** * Constructor. @@ -121,10 +121,10 @@ public function process($arguments = null) $this->arguments = $arguments; $this->optionValues = $this->optionSet->getDefaults(); $this->argumentValues = $this->argumentSet->getDefaults(); - $this->parsedArgumentValues = array(); - $this->errors = array(); + $this->parsedArgumentValues = []; + $this->errors = []; - while (!in_array($argument = array_shift($this->arguments), array('', null))) { + while (!in_array($argument = array_shift($this->arguments), ['', null])) { if ('--' == $argument) { // stop options parsing $this->parsedArgumentValues = array_merge($this->parsedArgumentValues, $this->arguments); diff --git a/lib/command/sfCommandOption.class.php b/lib/command/sfCommandOption.class.php index 6cdf8f6c7..d525aa7e9 100644 --- a/lib/command/sfCommandOption.class.php +++ b/lib/command/sfCommandOption.class.php @@ -143,7 +143,7 @@ public function setDefault($default = null) if ($this->isArray()) { if (null === $default) { - $default = array(); + $default = []; } elseif (!is_array($default)) { throw new sfCommandException('A default value for an array option must be an array.'); } diff --git a/lib/command/sfCommandOptionSet.class.php b/lib/command/sfCommandOptionSet.class.php index fe4a3ce4a..e8e00cb57 100644 --- a/lib/command/sfCommandOptionSet.class.php +++ b/lib/command/sfCommandOptionSet.class.php @@ -15,15 +15,15 @@ */ class sfCommandOptionSet { - protected $options = array(); - protected $shortcuts = array(); + protected $options = []; + protected $shortcuts = []; /** * Constructor. * * @param array $options An array of sfCommandOption objects */ - public function __construct($options = array()) + public function __construct($options = []) { $this->setOptions($options); } @@ -33,10 +33,10 @@ public function __construct($options = array()) * * @param array $options An array of sfCommandOption objects */ - public function setOptions($options = array()) + public function setOptions($options = []) { - $this->options = array(); - $this->shortcuts = array(); + $this->options = []; + $this->shortcuts = []; $this->addOptions($options); } @@ -45,7 +45,7 @@ public function setOptions($options = array()) * * @param array $options An array of sfCommandOption objects */ - public function addOptions($options = array()) + public function addOptions($options = []) { foreach ($options as $option) { $this->addOption($option); @@ -145,7 +145,7 @@ public function getOptionForShortcut($shortcut) */ public function getDefaults() { - $values = array(); + $values = []; foreach ($this->options as $option) { $values[$option->getName()] = $option->getDefault(); } diff --git a/lib/command/sfFormatter.class.php b/lib/command/sfFormatter.class.php index bc8ba4924..d37829c87 100644 --- a/lib/command/sfFormatter.class.php +++ b/lib/command/sfFormatter.class.php @@ -37,7 +37,7 @@ public function __construct($maxLineSize = null) * @param string $name The style name * @param array $options An array of options */ - public function setStyle($name, $options = array()) + public function setStyle($name, $options = []) { } @@ -49,7 +49,7 @@ public function setStyle($name, $options = array()) * * @return string The formatted text */ - public function format($text = '', $parameters = array()) + public function format($text = '', $parameters = []) { return $text; } diff --git a/lib/command/sfSymfonyCommandApplication.class.php b/lib/command/sfSymfonyCommandApplication.class.php index 29ac90e85..bec81a576 100644 --- a/lib/command/sfSymfonyCommandApplication.class.php +++ b/lib/command/sfSymfonyCommandApplication.class.php @@ -15,7 +15,7 @@ */ class sfSymfonyCommandApplication extends sfCommandApplication { - protected $taskFiles = array(); + protected $taskFiles = []; /** * Configures the current symfony command application. @@ -81,7 +81,7 @@ public function run($options = null) public function loadTasks(sfProjectConfiguration $configuration) { // Symfony core tasks - $dirs = array(sfConfig::get('sf_symfony_lib_dir').'/task'); + $dirs = [sfConfig::get('sf_symfony_lib_dir').'/task']; // Plugin tasks foreach ($configuration->getPluginPaths() as $path) { @@ -99,7 +99,7 @@ public function loadTasks(sfProjectConfiguration $configuration) } // register local autoloader for tasks - spl_autoload_register(array($this, 'autoloadTask')); + spl_autoload_register([$this, 'autoloadTask']); // require tasks foreach ($this->taskFiles as $task => $file) { @@ -108,7 +108,7 @@ class_exists($task, true); } // unregister local autoloader - spl_autoload_unregister(array($this, 'autoloadTask')); + spl_autoload_unregister([$this, 'autoloadTask']); } /** diff --git a/lib/config/sfApplicationConfiguration.class.php b/lib/config/sfApplicationConfiguration.class.php index e59d517d7..cab2df13c 100644 --- a/lib/config/sfApplicationConfiguration.class.php +++ b/lib/config/sfApplicationConfiguration.class.php @@ -16,13 +16,13 @@ abstract class sfApplicationConfiguration extends ProjectConfiguration { protected static $coreLoaded = false; - protected static $loadedHelpers = array(); + protected static $loadedHelpers = []; protected $configCache; protected $application; protected $environment; protected $debug = false; - protected $config = array(); + protected $config = []; protected $cache; /** @@ -101,7 +101,7 @@ public function initConfiguration() } // autoloader(s) - $this->dispatcher->connect('autoload.filter_config', array($this, 'filterAutoloadConfig')); + $this->dispatcher->connect('autoload.filter_config', [$this, 'filterAutoloadConfig']); sfAutoload::getInstance()->register(); if ($this->isDebug()) { sfAutoloadAgain::getInstance()->register(); @@ -135,7 +135,7 @@ public function initConfiguration() // the error log, then errors are displayed (display_errors is set to 1). if ( !$this->isDebug() - || !in_array(PHP_SAPI, array('cli', 'phpdbg', 'embed'), true) + || !in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ) { ini_set('display_errors', 0); } elseif ( @@ -196,12 +196,12 @@ public function checkLock() || $this->hasLockFile(sfConfig::get('sf_data_dir').DIRECTORY_SEPARATOR.$this->getApplication().'_'.$this->getEnvironment().'.lck') ) { // application is not available - we'll find the most specific unavailable page... - $files = array( + $files = [ sfConfig::get('sf_app_config_dir').'/unavailable.php', sfConfig::get('sf_config_dir').'/unavailable.php', sfConfig::get('sf_web_dir').'/errors/unavailable.php', $this->getSymfonyLibDir().'/exception/data/unavailable.php', - ); + ]; foreach ($files as $file) { if (is_readable($file)) { @@ -227,12 +227,12 @@ public function setRootDir($rootDir) { parent::setRootDir($rootDir); - sfConfig::add(array( + sfConfig::add([ 'sf_app' => $this->getApplication(), 'sf_environment' => $this->getEnvironment(), 'sf_debug' => $this->isDebug(), 'sf_cli' => PHP_SAPI === 'cli', - )); + ]); $this->setAppDir(sfConfig::get('sf_apps_dir').DIRECTORY_SEPARATOR.$this->getApplication()); } @@ -244,7 +244,7 @@ public function setRootDir($rootDir) */ public function setAppDir($appDir) { - sfConfig::add(array( + sfConfig::add([ 'sf_app_dir' => $appDir, // SF_APP_DIR directory structure @@ -253,7 +253,7 @@ public function setAppDir($appDir) 'sf_app_module_dir' => $appDir.DIRECTORY_SEPARATOR.'modules', 'sf_app_template_dir' => $appDir.DIRECTORY_SEPARATOR.'templates', 'sf_app_i18n_dir' => $appDir.DIRECTORY_SEPARATOR.'i18n', - )); + ]); } /** @@ -263,7 +263,7 @@ public function setCacheDir($cacheDir) { parent::setCacheDir($cacheDir); - sfConfig::add(array( + sfConfig::add([ 'sf_app_base_cache_dir' => $cacheDir.DIRECTORY_SEPARATOR.$this->getApplication(), 'sf_app_cache_dir' => $appCacheDir = $cacheDir.DIRECTORY_SEPARATOR.$this->getApplication().DIRECTORY_SEPARATOR.$this->getEnvironment(), @@ -273,7 +273,7 @@ public function setCacheDir($cacheDir) 'sf_config_cache_dir' => $appCacheDir.DIRECTORY_SEPARATOR.'config', 'sf_test_cache_dir' => $appCacheDir.DIRECTORY_SEPARATOR.'test', 'sf_module_cache_dir' => $appCacheDir.DIRECTORY_SEPARATOR.'modules', - )); + ]); } /** @@ -286,7 +286,7 @@ public function setCacheDir($cacheDir) public function getControllerDirs($moduleName) { if (!isset($this->cache['getControllerDirs'][$moduleName])) { - $dirs = array(); + $dirs = []; $dirs[sfConfig::get('sf_app_module_dir').'/'.$moduleName.'/actions'] = false; // application @@ -315,7 +315,7 @@ public function getControllerDirs($moduleName) */ public function getLibDirs($moduleName) { - $dirs = array(); + $dirs = []; $dirs[] = sfConfig::get('sf_app_module_dir').'/'.$moduleName.'/lib'; // application $dirs = array_merge($dirs, $this->getPluginSubPaths('/modules/'.$moduleName.'/lib')); // plugins @@ -334,7 +334,7 @@ public function getLibDirs($moduleName) */ public function getTemplateDirs($moduleName) { - $dirs = array(); + $dirs = []; $dirs[] = sfConfig::get('sf_app_module_dir').'/'.$moduleName.'/templates'; // application $dirs = array_merge($dirs, $this->getPluginSubPaths('/modules/'.$moduleName.'/templates')); // plugins @@ -353,7 +353,7 @@ public function getTemplateDirs($moduleName) */ public function getHelperDirs($moduleName = '') { - $dirs = array(); + $dirs = []; if ($moduleName) { $dirs[] = sfConfig::get('sf_app_module_dir').'/'.$moduleName.'/lib/helper'; // module @@ -363,12 +363,12 @@ public function getHelperDirs($moduleName = '') return array_merge( $dirs, - array( + [ sfConfig::get('sf_app_lib_dir').'/helper', // application sfConfig::get('sf_lib_dir').'/helper', // project - ), + ], $this->getPluginSubPaths('/lib/helper'), // plugins - array($this->getSymfonyLibDir().'/helper') // symfony + [$this->getSymfonyLibDir().'/helper'] // symfony ); } @@ -430,7 +430,7 @@ public function getPluginPaths() */ public function getDecoratorDirs() { - return array(sfConfig::get('sf_app_template_dir')); + return [sfConfig::get('sf_app_template_dir')]; } /** @@ -456,7 +456,7 @@ public function getDecoratorDir($template) */ public function getI18NGlobalDirs() { - $dirs = array(); + $dirs = []; // application if (is_dir($dir = sfConfig::get('sf_app_i18n_dir'))) { @@ -476,7 +476,7 @@ public function getI18NGlobalDirs() */ public function getI18NDirs($moduleName) { - $dirs = array(); + $dirs = []; // module if (is_dir($dir = sfConfig::get('sf_app_module_dir').'/'.$moduleName.'/i18n')) { @@ -506,9 +506,9 @@ public function getConfigPaths($configPath) { $globalConfigPath = basename(dirname($configPath)).'/'.basename($configPath); - $files = array( + $files = [ $this->getSymfonyLibDir().'/config/'.$globalConfigPath, // symfony - ); + ]; foreach ($this->getPluginPaths() as $path) { if (is_file($file = $path.'/'.$globalConfigPath)) { @@ -516,12 +516,12 @@ public function getConfigPaths($configPath) } } - $files = array_merge($files, array( + $files = array_merge($files, [ $this->getRootDir().'/'.$globalConfigPath, // project $this->getRootDir().'/'.$configPath, // project sfConfig::get('sf_app_dir').'/'.$globalConfigPath, // application sfConfig::get('sf_app_cache_dir').'/'.$configPath, // generated modules - )); + ]); foreach ($this->getPluginPaths() as $path) { if (is_file($file = $path.'/'.$configPath)) { @@ -531,7 +531,7 @@ public function getConfigPaths($configPath) $files[] = sfConfig::get('sf_app_dir').'/'.$configPath; // module - $configs = array(); + $configs = []; foreach (array_unique($files) as $file) { if (is_readable($file)) { $configs[] = $file; @@ -576,7 +576,7 @@ public function loadHelpers($helpers, $moduleName = '') } if (!$included) { - throw new InvalidArgumentException(sprintf('Unable to load "%sHelper.php" helper in: %s.', $helperName, implode(', ', array_map(array('sfDebug', 'shortenFilePath'), $dirs)))); + throw new InvalidArgumentException(sprintf('Unable to load "%sHelper.php" helper in: %s.', $helperName, implode(', ', array_map(['sfDebug', 'shortenFilePath'], $dirs)))); } } diff --git a/lib/config/sfAutoloadConfigHandler.class.php b/lib/config/sfAutoloadConfigHandler.class.php index e307aea15..2b7cb7a5c 100755 --- a/lib/config/sfAutoloadConfigHandler.class.php +++ b/lib/config/sfAutoloadConfigHandler.class.php @@ -28,9 +28,9 @@ class sfAutoloadConfigHandler extends sfYamlConfigHandler public function execute($configFiles) { // set our required categories list and initialize our handler - $this->initialize(array('required_categories' => array('autoload'))); + $this->initialize(['required_categories' => ['autoload']]); - $data = array(); + $data = []; foreach ($this->parse($configFiles) as $name => $mapping) { $data[] = sprintf("\n // %s", $name); @@ -51,7 +51,7 @@ public function execute($configFiles) public function evaluate($configFiles) { - $mappings = array(); + $mappings = []; foreach ($this->parse($configFiles) as $mapping) { foreach ($mapping as $class => $file) { $mappings[$class] = $file; @@ -63,7 +63,7 @@ public function evaluate($configFiles) public static function parseFile($path, $file, $prefix) { - $mapping = array(); + $mapping = []; preg_match_all('~^\s*(?:abstract\s+|final\s+)?(?:class|interface|trait)\s+(\w+)~mi', file_get_contents($file), $classes); foreach ($classes[1] as $class) { $localPrefix = ''; @@ -89,7 +89,7 @@ public static function getConfiguration(array $configFiles) $configuration = sfProjectConfiguration::getActive(); $pluginPaths = $configuration->getPluginPaths(); - $pluginConfigFiles = array(); + $pluginConfigFiles = []; // move plugin files to front foreach ($configFiles as $i => $configFile) { @@ -122,9 +122,9 @@ protected function parse(array $configFiles) // parse the yaml $config = static::getConfiguration($configFiles); - $mappings = array(); + $mappings = []; foreach ($config['autoload'] as $name => $entry) { - $mapping = array(); + $mapping = []; // file mapping or directory mapping? if (isset($entry['files'])) { diff --git a/lib/config/sfCacheConfigHandler.class.php b/lib/config/sfCacheConfigHandler.class.php index 6e1ca0ce8..b531d9555 100644 --- a/lib/config/sfCacheConfigHandler.class.php +++ b/lib/config/sfCacheConfigHandler.class.php @@ -15,7 +15,7 @@ */ class sfCacheConfigHandler extends sfYamlConfigHandler { - protected $cacheConfig = array(); + protected $cacheConfig = []; /** * Executes this configuration handler. @@ -34,7 +34,7 @@ public function execute($configFiles) $this->yamlConfig = static::getConfiguration($configFiles); // iterate through all action names - $data = array(); + $data = []; $first = true; foreach ($this->yamlConfig as $actionName => $values) { if ('all' == $actionName) { @@ -78,7 +78,7 @@ public static function getConfiguration(array $configFiles) */ protected function addCache($actionName = '') { - $data = array(); + $data = []; // enabled? $enabled = $this->getConfigValue('enabled', $actionName); @@ -96,9 +96,9 @@ protected function addCache($actionName = '') $contextual = $this->getConfigValue('contextual', $actionName) ? 'true' : 'false'; // vary - $vary = $this->getConfigValue('vary', $actionName, array()); + $vary = $this->getConfigValue('vary', $actionName, []); if (!is_array($vary)) { - $vary = array($vary); + $vary = [$vary]; } // add cache information to cache manager diff --git a/lib/config/sfCompileConfigHandler.class.php b/lib/config/sfCompileConfigHandler.class.php index 5a70c27ce..7bbd8cffb 100644 --- a/lib/config/sfCompileConfigHandler.class.php +++ b/lib/config/sfCompileConfigHandler.class.php @@ -51,13 +51,13 @@ public function execute($configFiles) } // strip php tags - $contents = sfToolkit::pregtr($contents, array('/^\s*<\?(php\s*)?/m' => '', '/^\s*\?>/m' => '')); + $contents = sfToolkit::pregtr($contents, ['/^\s*<\?(php\s*)?/m' => '', '/^\s*\?>/m' => '']); // replace windows and mac format with unix format $contents = str_replace("\r", "\n", $contents); // replace multiple new lines with a single newline - $contents = preg_replace(array('/\s+$/Sm', '/\n+/S'), "\n", $contents); + $contents = preg_replace(['/\s+$/Sm', '/\n+/S'], "\n", $contents); // append file data $data .= "\n".$contents; @@ -79,7 +79,7 @@ public function execute($configFiles) */ public static function getConfiguration(array $configFiles) { - $config = array(); + $config = []; foreach ($configFiles as $configFile) { $config = array_merge($config, static::parseYaml($configFile)); } diff --git a/lib/config/sfConfig.class.php b/lib/config/sfConfig.class.php index 40e160fca..2ad673ea7 100644 --- a/lib/config/sfConfig.class.php +++ b/lib/config/sfConfig.class.php @@ -15,7 +15,7 @@ */ class sfConfig { - protected static $config = array(); + protected static $config = []; /** * Retrieves a config parameter. @@ -63,7 +63,7 @@ public static function set($name, $value) * * @param array $parameters An associative array of config parameters and their associated values */ - public static function add($parameters = array()) + public static function add($parameters = []) { self::$config = array_merge(self::$config, $parameters); } @@ -83,6 +83,6 @@ public static function getAll() */ public static function clear() { - self::$config = array(); + self::$config = []; } } diff --git a/lib/config/sfConfigCache.class.php b/lib/config/sfConfigCache.class.php index 14f3c0e37..23de85854 100644 --- a/lib/config/sfConfigCache.class.php +++ b/lib/config/sfConfigCache.class.php @@ -20,8 +20,8 @@ class sfConfigCache { protected $configuration; - protected $handlers = array(); - protected $userHandlers = array(); + protected $handlers = []; + protected $userHandlers = []; /** * Constructor. @@ -67,7 +67,7 @@ public function checkConfig($configPath, $optional = false) if (!sfToolkit::isPathAbsolute($configPath)) { $files = $this->configuration->getConfigPaths($configPath); } else { - $files = is_readable($configPath) ? array($configPath) : array(); + $files = is_readable($configPath) ? [$configPath] : []; } if (!isset($files[0])) { @@ -123,7 +123,7 @@ public function getCacheName($config) } // replace unfriendly filename characters with an underscore - $config = str_replace(array('\\', '/', ' '), '_', $config); + $config = str_replace(['\\', '/', ' '], '_', $config); $config .= '.php'; return sfConfig::get('sf_config_cache_dir').'/'.$config; @@ -161,7 +161,7 @@ public function import($config, $once = true, $optional = false) * @param class $class A configuration handler class * @param string $params An array of options for the handler class initialization */ - public function registerConfigHandler($handler, $class, $params = array()) + public function registerConfigHandler($handler, $class, $params = []) { $this->userHandlers[$handler] = new $class($params); } @@ -204,8 +204,8 @@ protected function callHandler($handler, $configs, $cache) // let's see if we have any wildcard handlers registered that match this basename foreach (array_keys($this->handlers) as $key) { // replace wildcard chars in the configuration - $pattern = strtr($key, array('.' => '\.', '*' => '(.*?)')); - $matches = array(); + $pattern = strtr($key, ['.' => '\.', '*' => '(.*?)']); + $matches = []; // create pattern from config if (preg_match('#'.$pattern.'$#', $handler, $matches)) { @@ -268,7 +268,7 @@ protected function loadConfigHandlers() } // ignore names - $ignore = array('.', '..', 'CVS', '.svn'); + $ignore = ['.', '..', 'CVS', '.svn']; // create a file pointer to the module dir $fp = opendir($sf_app_module_dir); @@ -283,7 +283,7 @@ protected function loadConfigHandlers() if (is_readable($configPath)) { // initialize the root configuration handler with this module name - $params = array('module_level' => true, 'module_name' => $directory); + $params = ['module_level' => true, 'module_name' => $directory]; $this->handlers['config_handlers.yml']->initialize($params); @@ -347,6 +347,6 @@ protected function mergeUserConfigHandlers() // user defined configuration handlers $this->handlers = array_merge($this->handlers, $this->userHandlers); - $this->userHandlers = array(); + $this->userHandlers = []; } } diff --git a/lib/config/sfDatabaseConfigHandler.class.php b/lib/config/sfDatabaseConfigHandler.class.php index 38473ca4b..c1ed33ac6 100644 --- a/lib/config/sfDatabaseConfigHandler.class.php +++ b/lib/config/sfDatabaseConfigHandler.class.php @@ -60,7 +60,7 @@ public function evaluate($configFiles) require_once $include; } - $databases = array(); + $databases = []; foreach ($data as $name => $database) { $databases[$name] = new $database[0]($database[1]); } @@ -90,9 +90,9 @@ protected function parse($configFiles) $config = static::getConfiguration($configFiles); // init our data and includes arrays - $data = array(); - $databases = array(); - $includes = array(); + $data = []; + $databases = []; + $includes = []; // get a list of database connections foreach ($config as $name => $dbConfig) { @@ -123,16 +123,16 @@ protected function parse($configFiles) } // parse parameters - $parameters = array(); + $parameters = []; if (isset($dbConfig['param'])) { $parameters = $dbConfig['param']; } $parameters['name'] = $name; // append new data - $data[$name] = array($dbConfig['class'], $parameters); + $data[$name] = [$dbConfig['class'], $parameters]; } - return array($includes, $data); + return [$includes, $data]; } } diff --git a/lib/config/sfDefineEnvironmentConfigHandler.class.php b/lib/config/sfDefineEnvironmentConfigHandler.class.php index aaeaae4e5..b43dd0b1a 100644 --- a/lib/config/sfDefineEnvironmentConfigHandler.class.php +++ b/lib/config/sfDefineEnvironmentConfigHandler.class.php @@ -39,7 +39,7 @@ public function execute($configFiles) // parse the yaml $config = static::getConfiguration($configFiles); - $values = array(); + $values = []; foreach ($config as $category => $keys) { $values = array_merge($values, $this->getValues($prefix, $category, $keys)); } @@ -83,10 +83,10 @@ protected function getValues($prefix, $category, $keys) if (!is_array($keys)) { list($key, $value) = $this->fixCategoryValue($prefix.strtolower($category), '', $keys); - return array($key => $value); + return [$key => $value]; } - $values = array(); + $values = []; $category = $this->fixCategoryName($category, $prefix); @@ -110,7 +110,7 @@ protected function getValues($prefix, $category, $keys) */ protected function fixCategoryValue($category, $key, $value) { - return array($category.$key, $value); + return [$category.$key, $value]; } /** diff --git a/lib/config/sfFactoryConfigHandler.class.php b/lib/config/sfFactoryConfigHandler.class.php index 83544652e..95e067f7b 100644 --- a/lib/config/sfFactoryConfigHandler.class.php +++ b/lib/config/sfFactoryConfigHandler.class.php @@ -34,11 +34,11 @@ public function execute($configFiles) $config = static::getConfiguration($configFiles); // init our data and includes arrays - $includes = array(); - $instances = array(); + $includes = []; + $instances = []; // available list of factories - $factories = array('view_cache_manager', 'logger', 'i18n', 'controller', 'request', 'response', 'routing', 'storage', 'user', 'view_cache', 'mailer', 'service_container'); + $factories = ['view_cache_manager', 'logger', 'i18n', 'controller', 'request', 'response', 'routing', 'storage', 'user', 'view_cache', 'mailer', 'service_container']; // let's do our fancy work foreach ($factories as $factory) { @@ -64,7 +64,7 @@ public function execute($configFiles) } // parse parameters - $parameters = array(); + $parameters = []; if (isset($keys['param'])) { if (!is_array($keys['param'])) { throw new InvalidArgumentException(sprintf('The "param" key for the "%s" factory must be an array (in %s).', $class, $configFiles[0])); @@ -94,7 +94,7 @@ public function execute($configFiles) break; case 'storage': - $defaultParameters = array(); + $defaultParameters = []; $defaultParameters[] = sprintf("'auto_shutdown' => false, 'session_id' => \$this->getRequest()->getParameter('%s'),", $parameters['session_name']); if (is_subclass_of($class, 'sfDatabaseSessionStorage')) { $defaultParameters[] = sprintf("'database' => \$this->getDatabaseManager()->getDatabase('%s'),", isset($parameters['database']) ? $parameters['database'] : 'default'); diff --git a/lib/config/sfFilterConfigHandler.class.php b/lib/config/sfFilterConfigHandler.class.php index b4ba963ee..d9d221e27 100644 --- a/lib/config/sfFilterConfigHandler.class.php +++ b/lib/config/sfFilterConfigHandler.class.php @@ -33,8 +33,8 @@ public function execute($configFiles) $config = static::getConfiguration($configFiles); // init our data and includes arrays - $data = array(); - $includes = array(); + $data = []; + $includes = []; $execution = false; $rendering = false; @@ -123,7 +123,7 @@ public static function getConfiguration(array $configFiles) // we get the order of the new file and merge with the previous configurations $previous = $config; - $config = array(); + $config = []; foreach (static::parseYaml($configFile) as $key => $value) { $value = (array) $value; $config[$key] = isset($previous[$key]) ? sfToolkit::arrayDeepMerge($previous[$key], $value) : $value; diff --git a/lib/config/sfGeneratorConfigHandler.class.php b/lib/config/sfGeneratorConfigHandler.class.php index 524c94630..32279c9c1 100644 --- a/lib/config/sfGeneratorConfigHandler.class.php +++ b/lib/config/sfGeneratorConfigHandler.class.php @@ -44,7 +44,7 @@ public function execute($configFiles) throw new sfParseException(sprintf('Configuration file "%s" must specify a generator class section under the generator section.', isset($configFiles[1]) ? $configFiles[1] : $configFiles[0])); } - foreach (array('fields', 'list', 'edit') as $section) { + foreach (['fields', 'list', 'edit'] as $section) { if (isset($config[$section])) { throw new sfParseException(sprintf('Configuration file "%s" can specify a "%s" section but only under the param section.', isset($configFiles[1]) ? $configFiles[1] : $configFiles[0], $section)); } @@ -54,7 +54,7 @@ public function execute($configFiles) $generatorManager = new sfGeneratorManager(sfContext::getInstance()->getConfiguration()); // generator parameters - $generatorParam = (isset($config['param']) ? $config['param'] : array()); + $generatorParam = (isset($config['param']) ? $config['param'] : []); // hack to find the module name (look for the last /modules/ in path) preg_match('#.*/modules/([^/]+)/#', str_replace('\\', '/', $configFiles[0]), $match); diff --git a/lib/config/sfPluginConfiguration.class.php b/lib/config/sfPluginConfiguration.class.php index d6d5467ce..aa80e077d 100644 --- a/lib/config/sfPluginConfiguration.class.php +++ b/lib/config/sfPluginConfiguration.class.php @@ -106,9 +106,9 @@ public function initializeAutoload() $autoload = sfSimpleAutoload::getInstance(sfConfig::get('sf_cache_dir').'/project_autoload.cache'); if (is_readable($file = $this->rootDir.'/config/autoload.yml')) { - $this->configuration->getEventDispatcher()->connect('autoload.filter_config', array($this, 'filterAutoloadConfig')); - $autoload->loadConfiguration(array($file)); - $this->configuration->getEventDispatcher()->disconnect('autoload.filter_config', array($this, 'filterAutoloadConfig')); + $this->configuration->getEventDispatcher()->connect('autoload.filter_config', [$this, 'filterAutoloadConfig']); + $autoload->loadConfiguration([$file]); + $this->configuration->getEventDispatcher()->disconnect('autoload.filter_config', [$this, 'filterAutoloadConfig']); } else { $autoload->addDirectory($this->rootDir.'/lib'); } @@ -125,22 +125,22 @@ public function filterAutoloadConfig(sfEvent $event, array $config) { // use array_merge so config is added to the front of the autoload array if (!isset($config['autoload'][$this->name.'_lib'])) { - $config['autoload'] = array_merge(array( - $this->name.'_lib' => array( + $config['autoload'] = array_merge([ + $this->name.'_lib' => [ 'path' => $this->rootDir.'/lib', 'recursive' => true, - ), - ), $config['autoload']); + ], + ], $config['autoload']); } if (!isset($config['autoload'][$this->name.'_module_libs'])) { - $config['autoload'] = array_merge(array( - $this->name.'_module_libs' => array( + $config['autoload'] = array_merge([ + $this->name.'_module_libs' => [ 'path' => $this->rootDir.'/modules/*/lib', 'recursive' => true, 'prefix' => 1, - ), - ), $config['autoload']); + ], + ], $config['autoload']); } return $config; @@ -151,7 +151,7 @@ public function filterAutoloadConfig(sfEvent $event, array $config) */ public function connectTests() { - $this->dispatcher->connect('task.test.filter_test_files', array($this, 'filterTestFiles')); + $this->dispatcher->connect('task.test.filter_test_files', [$this, 'filterTestFiles']); } /** @@ -167,7 +167,7 @@ public function filterTestFiles(sfEvent $event, $files) if ($task instanceof sfTestAllTask) { $directory = $this->rootDir.'/test'; - $names = array(); + $names = []; } elseif ($task instanceof sfTestFunctionalTask) { $directory = $this->rootDir.'/test/functional'; $names = $event['arguments']['controller']; @@ -177,7 +177,7 @@ public function filterTestFiles(sfEvent $event, $files) } if (!count($names)) { - $names = array('*'); + $names = ['*']; } foreach ($names as $name) { diff --git a/lib/config/sfProjectConfiguration.class.php b/lib/config/sfProjectConfiguration.class.php index b2d02c8ec..68f006e20 100644 --- a/lib/config/sfProjectConfiguration.class.php +++ b/lib/config/sfProjectConfiguration.class.php @@ -25,16 +25,16 @@ class sfProjectConfiguration protected $dispatcher; /** @var array */ - protected $plugins = array(); + protected $plugins = []; /** @var array */ - protected $pluginPaths = array(); + protected $pluginPaths = []; /** @var array */ - protected $overriddenPluginPaths = array(); + protected $overriddenPluginPaths = []; /** @var sfPluginConfiguration[] */ - protected $pluginConfigurations = array(); + protected $pluginConfigurations = []; /** @var bool */ protected $pluginsLoaded = false; @@ -85,7 +85,7 @@ public function __construct($rootDir = null, ?sfEventDispatcher $dispatcher = nu */ public function __call($method, $arguments) { - $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'configuration.method_not_found', array('method' => $method, 'arguments' => $arguments))); + $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'configuration.method_not_found', ['method' => $method, 'arguments' => $arguments])); if (!$event->isProcessed()) { throw new sfException(sprintf('Call to undefined method %s::%s.', get_class($this), $method)); } @@ -144,7 +144,7 @@ public function setRootDir($rootDir) { $this->rootDir = $rootDir; - sfConfig::add(array( + sfConfig::add([ 'sf_root_dir' => $rootDir, // global directory structure @@ -155,7 +155,7 @@ public function setRootDir($rootDir) 'sf_config_dir' => $rootDir.DIRECTORY_SEPARATOR.'config', 'sf_test_dir' => $rootDir.DIRECTORY_SEPARATOR.'test', 'sf_plugins_dir' => $rootDir.DIRECTORY_SEPARATOR.'plugins', - )); + ]); $this->setWebDir($rootDir.DIRECTORY_SEPARATOR.'web'); $this->setCacheDir($rootDir.DIRECTORY_SEPARATOR.'cache'); @@ -198,11 +198,11 @@ public function setLogDir($logDir) */ public function setWebDir($webDir) { - sfConfig::add(array( + sfConfig::add([ 'sf_web_dir' => $webDir, 'sf_upload_dir_name' => $uploadDirName = 'uploads', 'sf_upload_dir' => $webDir.DIRECTORY_SEPARATOR.$uploadDirName, - )); + ]); } /** @@ -215,7 +215,7 @@ public function getModelDirs() { return array_merge( $this->getPluginSubPaths('/lib/model'), // plugins - array(sfConfig::get('sf_lib_dir').'/model') // project + [sfConfig::get('sf_lib_dir').'/model'] // project ); } @@ -230,9 +230,9 @@ public function getModelDirs() public function getGeneratorTemplateDirs($class, $theme) { return array_merge( - array(sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/template'), // project + [sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/template'], // project $this->getPluginSubPaths('/data/generator/'.$class.'/'.$theme.'/template'), // plugins - array(sfConfig::get('sf_data_dir').'/generator/'.$class.'/default/template'), // project (default theme) + [sfConfig::get('sf_data_dir').'/generator/'.$class.'/default/template'], // project (default theme) $this->getPluginSubPaths('/data/generator/'.$class.'/default/template') // plugins (default theme) ); } @@ -248,9 +248,9 @@ public function getGeneratorTemplateDirs($class, $theme) public function getGeneratorSkeletonDirs($class, $theme) { return array_merge( - array(sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/skeleton'), // project + [sfConfig::get('sf_data_dir').'/generator/'.$class.'/'.$theme.'/skeleton'], // project $this->getPluginSubPaths('/data/generator/'.$class.'/'.$theme.'/skeleton'), // plugins - array(sfConfig::get('sf_data_dir').'/generator/'.$class.'/default/skeleton'), // project (default theme) + [sfConfig::get('sf_data_dir').'/generator/'.$class.'/default/skeleton'], // project (default theme) $this->getPluginSubPaths('/data/generator/'.$class.'/default/skeleton') // plugins (default theme) ); } @@ -289,9 +289,9 @@ public function getConfigPaths($configPath) { $globalConfigPath = basename(dirname($configPath)).'/'.basename($configPath); - $files = array( + $files = [ $this->getSymfonyLibDir().'/config/'.$globalConfigPath, // symfony - ); + ]; foreach ($this->getPluginPaths() as $path) { if (is_file($file = $path.'/'.$globalConfigPath)) { @@ -299,10 +299,10 @@ public function getConfigPaths($configPath) } } - $files = array_merge($files, array( + $files = array_merge($files, [ $this->getRootDir().'/'.$globalConfigPath, // project $this->getRootDir().'/'.$configPath, // project - )); + ]); foreach ($this->getPluginPaths() as $path) { if (is_file($file = $path.'/'.$configPath)) { @@ -310,7 +310,7 @@ public function getConfigPaths($configPath) } } - $configs = array(); + $configs = []; foreach (array_unique($files) as $file) { if (is_readable($file)) { $configs[] = $file; @@ -335,7 +335,7 @@ public function setPlugins(array $plugins) $this->plugins = $plugins; - $this->pluginPaths = array(); + $this->pluginPaths = []; } /** @@ -349,7 +349,7 @@ public function enablePlugins($plugins) if (func_num_args() > 1) { $plugins = func_get_args(); } else { - $plugins = array($plugins); + $plugins = [$plugins]; } } @@ -370,7 +370,7 @@ public function disablePlugins($plugins) } if (!is_array($plugins)) { - $plugins = array($plugins); + $plugins = [$plugins]; } foreach ($plugins as $plugin) { @@ -381,7 +381,7 @@ public function disablePlugins($plugins) } } - $this->pluginPaths = array(); + $this->pluginPaths = []; } /** @@ -391,7 +391,7 @@ public function disablePlugins($plugins) * * @throws LogicException If plugins have already been loaded */ - public function enableAllPluginsExcept($plugins = array()) + public function enableAllPluginsExcept($plugins = []) { if ($this->pluginsLoaded) { throw new LogicException('Plugins have already been loaded.'); @@ -427,7 +427,7 @@ public function getPluginSubPaths($subPath = '') return $this->pluginPaths[$subPath]; } - $this->pluginPaths[$subPath] = array(); + $this->pluginPaths[$subPath] = []; $pluginPaths = $this->getPluginPaths(); foreach ($pluginPaths as $pluginPath) { if (is_dir($pluginPath.$subPath)) { @@ -450,7 +450,7 @@ public function getPluginPaths() if (!isset($this->pluginPaths[''])) { $pluginPaths = $this->getAllPluginPaths(); - $this->pluginPaths[''] = array(); + $this->pluginPaths[''] = []; foreach ($this->getPlugins() as $plugin) { if (isset($pluginPaths[$plugin])) { $this->pluginPaths[''][] = $pluginPaths[$plugin]; @@ -470,15 +470,15 @@ public function getPluginPaths() */ public function getAllPluginPaths() { - $pluginPaths = array(); + $pluginPaths = []; // search for *Plugin directories representing plugins // follow links and do not recurse. No need to exclude VC because they do not end with *Plugin $finder = sfFinder::type('dir')->maxdepth(0)->ignore_version_control(false)->follow_link()->name('*Plugin'); - $dirs = array( + $dirs = [ $this->getSymfonyLibDir().'/plugins', sfConfig::get('sf_plugins_dir'), - ); + ]; foreach ($finder->in($dirs) as $path) { $pluginPaths[basename($path)] = $path; diff --git a/lib/config/sfRootConfigHandler.class.php b/lib/config/sfRootConfigHandler.class.php index 4b9df5583..d7dfcbf9d 100644 --- a/lib/config/sfRootConfigHandler.class.php +++ b/lib/config/sfRootConfigHandler.class.php @@ -40,8 +40,8 @@ public function execute($configFiles) } // init our data and includes arrays - $data = array(); - $includes = array(); + $data = []; + $includes = []; // let's do our fancy work foreach ($config as $category => $keys) { diff --git a/lib/config/sfRoutingConfigHandler.class.php b/lib/config/sfRoutingConfigHandler.class.php index 9978334ab..f917bd4ab 100644 --- a/lib/config/sfRoutingConfigHandler.class.php +++ b/lib/config/sfRoutingConfigHandler.class.php @@ -28,14 +28,14 @@ public function execute($configFiles) $options = $this->getOptions(); unset($options['cache']); - $data = array(); + $data = []; foreach ($this->parse($configFiles) as $name => $routeConfig) { $r = new ReflectionClass($routeConfig[0]); /** @var sfRoute $route */ $route = $r->newInstanceArgs($routeConfig[1]); - $routes = $route instanceof sfRouteCollection ? $route : array($name => $route); + $routes = $route instanceof sfRouteCollection ? $route : [$name => $route]; foreach (sfPatternRouting::flattenRoutes($routes) as $name => $route) { $route->setDefaultOptions($options); $data[] = sprintf('$this->routes[\'%s\'] = %s;', $name, var_export(serialize($route), true)); @@ -55,7 +55,7 @@ public function evaluate($configFiles) { $routeDefinitions = $this->parse($configFiles); - $routes = array(); + $routes = []; foreach ($routeDefinitions as $name => $route) { $r = new ReflectionClass($route[0]); $routes[$name] = $r->newInstanceArgs($route[1]); @@ -85,24 +85,24 @@ protected function parse($configFiles) $config = static::getConfiguration($configFiles); // collect routes - $routes = array(); + $routes = []; foreach ($config as $name => $params) { if ( (isset($params['type']) && 'collection' == $params['type']) || (isset($params['class']) && false !== strpos($params['class'], 'Collection')) ) { - $options = isset($params['options']) ? $params['options'] : array(); + $options = isset($params['options']) ? $params['options'] : []; $options['name'] = $name; - $options['requirements'] = isset($params['requirements']) ? $params['requirements'] : array(); + $options['requirements'] = isset($params['requirements']) ? $params['requirements'] : []; - $routes[$name] = array(isset($params['class']) ? $params['class'] : 'sfRouteCollection', array($options)); + $routes[$name] = [isset($params['class']) ? $params['class'] : 'sfRouteCollection', [$options]]; } else { - $routes[$name] = array(isset($params['class']) ? $params['class'] : 'sfRoute', array( + $routes[$name] = [isset($params['class']) ? $params['class'] : 'sfRoute', [ $params['url'] ?: '/', - isset($params['params']) ? $params['params'] : (isset($params['param']) ? $params['param'] : array()), - isset($params['requirements']) ? $params['requirements'] : array(), - isset($params['options']) ? $params['options'] : array(), - )); + isset($params['params']) ? $params['params'] : (isset($params['param']) ? $params['param'] : []), + isset($params['requirements']) ? $params['requirements'] : [], + isset($params['options']) ? $params['options'] : [], + ]]; } } diff --git a/lib/config/sfServiceConfigHandler.class.php b/lib/config/sfServiceConfigHandler.class.php index 66b421884..0735f5fa6 100644 --- a/lib/config/sfServiceConfigHandler.class.php +++ b/lib/config/sfServiceConfigHandler.class.php @@ -32,10 +32,10 @@ public function execute($configFiles) $loader->load(static::getConfiguration($configFiles)); $dumper = new sfServiceContainerDumperPhp($serviceContainerBuilder); - $code = $dumper->dump(array( + $code = $dumper->dump([ 'class' => $class, 'base_class' => $this->parameterHolder->get('base_class'), - )); + ]); // compile data $retval = sprintf( diff --git a/lib/config/sfViewConfigHandler.class.php b/lib/config/sfViewConfigHandler.class.php index 68bb6e543..4df6dd7e4 100644 --- a/lib/config/sfViewConfigHandler.class.php +++ b/lib/config/sfViewConfigHandler.class.php @@ -32,7 +32,7 @@ public function execute($configFiles) $this->yamlConfig = static::getConfiguration($configFiles); // init our data array - $data = array(); + $data = []; $data[] = "\$response = \$this->context->getResponse();\n\n"; @@ -123,7 +123,7 @@ protected function addComponentSlots($viewName = '') $components = $this->mergeConfigValue('components', $viewName); foreach ($components as $name => $component) { if (!is_array($component) || count($component) < 1) { - $component = array(null, null); + $component = [null, null]; } $data .= " \$this->setComponentSlot('{$name}', '{$component[0]}', '{$component[1]}');\n"; @@ -213,7 +213,7 @@ protected function addLayout($viewName = '') */ protected function addHtmlHead($viewName = '') { - $data = array(); + $data = []; foreach ($this->mergeConfigValue('http_metas', $viewName) as $httpequiv => $content) { $data[] = sprintf(" \$response->addHttpMeta('%s', '%s', false);", $httpequiv, str_replace('\'', '\\\'', $content)); @@ -255,7 +255,7 @@ protected function addHtmlAsset($viewName = '') */ protected function addEscaping($viewName = '') { - $data = array(); + $data = []; $escaping = $this->getConfigValue('escaping', $viewName); @@ -269,16 +269,16 @@ protected function addEscaping($viewName = '') protected static function mergeConfig($config) { // merge javascripts and stylesheets - $config['all']['stylesheets'] = array_merge(isset($config['default']['stylesheets']) && is_array($config['default']['stylesheets']) ? $config['default']['stylesheets'] : array(), isset($config['all']['stylesheets']) && is_array($config['all']['stylesheets']) ? $config['all']['stylesheets'] : array()); + $config['all']['stylesheets'] = array_merge(isset($config['default']['stylesheets']) && is_array($config['default']['stylesheets']) ? $config['default']['stylesheets'] : [], isset($config['all']['stylesheets']) && is_array($config['all']['stylesheets']) ? $config['all']['stylesheets'] : []); unset($config['default']['stylesheets']); - $config['all']['javascripts'] = array_merge(isset($config['default']['javascripts']) && is_array($config['default']['javascripts']) ? $config['default']['javascripts'] : array(), isset($config['all']['javascripts']) && is_array($config['all']['javascripts']) ? $config['all']['javascripts'] : array()); + $config['all']['javascripts'] = array_merge(isset($config['default']['javascripts']) && is_array($config['default']['javascripts']) ? $config['default']['javascripts'] : [], isset($config['all']['javascripts']) && is_array($config['all']['javascripts']) ? $config['all']['javascripts'] : []); unset($config['default']['javascripts']); // merge default and all $config['all'] = sfToolkit::arrayDeepMerge( - isset($config['default']) && is_array($config['default']) ? $config['default'] : array(), - isset($config['all']) && is_array($config['all']) ? $config['all'] : array() + isset($config['default']) && is_array($config['default']) ? $config['default'] : [], + isset($config['all']) && is_array($config['all']) ? $config['all'] : [] ); unset($config['default']); @@ -296,7 +296,7 @@ protected static function mergeConfig($config) */ private function addAssets($type, $assets) { - $tmp = array(); + $tmp = []; foreach ((array) $assets as $asset) { $position = ''; if (is_array($asset)) { @@ -309,11 +309,11 @@ private function addAssets($type, $assets) } } else { $key = $asset; - $options = array(); + $options = []; } if ('-*' == $key) { - $tmp = array(); + $tmp = []; } elseif ('-' == $key[0]) { unset($tmp[substr($key, 1)]); } else { diff --git a/lib/config/sfYamlConfigHandler.class.php b/lib/config/sfYamlConfigHandler.class.php index 35837b45d..d1ea1e798 100644 --- a/lib/config/sfYamlConfigHandler.class.php +++ b/lib/config/sfYamlConfigHandler.class.php @@ -28,10 +28,10 @@ abstract class sfYamlConfigHandler extends sfConfigHandler */ public static function parseYamls($configFiles) { - $config = array(); + $config = []; foreach ($configFiles as $configFile) { // the first level is an environment and its value must be an array - $values = array(); + $values = []; foreach (static::parseYaml($configFile) as $env => $value) { if (null !== $value) { $values[$env] = $value; @@ -69,14 +69,14 @@ public static function parseYaml($configFile) throw new sfParseException(sprintf('Configuration file "%s" could not be parsed', $configFile)); } - return null === $config ? array() : $config; + return null === $config ? [] : $config; } public static function flattenConfiguration($config) { $config['all'] = sfToolkit::arrayDeepMerge( - isset($config['default']) && is_array($config['default']) ? $config['default'] : array(), - isset($config['all']) && is_array($config['all']) ? $config['all'] : array() + isset($config['default']) && is_array($config['default']) ? $config['default'] : [], + isset($config['all']) && is_array($config['all']) ? $config['all'] : [] ); unset($config['default']); @@ -94,9 +94,9 @@ public static function flattenConfiguration($config) public static function flattenConfigurationWithEnvironment($config) { return sfToolkit::arrayDeepMerge( - isset($config['default']) && is_array($config['default']) ? $config['default'] : array(), - isset($config['all']) && is_array($config['all']) ? $config['all'] : array(), - isset($config[sfConfig::get('sf_environment')]) && is_array($config[sfConfig::get('sf_environment')]) ? $config[sfConfig::get('sf_environment')] : array() + isset($config['default']) && is_array($config['default']) ? $config['default'] : [], + isset($config['all']) && is_array($config['all']) ? $config['all'] : [], + isset($config[sfConfig::get('sf_environment')]) && is_array($config[sfConfig::get('sf_environment')]) ? $config[sfConfig::get('sf_environment')] : [] ); } @@ -110,7 +110,7 @@ public static function flattenConfigurationWithEnvironment($config) */ protected function mergeConfigValue($keyName, $category) { - $values = array(); + $values = []; if (isset($this->yamlConfig['all'][$keyName]) && is_array($this->yamlConfig['all'][$keyName])) { $values = $this->yamlConfig['all'][$keyName]; diff --git a/lib/controller/default/templates/defaultLayout.php b/lib/controller/default/templates/defaultLayout.php index 1898f65a8..8aa94057f 100644 --- a/lib/controller/default/templates/defaultLayout.php +++ b/lib/controller/default/templates/defaultLayout.php @@ -18,7 +18,7 @@
- 'symfony PHP Framework', 'class' => 'sfTLogo', 'size' => '186x39')), 'http://www.symfony-project.org/'); ?> + 'symfony PHP Framework', 'class' => 'sfTLogo', 'size' => '186x39']), 'http://www.symfony-project.org/'); ?>
diff --git a/lib/controller/default/templates/disabledSuccess.php b/lib/controller/default/templates/disabledSuccess.php index 1f76fbff2..d52ff435b 100644 --- a/lib/controller/default/templates/disabledSuccess.php +++ b/lib/controller/default/templates/disabledSuccess.php @@ -1,7 +1,7 @@
- 'module disabled', 'class' => 'sfTMessageIcon', 'size' => '48x48')); ?> + 'module disabled', 'class' => 'sfTMessageIcon', 'size' => '48x48']); ?>

This Module is Unavailable

This module has been disabled.
diff --git a/lib/controller/default/templates/error404Success.php b/lib/controller/default/templates/error404Success.php index 919af7520..9a65929a1 100644 --- a/lib/controller/default/templates/error404Success.php +++ b/lib/controller/default/templates/error404Success.php @@ -1,7 +1,7 @@
- 'page not found', 'class' => 'sfTMessageIcon', 'size' => '48x48')); ?> + 'page not found', 'class' => 'sfTMessageIcon', 'size' => '48x48']); ?>

Oops! Page Not Found

The server returned a 404 response.
diff --git a/lib/controller/default/templates/indexSuccess.php b/lib/controller/default/templates/indexSuccess.php index b50638f39..9d887fb63 100644 --- a/lib/controller/default/templates/indexSuccess.php +++ b/lib/controller/default/templates/indexSuccess.php @@ -1,7 +1,7 @@
- 'ok', 'class' => 'sfTMessageIcon', 'size' => '48x48')); ?> + 'ok', 'class' => 'sfTMessageIcon', 'size' => '48x48']); ?>

Symfony Project Created

Congratulations! You have successfully created your symfony project.
diff --git a/lib/controller/default/templates/loginSuccess.php b/lib/controller/default/templates/loginSuccess.php index f1b5c7e0e..ea2603779 100644 --- a/lib/controller/default/templates/loginSuccess.php +++ b/lib/controller/default/templates/loginSuccess.php @@ -1,7 +1,7 @@
- 'login required', 'class' => 'sfTMessageIcon', 'size' => '48x48')); ?> + 'login required', 'class' => 'sfTMessageIcon', 'size' => '48x48']); ?>

Login Required

This page is not public.
diff --git a/lib/controller/default/templates/moduleSuccess.php b/lib/controller/default/templates/moduleSuccess.php index b4dc0bdcd..f26727222 100644 --- a/lib/controller/default/templates/moduleSuccess.php +++ b/lib/controller/default/templates/moduleSuccess.php @@ -1,7 +1,7 @@
- 'module created', 'class' => 'sfTMessageIcon', 'size' => '48x48')); ?> + 'module created', 'class' => 'sfTMessageIcon', 'size' => '48x48']); ?>

Module "get('module'); ?>" created

Congratulations! You have successfully created a symfony module.
diff --git a/lib/controller/default/templates/secureSuccess.php b/lib/controller/default/templates/secureSuccess.php index 3151ff665..912963b26 100644 --- a/lib/controller/default/templates/secureSuccess.php +++ b/lib/controller/default/templates/secureSuccess.php @@ -1,7 +1,7 @@
- 'credentials required', 'class' => 'sfTMessageIcon', 'size' => '48x48')); ?> + 'credentials required', 'class' => 'sfTMessageIcon', 'size' => '48x48']); ?>

Credentials Required

This page is in a restricted area.
diff --git a/lib/controller/sfController.class.php b/lib/controller/sfController.class.php index d484b350c..b420285fc 100644 --- a/lib/controller/sfController.class.php +++ b/lib/controller/sfController.class.php @@ -24,7 +24,7 @@ abstract class sfController protected $dispatcher; /** @var string[] */ - protected $controllerClasses = array(); + protected $controllerClasses = []; /** @var int */ protected $renderMode = sfView::RENDER_CLIENT; @@ -56,7 +56,7 @@ public function __construct($context) */ public function __call($method, $arguments) { - $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'controller.method_not_found', array('method' => $method, 'arguments' => $arguments))); + $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'controller.method_not_found', ['method' => $method, 'arguments' => $arguments])); if (!$event->isProcessed()) { throw new sfException(sprintf('Call to undefined method %s::%s.', get_class($this), $method)); } @@ -129,7 +129,7 @@ public function forward($moduleName, $actionName) if (!$this->actionExists($moduleName, $actionName)) { // the requested action doesn't exist if (sfConfig::get('sf_logging_enabled')) { - $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Action "%s/%s" does not exist', $moduleName, $actionName)))); + $this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Action "%s/%s" does not exist', $moduleName, $actionName)])); } throw new sfError404Exception(sprintf('Action "%s/%s" does not exist.', $moduleName, $actionName)); @@ -161,13 +161,13 @@ public function forward($moduleName, $actionName) $filterChain = new sfFilterChain(); $filterChain->loadConfiguration($actionInstance); - $this->context->getEventDispatcher()->notify(new sfEvent($this, 'controller.change_action', array('module' => $moduleName, 'action' => $actionName))); + $this->context->getEventDispatcher()->notify(new sfEvent($this, 'controller.change_action', ['module' => $moduleName, 'action' => $actionName])); if ($moduleName == sfConfig::get('sf_error_404_module') && $actionName == sfConfig::get('sf_error_404_action')) { $this->context->getResponse()->setStatusCode(404); $this->context->getResponse()->setHttpHeader('Status', '404 Not Found'); - $this->dispatcher->notify(new sfEvent($this, 'controller.page_not_found', array('module' => $moduleName, 'action' => $actionName))); + $this->dispatcher->notify(new sfEvent($this, 'controller.page_not_found', ['module' => $moduleName, 'action' => $actionName])); } // process the filter chain @@ -281,7 +281,7 @@ public function getView($moduleName, $actionName, $viewName) public function getPresentationFor($module, $action, $viewName = null) { if (sfConfig::get('sf_logging_enabled')) { - $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Get presentation for action "%s/%s" (view class: "%s")', $module, $action, $viewName)))); + $this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Get presentation for action "%s/%s" (view class: "%s")', $module, $action, $viewName)])); } // get original render mode @@ -448,7 +448,7 @@ protected function controllerExists($moduleName, $controllerName, $extension, $t // send an exception if debug if ($throwExceptions && sfConfig::get('sf_debug')) { - $dirs = array_map(array('sfDebug', 'shortenFilePath'), array_keys($dirs)); + $dirs = array_map(['sfDebug', 'shortenFilePath'], array_keys($dirs)); throw new sfControllerException(sprintf('Controller "%s/%s" does not exist in: %s.', $moduleName, $controllerName, implode(', ', $dirs))); } diff --git a/lib/controller/sfFrontWebController.class.php b/lib/controller/sfFrontWebController.class.php index cddf17322..073dea69c 100644 --- a/lib/controller/sfFrontWebController.class.php +++ b/lib/controller/sfFrontWebController.class.php @@ -28,7 +28,7 @@ public function dispatch() { try { // reinitialize filters (needed for unit and functional tests) - sfFilter::$filterCalled = array(); + sfFilter::$filterCalled = []; // determine our module and action /** @var sfWebRequest $request */ diff --git a/lib/controller/sfWebController.class.php b/lib/controller/sfWebController.class.php index 80af2750a..74eb60d85 100644 --- a/lib/controller/sfWebController.class.php +++ b/lib/controller/sfWebController.class.php @@ -25,7 +25,7 @@ abstract class sfWebController extends sfController * * @return string A URL to a symfony resource */ - public function genUrl($parameters = array(), $absolute = false) + public function genUrl($parameters = [], $absolute = false) { $route = ''; $fragment = ''; @@ -82,7 +82,7 @@ public function convertUrlStringToParameters($url) { $givenUrl = $url; - $params = array(); + $params = []; $queryString = ''; $route = ''; @@ -137,7 +137,7 @@ public function convertUrlStringToParameters($url) } } - return array($route, $params); + return [$route, $params]; } /** @@ -161,7 +161,7 @@ public function redirect($url, $delay = 0, $statusCode = 302) $url = str_replace('&', '&', $url); if (sfConfig::get('sf_logging_enabled')) { - $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Redirect to "%s"', $url)))); + $this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Redirect to "%s"', $url)])); } // redirect diff --git a/lib/database/sfDatabase.class.php b/lib/database/sfDatabase.class.php index 61f13c391..a380050cd 100644 --- a/lib/database/sfDatabase.class.php +++ b/lib/database/sfDatabase.class.php @@ -34,7 +34,7 @@ abstract class sfDatabase * * @param array $parameters An associative array of initialization parameters */ - public function __construct($parameters = array()) + public function __construct($parameters = []) { $this->initialize($parameters); } @@ -46,7 +46,7 @@ public function __construct($parameters = array()) * * @throws sfInitializationException If an error occurs while initializing this sfDatabase object */ - public function initialize($parameters = array()) + public function initialize($parameters = []) { $this->parameterHolder = new sfParameterHolder(); $this->parameterHolder->add($parameters); diff --git a/lib/database/sfDatabaseManager.class.php b/lib/database/sfDatabaseManager.class.php index 96c95de7e..c293005ed 100644 --- a/lib/database/sfDatabaseManager.class.php +++ b/lib/database/sfDatabaseManager.class.php @@ -21,7 +21,7 @@ class sfDatabaseManager { /** @var sfProjectConfiguration */ protected $configuration; - protected $databases = array(); + protected $databases = []; /** * Class constructor. @@ -30,12 +30,12 @@ class sfDatabaseManager * * @param array $options */ - public function __construct(sfProjectConfiguration $configuration, $options = array()) + public function __construct(sfProjectConfiguration $configuration, $options = []) { $this->initialize($configuration); if (!isset($options['auto_shutdown']) || $options['auto_shutdown']) { - register_shutdown_function(array($this, 'shutdown')); + register_shutdown_function([$this, 'shutdown']); } } @@ -62,7 +62,7 @@ public function loadConfiguration() $databases = include $this->configuration->getConfigCache()->checkConfig('config/databases.yml'); } else { $configHandler = new sfDatabaseConfigHandler(); - $databases = $configHandler->evaluate(array($this->configuration->getRootDir().'/config/databases.yml')); + $databases = $configHandler->evaluate([$this->configuration->getRootDir().'/config/databases.yml']); } foreach ($databases as $name => $database) { diff --git a/lib/database/sfPDODatabase.class.php b/lib/database/sfPDODatabase.class.php index 996e43e97..73c02cbdb 100644 --- a/lib/database/sfPDODatabase.class.php +++ b/lib/database/sfPDODatabase.class.php @@ -27,7 +27,7 @@ class sfPDODatabase extends sfDatabase */ public function __call($method, $arguments) { - return call_user_func_array(array($this->getConnection(), $method), $arguments); + return call_user_func_array([$this->getConnection(), $method], $arguments); } /** @@ -48,7 +48,7 @@ public function connect() $password = $this->getParameter('password'); $persistent = $this->getParameter('persistent'); - $options = $persistent ? array(PDO::ATTR_PERSISTENT => true) : array(); + $options = $persistent ? [PDO::ATTR_PERSISTENT => true] : []; $this->connection = new $pdo_class($dsn, $username, $password, $options); } catch (PDOException $e) { diff --git a/lib/debug/sfDebug.class.php b/lib/debug/sfDebug.class.php index 56c687788..e671fe03a 100644 --- a/lib/debug/sfDebug.class.php +++ b/lib/debug/sfDebug.class.php @@ -22,10 +22,10 @@ class sfDebug */ public static function symfonyInfoAsArray() { - return array( + return [ 'version' => SYMFONY_VERSION, 'path' => sfConfig::get('sf_symfony_lib_dir'), - ); + ]; } /** @@ -35,11 +35,11 @@ public static function symfonyInfoAsArray() */ public static function phpInfoAsArray() { - $values = array( + $values = [ 'php' => phpversion(), 'os' => php_uname(), 'extensions' => get_loaded_extensions(), - ); + ]; natcasesort($values['extensions']); @@ -60,13 +60,13 @@ public static function phpInfoAsArray() */ public static function globalsAsArray() { - $values = array(); - foreach (array('cookie', 'server', 'get', 'post', 'files', 'env', 'session') as $name) { + $values = []; + foreach (['cookie', 'server', 'get', 'post', 'files', 'env', 'session'] as $name) { if (!isset($GLOBALS['_'.strtoupper($name)])) { continue; } - $values[$name] = array(); + $values[$name] = []; foreach ($GLOBALS['_'.strtoupper($name)] as $key => $value) { $values[$name][$key] = $value; } @@ -102,14 +102,14 @@ public static function settingsAsArray() public static function requestAsArray(?sfRequest $request = null) { if (!$request) { - return array(); + return []; } - return array( + return [ 'options' => $request->getOptions(), 'parameterHolder' => self::flattenParameterHolder($request->getParameterHolder(), true), 'attributeHolder' => self::flattenParameterHolder($request->getAttributeHolder(), true), - ); + ]; } /** @@ -122,19 +122,19 @@ public static function requestAsArray(?sfRequest $request = null) public static function responseAsArray(?sfResponse $response = null) { if (!$response) { - return array(); + return []; } - return array( - 'status' => array('code' => $response->getStatusCode(), 'text' => $response->getStatusText()), + return [ + 'status' => ['code' => $response->getStatusCode(), 'text' => $response->getStatusText()], 'options' => $response->getOptions(), - 'cookies' => method_exists($response, 'getCookies') ? $response->getCookies() : array(), - 'httpHeaders' => method_exists($response, 'getHttpHeaders') ? $response->getHttpHeaders() : array(), - 'javascripts' => method_exists($response, 'getJavascripts') ? $response->getJavascripts('ALL') : array(), - 'stylesheets' => method_exists($response, 'getStylesheets') ? $response->getStylesheets('ALL') : array(), - 'metas' => method_exists($response, 'getMetas') ? $response->getMetas() : array(), - 'httpMetas' => method_exists($response, 'getHttpMetas') ? $response->getHttpMetas() : array(), - ); + 'cookies' => method_exists($response, 'getCookies') ? $response->getCookies() : [], + 'httpHeaders' => method_exists($response, 'getHttpHeaders') ? $response->getHttpHeaders() : [], + 'javascripts' => method_exists($response, 'getJavascripts') ? $response->getJavascripts('ALL') : [], + 'stylesheets' => method_exists($response, 'getStylesheets') ? $response->getStylesheets('ALL') : [], + 'metas' => method_exists($response, 'getMetas') ? $response->getMetas() : [], + 'httpMetas' => method_exists($response, 'getHttpMetas') ? $response->getHttpMetas() : [], + ]; } /** @@ -147,21 +147,21 @@ public static function responseAsArray(?sfResponse $response = null) public static function userAsArray(?sfUser $user = null) { if (!$user) { - return array(); + return []; } - $data = array( + $data = [ 'options' => $user->getOptions(), 'attributeHolder' => self::flattenParameterHolder($user->getAttributeHolder(), true), 'culture' => $user->getCulture(), - ); + ]; if ($user instanceof sfBasicSecurityUser) { - $data = array_merge($data, array( + $data = array_merge($data, [ 'authenticated' => $user->isAuthenticated(), 'credentials' => $user->getCredentials(), 'lastRequest' => $user->getLastRequestTime(), - )); + ]); } return $data; @@ -177,10 +177,10 @@ public static function userAsArray(?sfUser $user = null) */ public static function flattenParameterHolder($parameterHolder, $removeObjects = false) { - $values = array(); + $values = []; if ($parameterHolder instanceof sfNamespacedParameterHolder) { foreach ($parameterHolder->getNamespaces() as $ns) { - $values[$ns] = array(); + $values[$ns] = []; foreach ($parameterHolder->getAll($ns) as $key => $value) { $values[$ns][$key] = $value; } @@ -210,7 +210,7 @@ public static function flattenParameterHolder($parameterHolder, $removeObjects = */ public static function removeObjects($values) { - $nvalues = array(); + $nvalues = []; foreach ($values as $key => $value) { if (is_array($value)) { $nvalues[$key] = self::removeObjects($value); @@ -237,7 +237,7 @@ public static function shortenFilePath($file) return $file; } - foreach (array('sf_root_dir', 'sf_symfony_lib_dir') as $key) { + foreach (['sf_root_dir', 'sf_symfony_lib_dir'] as $key) { if (0 === strpos($file, $value = sfConfig::get($key))) { $file = str_replace($value, strtoupper($key), $file); diff --git a/lib/debug/sfTimerManager.class.php b/lib/debug/sfTimerManager.class.php index 5026484d0..e099797e2 100644 --- a/lib/debug/sfTimerManager.class.php +++ b/lib/debug/sfTimerManager.class.php @@ -16,7 +16,7 @@ class sfTimerManager { /** @var sfTimer[] */ - public static $timers = array(); + public static $timers = []; /** * Gets a sfTimer instance. @@ -56,6 +56,6 @@ public static function getTimers() */ public static function clearTimers() { - self::$timers = array(); + self::$timers = []; } } diff --git a/lib/debug/sfWebDebug.class.php b/lib/debug/sfWebDebug.class.php index 2e362e073..3e1d2258b 100644 --- a/lib/debug/sfWebDebug.class.php +++ b/lib/debug/sfWebDebug.class.php @@ -17,8 +17,8 @@ class sfWebDebug { protected $dispatcher; protected $logger; - protected $options = array(); - protected $panels = array(); + protected $options = []; + protected $panels = []; /** * Constructor. @@ -32,7 +32,7 @@ class sfWebDebug * @param sfVarLogger $logger The logger * @param array $options An array of options */ - public function __construct(sfEventDispatcher $dispatcher, sfVarLogger $logger, array $options = array()) + public function __construct(sfEventDispatcher $dispatcher, sfVarLogger $logger, array $options = []) { $this->dispatcher = $dispatcher; $this->logger = $logger; @@ -43,7 +43,7 @@ public function __construct(sfEventDispatcher $dispatcher, sfVarLogger $logger, } if (!isset($this->options['request_parameters'])) { - $this->options['request_parameters'] = array(); + $this->options['request_parameters'] = []; } $this->configure(); @@ -157,7 +157,7 @@ public function injectToolbar($content) } if (false !== $pos = $posFunction($content, '')) { - $styles = ''; + $styles = ''; $content = $substrFunction($content, 0, $pos).$styles.$substrFunction($content, $pos); } @@ -180,8 +180,8 @@ public function asHtml() { $current = isset($this->options['request_parameters']['sfWebDebugPanel']) ? $this->options['request_parameters']['sfWebDebugPanel'] : null; - $titles = array(); - $panels = array(); + $titles = []; + $panels = []; foreach ($this->panels as $name => $panel) { if ($title = $panel->getTitle()) { if (($content = $panel->getPanelContent()) || $panel->getTitleUrl()) { diff --git a/lib/debug/sfWebDebugPanel.class.php b/lib/debug/sfWebDebugPanel.class.php index 9c1d42334..487feac49 100644 --- a/lib/debug/sfWebDebugPanel.class.php +++ b/lib/debug/sfWebDebugPanel.class.php @@ -164,7 +164,7 @@ public function formatFileLink($file, $line = null, $text = null) // return a link return sprintf( '%s', - htmlspecialchars(strtr($linkFormat, array('%f' => $file, '%l' => $line)), ENT_QUOTES, sfConfig::get('sf_charset')), + htmlspecialchars(strtr($linkFormat, ['%f' => $file, '%l' => $line]), ENT_QUOTES, sfConfig::get('sf_charset')), htmlspecialchars($shortFile, ENT_QUOTES, sfConfig::get('sf_charset')), null === $text ? $shortFile : $text ); diff --git a/lib/debug/sfWebDebugPanelConfig.class.php b/lib/debug/sfWebDebugPanelConfig.class.php index 9b1a74b2a..f13b224ac 100644 --- a/lib/debug/sfWebDebugPanelConfig.class.php +++ b/lib/debug/sfWebDebugPanelConfig.class.php @@ -27,7 +27,7 @@ public function getPanelTitle() public function getPanelContent() { - $config = array( + $config = [ 'debug' => sfConfig::get('sf_debug') ? 'on' : 'off', 'xdebug' => extension_loaded('xdebug') ? 'on' : 'off', 'logging' => sfConfig::get('sf_logging_enabled') ? 'on' : 'off', @@ -37,7 +37,7 @@ public function getPanelContent() 'eaccelerator' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable') ? 'on' : 'off', 'apc' => extension_loaded('apc') && ini_get('apc.enabled') ? 'on' : 'off', 'xcache' => extension_loaded('xcache') && ini_get('xcache.cacher') ? 'on' : 'off', - ); + ]; $html = '
    '; foreach ($config as $key => $value) { diff --git a/lib/debug/sfWebDebugPanelLogs.class.php b/lib/debug/sfWebDebugPanelLogs.class.php index fc7928e11..e077bed56 100644 --- a/lib/debug/sfWebDebugPanelLogs.class.php +++ b/lib/debug/sfWebDebugPanelLogs.class.php @@ -59,7 +59,7 @@ class_exists($log['type'], false) ? $this->formatFileLink($log['type']) : $log[' } $html .= ''; - $types = array(); + $types = []; foreach ($this->webDebug->getLogger()->getTypes() as $type) { $types[] = ''.$type.''; } @@ -89,7 +89,7 @@ protected function formatLogLine($logLine) static $constants; if (!$constants) { - foreach (array('sf_app_dir', 'sf_root_dir', 'sf_symfony_lib_dir') as $constant) { + foreach (['sf_app_dir', 'sf_root_dir', 'sf_symfony_lib_dir'] as $constant) { $constants[realpath(sfConfig::get($constant)).DIRECTORY_SEPARATOR] = $constant.DIRECTORY_SEPARATOR; } } @@ -100,9 +100,9 @@ protected function formatLogLine($logLine) // replace constants value with constant name $logLine = str_replace(array_keys($constants), array_values($constants), $logLine); - $logLine = sfToolkit::pregtr($logLine, array('/"(.+?)"/s' => '"\\1"', + $logLine = sfToolkit::pregtr($logLine, ['/"(.+?)"/s' => '"\\1"', '/^(.+?)\(\)\:/S' => '\\1():', - '/line (\d+)$/' => 'line \\1')); + '/line (\d+)$/' => 'line \\1']); // special formatting for SQL lines $logLine = $this->formatSql($logLine); diff --git a/lib/debug/sfWebDebugPanelMailer.class.php b/lib/debug/sfWebDebugPanelMailer.class.php index 5b71b3b46..d1a7002f9 100644 --- a/lib/debug/sfWebDebugPanelMailer.class.php +++ b/lib/debug/sfWebDebugPanelMailer.class.php @@ -27,7 +27,7 @@ public function __construct(sfWebDebug $webDebug) { parent::__construct($webDebug); - $this->webDebug->getEventDispatcher()->connect('mailer.configure', array($this, 'listenForMailerConfigure')); + $this->webDebug->getEventDispatcher()->connect('mailer.configure', [$this, 'listenForMailerConfigure']); } public function getTitle() @@ -50,7 +50,7 @@ public function getPanelContent() return false; } - $html = array(); + $html = []; // configuration information $strategy = $this->mailer->getDeliveryStrategy(); @@ -86,7 +86,7 @@ protected function renderMessageInformation(Swift_Message $message) $to = null === $message->getTo() ? '' : implode(', ', array_keys($message->getTo())); - $html = array(); + $html = []; $html[] = sprintf('

    %s (to: %s) %s

    ', $message->getSubject(), $to, $this->getToggler('sfWebDebugMailTemplate'.$i)); $html[] = '
    '; $html[] = '
    '.htmlentities($message->toString(), ENT_QUOTES, $message->getCharset()).'
    '; diff --git a/lib/debug/sfWebDebugPanelTimer.class.php b/lib/debug/sfWebDebugPanelTimer.class.php index 7ce5af2ec..3eb90d6c8 100644 --- a/lib/debug/sfWebDebugPanelTimer.class.php +++ b/lib/debug/sfWebDebugPanelTimer.class.php @@ -26,7 +26,7 @@ public function __construct(sfWebDebug $webDebug) { parent::__construct($webDebug); - $this->webDebug->getEventDispatcher()->connect('debug.web.filter_logs', array($this, 'filterLogs')); + $this->webDebug->getEventDispatcher()->connect('debug.web.filter_logs', [$this, 'filterLogs']); } public function getTitle() @@ -55,7 +55,7 @@ public function getPanelContent() public function filterLogs(sfEvent $event, $logs) { - $newLogs = array(); + $newLogs = []; foreach ($logs as $log) { if ('sfWebDebugLogger' != $log['type']) { $newLogs[] = $log; diff --git a/lib/debug/sfWebDebugPanelView.class.php b/lib/debug/sfWebDebugPanelView.class.php index 7072ea25a..96af9c19f 100644 --- a/lib/debug/sfWebDebugPanelView.class.php +++ b/lib/debug/sfWebDebugPanelView.class.php @@ -17,8 +17,8 @@ */ class sfWebDebugPanelView extends sfWebDebugPanel { - protected $actions = array(); - protected $partials = array(); + protected $actions = []; + protected $partials = []; /** * Constructor. @@ -29,8 +29,8 @@ public function __construct(sfWebDebug $webDebug) { parent::__construct($webDebug); - $this->webDebug->getEventDispatcher()->connect('controller.change_action', array($this, 'listenForChangeAction')); - $this->webDebug->getEventDispatcher()->connect('template.filter_parameters', array($this, 'filterTemplateParameters')); + $this->webDebug->getEventDispatcher()->connect('controller.change_action', [$this, 'listenForChangeAction']); + $this->webDebug->getEventDispatcher()->connect('template.filter_parameters', [$this, 'filterTemplateParameters']); } /** @@ -38,8 +38,8 @@ public function __construct(sfWebDebug $webDebug) */ public function listenForChangeAction(sfEvent $event) { - $this->actions = array(); - $this->partials = array(); + $this->actions = []; + $this->partials = []; } /** @@ -51,12 +51,12 @@ public function listenForChangeAction(sfEvent $event) */ public function filterTemplateParameters(sfEvent $event, $parameters) { - $entry = array('parameters' => $parameters); + $entry = ['parameters' => $parameters]; if ('action' == $parameters['sf_type'] && $file = $this->getLastTemplate()) { - $this->actions[] = $entry + array('file' => $file); + $this->actions[] = $entry + ['file' => $file]; } elseif ('partial' == $parameters['sf_type'] && $file = $this->getLastTemplate('sfPartialView')) { - $this->partials[] = $entry + array('file' => $file); + $this->partials[] = $entry + ['file' => $file]; } return $parameters; @@ -85,7 +85,7 @@ public function getPanelTitle() */ public function getPanelContent() { - $html = array(); + $html = []; foreach ($this->actions as $action) { $html[] = $this->renderTemplateInformation($action['file'], $action['parameters']); @@ -135,7 +135,7 @@ protected function renderTemplateInformation($file, $parameters, $label = 'Templ $parameters = $this->filterCoreParameters($parameters); ++$i; - $html = array(); + $html = []; $html[] = sprintf('

    %s: %s %s

    ', $label, $this->formatFileLink($file, null, $this->shortenTemplatePath($file)), $this->getToggler('sfWebDebugViewTemplate'.$i)); $html[] = '
    '; if (count($parameters)) { @@ -143,7 +143,7 @@ protected function renderTemplateInformation($file, $parameters, $label = 'Templ $html[] = '
      '; foreach ($parameters as $name => $parameter) { $presentation = '
    • '.$this->formatParameterAsHtml($name, $parameter).'
    • '; - $html[] = $this->webDebug->getEventDispatcher()->filter(new sfEvent($this, 'debug.web.view.filter_parameter_html', array('parameter' => $parameter)), $presentation)->getReturnValue(); + $html[] = $this->webDebug->getEventDispatcher()->filter(new sfEvent($this, 'debug.web.view.filter_parameter_html', ['parameter' => $parameter]), $presentation)->getReturnValue(); } $html[] = '
    '; } else { @@ -204,7 +204,7 @@ protected function formatFormAsHtml($name, sfForm $form) $this->setStatus(sfLogger::NOTICE); } - $html = array(); + $html = []; $html[] = $this->getParameterDescription($name, $form, $form->hasErrors() ? '$%s' : null); $html[] = $this->getToggler('sfWebDebugViewForm'.$i); $html[] = '