diff --git a/.circleci/config.yml b/.circleci/config.yml index 0df0750369..16f7be0bba 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -313,7 +313,7 @@ jobs: lint: docker: - - image: cimg/php:8.1.27-node + - image: cimg/php:8.3-node steps: - checkout - run: diff --git a/README.md b/README.md index 1edf9ff9e4..f19bd742c7 100644 --- a/README.md +++ b/README.md @@ -326,24 +326,26 @@ PHPCodesniffer and the parallel linting tools should be installed automatically The following composer scripts are aliases for running these tools. -* Check for code style errors across all project files. Must have zero errors: - `./bin/composer phpcs-errors`: -* Check for code style errors and warnings across all project files. - `./bin/composer phpcs-strict` -* Check for code style errors in current branch. Must have zero errors: +* Check for code style errors across all project files. Must have zero errors: +`./bin/composer phpcs-errors` +* Check for code style errors and warnings across all project file +`./bin/composer phpcs-strict` +* Check for code style errors in current branch. Must have zero errors: `./bin/composer phpcs-changes` -* Check for code style errors and warnings in current branch. +* Check for code style errors and warnings in current branch. `./bin/composer phpcs-changes-strict` -* Check for PHP lint errors +* Check for PHP lint errors `./bin/composer php-lint` +* Check for PHP 8.3 compatibility + `./bin/composer php-compatibility` ## Project Restart/Reset + Sometimes, Docker problems arise after an upgrade and a more complete restart is needed. After closing down and destroying the existing containers, networks, and volumes the procedure is the same as the full project setup. ### Docker Cleanup - ``` docker compose down docker system prune diff --git a/composer.json b/composer.json index e16e6a0886..7cbb863e57 100644 --- a/composer.json +++ b/composer.json @@ -167,7 +167,9 @@ }, "require-dev": { "drupal/coder": "^8.3", - "php-parallel-lint/php-parallel-lint": "^1.4" + "php-parallel-lint/php-parallel-lint": "^1.4", + "phpcompatibility/php-compatibility": "^9.3", + "rector/rector": "^2.0" }, "scripts": { "changed-files": [ @@ -187,6 +189,9 @@ ], "php-lint": [ "vendor/bin/parallel-lint -e php,module,inc,install,test,profile,theme ./web/modules/custom ./web/themes/custom" + ], + "php-compatibility": [ + "vendor/bin/phpcs -pn --runtime-set testVersion 8.3- web/modules/custom web/themes/custom -d memory_limit=2G --standard=.phpcs.xml.dist" ] } } diff --git a/composer.lock b/composer.lock index 8cf213b5e2..05488a96a8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "750e25aca453a5fccca5ae752bbcd6e3", + "content-hash": "5fd38683d9cee7e076430366de6e832a", "packages": [ { "name": "asm89/stack-cors", @@ -11838,6 +11838,68 @@ }, "time": "2024-03-27T12:14:49+00:00" }, + { + "name": "phpcompatibility/php-compatibility", + "version": "9.3.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "homepage": "https://github.com/wimg", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibility" + }, + "time": "2019-12-27T09:44:58+00:00" + }, { "name": "phpstan/phpdoc-parser", "version": "1.33.0", @@ -11885,6 +11947,123 @@ }, "time": "2024-10-13T11:25:22+00:00" }, + { + "name": "phpstan/phpstan", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "50d276fc3bf1430ec315f2f109bbde2769821524" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/50d276fc3bf1430ec315f2f109bbde2769821524", + "reference": "50d276fc3bf1430ec315f2f109bbde2769821524", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2024-12-17T17:14:01+00:00" + }, + { + "name": "rector/rector", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "3f27091368bd935dbbaa8387099792fb20f65f68" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/3f27091368bd935dbbaa8387099792fb20f65f68", + "reference": "3f27091368bd935dbbaa8387099792fb20f65f68", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0", + "phpstan/phpstan": "^2.0.1" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "suggest": { + "ext-dom": "To manipulate phpunit.xml via the custom-rule command" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2024-12-12T15:22:19+00:00" + }, { "name": "sirbrillig/phpcs-variable-analysis", "version": "v2.11.21", @@ -12102,7 +12281,7 @@ }, "prefer-stable": true, "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.2.0" + "platform": {}, + "platform-dev": {}, + "plugin-api-version": "2.6.0" } diff --git a/rector.php b/rector.php new file mode 100644 index 0000000000..6158933cfd --- /dev/null +++ b/rector.php @@ -0,0 +1,18 @@ +paths([ + __DIR__ . '/web/modules/custom/', + __DIR__ . '/web/themes/custom/', + ]); + + // Other configurations, such as rule sets + $rectorConfig->sets([ + SetList::PHP_83, + ]); +}; diff --git a/web/modules/custom/usa_orphaned_entities/src/Form/OrphanedEntitiesSettings.php b/web/modules/custom/usa_orphaned_entities/src/Form/OrphanedEntitiesSettings.php index 9283daafa4..3f2d14d35b 100644 --- a/web/modules/custom/usa_orphaned_entities/src/Form/OrphanedEntitiesSettings.php +++ b/web/modules/custom/usa_orphaned_entities/src/Form/OrphanedEntitiesSettings.php @@ -17,6 +17,7 @@ public function getFormId() { /** * {@inheritdoc} */ + #[\Override] public function buildForm(array $form, FormStateInterface $form_state) { $entityTypeManager = \Drupal::service('entity_type.manager'); @@ -77,6 +78,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { /** * {@inheritdoc} */ + #[\Override] public function validateForm(array &$form, FormStateInterface $form_state) { // foreach ($form['entity_reference'] as $index => $entity_reference) { @@ -96,6 +98,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) { /** * {@inheritdoc} */ + #[\Override] public function submitForm(array &$form, FormStateInterface $form_state) { $config = $this->config('orphaned_entities.settings'); foreach ($form['entity_reference'] as $index => $entity_reference) { diff --git a/web/modules/custom/usa_twig_vars/src/TaxonomyDatalayerBuilder.php b/web/modules/custom/usa_twig_vars/src/TaxonomyDatalayerBuilder.php index 264cb50d86..135edacd6a 100644 --- a/web/modules/custom/usa_twig_vars/src/TaxonomyDatalayerBuilder.php +++ b/web/modules/custom/usa_twig_vars/src/TaxonomyDatalayerBuilder.php @@ -18,17 +18,17 @@ class TaxonomyDatalayerBuilder { public const HOME_TITLE_ES = "Página principal"; public const HOME_URL_ES = "/es/"; - private const ABOUT_GOVT_EN = "About the U.S. and its government"; - private const ABOUT_URL_EN = "/about-the-us"; + private const string ABOUT_GOVT_EN = "About the U.S. and its government"; + private const string ABOUT_URL_EN = "/about-the-us"; - private const ABOUT_GOVT_ES = "Acerca de EE. UU. y su Gobierno"; - private const ABOUT_URL_ES = "/es/acerca-de-estados-unidos"; + private const string ABOUT_GOVT_ES = "Acerca de EE. UU. y su Gobierno"; + private const string ABOUT_URL_ES = "/es/acerca-de-estados-unidos"; - private const AGENCY_INDEX_URL_EN = '/agency-index'; - private const AGENCY_INDEX_URL_ES = '/es/indice-agencias'; + private const string AGENCY_INDEX_URL_EN = '/agency-index'; + private const string AGENCY_INDEX_URL_ES = '/es/indice-agencias'; - private const STATE_INDEX_URL_EN = '/state-governments'; - private const STATE_INDEX_URL_ES = '/es/gobiernos-estatales'; + private const string STATE_INDEX_URL_EN = '/state-governments'; + private const string STATE_INDEX_URL_ES = '/es/gobiernos-estatales'; /** * Language code for entity. diff --git a/web/modules/custom/usagov_benefit_finder/src/Form/BenefitFinderSettingsForm.php b/web/modules/custom/usagov_benefit_finder/src/Form/BenefitFinderSettingsForm.php index 14280934ec..3bd4af1852 100644 --- a/web/modules/custom/usagov_benefit_finder/src/Form/BenefitFinderSettingsForm.php +++ b/web/modules/custom/usagov_benefit_finder/src/Form/BenefitFinderSettingsForm.php @@ -17,6 +17,7 @@ public function getFormId() { /** * {@inheritdoc} */ + #[\Override] public function buildForm(array $form, FormStateInterface $form_state) { $form = parent::buildForm($form, $form_state); @@ -35,6 +36,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { /** * {@inheritdoc} */ + #[\Override] public function submitForm(array &$form, FormStateInterface $form_state) { $this->config('usagov_benefit_finder.settings') ->set('automate_json_data_file_generating', $form_state->getValue('automate_json_data_file_generating')) diff --git a/web/modules/custom/usagov_directories/src/Form/DirectoryRecordsAddAcronymsForm.php b/web/modules/custom/usagov_directories/src/Form/DirectoryRecordsAddAcronymsForm.php index 45f36e110a..ce7ee9b502 100644 --- a/web/modules/custom/usagov_directories/src/Form/DirectoryRecordsAddAcronymsForm.php +++ b/web/modules/custom/usagov_directories/src/Form/DirectoryRecordsAddAcronymsForm.php @@ -48,6 +48,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { /** * {@inheritdoc} */ + #[\Override] public function validateForm(array &$form, FormStateInterface $form_state) { $all_files = $this->getRequest()->files->get('files', []); $file = $all_files['acronym_file']; diff --git a/web/modules/custom/usagov_directories/src/Form/DirectoryRecordsAddSynonymsForm.php b/web/modules/custom/usagov_directories/src/Form/DirectoryRecordsAddSynonymsForm.php index e438bdee98..0a465ecdf8 100644 --- a/web/modules/custom/usagov_directories/src/Form/DirectoryRecordsAddSynonymsForm.php +++ b/web/modules/custom/usagov_directories/src/Form/DirectoryRecordsAddSynonymsForm.php @@ -48,6 +48,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { /** * {@inheritdoc} */ + #[\Override] public function validateForm(array &$form, FormStateInterface $form_state) { $all_files = $this->getRequest()->files->get('files', []); $file = $all_files['synonym_file']; diff --git a/web/modules/custom/usagov_directories/src/Form/DirectoryRecordsAddTogglesForm.php b/web/modules/custom/usagov_directories/src/Form/DirectoryRecordsAddTogglesForm.php index f12d6d79d9..6950753115 100644 --- a/web/modules/custom/usagov_directories/src/Form/DirectoryRecordsAddTogglesForm.php +++ b/web/modules/custom/usagov_directories/src/Form/DirectoryRecordsAddTogglesForm.php @@ -48,6 +48,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { /** * {@inheritdoc} */ + #[\Override] public function validateForm(array &$form, FormStateInterface $form_state) { $all_files = $this->getRequest()->files->get('files', []); $file = $all_files['toggle_map_file']; diff --git a/web/modules/custom/usagov_login/src/Form/LoginSettingsForm.php b/web/modules/custom/usagov_login/src/Form/LoginSettingsForm.php index dc4e6a2636..64405c054e 100755 --- a/web/modules/custom/usagov_login/src/Form/LoginSettingsForm.php +++ b/web/modules/custom/usagov_login/src/Form/LoginSettingsForm.php @@ -36,6 +36,7 @@ public function __construct(ConfigFactoryInterface $config_factory, StateInterfa /** * {@inheritdoc} */ + #[\Override] public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), @@ -60,6 +61,7 @@ protected function getEditableConfigNames() { /** * {@inheritdoc} */ + #[\Override] public function buildForm(array $form, FormStateInterface $form_state) { $form['sso_login_path'] = [ '#type' => 'textfield', @@ -89,6 +91,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { /** * {@inheritdoc} */ + #[\Override] public function submitForm(array &$form, FormStateInterface $form_state) { $this->state->set('usagov_login_local_form', $form_state->getValue('display_local')); diff --git a/web/modules/custom/usagov_menus/src/Plugin/Block/SidebarFirstBlock.php b/web/modules/custom/usagov_menus/src/Plugin/Block/SidebarFirstBlock.php index 9004c7c25d..61b9355301 100644 --- a/web/modules/custom/usagov_menus/src/Plugin/Block/SidebarFirstBlock.php +++ b/web/modules/custom/usagov_menus/src/Plugin/Block/SidebarFirstBlock.php @@ -31,10 +31,10 @@ )] class SidebarFirstBlock extends AbstractMenuBlock { - private const AGENCIES_NID_EN = 629; - private const AGENCIES_NID_ES = 1696; - private const STATES_NID_EN = 1885; - private const STATES_NID_ES = 1870; + private const int AGENCIES_NID_EN = 629; + private const int AGENCIES_NID_ES = 1696; + private const int STATES_NID_EN = 1885; + private const int STATES_NID_ES = 1870; /** * {@inheritdoc}