From aa1612342e05f2075325ab9f2f9babaaa2074db4 Mon Sep 17 00:00:00 2001 From: Yassine Doghri Date: Wed, 19 May 2021 16:35:13 +0000 Subject: [PATCH] style(ecs): add easy-coding-standard to enforce coding style rules for php - update .devcontainer settings: remove auto-formatting for php + set intelephense as default formatter - remove prettier php plugin as it lacks php 8 support - add captain hook action for checking style pre-commit - fix style with ecs on all files except views --- .devcontainer/devcontainer.json | 5 +- .phpcs.xml | 7 - .prettierrc.json | 7 - app/Authorization/FlatAuthorization.php | 14 +- app/Authorization/PermissionModel.php | 28 +- app/Common.php | 9 +- app/Config/ActivityPub.php | 8 +- app/Config/Analytics.php | 3 +- app/Config/App.php | 29 +- app/Config/Autoload.php | 2 +- app/Config/Boot/production.php | 9 +- app/Config/Cache.php | 5 +- app/Config/ContentSecurityPolicy.php | 66 +- app/Config/Cookie.php | 9 +- app/Config/Database.php | 11 +- app/Config/Email.php | 21 - app/Config/Encryption.php | 8 +- app/Config/Events.php | 66 +- app/Config/Exceptions.php | 2 - app/Config/Filters.php | 28 +- app/Config/Format.php | 5 +- app/Config/Honeypot.php | 5 - app/Config/Images.php | 19 +- app/Config/Kint.php | 8 +- app/Config/Logger.php | 17 +- app/Config/Migrations.php | 3 - app/Config/Mimes.php | 71 +- app/Config/Pager.php | 1 - app/Config/Paths.php | 13 +- app/Config/Routes.php | 69 +- app/Config/Security.php | 6 - app/Config/Services.php | 57 +- app/Config/Toolbar.php | 3 - app/Config/UserAgents.php | 1 + app/Config/Validation.php | 14 +- app/Config/View.php | 27 +- app/Controllers/ActorController.php | 4 +- app/Controllers/Admin/BaseController.php | 16 +- .../Admin/ContributorController.php | 42 +- app/Controllers/Admin/EpisodeController.php | 158 +- .../Admin/EpisodePersonController.php | 23 +- app/Controllers/Admin/FediverseController.php | 6 +- app/Controllers/Admin/HomeController.php | 1 + app/Controllers/Admin/MyAccountController.php | 14 +- app/Controllers/Admin/PageController.php | 45 +- app/Controllers/Admin/PersonController.php | 40 +- app/Controllers/Admin/PodcastController.php | 145 +- .../Admin/PodcastImportController.php | 172 +- .../Admin/PodcastPersonController.php | 26 +- .../Admin/PodcastPlatformController.php | 51 +- app/Controllers/Admin/UserController.php | 81 +- app/Controllers/AuthController.php | 33 +- app/Controllers/BaseController.php | 16 +- app/Controllers/CreditsController.php | 178 ++ app/Controllers/EpisodeController.php | 49 +- app/Controllers/FeedController.php | 26 +- app/Controllers/HomeController.php | 10 +- app/Controllers/InstallController.php | 116 +- app/Controllers/NoteController.php | 54 +- app/Controllers/PageController.php | 175 +- app/Controllers/PlatformController.php | 2 +- app/Controllers/PodcastController.php | 41 +- ...17-12-01-160000_add_podcasts_platforms.php | 3 +- .../2020-05-29-152000_add_categories.php | 3 +- .../2020-05-30-101000_add_languages.php | 3 +- .../2020-05-30-101500_add_podcasts.php | 11 +- .../2020-06-05-170000_add_episodes.php | 11 +- .../2020-06-05-180000_add_soundbites.php | 19 +- .../2020-06-05-190000_add_platforms.php | 7 +- .../2020-07-03-191500_add_podcasts_users.php | 19 +- .../2020-08-17-150000_add_pages.php | 3 +- ...0-09-29-150000_add_podcasts_categories.php | 19 +- .../2020-12-25-120000_add_persons.php | 3 +- ...2020-12-25-130000_add_podcasts_persons.php | 26 +- ...2020-12-25-140000_add_episodes_persons.php | 35 +- .../2020-12-25-150000_add_credit_view.php | 8 +- ...1-02-23-100000_add_episode_id_to_notes.php | 12 +- ...1-03-09-113000_add_created_by_to_notes.php | 12 +- app/Database/Seeds/AppSeeder.php | 3 +- app/Database/Seeds/AuthSeeder.php | 22 +- app/Database/Seeds/CategorySeeder.php | 3 +- .../Seeds/FakePodcastsAnalyticsSeeder.php | 24 +- .../Seeds/FakeWebsiteAnalyticsSeeder.php | 9 +- app/Database/Seeds/LanguageSeeder.php | 401 +++- app/Database/Seeds/PlatformSeeder.php | 3 +- app/Database/Seeds/TestSeeder.php | 30 +- app/Entities/Actor.php | 9 +- app/Entities/Category.php | 2 +- app/Entities/Credit.php | 37 +- app/Entities/Episode.php | 170 +- app/Entities/Image.php | 41 +- app/Entities/Location.php | 29 +- app/Entities/Note.php | 8 +- app/Entities/Page.php | 5 +- app/Entities/Person.php | 21 +- app/Entities/Podcast.php | 124 +- app/Entities/User.php | 9 +- app/Filters/PermissionFilter.php | 34 +- app/Helpers/auth_helper.php | 18 +- app/Helpers/breadcrumb_helper.php | 4 +- app/Helpers/components_helper.php | 70 +- app/Helpers/form_helper.php | 27 +- app/Helpers/id3_helper.php | 13 +- app/Helpers/media_helper.php | 29 +- app/Helpers/misc_helper.php | 6 +- app/Helpers/page_helper.php | 2 +- app/Helpers/rss_helper.php | 285 +-- app/Helpers/svg_helper.php | 16 +- app/Helpers/url_helper.php | 10 +- app/Language/en/Breadcrumb.php | 3 +- app/Language/en/Countries.php | 1 + app/Language/fr/Breadcrumb.php | 3 +- app/Language/fr/Countries.php | 1 + .../ActivityPub/Activities/AcceptActivity.php | 6 +- .../Activities/AnnounceActivity.php | 11 +- .../ActivityPub/Activities/CreateActivity.php | 6 +- .../ActivityPub/Activities/DeleteActivity.php | 6 +- .../ActivityPub/Activities/FollowActivity.php | 6 +- .../ActivityPub/Activities/LikeActivity.php | 6 +- .../ActivityPub/Activities/UndoActivity.php | 6 +- app/Libraries/ActivityPub/ActivityRequest.php | 15 +- app/Libraries/ActivityPub/Config/Routes.php | 14 +- .../Controllers/ActorController.php | 224 +-- .../Controllers/BlockController.php | 37 +- .../Controllers/NoteController.php | 78 +- .../Controllers/SchedulerController.php | 10 +- .../Controllers/WebFingerController.php | 4 +- .../ActivityPub/Core/AbstractObject.php | 7 +- app/Libraries/ActivityPub/Core/Activity.php | 10 +- app/Libraries/ActivityPub/Core/ObjectType.php | 9 +- .../2018-01-01-010000_add_actors.php | 3 +- .../2018-01-01-020000_add_notes.php | 27 +- .../2018-01-01-100000_add_activities.php | 27 +- .../2018-01-01-100000_add_favourites.php | 23 +- .../2018-01-01-100000_add_follows.php | 23 +- .../2018-01-01-100000_add_preview_cards.php | 7 +- ...8-01-01-110000_add_notes_preview_cards.php | 19 +- .../2018-01-01-120000_add_blocked_domains.php | 3 +- .../ActivityPub/Entities/Activity.php | 27 +- app/Libraries/ActivityPub/Entities/Actor.php | 14 +- app/Libraries/ActivityPub/Entities/Note.php | 64 +- .../ActivityPub/Filters/ActivityPubFilter.php | 40 +- .../Helpers/activitypub_helper.php | 166 +- app/Libraries/ActivityPub/HttpSignature.php | 29 +- .../ActivityPub/Models/ActivityModel.php | 16 +- .../ActivityPub/Models/ActorModel.php | 91 +- .../ActivityPub/Models/BlockedDomainModel.php | 48 +- .../ActivityPub/Models/FavouriteModel.php | 140 +- .../ActivityPub/Models/FollowModel.php | 106 +- .../ActivityPub/Models/NoteModel.php | 438 ++-- .../ActivityPub/Models/PreviewCardModel.php | 36 +- .../ActivityPub/Objects/ActorObject.php | 14 +- .../ActivityPub/Objects/NoteObject.php | 12 +- .../Objects/OrderedCollectionObject.php | 9 +- .../Objects/OrderedCollectionPage.php | 7 +- app/Libraries/ActivityPub/WebFinger.php | 25 +- app/Libraries/Analytics/AnalyticsTrait.php | 4 +- app/Libraries/Analytics/Config/Analytics.php | 5 +- app/Libraries/Analytics/Config/Routes.php | 24 +- .../Controllers/AnalyticsController.php | 21 +- .../EpisodeAnalyticsController.php | 25 +- .../Controllers/EpisodeController.php | 50 +- .../UnknownUserAgentsController.php | 2 +- ...17-12-01-120000_add_analytics_podcasts.php | 7 +- ...0000_add_analytics_podcasts_by_episode.php | 7 +- ...-130000_add_analytics_podcasts_by_hour.php | 7 +- ...40000_add_analytics_podcasts_by_player.php | 17 +- ...0000_add_analytics_podcasts_by_country.php | 7 +- ...60000_add_analytics_podcasts_by_region.php | 14 +- ...70000_add_analytics_website_by_browser.php | 7 +- ...80000_add_analytics_website_by_referer.php | 10 +- ...00_add_analytics_website_by_entry_page.php | 7 +- ...00000_add_analytics_unknown_useragents.php | 7 +- ...10000_add_analytics_podcasts_procedure.php | 11 +- ...analytics_unknown_useragents_procedure.php | 7 +- ...210000_add_analytics_website_procedure.php | 7 +- .../Analytics/Entities/AnalyticsPodcasts.php | 4 +- .../Entities/AnalyticsPodcastsByCountry.php | 4 +- .../Entities/AnalyticsPodcastsByEpisode.php | 4 +- .../Entities/AnalyticsPodcastsByHour.php | 4 +- .../Entities/AnalyticsPodcastsByPlayer.php | 4 +- .../Entities/AnalyticsPodcastsByRegion.php | 4 +- .../Entities/AnalyticsPodcastsByService.php | 6 +- .../Entities/AnalyticsUnknownUserAgent.php | 4 +- .../Entities/AnalyticsWebsiteByBrowser.php | 4 +- .../Entities/AnalyticsWebsiteByEntryPage.php | 4 +- .../Entities/AnalyticsWebsiteByReferer.php | 4 +- .../Analytics/Helpers/analytics_helper.php | 130 +- .../Models/AnalyticsPodcastByCountryModel.php | 27 +- .../Models/AnalyticsPodcastByEpisodeModel.php | 27 +- .../Models/AnalyticsPodcastByHourModel.php | 14 +- .../Models/AnalyticsPodcastByPlayerModel.php | 58 +- .../Models/AnalyticsPodcastByRegionModel.php | 19 +- .../Models/AnalyticsPodcastByServiceModel.php | 16 +- .../Models/AnalyticsPodcastModel.php | 89 +- .../AnalyticsUnknownUseragentsModel.php | 8 +- .../Models/AnalyticsWebsiteByBrowserModel.php | 14 +- .../AnalyticsWebsiteByEntryPageModel.php | 18 +- .../Models/AnalyticsWebsiteByRefererModel.php | 32 +- app/Libraries/Breadcrumb.php | 23 +- app/Libraries/Negotiate.php | 7 +- app/Libraries/PodcastActor.php | 3 +- app/Libraries/Router.php | 46 +- app/Libraries/SimpleRSSElement.php | 11 +- app/Models/CategoryModel.php | 43 +- app/Models/EpisodeModel.php | 125 +- app/Models/LanguageModel.php | 8 +- app/Models/NoteModel.php | 2 +- app/Models/PageModel.php | 5 +- app/Models/PersonModel.php | 150 +- app/Models/PlatformModel.php | 78 +- app/Models/PodcastModel.php | 144 +- app/Models/SoundbiteModel.php | 29 +- app/Models/UserModel.php | 14 +- app/Validation/FileRules.php | 20 +- app/Validation/Rules.php | 1 - captainhook.json | 9 +- composer.json | 16 +- composer.lock | 1777 ++--------------- ecs.php | 29 + package-lock.json | 57 +- package.json | 3 +- .../_support/Database/Seeds/ExampleSeeder.php | 4 +- tests/_support/DatabaseTestCase.php | 17 +- tests/_support/Libraries/ConfigReader.php | 33 +- tests/_support/Models/ExampleModel.php | 8 +- tests/_support/SessionTestCase.php | 11 +- tests/database/ExampleDatabaseTest.php | 2 +- tests/session/ExampleSessionTest.php | 5 +- tests/unit/HealthTest.php | 7 +- 230 files changed, 3341 insertions(+), 5805 deletions(-) delete mode 100644 .phpcs.xml create mode 100644 app/Controllers/CreditsController.php create mode 100644 ecs.php diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ab03fd17..621ed45d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -10,9 +10,9 @@ "terminal.integrated.defaultProfile.linux": "/bin/bash", "editor.formatOnSave": true, "[php]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "bmewburn.vscode-intelephense-client", + "editor.formatOnSave": false }, - "phpSniffer.autoDetect": true, "color-highlight.markerType": "dot-before", "files.associations": { "*.xml.dist": "xml", @@ -31,7 +31,6 @@ "jamesbirtles.svelte-vscode", "dbaeumer.vscode-eslint", "stylelint.vscode-stylelint", - "wongjn.php-sniffer", "eamodio.gitlens", "breezelin.phpstan", "kasik96.latte" diff --git a/.phpcs.xml b/.phpcs.xml deleted file mode 100644 index 0877821c..00000000 --- a/.phpcs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - Castopod Host's coding standard based on the PSR-1 standard. - - - - \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json index 4f595576..d567a64c 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,13 +1,6 @@ { "trailingComma": "es5", "overrides": [ - { - "files": "*.php", - "options": { - "phpVersion": "7.4", - "singleQuote": true - } - }, { "files": "*.md", "options": { diff --git a/app/Authorization/FlatAuthorization.php b/app/Authorization/FlatAuthorization.php index f7015aa5..2e706b64 100644 --- a/app/Authorization/FlatAuthorization.php +++ b/app/Authorization/FlatAuthorization.php @@ -7,9 +7,8 @@ use Myth\Auth\Authorization\FlatAuthorization as MythAuthFlatAuthorization; class FlatAuthorization extends MythAuthFlatAuthorization { /** - * The group model to use. Usually the class noted - * below (or an extension thereof) but can be any - * compatible CodeIgniter Model. + * The group model to use. Usually the class noted below (or an extension thereof) but can be any compatible + * CodeIgniter Model. * * @var PermissionModel */ @@ -18,19 +17,16 @@ class FlatAuthorization extends MythAuthFlatAuthorization /** * Checks a group to see if they have the specified permission. */ - public function groupHasPermission(int|string $permission, int $groupId): bool + public function groupHasPermission(int | string $permission, int $groupId): bool { // Get the Permission ID $permissionId = $this->getPermissionID($permission); - if (!is_numeric($permissionId)) { + if (! is_numeric($permissionId)) { return false; } - return $this->permissionModel->doesGroupHavePermission( - $groupId, - $permissionId, - ); + return $this->permissionModel->doesGroupHavePermission($groupId, $permissionId,); } /** diff --git a/app/Authorization/PermissionModel.php b/app/Authorization/PermissionModel.php index d2e2c9bd..aefea9e9 100644 --- a/app/Authorization/PermissionModel.php +++ b/app/Authorization/PermissionModel.php @@ -7,13 +7,10 @@ use Myth\Auth\Authorization\PermissionModel as MythAuthPermissionModel; class PermissionModel extends MythAuthPermissionModel { /** - * Checks to see if a user, or one of their groups, - * has a specific permission. + * Checks to see if a user, or one of their groups, has a specific permission. */ - public function doesGroupHavePermission( - int $groupId, - int $permissionId - ): bool { + public function doesGroupHavePermission(int $groupId, int $permissionId): bool + { // Check group permissions and take advantage of caching $groupPerms = $this->getPermissionsForGroup($groupId); @@ -22,28 +19,20 @@ class PermissionModel extends MythAuthPermissionModel } /** - * Gets all permissions for a group in a way that can be - * easily used to check against: + * Gets all permissions for a group in a way that can be easily used to check against: * - * [ - * id => name, - * id => name - * ] + * [ id => name, id => name ] * * @return array */ public function getPermissionsForGroup(int $groupId): array { $cacheName = "group{$groupId}_permissions"; - if (!($found = cache($cacheName))) { + if (! ($found = cache($cacheName))) { $groupPermissions = $this->db ->table('auth_groups_permissions') ->select('id, auth_permissions.name') - ->join( - 'auth_permissions', - 'auth_permissions.id = permission_id', - 'inner', - ) + ->join('auth_permissions', 'auth_permissions.id = permission_id', 'inner',) ->where('group_id', $groupId) ->get() ->getResultObject(); @@ -53,7 +42,8 @@ class PermissionModel extends MythAuthPermissionModel $found[$row->id] = strtolower($row->name); } - cache()->save($cacheName, $found, 300); + cache() + ->save($cacheName, $found, 300); } return $found; diff --git a/app/Common.php b/app/Common.php index 780ba3f8..63992542 100644 --- a/app/Common.php +++ b/app/Common.php @@ -1,14 +1,11 @@ gateway = config('App')->adminGateway . '/analytics'; + $this->gateway = config('App') + ->adminGateway . '/analytics'; } /** diff --git a/app/Config/App.php b/app/Config/App.php index 29f17116..fdfb92fb 100644 --- a/app/Config/App.php +++ b/app/Config/App.php @@ -2,8 +2,8 @@ namespace Config; -use CodeIgniter\Session\Handlers\FileHandler; use CodeIgniter\Config\BaseConfig; +use CodeIgniter\Session\Handlers\FileHandler; class App extends BaseConfig { @@ -21,7 +21,6 @@ class App extends BaseConfig * and path to your installation. However, you should always configure this * explicitly and never rely on auto-guessing, especially in production * environments. - * */ public string $baseURL = 'http://localhost:8080/'; @@ -34,7 +33,6 @@ class App extends BaseConfig * WITH a trailing slash: * * http://cdn.example.com/ - * */ public string $mediaBaseURL = 'http://127.0.0.2:8080/'; @@ -46,7 +44,6 @@ class App extends BaseConfig * Typically this will be your index.php file, unless you've renamed it to * something else. If you are using mod_rewrite to remove the page set this * variable so that it is blank. - * */ public string $indexPage = ''; @@ -64,7 +61,6 @@ class App extends BaseConfig * 'PATH_INFO' Uses $_SERVER['PATH_INFO'] * * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! - * */ public string $uriProtocol = 'REQUEST_URI'; @@ -77,7 +73,6 @@ class App extends BaseConfig * is viewing the site from. It affects the language strings and other * strings (like currency markers, numbers, etc), that your program * should run under for this request. - * */ public string $defaultLocale = 'en'; @@ -113,7 +108,6 @@ class App extends BaseConfig * * The default timezone that will be used in your application to display * dates with the date helper, and can be retrieved through app_timezone() - * */ public string $appTimezone = 'UTC'; @@ -126,7 +120,6 @@ class App extends BaseConfig * that require a character set to be provided. * * @see http://php.net/htmlspecialchars for a list of supported charsets. - * */ public string $charset = 'UTF-8'; @@ -139,7 +132,6 @@ class App extends BaseConfig * made via a secure connection (HTTPS). If the incoming request is not * secure, the user will be redirected to a secure version of the page * and the HTTP Strict Transport Security header will be set. - * */ public bool $forceGlobalSecureRequests = true; @@ -153,7 +145,6 @@ class App extends BaseConfig * - `CodeIgniter\Session\Handlers\DatabaseHandler` * - `CodeIgniter\Session\Handlers\MemcachedHandler` * - `CodeIgniter\Session\Handlers\RedisHandler` - * */ public string $sessionDriver = FileHandler::class; @@ -163,7 +154,6 @@ class App extends BaseConfig * -------------------------------------------------------------------------- * * The session cookie name, must contain only [0-9a-z_-] characters - * */ public string $sessionCookieName = 'ci_session'; @@ -174,7 +164,6 @@ class App extends BaseConfig * * The number of SECONDS you want the session to last. * Setting to 0 (zero) means expire when the browser is closed. - * */ public int $sessionExpiration = 7200; @@ -192,7 +181,6 @@ class App extends BaseConfig * Please read up the manual for the format with other session drivers. * * IMPORTANT: You are REQUIRED to set a valid save path! - * */ public string $sessionSavePath = WRITEPATH . 'session'; @@ -205,7 +193,6 @@ class App extends BaseConfig * * WARNING: If you're using the database driver, don't forget to update * your session table's PRIMARY KEY when changing this setting. - * */ public bool $sessionMatchIP = false; @@ -215,7 +202,6 @@ class App extends BaseConfig * -------------------------------------------------------------------------- * * How many seconds between CI regenerating the session ID. - * */ public int $sessionTimeToUpdate = 300; @@ -227,7 +213,6 @@ class App extends BaseConfig * Whether to destroy session data associated with the old session ID * when auto-regenerating the session ID. When set to FALSE, the data * will be later deleted by the garbage collector. - * */ public bool $sessionRegenerateDestroy = false; @@ -238,8 +223,6 @@ class App extends BaseConfig * * Set a cookie name prefix if you need to avoid collisions. * - * @var string - * * @deprecated use Config\Cookie::$prefix property instead. */ public string $cookiePrefix = ''; @@ -251,8 +234,6 @@ class App extends BaseConfig * * Set to `.your-domain.com` for site-wide cookies. * - * @var string - * * @deprecated use Config\Cookie::$domain property instead. */ public string $cookieDomain = ''; @@ -264,8 +245,6 @@ class App extends BaseConfig * * Typically will be a forward slash. * - * @var string - * * @deprecated use Config\Cookie::$path property instead. */ public string $cookiePath = '/'; @@ -277,8 +256,6 @@ class App extends BaseConfig * * Cookie will only be set if a secure HTTPS connection exists. * - * @var bool - * * @deprecated use Config\Cookie::$secure property instead. */ public bool $cookieSecure = false; @@ -316,8 +293,6 @@ class App extends BaseConfig * (empty string) means default SameSite attribute set by browsers (`Lax`) * will be set on cookies. If set to `None`, `$cookieSecure` must also be set. * - * @var string - * * @deprecated use Config\Cookie::$samesite property instead. */ public string $cookieSameSite = 'Lax'; @@ -340,7 +315,7 @@ class App extends BaseConfig * * @var string|string[] */ - public string|array $proxyIPs = ''; + public string | array $proxyIPs = ''; /** * -------------------------------------------------------------------------- diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php index adb58349..209af318 100644 --- a/app/Config/Autoload.php +++ b/app/Config/Autoload.php @@ -40,7 +40,7 @@ class Autoload extends AutoloadConfig * @var array */ public $psr4 = [ - APP_NAMESPACE => APPPATH, // For custom app namespace + APP_NAMESPACE => APPPATH, 'Config' => APPPATH . 'Config', 'ActivityPub' => APPPATH . 'Libraries/ActivityPub', 'Analytics' => APPPATH . 'Libraries/Analytics', diff --git a/app/Config/Boot/production.php b/app/Config/Boot/production.php index 60c8888e..4653c264 100644 --- a/app/Config/Boot/production.php +++ b/app/Config/Boot/production.php @@ -8,14 +8,7 @@ * it and display a generic error message. */ ini_set('display_errors', '0'); -error_reporting( - E_ALL & - ~E_NOTICE & - ~E_DEPRECATED & - ~E_STRICT & - ~E_USER_NOTICE & - ~E_USER_DEPRECATED, -); +error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED,); /** * -------------------------------------------------------------------------- diff --git a/app/Config/Cache.php b/app/Config/Cache.php index a59e6d17..42266130 100644 --- a/app/Config/Cache.php +++ b/app/Config/Cache.php @@ -19,7 +19,6 @@ class Cache extends BaseConfig * * The name of the preferred handler that should be used. If for some reason * it is not available, the $backupHandler will be used in its place. - * */ public string $handler = 'file'; @@ -31,7 +30,6 @@ class Cache extends BaseConfig * The name of the handler that will be used in case the first one is * unreachable. Often, 'file' is used here since the filesystem is * always available, though that's not always practical for the app. - * */ public string $backupHandler = 'dummy'; @@ -64,7 +62,7 @@ class Cache extends BaseConfig * * @var boolean|string[] */ - public bool|array $cacheQueryString = false; + public bool | array $cacheQueryString = false; /** * -------------------------------------------------------------------------- @@ -73,7 +71,6 @@ class Cache extends BaseConfig * * This string is added to all cache item names to help avoid collisions * if you run multiple applications with the same cache engine. - * */ public string $prefix = ''; diff --git a/app/Config/ContentSecurityPolicy.php b/app/Config/ContentSecurityPolicy.php index 29c3e2d2..c4d17653 100644 --- a/app/Config/ContentSecurityPolicy.php +++ b/app/Config/ContentSecurityPolicy.php @@ -5,9 +5,8 @@ namespace Config; use CodeIgniter\Config\BaseConfig; /** - * Stores the default settings for the ContentSecurityPolicy, if you - * choose to use it. The values here will be read in and set as defaults - * for the site. If needed, they can be overridden on a page-by-page basis. + * Stores the default settings for the ContentSecurityPolicy, if you choose to use it. The values here will be read in + * and set as defaults for the site. If needed, they can be overridden on a page-by-page basis. * * Suggested reference for explanations: * @@ -15,64 +14,49 @@ use CodeIgniter\Config\BaseConfig; */ class ContentSecurityPolicy extends BaseConfig { - //------------------------------------------------------------------------- - // Broadbrush CSP management - //------------------------------------------------------------------------- - /** * Default CSP report context - * */ public bool $reportOnly = false; /** - * Specifies a URL where a browser will send reports - * when a content security policy is violated. - * - * @var string|null + * Specifies a URL where a browser will send reports when a content security policy is violated. */ public ?string $reportURI = null; /** - * Instructs user agents to rewrite URL schemes, changing - * HTTP to HTTPS. This directive is for websites with - * large numbers of old URLs that need to be rewritten. - * + * Instructs user agents to rewrite URL schemes, changing HTTP to HTTPS. This directive is for websites with large + * numbers of old URLs that need to be rewritten. */ public bool $upgradeInsecureRequests = false; - //------------------------------------------------------------------------- - // Sources allowed - // Note: once you set a policy to 'none', it cannot be further restricted - //------------------------------------------------------------------------- - /** * Will default to self if not overridden * * @var string|string[]|null */ - public string|array|null $defaultSrc; + public string | array | null $defaultSrc; /** * Lists allowed scripts' URLs. * * @var string|string[] */ - public string|array $scriptSrc = 'self'; + public string | array $scriptSrc = 'self'; /** * Lists allowed stylesheets' URLs. * * @var string|string[] */ - public string|array $styleSrc = 'self'; + public string | array $styleSrc = 'self'; /** * Defines the origins from which images can be loaded. * * @var string|string[] */ - public string|array $imageSrc = 'self'; + public string | array $imageSrc = 'self'; /** * Restricts the URLs that can appear in a page's `` element. @@ -81,77 +65,75 @@ class ContentSecurityPolicy extends BaseConfig * * @var string|string[]|null */ - public string|array|null $baseURI; + public string | array | null $baseURI; /** * Lists the URLs for workers and embedded frame contents * * @var string|string[] */ - public string|array $childSrc = 'self'; + public string | array $childSrc = 'self'; /** - * Limits the origins that you can connect to (via XHR, - * WebSockets, and EventSource). + * Limits the origins that you can connect to (via XHR, WebSockets, and EventSource). * * @var string|string[] */ - public string|array $connectSrc = 'self'; + public string | array $connectSrc = 'self'; /** * Specifies the origins that can serve web fonts. * * @var string|string[] */ - public string|array $fontSrc; + public string | array $fontSrc; /** * Lists valid endpoints for submission from `
` tags. * * @var string|string[] */ - public string|array $formAction = 'self'; + public string | array $formAction = 'self'; /** - * Specifies the sources that can embed the current page. - * This directive applies to ``, `