]> git.agnieray.net Git - galette.git/commitdiff
Improve coding standards
authorJohan Cwiklinski <johan@x-tnd.be>
Sun, 14 Apr 2024 06:40:05 +0000 (08:40 +0200)
committerJohan Cwiklinski <johan@x-tnd.be>
Mon, 15 Apr 2024 11:12:46 +0000 (13:12 +0200)
Enforce typehints on properties, parameters and methods returns
Use object instead of stdClass
Drop useless var declarations
Throw an exception instead of silent fail when property does not
exists

129 files changed:
.phpcs.xml
galette/composer.json
galette/composer.lock
galette/includes/functions.inc.php
galette/includes/galette.inc.php
galette/includes/i18n.inc.php
galette/includes/routes/ajax.routes.php
galette/includes/routes/plugins.routes.php
galette/includes/routes/public_pages.routes.php
galette/includes/sql_parse.php
galette/lib/Galette/Controllers/AbstractController.php
galette/lib/Galette/Controllers/Crud/MembersController.php
galette/lib/Galette/Controllers/Crud/TransactionsController.php
galette/lib/Galette/Core/AbstractPassword.php
galette/lib/Galette/Core/Authentication.php
galette/lib/Galette/Core/Db.php
galette/lib/Galette/Core/Gaptcha.php
galette/lib/Galette/Core/History.php
galette/lib/Galette/Core/Install.php
galette/lib/Galette/Core/L10n.php
galette/lib/Galette/Core/LightSlimApp.php
galette/lib/Galette/Core/Mailing.php
galette/lib/Galette/Core/MailingHistory.php
galette/lib/Galette/Core/Pagination.php
galette/lib/Galette/Core/Password.php
galette/lib/Galette/Core/Picture.php
galette/lib/Galette/Core/Plugins.php
galette/lib/Galette/Core/Preferences.php
galette/lib/Galette/Core/SlimApp.php
galette/lib/Galette/DynamicFields/DynamicField.php
galette/lib/Galette/Entity/Adherent.php
galette/lib/Galette/Entity/Contribution.php
galette/lib/Galette/Entity/ContributionsTypes.php
galette/lib/Galette/Entity/Document.php
galette/lib/Galette/Entity/FieldsConfig.php
galette/lib/Galette/Entity/ListsConfig.php
galette/lib/Galette/Entity/PaymentType.php
galette/lib/Galette/Entity/PdfModel.php
galette/lib/Galette/Entity/Reminder.php
galette/lib/Galette/Entity/SavedSearch.php
galette/lib/Galette/Entity/Social.php
galette/lib/Galette/Entity/Status.php
galette/lib/Galette/Entity/Title.php
galette/lib/Galette/Entity/Transaction.php
galette/lib/Galette/Events/ContribListener.php
galette/lib/Galette/Events/GaletteEvent.php
galette/lib/Galette/Events/MemberListener.php
galette/lib/Galette/Features/Cacheable.php
galette/lib/Galette/Features/Dynamics.php
galette/lib/Galette/Features/Replacements.php
galette/lib/Galette/Filters/AdvancedMembersList.php
galette/lib/Galette/Filters/ContributionsList.php
galette/lib/Galette/Filters/HistoryList.php
galette/lib/Galette/Filters/MembersList.php
galette/lib/Galette/Filters/ScheduledPaymentsList.php
galette/lib/Galette/Filters/TransactionsList.php
galette/lib/Galette/IO/ContributionsCsv.php
galette/lib/Galette/IO/CsvIn.php
galette/lib/Galette/IO/CsvOut.php
galette/lib/Galette/IO/FileTrait.php
galette/lib/Galette/IO/MembersCsv.php
galette/lib/Galette/IO/News.php
galette/lib/Galette/IO/ScheduledPaymentsCsv.php
galette/lib/Galette/Middleware/Authenticate.php
galette/lib/Galette/Middleware/PublicPages.php
galette/lib/Galette/Middleware/UpdateAndMaintenance.php
galette/lib/Galette/Repository/Groups.php
galette/lib/Galette/Repository/Members.php
galette/lib/Galette/Repository/Repository.php
galette/lib/Galette/Twig/CsrfExtension.php
galette/lib/Galette/Util/Release.php
tests/Galette/Controllers/tests/units/PdfController.php
tests/Galette/Core/tests/units/CheckModules.php
tests/Galette/Core/tests/units/Db.php
tests/Galette/Core/tests/units/Galette.php
tests/Galette/Core/tests/units/History.php
tests/Galette/Core/tests/units/I18n.php
tests/Galette/Core/tests/units/Install.php
tests/Galette/Core/tests/units/L10n.php
tests/Galette/Core/tests/units/Links.php
tests/Galette/Core/tests/units/Login.php
tests/Galette/Core/tests/units/Logo.php
tests/Galette/Core/tests/units/MailingHistory.php
tests/Galette/Core/tests/units/Password.php
tests/Galette/Core/tests/units/Picture.php
tests/Galette/Core/tests/units/Plugins.php
tests/Galette/Core/tests/units/Preferences.php
tests/Galette/Core/tests/units/PrintLogo.php
tests/Galette/DynamicFields/tests/units/Boolean.php
tests/Galette/DynamicFields/tests/units/Choice.php
tests/Galette/DynamicFields/tests/units/Date.php
tests/Galette/DynamicFields/tests/units/DynamicField.php
tests/Galette/DynamicFields/tests/units/File.php
tests/Galette/DynamicFields/tests/units/Line.php
tests/Galette/DynamicFields/tests/units/Separator.php
tests/Galette/DynamicFields/tests/units/Text.php
tests/Galette/Entity/tests/units/Adherent.php
tests/Galette/Entity/tests/units/Contribution.php
tests/Galette/Entity/tests/units/ContributionsTypes.php
tests/Galette/Entity/tests/units/FieldsConfig.php
tests/Galette/Entity/tests/units/Group.php
tests/Galette/Entity/tests/units/ListsConfig.php
tests/Galette/Entity/tests/units/PaymentType.php
tests/Galette/Entity/tests/units/PdfModel.php
tests/Galette/Entity/tests/units/SavedSearch.php
tests/Galette/Entity/tests/units/ScheduledPayment.php
tests/Galette/Entity/tests/units/Social.php
tests/Galette/Entity/tests/units/Status.php
tests/Galette/Entity/tests/units/Texts.php
tests/Galette/Entity/tests/units/Title.php
tests/Galette/Entity/tests/units/Transaction.php
tests/Galette/Filters/tests/units/ContributionsList.php
tests/Galette/Filters/tests/units/HistoryList.php
tests/Galette/Filters/tests/units/TransactionsList.php
tests/Galette/IO/tests/units/CsvIn.php
tests/Galette/IO/tests/units/News.php
tests/Galette/Repository/tests/units/Contributions.php
tests/Galette/Repository/tests/units/Groups.php
tests/Galette/Repository/tests/units/Members.php
tests/Galette/Repository/tests/units/PaymentTypes.php
tests/Galette/Repository/tests/units/PdfModels.php
tests/Galette/Repository/tests/units/Reminders.php
tests/Galette/Repository/tests/units/ScheduledPayments.php
tests/Galette/Repository/tests/units/Transactions.php
tests/Galette/Util/tests/units/Password.php
tests/Galette/Util/tests/units/Telemetry.php
tests/GaletteDbFails/Core/tests/units/Install.php
tests/GaletteTestCase.php
tests/GaletteUpdate/Core/tests/units/Install.php

index 04d14b010fd57a1385a0a0ce1beed0c27297c6ee..26cd2e051991719c03cb2fc81fc868e195775d58 100644 (file)
      </rule>
      <rule ref="PEAR.Commenting.FunctionComment"/>
      <rule ref="PEAR.Commenting.InlineComment"/>
+     <rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
+         <exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification"/>
+     </rule>
+     <rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
+         <exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification"/>
+     </rule>
+     <rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
+         <exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation"/>
+         <exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
+     </rule>
 </ruleset>
index dcfe52e8d1e1e267374b95cc14f0b9d3a5fd1139..47a3b36fdbb038faf611d5e7caac5e0596e35b1f 100644 (file)
         "friendsoftwig/twigcs": "^6.2",
         "phpstan/phpstan": "^1.9",
         "phpunit/phpunit": "^10.0",
-        "malukenho/docheader": "^1.0"
+        "malukenho/docheader": "^1.0",
+        "slevomat/coding-standard": "^8.14"
     },
     "config": {
         "optimize-autoloader": true,
-        "platform-check": false
+        "platform-check": false,
+        "allow-plugins": {
+            "dealerdirect/phpcodesniffer-composer-installer": true
+        }
     },
     "scripts": {
         "post-install-cmd": [
index e58d3df3b6bf20d51298b32e45b597d2c3edaf38..2204c69add9e26dc5138837c51be6ef63bc5cb16 100644 (file)
@@ -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": "49aee4bfa35737b80d4e7c19726e83c8",
+    "content-hash": "be5bd2ccb4b48326a2ceeec5665880c3",
     "packages": [
         {
             "name": "akrabat/rka-slim-session-middleware",
         }
     ],
     "packages-dev": [
+        {
+            "name": "dealerdirect/phpcodesniffer-composer-installer",
+            "version": "v1.0.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/PHPCSStandards/composer-installer.git",
+                "reference": "4be43904336affa5c2f70744a348312336afd0da"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da",
+                "reference": "4be43904336affa5c2f70744a348312336afd0da",
+                "shasum": ""
+            },
+            "require": {
+                "composer-plugin-api": "^1.0 || ^2.0",
+                "php": ">=5.4",
+                "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0"
+            },
+            "require-dev": {
+                "composer/composer": "*",
+                "ext-json": "*",
+                "ext-zip": "*",
+                "php-parallel-lint/php-parallel-lint": "^1.3.1",
+                "phpcompatibility/php-compatibility": "^9.0",
+                "yoast/phpunit-polyfills": "^1.0"
+            },
+            "type": "composer-plugin",
+            "extra": {
+                "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
+            },
+            "autoload": {
+                "psr-4": {
+                    "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Franck Nijhof",
+                    "email": "franck.nijhof@dealerdirect.com",
+                    "homepage": "http://www.frenck.nl",
+                    "role": "Developer / IT Manager"
+                },
+                {
+                    "name": "Contributors",
+                    "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors"
+                }
+            ],
+            "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
+            "homepage": "http://www.dealerdirect.com",
+            "keywords": [
+                "PHPCodeSniffer",
+                "PHP_CodeSniffer",
+                "code quality",
+                "codesniffer",
+                "composer",
+                "installer",
+                "phpcbf",
+                "phpcs",
+                "plugin",
+                "qa",
+                "quality",
+                "standard",
+                "standards",
+                "style guide",
+                "stylecheck",
+                "tests"
+            ],
+            "support": {
+                "issues": "https://github.com/PHPCSStandards/composer-installer/issues",
+                "source": "https://github.com/PHPCSStandards/composer-installer"
+            },
+            "time": "2023-01-05T11:28:13+00:00"
+        },
         {
             "name": "friendsoftwig/twigcs",
             "version": "6.2.0",
             },
             "time": "2022-02-21T01:04:05+00:00"
         },
+        {
+            "name": "phpstan/phpdoc-parser",
+            "version": "1.28.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phpstan/phpdoc-parser.git",
+                "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb",
+                "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^7.2 || ^8.0"
+            },
+            "require-dev": {
+                "doctrine/annotations": "^2.0",
+                "nikic/php-parser": "^4.15",
+                "php-parallel-lint/php-parallel-lint": "^1.2",
+                "phpstan/extension-installer": "^1.0",
+                "phpstan/phpstan": "^1.5",
+                "phpstan/phpstan-phpunit": "^1.1",
+                "phpstan/phpstan-strict-rules": "^1.0",
+                "phpunit/phpunit": "^9.5",
+                "symfony/process": "^5.2"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "PHPStan\\PhpDocParser\\": [
+                        "src/"
+                    ]
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "description": "PHPDoc parser with support for nullable, intersection and generic types",
+            "support": {
+                "issues": "https://github.com/phpstan/phpdoc-parser/issues",
+                "source": "https://github.com/phpstan/phpdoc-parser/tree/1.28.0"
+            },
+            "time": "2024-04-03T18:51:33+00:00"
+        },
         {
             "name": "phpstan/phpstan",
             "version": "1.10.41",
             ],
             "time": "2023-02-07T11:34:05+00:00"
         },
+        {
+            "name": "slevomat/coding-standard",
+            "version": "8.14.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/slevomat/coding-standard.git",
+                "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fea1fd6f137cc84f9cba0ae30d549615dbc6a926",
+                "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926",
+                "shasum": ""
+            },
+            "require": {
+                "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0",
+                "php": "^7.2 || ^8.0",
+                "phpstan/phpdoc-parser": "^1.23.1",
+                "squizlabs/php_codesniffer": "^3.7.1"
+            },
+            "require-dev": {
+                "phing/phing": "2.17.4",
+                "php-parallel-lint/php-parallel-lint": "1.3.2",
+                "phpstan/phpstan": "1.10.37",
+                "phpstan/phpstan-deprecation-rules": "1.1.4",
+                "phpstan/phpstan-phpunit": "1.3.14",
+                "phpstan/phpstan-strict-rules": "1.5.1",
+                "phpunit/phpunit": "8.5.21|9.6.8|10.3.5"
+            },
+            "type": "phpcodesniffer-standard",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "8.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "SlevomatCodingStandard\\": "SlevomatCodingStandard/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.",
+            "keywords": [
+                "dev",
+                "phpcs"
+            ],
+            "support": {
+                "issues": "https://github.com/slevomat/coding-standard/issues",
+                "source": "https://github.com/slevomat/coding-standard/tree/8.14.1"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/kukulich",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2023-10-08T07:28:08+00:00"
+        },
         {
             "name": "squizlabs/php_codesniffer",
             "version": "3.7.2",
index 2716e5cb76588ebe24979b3e2e4a45aa95c92b42..6803e37ddb47c242af351b427604d2edf9a8526d 100644 (file)
@@ -30,7 +30,7 @@ if (!defined('GALETTE_ROOT')) {
  *
  * @return boolean
  */
-function isValidWebUrl($url)
+function isValidWebUrl(string $url): bool
 {
     return (preg_match(
         '#^http[s]?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i',
index 0dfe26e0c6ba91399ae8f1875425d825947c9d21..512ede333557c24fb22990589555f6a012fad3ca 100644 (file)
@@ -114,7 +114,7 @@ Logger stuff
 ------------------------------------------------------------------------------*/
 
 error_reporting(E_ALL);
-set_error_handler(function ($severity, $message, $file, $line) {
+set_error_handler(function ($severity, $message, $file, $line): void {
     if (error_reporting() & $severity) {
         throw new \ErrorException($message, 0, $severity, $file, $line);
     }
index f55e54cfa3fdafbfac91c03089d70c84710bdc61..a14ba5928987d7f84a45058cfaf40c17cae3e9e9 100644 (file)
@@ -39,7 +39,7 @@ $language = $i18n->getLongID();
  *
  * @return string
  */
-function _T($string, $domain = 'galette', $nt = true)
+function _T(string $string, string $domain = 'galette', bool $nt = true): string
 {
     global $language, $installer, $translator, $l10n;
 
@@ -92,7 +92,7 @@ function _T($string, $domain = 'galette', $nt = true)
  *
  * @return string
  */
-function _Tn($singular, $plural, $count, $domain = 'galette', $nt = true)
+function _Tn(string $singular, string $plural, int $count, string $domain = 'galette', bool $nt = true): string
 {
     global $language, $installer, $translator, $l10n;
 
@@ -144,7 +144,7 @@ function _Tn($singular, $plural, $count, $domain = 'galette', $nt = true)
  *
  * @return string
  */
-function _Tx($context, $string, $domain = 'galette', $nt = true)
+function _Tx(string $context, string $string, string $domain = 'galette', bool $nt = true): string
 {
     global $language, $installer, $translator, $l10n;
 
@@ -184,7 +184,7 @@ function _Tx($context, $string, $domain = 'galette', $nt = true)
  *
  * @return string
  */
-function _Tnx($context, $singular, $plural, $count, $domain = 'galette', $nt = true)
+function _Tnx(string $context, string $singular, string $plural, int $count, string $domain = 'galette', bool $nt = true): string
 {
     global $language, $installer, $translator, $l10n;
 
@@ -234,7 +234,7 @@ function _Tnx($context, $singular, $plural, $count, $domain = 'galette', $nt = t
  *
  * @return string
  */
-function contextualizedString($string, $context)
+function contextualizedString(string $string, string $context): string
 {
     return "{$string}\004{$context}";
 }
@@ -247,7 +247,7 @@ function contextualizedString($string, $context)
  *
  * @return string
  */
-function __($string, $domain = 'galette')
+function __(string $string, string $domain = 'galette'): string
 {
     return _T($string, $domain, false);
 }
index 1aa806cf0adfc29afdb339811bd700a615a3fa12..66c401b0b7d137a33e3a7b29f72f416b4f460148 100644 (file)
@@ -27,7 +27,7 @@ use Galette\Repository\Members;
 use Galette\Filters\MembersList;
 use Slim\Routing\RouteCollectorProxy;
 
-$app->group('/ajax', function (RouteCollectorProxy $app) use ($authenticate) {
+$app->group('/ajax', function (RouteCollectorProxy $app) use ($authenticate): void {
     $app->get(
         '/messages',
         [AjaxController::class, 'messages']
index 86b550b9ece4634a8d432bebf2025547e56b50cf..678bc7956aebc6c5305af2bed50f033d5b5ddf06 100644 (file)
@@ -24,7 +24,7 @@ use Slim\Psr7\Response;
 
 $app->group(
     '/plugins',
-    function (\Slim\Routing\RouteCollectorProxy $app) use ($authenticate) {
+    function (\Slim\Routing\RouteCollectorProxy $app) use ($authenticate): void {
         /** @var $container \DI\Container */
         $container = $app->getContainer();
         $modules = $container->get('plugins')->getModules();
@@ -77,7 +77,7 @@ $app->group(
             $app->group(
                 '/' . $module['route'],
                 //$module_id may be used in included _routes.php from plugin.
-                function (\Slim\Routing\RouteCollectorProxy $app) use ($module, $module_id, $authenticate, $container) {
+                function (\Slim\Routing\RouteCollectorProxy $app) use ($module, $module_id, $authenticate, $container): void {
                     //Plugin home: give information
                     $app->get(
                         '',
index 446268e4dae7350c344e4d58cc69bb6ecc7a535c..fc51526929d4601dbc8f8acfcb57cefdc4cd9519 100644 (file)
@@ -22,7 +22,7 @@
 use Galette\Controllers\Crud;
 use Slim\Routing\RouteCollectorProxy;
 
-$app->group('/public', function (RouteCollectorProxy $app) use ($routeparser) {
+$app->group('/public', function (RouteCollectorProxy $app) use ($routeparser): void {
     //public members list
     $app->get(
         '/{type:list|trombi}[/{option:page|order}/{value:\d+|\w+}]',
index c16c05ea3498084737340b9734cbba6cb4bcf67a..2103449b70b297b19cd4aeef53e8a3bc459571eb 100644 (file)
@@ -62,7 +62,7 @@
  *
  * @return string
  */
-function remove_comments(&$output)
+function remove_comments(string &$output): string
 {
     $lines = explode("\n", $output);
     $output = "";
@@ -96,7 +96,7 @@ function remove_comments(&$output)
  *
  * @return string
  */
-function remove_remarks($sql)
+function remove_remarks(string $sql): string
 {
     $lines = explode("\n", $sql);
 
@@ -131,7 +131,7 @@ function remove_remarks($sql)
  *
  * @return array
  */
-function split_sql_file($sql, $delimiter)
+function split_sql_file(string $sql, string $delimiter): array
 {
     // Split up our string into "possible" SQL statements.
     $tokens = explode($delimiter, $sql);
index 1392beb7bf32d9dab404f16aac46a615513ef86e..ceb319dd59b38b42fd57f7f2c17b92be7c98505d 100644 (file)
@@ -50,83 +50,35 @@ use Slim\Views\Twig;
 
 abstract class AbstractController
 {
-    /**
-     * @var ContainerInterface
-     */
-    private $container;
-    /**
-     * @var Db
-     */
+    private ContainerInterface $container;
     #[Inject]
     protected Db $zdb;
-    /**
-     * @var Login
-     */
     #[Inject]
     protected Login $login;
-    /**
-     * @var Preferences
-     */
     #[Inject]
     protected Preferences $preferences;
-    /**
-     * @var Twig
-     */
     #[Inject]
     protected Twig $view;
-    /**
-     * @var Logo
-     */
     #[Inject]
     protected Logo $logo;
-    /**
-     * @var PrintLogo
-     */
     #[Inject]
     protected PrintLogo $print_logo;
-    /**
-     * @var Plugins
-     */
     #[Inject]
     protected Plugins $plugins;
-    /**
-     * @var RouteParser
-     */
     #[Inject]
     protected RouteParser $routeparser;
-    /**
-     * @var History
-     */
     #[Inject]
     protected History $history;
-    /**
-     * @var I18n
-     */
     #[Inject]
     protected I18n $i18n;
-    /**
-     * @var L10n
-     */
     #[Inject]
     protected L10n $l10n;
-    /**
-     * @var Session
-     */
     #[Inject("session")]
     protected Session $session;
-    /**
-     * @var Messages
-     */
     #[Inject]
     protected Messages $flash;
-    /**
-     * @var FieldsConfig
-     */
     #[Inject]
     protected FieldsConfig $fields_config;
-    /**
-     * @var ListsConfig
-     */
     #[Inject]
     protected ListsConfig $lists_config;
     /**
index edf2a64abb5e70d2a01de1e5811f79132f4e8f27..462524b206bde194ec8262a82a78dcb9d0e39038 100644 (file)
@@ -54,7 +54,6 @@ class MembersController extends CrudController
 {
     use BatchList;
 
-    /** @var bool */
     private bool $is_self_membership = false;
 
     // CRUD - Create
index b664bc4e370e926c2992f6def29bc5f094a237ba..cb9db44d87ee9c4610e57edf8632e2c80e60feb6 100644 (file)
@@ -177,7 +177,7 @@ class TransactionsController extends ContributionsController
      *
      * @return Response
      */
-    public function doEdit(Request $request, Response $response, int $id = null, $type = null): Response
+    public function doEdit(Request $request, Response $response, int $id = null, ?string $type = null): Response
     {
         $post = $request->getParsedBody();
         $trans = new Transaction($this->zdb, $this->login);
index de30b40dc9491557322b14a51ff21792ac8d9135..fc4fc9a6372048601be5abe14a537f60a07496ba 100644 (file)
@@ -66,11 +66,11 @@ abstract class AbstractPassword
     /**
      * Generates a new password for specified member
      *
-     * @param mixed $arg Any argument required
+     * @param int $id_adh Member identifier
      *
      * @return boolean
      */
-    abstract public function generateNewPassword($arg): bool;
+    abstract public function generateNewPassword(int $id_adh): bool;
 
     /**
      * Remove expired passwords queries (older than 24 hours)
index 49d7976f279492f77135464f76cb7e54ada1fa3f..8d9d4c6ab55d9f6483ef8fb68ed2117d561e0721 100644 (file)
@@ -295,7 +295,7 @@ abstract class Authentication
      *
      * @return mixed
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         $forbidden = array('logged', 'admin', 'active', 'superadmin', 'staff', 'cron', 'uptodate');
         if (in_array($name, $forbidden)) {
index c1b43a9aeee2d502ecc34a559edf917a533b1c52..4ec0b80a04458787aa39a22a101050568e68ba88 100644 (file)
@@ -56,15 +56,11 @@ use Laminas\Db\Sql\SqlInterface;
  */
 class Db
 {
-    /** @var Adapter */
     private Adapter $db;
-    /** @var string */
     private string $type_db;
-    /** @var Sql */
     private Sql $sql;
     /** @var array<string,string> */
     private array $options;
-    /** @var string */
     private string $last_query;
 
     public const MYSQL = 'mysql';
@@ -799,7 +795,7 @@ class Db
      * @return mixed
      * @throws RuntimeException
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         switch ($name) {
             case 'db':
@@ -1004,7 +1000,7 @@ class Db
      *
      * @return integer
      */
-    public function getLastGeneratedValue($entity): int
+    public function getLastGeneratedValue(object $entity): int
     {
         /** @phpstan-ignore-next-line */
         return (int)$this->driver->getLastGeneratedValue(
index acadb528d740006e771199db10c35c886a013bff..f79fcfd02de6df3ed04ae966f304454cf7f0c8ca 100644 (file)
@@ -38,15 +38,10 @@ class Gaptcha
     private int $max = 12;
     private int $min = 0;
 
-    /** @var I18n */
     private I18n $i18n;
-    /** @var integer */
     private int $current_left;
-    /** @var integer */
     private int $current_right;
-    /** @var integer */
     private int $current_op;
-    /** @var integer */
     private int $gaptcha;
 
     /**
index ceab0fdadf74b0ebf1e4f28de2ed587ac49e96b5..571af8d52330be457f23003a7b5dffd305e7ace1 100644 (file)
@@ -375,22 +375,20 @@ class History
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
-        Analog::log(
-            '[History] Getting property `' . $name . '`',
-            Analog::DEBUG
-        );
-
         $forbidden = array();
         if (!in_array($name, $forbidden)) {
             return $this->$name;
-        } else {
-            Analog::log(
-                '[History] Unable to get property `' . $name . '`',
-                Analog::WARNING
-            );
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -417,7 +415,7 @@ class History
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         Analog::log(
             '[History] Setting property `' . $name . '`',
index a2fc6bc8fc1f7c5cae7d96fb8ec4938f32020946..a9e76f8ea34182052c1786904f8ac7e02988553a 100644 (file)
@@ -1297,7 +1297,7 @@ define('PREFIX_DB', '" . $this->db_prefix . "');
      *
      * @return boolean
      */
-    public function isStepPassed($step): bool
+    public function isStepPassed(int $step): bool
     {
         return $this->step > $step;
     }
index 84f92daba61e2e5d5d9691647359225cf9f13629..954da3d4af15302ce4364ea971c2d5939c647400 100644 (file)
@@ -37,9 +37,7 @@ class L10n
 {
     public const TABLE = 'l10n';
 
-    /** @var Db */
     private Db $zdb;
-    /** @var I18n */
     private I18n $i18n;
 
     /**
index 21d5f96ccddf5427ddf354441c95983342f9f424..d8405e72ff7fb1b12b1c32380d06ed48c02fa40b 100644 (file)
@@ -33,7 +33,6 @@ use Slim\App;
 class LightSlimApp
 {
     private string $mode;
-    /** @var App  */
     private App $app;
 
     /**
index 0cc0dc5ed2890006133ffc88ca2fb0ec36160752..79bd083ca7667dac499d7cf3c37dadf702699691 100644 (file)
@@ -502,7 +502,7 @@ class Mailing extends GaletteMail
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         $forbidden = array('ordered');
         if (!in_array($name, $forbidden)) {
@@ -598,7 +598,7 @@ class Mailing extends GaletteMail
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         switch ($name) {
             case 'subject':
index f688b8aea7acbf81e23fb26e95c7c46bc7a7f7e6..b07564c6e3e034a77f51271f013a6adb937ccf47 100644 (file)
@@ -68,6 +68,10 @@ class MailingHistory extends History
      */
     public function __construct(Db $zdb, Login $login, Preferences $preferences, MailingsList $filters = null, Mailing $mailing = null)
     {
+        if ($filters === null) {
+            $filters = new MailingsList();
+        }
+
         parent::__construct($zdb, $login, $preferences, $filters);
         $this->mailing = $mailing;
     }
index 40bc8dac4e7a16e964bd97f8e8e3416d7e6498ed..e58edeae6fa1c521348ebc2bde7fb0f0e5606731 100644 (file)
@@ -366,17 +366,19 @@ abstract class Pagination
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         if (in_array($name, $this->pagination_fields)) {
             return $this->$name;
-        } else {
-            Analog::log(
-                '[' . get_class($this) .
-                '|Pagination] Unable to get property `' . $name . '`',
-                Analog::WARNING
-            );
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -403,7 +405,7 @@ abstract class Pagination
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         switch ($name) {
             case 'ordered':
index 854049b1bb056dbfce4f54da60317b7fe7281515..07eb42dcc70491ec04a7542ff707cb4ff4a7c80d 100644 (file)
@@ -95,7 +95,7 @@ class Password extends AbstractPassword
      *
      * @return boolean
      */
-    public function generateNewPassword($id_adh): bool
+    public function generateNewPassword(int $id_adh): bool
     {
         //first of all, we'll remove all existant entries for specified id
         $this->removeOldEntries($id_adh);
@@ -171,7 +171,7 @@ class Password extends AbstractPassword
      *
      * @return false|int false if hash is not valid, member id otherwise
      */
-    public function isHashValid(string $hash)
+    public function isHashValid(string $hash): false|int
     {
         try {
             $select = $this->zdb->select(self::TABLE);
index e19bf67064ff2a577c22a96297f19b378e5fad90..a0716bc28d57534d760ab15eaa3a00939ffc3a79 100644 (file)
@@ -76,9 +76,9 @@ class Picture implements FileInterface
     /**
      * Default constructor.
      *
-     * @param mixed|null $id_adh the id of the member
+     * @param string|int|null $id_adh the id of the member
      */
-    public function __construct($id_adh = null)
+    public function __construct(string|int|null $id_adh = null)
     {
         $this->init(
             null,
@@ -92,7 +92,7 @@ class Picture implements FileInterface
         );
 
         // '!==' needed, otherwise ''==0
-        if ($id_adh !== '' && $id_adh !== null) {
+        if (!empty($id_adh) && $id_adh !== '') {
             $this->id = $id_adh;
             if (!isset($this->db_id)) {
                 $this->db_id = $id_adh;
@@ -289,11 +289,11 @@ class Picture implements FileInterface
     }
 
     /**
-     * Get image file content
+     * Get image file contents in stdOut
      *
-     * @return mixed
+     * @return void
      */
-    public function getContents()
+    public function getContents(): void
     {
         readfile($this->file_path);
     }
@@ -963,7 +963,7 @@ class Picture implements FileInterface
      *
      * @return string Localized message
      */
-    public function getErrorMessage($code): string
+    public function getErrorMessage(int $code): string
     {
         $error = null;
         switch ($code) {
index c0ca48edfe13c14648f3f273b9aad17a95808bb8..7f323c1846d808b6e619174cd4fb182b0c660d01 100644 (file)
@@ -415,7 +415,7 @@ class Plugins
      *
      * @return mixed module's information
      */
-    public function moduleInfo(string $id, string $info)
+    public function moduleInfo(string $id, string $info): mixed
     {
         return $this->modules[$id][$info] ?? null;
     }
index 71a8437cfa7b84199a2c968addbf3ebec0a9e2d2..54287e25640d47ce834187ac553e30ffd000a9d4 100644 (file)
@@ -642,7 +642,7 @@ class Preferences
      *
      * @return mixed
      */
-    public function validateValue(string $fieldname, $value)
+    public function validateValue(string $fieldname, mixed $value): mixed
     {
         global $login;
 
@@ -956,7 +956,7 @@ class Preferences
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         $forbidden = array('defaults');
         $virtuals = array('vpref_email', 'vpref_email_newadh');
@@ -1047,7 +1047,7 @@ class Preferences
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         //does this pref exists ?
         if (!array_key_exists($name, self::$defaults)) {
index ad9716fd8f7caf1f1ad2a62a677b1fec7d5a7e0d..564dc19f8c800e75ead84625c165a026ee565984 100644 (file)
@@ -32,7 +32,6 @@ use Slim\App;
  */
 class SlimApp
 {
-    /** @var App  */
     private App $app;
 
     /**
index 24eeef96f7ca8912a1a0f68cc22521f399ce52f6..d36c4b933c3874f347edac587017c36aa5d756b4 100644 (file)
@@ -106,7 +106,7 @@ abstract class DynamicField
      * @param Db    $zdb  Database instance
      * @param mixed $args Arguments
      */
-    public function __construct(Db $zdb, $args = null)
+    public function __construct(Db $zdb, mixed $args = null)
     {
         $this->zdb = $zdb;
 
index f9bdbe971a1a3ef5086252308d2069e383600e31..635beebe315c0701191605602830cb91a90f89f4 100644 (file)
@@ -1322,7 +1322,7 @@ class Adherent
      *
      * @return void
      */
-    public function validate(string $field, $value, array $values): void
+    public function validate(string $field, mixed $value, array $values): void
     {
         global $preferences;
 
@@ -1753,7 +1753,7 @@ class Adherent
      *
      * @return mixed
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         $forbidden = array(
             'admin', 'staff', 'due_free', 'appears_in_list', 'active',
index 01757bb1f172c099f6a8ecae6e026cb788b7f317..07d355158833eb15bbf466fae4ffb7079f1a1f9b 100644 (file)
@@ -101,9 +101,7 @@ class Contribution
     /** @var array<int, PaymentType> */
     private array $ptypes_list;
 
-    /** @var Db */
     private Db $zdb;
-    /** @var Login */
     private Login $login;
     /** @var array<string> */
     protected array $errors = [];
@@ -1132,7 +1130,7 @@ class Contribution
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         if (in_array($name, $this->forbidden_fields)) {
             Analog::log(
@@ -1194,8 +1192,9 @@ class Contribution
                 "Unknown property '$name'",
                 Analog::WARNING
             );
-            return null;
         }
+
+        return null;
     }
 
     /**
@@ -1206,7 +1205,7 @@ class Contribution
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         global $preferences;
 
index a3d87207ff947f49351546275c20a8fd86d99a5c..d8d2c7fa32f45de08fcbbd2ff6b576f442454192 100644 (file)
@@ -581,7 +581,7 @@ class ContributionsTypes
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         $forbidden = array();
         $virtuals = array('extension', 'libelle');
index ff7c179809fda6a8de442102f7933e6863fc9683..605d7ea3a93d8f739f9cd6aadbabd042fa634d74 100644 (file)
@@ -57,19 +57,12 @@ class Document implements FileInterface
     public const MINUTES = 'minutes';
     public const VOTES = 'votes';
 
-    /** @var Db */
     private Db $zdb;
-    /** @var int */
     private int $id;
-    /** @var string */
     private string $type;
-    /** @var string */
     private string $filename;
-    /** @var DateTime */
     private DateTime $creation_date;
-    /** @var string */
     protected string $store_path = GALETTE_DOCUMENTS_PATH;
-    /** @var ?string */
     private ?string $comment = null;
     /** @var array<string> */
     private array $errors = [];
index 473f51af201bd4c3bf561476c455b4d11b6f69f9..96fcf88d68dfbaef72d808b7a0a5b9ccbc51f132 100644 (file)
@@ -316,7 +316,7 @@ class FieldsConfig
             if (count($this->core_db_fields)) {
                 array_walk(
                     $this->core_db_fields,
-                    function ($field) use (&$_all_fields) {
+                    function ($field) use (&$_all_fields): void {
                         $_all_fields[$field['field_id']] = $field;
                     }
                 );
index c6dc38edc94b957687a885bf2e386e4714866b69..181fa39a9f8a45849af0e4d10fc44ce16d204384 100644 (file)
@@ -22,7 +22,6 @@
 namespace Galette\Entity;
 
 use ArrayObject;
-use stdClass;
 use Throwable;
 use Analog\Analog;
 use Galette\Core\Login;
@@ -182,11 +181,11 @@ class ListsConfig extends FieldsConfig
     /**
      * Handle list labels
      *
-     * @param stdClass $field Field data
+     * @param object $field Field data
      *
      * @return void
      */
-    private function handleLabel(stdClass $field): void
+    private function handleLabel(object $field): void
     {
         switch ($field->field_id) {
             case 'bool_admin_adh':
index 7219848881ceca50243e0116cf32cbbb46789011..d1d4155bd28255bd61bfc5bff8c31a3891e8afba 100644 (file)
@@ -198,19 +198,21 @@ class PaymentType
      *
      * @return mixed
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         switch ($name) {
             case 'id':
             case 'name':
                 return $this->$name;
-            default:
-                Analog::log(
-                    'Unable to get Title property ' . $name,
-                    Analog::WARNING
-                );
-                break;
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -240,7 +242,7 @@ class PaymentType
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         switch ($name) {
             case 'name':
index 0ee04ecdae4fc40aeadf8bd52fa762a26942e35f..4403c539a20437f6078ab80b5dfd955fa3968836 100644 (file)
@@ -315,10 +315,8 @@ abstract class PdfModel
      *
      * @return mixed
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
-        global $lang;
-
         switch ($name) {
             case 'id':
                 return (int)$this->$name;
@@ -367,13 +365,15 @@ abstract class PdfModel
 
                 $value = $this->proceedReplacements($prop_value);
                 return $value;
-            default:
-                Analog::log(
-                    'Unable to get PdfModel property ' . $name,
-                    Analog::WARNING
-                );
-                break;
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -418,7 +418,7 @@ abstract class PdfModel
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         switch ($name) {
             case 'type':
index b15c32ea135bfcfc50cd1255d123b65f5211e8e4..b2e63ca4b060f734922b106c762e4e8e3de5c4f3 100644 (file)
@@ -51,9 +51,7 @@ class Reminder
     private int $type;
     private Adherent $dest;
     private string $date;
-    /** @var boolean */
     private bool $success = false;
-    /** @var boolean */
     private bool $nomail;
     private string $comment;
     private string $msg;
@@ -314,7 +312,7 @@ class Reminder
      *
      * @return mixed
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         switch ($name) {
             case 'member_id':
@@ -324,13 +322,15 @@ class Reminder
                 return $this->$name;
             case 'comment':
                 return $this->comment;
-            default:
-                Analog::log(
-                    'Unable to get Reminder property ' . $name,
-                    Analog::WARNING
-                );
-                break;
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -361,7 +361,7 @@ class Reminder
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         switch ($name) {
             case 'type':
index f82a16c053bf5d52c97cc9cf38fdf80b6a390c05..2d102f0bcceee0cb5945dbbd34ea6fd0d0154c2d 100644 (file)
@@ -247,7 +247,7 @@ class SavedSearch
      *
      * @return mixed
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         $forbidden = [];
         $virtuals = ['sparameters'];
@@ -289,17 +289,19 @@ class SavedSearch
                     }
                     return $parameters;
                 default:
-                    if (!property_exists($this, $name)) {
-                        Analog::log(
-                            "Unknown property '$name'",
-                            Analog::WARNING
-                        );
-                        return null;
-                    } else {
+                    if (property_exists($this, $name)) {
                         return $this->$name;
                     }
             }
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -338,7 +340,7 @@ class SavedSearch
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         switch ($name) {
             case 'form':
index 3c1c4f2fbe66cf7fa7def915ba788131d0f62dc5..7eea87b15f8c35c85a2e0ffeaa43f3e4e33e864a 100644 (file)
@@ -55,17 +55,11 @@ class Social
     public const BLOG = 'blog';
     public const DISCORD = 'discord';
 
-    /** @var Db */
     private Db $zdb;
-    /** @var int */
     private int $id;
-    /** @var string */
     private string $type;
-    /** @var string */
     private string $url;
-    /** @var int */
     private ?int $id_adh;
-    /** @var Adherent|null */
     private ?Adherent $member = null;
 
     /**
@@ -251,7 +245,7 @@ class Social
      *
      * @return mixed
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         return $this->$name;
     }
index 0ae41ea1afb69e71be11b026a6ab65f67fe800b5..917887834a17c19d45c7664fff8c9b0cb13cd08a 100644 (file)
@@ -547,7 +547,7 @@ class Status
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         $forbidden = array();
         $virtuals = array('extension', 'libelle');
index 62afbe6e01a97ad95aa44975bffc1d14ed666564..0306fa5df929864fef7002534202165a690b8240 100644 (file)
@@ -197,7 +197,7 @@ class Title
      *
      * @return mixed
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         global $lang;
 
@@ -231,13 +231,15 @@ class Title
                 } else {
                     return $this->$rname;
                 }
-            default:
-                Analog::log(
-                    'Unable to get Title property ' . $name,
-                    Analog::WARNING
-                );
-                break;
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -270,7 +272,7 @@ class Title
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         switch ($name) {
             case 'short':
index e766cb3e07bc23c753f04ff4a8c654d2e6daeb84..979d539a1378596e3ebda4a0bf511cba48f84aac 100644 (file)
@@ -593,7 +593,7 @@ class Transaction
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         if (!in_array($name, $this->forbidden_fields) && property_exists($this, $name)) {
             switch ($name) {
@@ -633,7 +633,7 @@ class Transaction
      *
      * @return array<string>|true
      */
-    public function handleFiles(array $files)
+    public function handleFiles(array $files): array|bool
     {
         $this->errors = [];
 
index 29fc174a7528e02c02435a4433ef20764be8d95c..e943245d3b2054fcd083563843b926ace7cdb5df 100644 (file)
@@ -43,17 +43,11 @@ use Slim\Routing\RouteParser;
  */
 class ContribListener implements ListenerSubscriber
 {
-    /** @var Preferences */
     private Preferences $preferences;
-    /** @var RouteParser */
     private RouteParser $routeparser;
-    /** @var History */
     private History $history;
-    /** @var Messages */
     private Messages $flash;
-    /** @var Login */
     private Login $login;
-    /** @var Db */
     private Db $zdb;
 
     /**
@@ -93,7 +87,7 @@ class ContribListener implements ListenerSubscriber
     {
         $acceptor->subscribeTo(
             'contribution.add',
-            function (GaletteEvent $event) {
+            function (GaletteEvent $event): void {
                 $this->contributionAdded($event->getObject());
             }
         );
index 95928dfb6bd81a4990e20e2a3b0132bfd5073723..49e21cc95fe510db459b41f667f09be07f7da8ab 100644 (file)
@@ -30,7 +30,6 @@ use League\Event\HasEventName;
  */
 class GaletteEvent implements HasEventName
 {
-    /** @var string */
     private string $name;
     private object $object;
 
index 5536852a04cf33070fd50ebf8de4f1fc933bce79..bab15ea5c8bde009bcdfe8188ef2eb87f9a2b71d 100644 (file)
@@ -42,17 +42,11 @@ use Slim\Routing\RouteParser;
  */
 class MemberListener implements ListenerSubscriber
 {
-    /** @var Preferences */
     private Preferences $preferences;
-    /** @var RouteParser */
     private RouteParser $routeparser;
-    /** @var History */
     private History $history;
-    /** @var Messages */
     private Messages $flash;
-    /** @var Login */
     private Login $login;
-    /** @var Db */
     private Db $zdb;
 
     /**
@@ -92,14 +86,14 @@ class MemberListener implements ListenerSubscriber
     {
         $acceptor->subscribeTo(
             'member.add',
-            function (GaletteEvent $event) {
+            function (GaletteEvent $event): void {
                 $this->memberAdded($event->getObject());
             }
         );
 
         $acceptor->subscribeTo(
             'member.edit',
-            function (GaletteEvent $event) {
+            function (GaletteEvent $event): void {
                 $this->memberEdited($event->getObject());
             }
         );
index d58201cea0f8296d4a49a73ef9f5852ca6f71fb8..0cee1ebeadc9948797bd56e5991c6e025f70b798 100644 (file)
@@ -163,5 +163,5 @@ trait Cacheable
      *
      * @return bool
      */
-    abstract protected function cacheLoaded($content): bool;
+    abstract protected function cacheLoaded(mixed $content): bool;
 }
index c4841aae489c78894e3652744e845bae0a6193fd..05c67648f63f96095127c57e747724fcc81d4127 100644 (file)
@@ -41,10 +41,8 @@ trait Dynamics
 {
     use Dependencies;
 
-    /** @var string */
     protected string $name_pattern = 'info_field_';
 
-    /** @var DynamicFieldsHandle */
     protected DynamicFieldsHandle $dynamics;
 
     /**
index d420ea0391be3805c45532103f5fe640aa26eeb2..aead596986c271c62bf183e8490cd715429ab4c3 100644 (file)
@@ -56,27 +56,15 @@ trait Replacements
     private array $dynamic_patterns = [];
     private ?PHPMailer $mail = null;
 
-    /**
-     * @var Db
-     */
     #[Inject("zdb")]
     protected Db $zdb;
 
-    /**
-     * @var Login
-     */
     #[Inject("login")]
     protected Login $login;
 
-    /**
-     * @var Preferences
-     */
     #[Inject("preferences")]
     protected Preferences $preferences;
 
-    /**
-     * @var RouteParser
-     */
     protected RouteParser $routeparser;
 
     /**
index aab70d6ac3f713d1ee36c150d8bab65f0c6d8d30..852d935cd162e2b6738470f0e85531614ce21db7 100644 (file)
@@ -297,14 +297,8 @@ class AdvancedMembersList extends MembersList
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
-
-        Analog::log(
-            '[AdvancedMembersList] Getting property `' . $name . '`',
-            Analog::DEBUG
-        );
-
         if (
             in_array($name, $this->pagination_fields)
             || in_array($name, $this->memberslist_fields)
@@ -372,13 +366,16 @@ class AdvancedMembersList extends MembersList
                         return $search_fields;
                 }
                 return $this->$name;
-            } else {
-                Analog::log(
-                    '[AdvancedMembersList] Unable to get property `' . $name . '`',
-                    Analog::WARNING
-                );
             }
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -416,7 +413,7 @@ class AdvancedMembersList extends MembersList
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         global $zdb, $preferences, $login;
 
index 8ed58c9f978d443149efc6ff7a1f97250be94e8f..c07ef4b042d9ff6f3eb59055942a88794c0cbe88 100644 (file)
@@ -145,13 +145,8 @@ class ContributionsList extends Pagination
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
-        Analog::log(
-            '[ContributionsList] Getting property `' . $name . '`',
-            Analog::DEBUG
-        );
-
         if (in_array($name, $this->pagination_fields)) {
             return parent::__get($name);
         } else {
@@ -189,13 +184,16 @@ class ContributionsList extends Pagination
                     default:
                         return $this->$name;
                 }
-            } else {
-                Analog::log(
-                    '[ContributionsList] Unable to get property `' . $name . '`',
-                    Analog::WARNING
-                );
             }
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -225,7 +223,7 @@ class ContributionsList extends Pagination
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         if (in_array($name, $this->pagination_fields)) {
             parent::__set($name, $value);
index 3fd55c3a119230d03378df7fe066f99a093664b0..eb4dff20c4dfa445b9405cf4f7ed5821dfa68968 100644 (file)
@@ -110,13 +110,8 @@ class HistoryList extends Pagination
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
-        Analog::log(
-            '[' . static::class . '] Getting property `' . $name . '`',
-            Analog::DEBUG
-        );
-
         if (in_array($name, $this->pagination_fields)) {
             return parent::__get($name);
         } else {
@@ -140,19 +135,21 @@ class HistoryList extends Pagination
                                 $e->getMessage(),
                                 Analog::INFO
                             );
-                            return $this->$name;
                         }
-                        break;
+                        return $this->$name;
                     default:
                         return $this->$name;
                 }
-            } else {
-                Analog::log(
-                    '[' . static::class . '] Unable to get property `' . $name . '`',
-                    Analog::WARNING
-                );
             }
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -182,7 +179,7 @@ class HistoryList extends Pagination
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         if (in_array($name, $this->pagination_fields)) {
             parent::__set($name, $value);
index 3e3df91f2ccf51c4cdd3144c35a866b7eb5e0a53..bfacf190d4ef8e20a59ff4dbe73b92bfd9982bf7 100644 (file)
@@ -118,20 +118,23 @@ class MembersList extends Pagination
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         if (in_array($name, $this->pagination_fields)) {
             return parent::__get($name);
         } else {
             if (in_array($name, $this->memberslist_fields)) {
                 return $this->$name;
-            } else {
-                Analog::log(
-                    '[MembersList] Unable to get property `' . $name . '`',
-                    Analog::WARNING
-                );
             }
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -161,7 +164,7 @@ class MembersList extends Pagination
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         if (in_array($name, $this->pagination_fields)) {
             parent::__set($name, $value);
index b6c9263058d0c3e896ae16f63e435bbe23986559..c59754aad67ea1a016bd7cb341f97d7bb7919c3d 100644 (file)
@@ -127,7 +127,7 @@ class ScheduledPaymentsList extends Pagination
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
         if (in_array($name, $this->pagination_fields)) {
             return parent::__get($name);
@@ -166,13 +166,16 @@ class ScheduledPaymentsList extends Pagination
                     default:
                         return $this->$name;
                 }
-            } else {
-                Analog::log(
-                    '[ScheduledPaymentsList] Unable to get property `' . $name . '`',
-                    Analog::WARNING
-                );
             }
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -202,7 +205,7 @@ class ScheduledPaymentsList extends Pagination
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         if (in_array($name, $this->pagination_fields)) {
             parent::__set($name, $value);
index 477a87d8fab4ac0a44ef9d5d6818aaf1707c9e01..49186a09461c23345155885745f67e02a87674dc 100644 (file)
@@ -107,13 +107,8 @@ class TransactionsList extends Pagination
      *
      * @return mixed the called property
      */
-    public function __get(string $name)
+    public function __get(string $name): mixed
     {
-        Analog::log(
-            '[TransactionsList] Getting property `' . $name . '`',
-            Analog::DEBUG
-        );
-
         if (in_array($name, $this->pagination_fields)) {
             return parent::__get($name);
         } else {
@@ -151,13 +146,16 @@ class TransactionsList extends Pagination
                     default:
                         return $this->$name;
                 }
-            } else {
-                Analog::log(
-                    '[TransactionsList] Unable to get property `' . $name . '`',
-                    Analog::WARNING
-                );
             }
         }
+
+        throw new \RuntimeException(
+            sprintf(
+                'Unable to get property "%s::%s"!',
+                __CLASS__,
+                $name
+            )
+        );
     }
 
     /**
@@ -187,7 +185,7 @@ class TransactionsList extends Pagination
      *
      * @return void
      */
-    public function __set(string $name, $value): void
+    public function __set(string $name, mixed $value): void
     {
         if (in_array($name, $this->pagination_fields)) {
             parent::__set($name, $value);
index 9ea57e13f49388a80cd8cabf6f102a7c6ffa83c3..e003d6b0492587c194c0cb306671fbd19bd52de5 100644 (file)
@@ -69,7 +69,7 @@ class ContributionsCsv extends CsvOut
      *
      * @return void
      */
-    public function exportContributions(ContributionsList $filters)
+    public function exportContributions(ContributionsList $filters): void
     {
         $class = '\\Galette\\Entity\\' . ucwords(trim($this->type, 's'));
         $contrib = new $class($this->zdb, $this->login);
@@ -164,7 +164,7 @@ class ContributionsCsv extends CsvOut
      *
      * @return string
      */
-    public function getPath()
+    public function getPath(): string
     {
         return $this->path;
     }
@@ -174,7 +174,7 @@ class ContributionsCsv extends CsvOut
      *
      * @return string
      */
-    public function getFileName()
+    public function getFileName(): string
     {
         return $this->filename;
     }
index d7f426dcb62c71f35d66be86ce3f14239cc95d89..4f1e5ddad1085f67316b477e5a357f696ee10d72 100644 (file)
@@ -121,7 +121,7 @@ class CsvIn extends Csv implements FileInterface
      *
      * @return void
      */
-    private function loadFields()
+    private function loadFields(): void
     {
         //at last, we got the defaults
         $this->fields = $this->default_fields;
@@ -138,7 +138,7 @@ class CsvIn extends Csv implements FileInterface
      *
      * @return array<string>
      */
-    public function getDefaultFields()
+    public function getDefaultFields(): array
     {
         return $this->default_fields;
     }
@@ -160,11 +160,11 @@ class CsvIn extends Csv implements FileInterface
         Db $zdb,
         Preferences $preferences,
         History $history,
-        $filename,
+        string $filename,
         array $members_fields,
         array $members_fields_cats,
-        $dryrun
-    ) {
+        bool $dryrun
+    ): bool|int {
         if (
             !file_exists(self::DEFAULT_DIRECTORY . '/' . $filename)
             || !is_readable(self::DEFAULT_DIRECTORY . '/' . $filename)
@@ -205,7 +205,7 @@ class CsvIn extends Csv implements FileInterface
      *
      * @return boolean
      */
-    private function check(string $filename)
+    private function check(string $filename): bool
     {
         $handle = fopen(self::DEFAULT_DIRECTORY . '/' . $filename, 'r');
         if (!$handle) {
@@ -445,7 +445,7 @@ class CsvIn extends Csv implements FileInterface
      *
      * @return boolean
      */
-    private function storeMembers($filename)
+    private function storeMembers(string $filename): bool
     {
         $handle = fopen(self::DEFAULT_DIRECTORY . '/' . $filename, 'r');
 
@@ -558,7 +558,7 @@ class CsvIn extends Csv implements FileInterface
      *
      * @return string Localized message
      */
-    public function getErrorMessage($code)
+    public function getErrorMessage(int $code): string
     {
         $error = null;
         switch ($code) {
index 9b38cf0f7dc608fb468a3ac400afbc4f0189076c..d7c5471778e7fac1308f3256648a41b799eeb309 100644 (file)
@@ -68,7 +68,7 @@ class CsvOut extends Csv
      * @return string CSV result
      */
     public function export(
-        $rs,
+        ResultSet|array $rs,
         string $separator,
         string $quote,
         array|bool $titles = false,
index fe31dbdbb90eb2a58117524f0f8126facb32a333..5f8d008ad135efa6f9c12cb95c5a35a5b71b7e8a 100644 (file)
@@ -55,9 +55,9 @@ trait FileTrait
     protected ?string $extension;
     protected ?string $dest_dir;
     /** @var array<string> */
-    protected $allowed_extensions = array();
+    protected array $allowed_extensions = array();
     /** @var array<string,string> */
-    protected $allowed_mimes = array();
+    protected array $allowed_mimes = array();
     protected int $maxlenght;
     protected int $mincropsize;
 
index 846a320ff96694a93ce6559489f607a1080c0dbb..da95eaed83adb21272a4debc4a8ee33f654d56b0 100644 (file)
@@ -75,7 +75,7 @@ class MembersCsv extends CsvOut
      *
      * @return void
      */
-    public function exportMembers(MembersList $filters)
+    public function exportMembers(MembersList $filters): void
     {
         $export_fields = null;
         if (file_exists(GALETTE_CONFIG_PATH . 'local_export_fields.inc.php')) {
@@ -252,7 +252,7 @@ class MembersCsv extends CsvOut
      *
      * @return string
      */
-    public function getPath()
+    public function getPath(): string
     {
         return $this->path;
     }
@@ -262,7 +262,7 @@ class MembersCsv extends CsvOut
      *
      * @return string
      */
-    public function getFileName()
+    public function getFileName(): string
     {
         return $this->filename;
     }
index 17c285ca0b514252c5b518c7bf3ecd5f51c3fafb..e753fbf385287b2a2bc762129242ae7b05b0dfc0 100644 (file)
@@ -84,7 +84,7 @@ class News
      *
      * @return bool
      */
-    protected function cacheLoaded($contents): bool
+    protected function cacheLoaded(mixed $contents): bool
     {
         if (Galette::isSerialized($contents)) {
             //legacy cache format
index 89f63d6bb35aac1865a71d304c04facdcbddd5c2..3fe6d421d3e7b2b17a494095f424a06b7fc670e7 100644 (file)
@@ -66,7 +66,7 @@ class ScheduledPaymentsCsv extends CsvOut
      *
      * @return void
      */
-    public function exportScheduledPayments(ScheduledPaymentsList $filters)
+    public function exportScheduledPayments(ScheduledPaymentsList $filters): void
     {
         $scheduled = new ScheduledPayment($this->zdb);
         $fields = $scheduled->getFields();
@@ -137,7 +137,7 @@ class ScheduledPaymentsCsv extends CsvOut
      *
      * @return string
      */
-    public function getPath()
+    public function getPath(): string
     {
         return $this->path;
     }
@@ -147,7 +147,7 @@ class ScheduledPaymentsCsv extends CsvOut
      *
      * @return string
      */
-    public function getFileName()
+    public function getFileName(): string
     {
         return $this->filename;
     }
index b3a9b6637f964aa6f9b3d15a5a4069b1f8460288..0a4d6db067052f00e6261879852f723f87b0bae3 100644 (file)
@@ -39,9 +39,6 @@ use Slim\Routing\RouteParser;
  */
 class Authenticate
 {
-    /**
-     * @var Messages
-     */
     protected Messages $flash;
 
     /**
@@ -49,19 +46,10 @@ class Authenticate
      */
     protected array $acls;
 
-    /**
-     * @var Login
-     */
     private Login $login;
 
-    /**
-     * @var Session
-     */
     private Session $session;
 
-    /**
-     * @var RouteParser
-     */
     private RouteParser $routeparser;
 
     /**
index 8ebbcf1b6f4a304b4888bd033e4005c17735813a..edb57a59f67ae40573aff06fe1dfc441dd3ef726 100644 (file)
@@ -37,24 +37,12 @@ use Slim\Routing\RouteParser;
  */
 class PublicPages
 {
-    /**
-     * @var Messages
-     */
     protected Messages $flash;
 
-    /**
-     * @var Login
-     */
     private Login $login;
 
-    /**
-     * @var RouteParser
-     */
     private RouteParser $routeparser;
 
-    /**
-     * @var Preferences
-     */
     private Preferences $preferences;
 
     /**
index b606e1c8013091a2b9cd5caa3b6d97276454b0f7..315a1301236a7434f605a53fff9737b9585aa31e 100644 (file)
@@ -47,14 +47,8 @@ class UpdateAndMaintenance
      */
     protected $callback;
 
-    /**
-     * @var I18n
-     */
     protected I18n $i18n;
 
-    /**
-     * @var RouteParser
-     */
     protected RouteParser $routeParser;
 
     /**
index 24dfd9a223718d580fac068a8206d07f56386752..41510b0ea7dd9e40a820020da53923531d840426 100644 (file)
@@ -39,9 +39,7 @@ use Galette\Core\Db;
  */
 class Groups
 {
-    /** @var Db */
     private Db $zdb;
-    /** @var Login */
     private Login $login;
 
     /**
@@ -407,7 +405,7 @@ class Groups
      *
      * @return boolean
      */
-    public static function isUnique(Db $zdb, string $name, ?int $parent = null, ?int $current = null)
+    public static function isUnique(Db $zdb, string $name, ?int $parent = null, ?int $current = null): bool
     {
         try {
             $select = $zdb->select(Group::TABLE);
index e0f8c43f06d6e396157f24536e9a4f3a989e93d4..a7f7d498ad43a27a27557cd5e62fc6de87f60b67 100644 (file)
@@ -139,7 +139,7 @@ class Members
         ?array $fields = null,
         bool $count = true,
         bool $limit = true
-    ) {
+    ): array|ResultSet {
         return $this->getMembersList(
             $as_members,
             $fields,
@@ -168,7 +168,7 @@ class Members
         ?array $fields = null,
         bool $count = true,
         bool $limit = true
-    ) {
+    ): array|ResultSet {
         return $this->getMembersList(
             $as_members,
             $fields,
@@ -203,7 +203,7 @@ class Members
         bool $managed = false,
         bool $limit = true,
         bool $export = false
-    ) {
+    ): array|ResultSet {
         global $zdb;
 
         if ($limit === true) {
@@ -425,7 +425,7 @@ class Members
      *
      * @return Adherent[]|ResultSet
      */
-    public function getList(bool $as_members = false, ?array $fields = null)
+    public function getList(bool $as_members = false, ?array $fields = null): array|ResultSet
     {
         return $this->getMembersList(
             $as_members,
@@ -446,7 +446,7 @@ class Members
      *
      * @return array<string, Adherent[]>
      */
-    public function getPublicList(bool $with_photos)
+    public function getPublicList(bool $with_photos): array
     {
         global $zdb;
 
@@ -523,7 +523,7 @@ class Members
         bool $export = false,
         bool $dues = false,
         bool $parent = false
-    ) {
+    ): array|false {
         global $zdb;
 
         if (!is_array($ids) || count($ids) < 1) {
index 854f9443cab6e2c746d8c6c106dacfdc950f91d0..d5e94b6f74b70f02d0e8a2d9a58a8c099cdc99cf 100644 (file)
@@ -27,7 +27,6 @@ use Galette\Core\Pagination;
 use Galette\Core\Preferences;
 use Galette\Core\Login;
 use Laminas\Db\ResultSet\ResultSet;
-use stdClass;
 
 /**
  * Repositories
@@ -111,9 +110,9 @@ abstract class Repository
     /**
      * Get entity instance
      *
-     * @return stdClass
+     * @return object
      */
-    public function getEntity()
+    public function getEntity(): object
     {
         $name = $this->entity;
         return new $name(
@@ -126,7 +125,7 @@ abstract class Repository
     /**
      * Get list
      *
-     * @return array<int, stdClass>|ResultSet
+     * @return array<int, object>|ResultSet
      */
     abstract public function getList(): array|ResultSet;
 
index dacc0ac4aa1cedf44b65d80458bcf64cc895dbb1..e1bd86a06d0f17a41bc732ee1e5df08f3ce9283a 100644 (file)
@@ -34,9 +34,6 @@ use Twig\Extension\GlobalsInterface;
 
 class CsrfExtension extends AbstractExtension implements GlobalsInterface
 {
-    /**
-     * @var Guard
-     */
     protected Guard $csrf;
 
     /**
index a43d4215ce24ccf9441288f5cf1b479fa3d5fe12..fb11f8b0532d945f73e8f8b990df2af033b03efe 100644 (file)
@@ -197,7 +197,7 @@ class Release
      *
      * @return bool
      */
-    protected function cacheLoaded($content): bool
+    protected function cacheLoaded(mixed $content): bool
     {
         if ($content === null) {
             return false;
index 018b210b14edddd7ec5cc123927cc6706b01ba9f..dbcb89d3c7fa39a108f6633408d853c789a3a9a4 100644 (file)
@@ -88,7 +88,7 @@ class PdfController extends GaletteTestCase
      *
      * @return void
      */
-    public function testStoreModels()
+    public function testStoreModels(): void
     {
         $model = new \Galette\Entity\PdfInvoice($this->zdb, $this->preferences);
         $this->assertSame('_T("Invoice") {CONTRIBUTION_YEAR}-{CONTRIBUTION_ID}', $model->title);
@@ -136,7 +136,7 @@ class PdfController extends GaletteTestCase
      *
      * @return void
      */
-    public function testMembersCards()
+    public function testMembersCards(): void
     {
         $this->getMemberOne();
 
@@ -201,7 +201,7 @@ class PdfController extends GaletteTestCase
      *
      * @return void
      */
-    public function testFilteredMembersCards()
+    public function testFilteredMembersCards(): void
     {
         $this->getMemberOne();
 
@@ -243,7 +243,7 @@ class PdfController extends GaletteTestCase
      *
      * @return void
      */
-    public function testMembersLabels()
+    public function testMembersLabels(): void
     {
         unset($this->session->filter_members);
         $this->getMemberOne();
@@ -315,7 +315,7 @@ class PdfController extends GaletteTestCase
      *
      * @return void
      */
-    public function testFilteredMembersLabels()
+    public function testFilteredMembersLabels(): void
     {
         unset($this->session->filter_members);
         $this->getMemberOne();
@@ -357,7 +357,7 @@ class PdfController extends GaletteTestCase
      *
      * @return void
      */
-    public function testadhesionForm()
+    public function testadhesionForm(): void
     {
         unset($this->session->filter_members);
         $this->getMemberOne();
@@ -409,7 +409,7 @@ class PdfController extends GaletteTestCase
      *
      * @return void
      */
-    public function testAttendanceSheet()
+    public function testAttendanceSheet(): void
     {
         $this->getMemberOne();
 
@@ -466,7 +466,7 @@ class PdfController extends GaletteTestCase
      *
      * @return void
      */
-    public function testContribution()
+    public function testContribution(): void
     {
         $this->getMemberOne();
         $this->createContribution();
index e8339b2a2f1f949d44eb0204a029a8c1881f7603..0df93c0e4307a98a7137a20e658f1587079dd2a1 100644 (file)
@@ -49,7 +49,7 @@ class CheckModules extends TestCase
      *
      * @return void
      */
-    public function testAllOK()
+    public function testAllOK(): void
     {
         $checks = new \Galette\Core\CheckModules();
         $this->assertTrue($checks->isValid());
@@ -65,7 +65,7 @@ class CheckModules extends TestCase
      *
      * @return void
      */
-    public function testAllKO()
+    public function testAllKO(): void
     {
         $checks = $this->getMockBuilder(\Galette\Core\CheckModules::class)
             ->setConstructorArgs([false])
@@ -88,7 +88,7 @@ class CheckModules extends TestCase
      *
      * @return void
      */
-    public function testToHtml()
+    public function testToHtml(): void
     {
         $checks = new \Galette\Core\CheckModules();
         $checks->doCheck();
index 422da6d14744e5d8120cc1db86a913fdad0bea9d..d379c32d3aa8e2553cdbbee19e1fba9ef1b77c05 100644 (file)
@@ -65,7 +65,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testConstructor()
+    public function testConstructor(): void
     {
         $db = new \Galette\Core\Db();
         $type = $db->type_db;
@@ -105,7 +105,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testConnectivity()
+    public function testConnectivity(): void
     {
         $res = $this->db->testConnectivity(
             TYPE_DB,
@@ -123,7 +123,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testGrant()
+    public function testGrant(): void
     {
         $result = $this->db->dropTestTable();
 
@@ -151,7 +151,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testGrantWException()
+    public function testGrantWException(): void
     {
         $atoum = $this;
 
@@ -163,7 +163,7 @@ class Db extends TestCase
         $this->db->method('execute')
             ->will(
                 $this->returnCallback(
-                    function ($o) {
+                    function ($o): void {
                         if ($o instanceof \Laminas\Db\Sql\Insert) {
                             throw new \LogicException('Error executing query!', 123);
                         }
@@ -286,7 +286,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testIsPostgres()
+    public function testIsPostgres(): void
     {
         $is_pg = $this->db->isPostgres();
 
@@ -305,7 +305,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testGetters()
+    public function testGetters(): void
     {
         switch (TYPE_DB) {
             case 'pgsql':
@@ -336,7 +336,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testSelect()
+    public function testSelect(): void
     {
         $select = $this->db->select('preferences', 'p');
         $select->where(array('p.nom_pref' => 'pref_nom'));
@@ -361,7 +361,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testSelectAll()
+    public function testSelectAll(): void
     {
         $all = $this->db->selectAll('preferences');
         $this->assertInstanceOf('Laminas\Db\ResultSet\ResultSet', $all);
@@ -372,7 +372,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testInsert()
+    public function testInsert(): void
     {
         $insert = $this->db->insert('titles');
         $data = [
@@ -400,7 +400,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testUpdate()
+    public function testUpdate(): void
     {
         $insert = $this->db->insert('titles');
         $data = [
@@ -442,7 +442,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testDelete()
+    public function testDelete(): void
     {
         $insert = $this->db->insert('titles');
         $data = [
@@ -474,7 +474,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testDbVersion()
+    public function testDbVersion(): void
     {
         $db_version = $this->db->getDbVersion();
         $this->assertSame(GALETTE_DB_VERSION, $db_version);
@@ -488,7 +488,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testDbVersionWException()
+    public function testDbVersionWException(): void
     {
         $this->db = $this->getMockBuilder(\Galette\Core\Db::class)
             ->onlyMethods(array('execute'))
@@ -496,7 +496,7 @@ class Db extends TestCase
         $this->db->method('execute')
             ->will(
                 $this->returnCallback(
-                    function ($table, $where) {
+                    function ($table, $where): void {
                         throw new \LogicException('Error executing query!', 123);
                     }
                 )
@@ -512,7 +512,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testGetColumns()
+    public function testGetColumns(): void
     {
         $cols = $this->db->getColumns('preferences');
 
@@ -540,7 +540,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testTables()
+    public function testTables(): void
     {
         $expected = array (
             'galette_groups_members',
@@ -594,7 +594,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testConvertToUtf()
+    public function testConvertToUtf(): void
     {
         $convert = $this->db->convertToUTF();
         $this->assertNull($convert);
@@ -605,7 +605,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testGetPlatform()
+    public function testGetPlatform(): void
     {
         $quoted = $this->db->platform->quoteValue('somethin\' to "quote"');
 
@@ -621,7 +621,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testExecute()
+    public function testExecute(): void
     {
         $select = $this->db->select('preferences', 'p');
         $select->where(['p.nom_pref' => 'azerty']);
@@ -635,7 +635,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testExecuteWException()
+    public function testExecuteWException(): void
     {
         $this->have_warnings = [
             new \ArrayObject(
@@ -659,7 +659,7 @@ class Db extends TestCase
      *
      * @return void
      */
-    public function testSerialization()
+    public function testSerialization(): void
     {
         $db = $this->db;
         $serialized = serialize($db);
index 8ab0729357d09c6e208b43038416438919444878..8345d9ab3f3eb1f927dfa7e838240decd3868204 100644 (file)
@@ -37,7 +37,7 @@ class Galette extends GaletteTestCase
      *
      * @return void
      */
-    public function testGitVersion()
+    public function testGitVersion(): void
     {
         $gitversion = \Galette\Core\Galette::gitVersion();
         $this->assertStringStartsWith(str_replace('-dev', '', GALETTE_VERSION), $gitversion);
@@ -55,7 +55,7 @@ class Galette extends GaletteTestCase
      *
      * @return void
      */
-    public function testSerialization()
+    public function testSerialization(): void
     {
         //global objects
         $login = new \Galette\Core\Login($this->zdb, $this->i18n);
@@ -130,7 +130,7 @@ class Galette extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetMenus()
+    public function testGetMenus(): void
     {
         global $preferences, $login, $plugins;
         $db = new \Galette\Core\Db();
@@ -220,7 +220,7 @@ class Galette extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetPublicMenus()
+    public function testGetPublicMenus(): void
     {
         global $preferences;
 
@@ -251,7 +251,7 @@ class Galette extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetDashboards()
+    public function testGetDashboards(): void
     {
         global $login;
 
@@ -318,7 +318,7 @@ class Galette extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetListActions()
+    public function testGetListActions(): void
     {
         global $login;
 
@@ -386,7 +386,7 @@ class Galette extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetDetailledActions()
+    public function testGetDetailledActions(): void
     {
         $member = $this->getMemberOne();
 
@@ -400,7 +400,7 @@ class Galette extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetBatchActions()
+    public function testGetBatchActions(): void
     {
         global $login;
 
index 2f6a07f87d6d6e991518697eb0a8ff88112108fb..d7cad4acdae8ca6e13a02552be561d96113c7d7e 100644 (file)
@@ -35,7 +35,7 @@ class History extends GaletteTestCase
      *
      * @return void
      */
-    public function testConstants()
+    public function testConstants(): void
     {
         $this->assertSame('logs', \Galette\Core\History::TABLE);
         $this->assertSame('id_log', \Galette\Core\History::PK);
@@ -46,7 +46,7 @@ class History extends GaletteTestCase
      *
      * @return void
      */
-    public function testHistoryFlow()
+    public function testHistoryFlow(): void
     {
         $this->i18n->changeLanguage('en_US');
         //nothing in the logs at the beginning
index 07b04c51d35e1bef05a5de1185de4f191d730531..b2cd60d39dff8afccf5d6ccc8d79ddf1868c8085 100644 (file)
@@ -63,7 +63,7 @@ class I18n extends TestCase
      *
      * @return void
      */
-    public function testAutoLang()
+    public function testAutoLang(): void
     {
         $this->i18n = new \Galette\Core\I18n();
 
@@ -93,7 +93,7 @@ class I18n extends TestCase
      *
      * @return void
      */
-    public function testGetList()
+    public function testGetList(): void
     {
         $list = $this->i18n->getList();
 
@@ -109,7 +109,7 @@ class I18n extends TestCase
      *
      * @return void
      */
-    public function testGetArrayList()
+    public function testGetArrayList(): void
     {
         $list = $this->i18n->getArrayList();
 
@@ -121,7 +121,7 @@ class I18n extends TestCase
      *
      * @return void
      */
-    public function testGetNameFromid()
+    public function testGetNameFromid(): void
     {
         $lang = $this->i18n->getNameFromId('en_US');
         $this->assertSame('English', $lang);
@@ -135,7 +135,7 @@ class I18n extends TestCase
      *
      * @return void
      */
-    public function testGetLangInfos()
+    public function testGetLangInfos(): void
     {
         $id = $this->i18n->getID();
         $longid = $this->i18n->getLongID();
@@ -164,7 +164,7 @@ class I18n extends TestCase
      *
      * @return void
      */
-    public function testChangeUnknownLanguage()
+    public function testChangeUnknownLanguage(): void
     {
         $this->i18n->changeLanguage('un_KN');
         $id = $this->i18n->getID();
@@ -177,7 +177,7 @@ class I18n extends TestCase
      *
      * @return void
      */
-    public function testSeemUtf8()
+    public function testSeemUtf8(): void
     {
         $is_utf = $this->i18n->seemUtf8('HéhéHÉHÉâ-ô߬- ©»«<ëßßä€êþÿûîœô');
         $is_iso = $this->i18n->seemUtf8(mb_convert_encoding('Héhé', 'ISO-8859-1'));
index 411afd07bc48e675b9648f5af075fd01644adf98..d2eaf05511aa7d34520a49a1e269b96e7185e82d 100644 (file)
@@ -61,7 +61,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testConstructor()
+    public function testConstructor(): void
     {
         $install = new \Galette\Core\Install();
 
@@ -89,7 +89,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testGetUpgradeScripts()
+    public function testGetUpgradeScripts(): void
     {
         $update_scripts = \Galette\Core\Install::getUpdateScripts(
             GALETTE_BASE_PATH . '/install',
@@ -162,7 +162,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testTypeStep()
+    public function testTypeStep(): void
     {
         $this->install->atTypeStep();
 
@@ -178,7 +178,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testInstallDbStep()
+    public function testInstallDbStep(): void
     {
         $this->install->setMode(\Galette\Core\Install::INSTALL);
         $this->install->atDbStep();
@@ -202,7 +202,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testUpgradeDbStep()
+    public function testUpgradeDbStep(): void
     {
         $this->install->setMode(\Galette\Core\Install::UPDATE);
         $this->install->atDbStep();
@@ -227,7 +227,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testUnknownMode()
+    public function testUnknownMode(): void
     {
         $this->expectException(\UnexpectedValueException::class);
         $this->expectExceptionMessage('Unknown mode "nonsense"');
@@ -239,7 +239,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testSetDbType()
+    public function testSetDbType(): void
     {
         $types = array(
             \Galette\Core\Db::MYSQL,
@@ -270,7 +270,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testDbCheckStep()
+    public function testDbCheckStep(): void
     {
         $errors = array();
         $this->install->setDbType(TYPE_DB, $errors);
@@ -326,7 +326,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testDbInstallStep()
+    public function testDbInstallStep(): void
     {
         $errors = array();
         $this->install->setDbType(TYPE_DB, $errors);
@@ -362,7 +362,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testAdminStep()
+    public function testAdminStep(): void
     {
         $this->install->atAdminStep();
 
@@ -386,7 +386,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testInitStep()
+    public function testInitStep(): void
     {
         $this->install->atGaletteInitStep();
 
index 183d2cb17526eff548230af56e15adb551315ef6..ee0ea9f015ef327faa09ba020ca18509384c7935 100644 (file)
@@ -73,7 +73,7 @@ class L10n extends TestCase
      *
      * @return void
      */
-    public function testAddDynamicTranslation()
+    public function testAddDynamicTranslation(): void
     {
         $this->i18n->changeLanguage('en_US');
 
index 80cb52dcb44a7a33ac5e84ff601969b92ee740d4..d32b18d1e9fd826edb412045245052b03c0663e6 100644 (file)
@@ -82,7 +82,7 @@ class Links extends GaletteTestCase
      *
      * @return void
      */
-    public function testGenerateNewLink()
+    public function testGenerateNewLink(): void
     {
         $links = $this->links;
         $this->getMemberTwo();
@@ -132,7 +132,7 @@ class Links extends GaletteTestCase
      *
      * @return void
      */
-    public function testExpiredValidate()
+    public function testExpiredValidate(): void
     {
         $links = $this->links;
         $this->getMemberTwo();
@@ -173,7 +173,7 @@ class Links extends GaletteTestCase
      *
      * @return void
      */
-    public function testCleanExpired()
+    public function testCleanExpired(): void
     {
         $date = new \DateTime();
         $date->sub(new \DateInterval('PT48H'));
@@ -218,7 +218,7 @@ class Links extends GaletteTestCase
      *
      * @return void
      */
-    public function testDuplicateLinkTarget()
+    public function testDuplicateLinkTarget(): void
     {
         $date = new \DateTime();
         $date->sub(new \DateInterval('PT48H'));
@@ -255,7 +255,7 @@ class Links extends GaletteTestCase
      *
      * @return void
      */
-    protected function createContribution()
+    protected function createContribution(): void
     {
         $now = new \DateTime(); // 2020-11-07
         $begin_date = clone $now;
@@ -284,12 +284,12 @@ class Links extends GaletteTestCase
     /**
      * Check contributions expecteds
      *
-     * @param Contribution $contrib       Contribution instance, if any
-     * @param array        $new_expecteds Changes on expected values
+     * @param ?\Galette\Entity\Contribution $contrib       Contribution instance, if any
+     * @param array<string,mixed>           $new_expecteds Changes on expected values
      *
      * @return void
      */
-    protected function checkContribExpected($contrib = null, $new_expecteds = [])
+    protected function checkContribExpected(\Galette\Entity\Contribution $contrib = null, array $new_expecteds = []): void
     {
         if ($contrib === null) {
             $contrib = $this->contrib;
index eaf870c4ad1979a97386172e231e436f9db3150d..d2d1daf81978b1281c9fb1e8fadf10215d941872 100644 (file)
@@ -54,7 +54,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testDefaults()
+    public function testDefaults(): void
     {
         $this->assertFalse($this->login->isLogged());
         $this->assertFalse($this->login->isStaff());
@@ -72,7 +72,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testNotLoggedCantImpersonate()
+    public function testNotLoggedCantImpersonate(): void
     {
         $login = $this->getMockBuilder(\Galette\Core\Login::class)
             ->setConstructorArgs(array($this->zdb, $this->i18n))
@@ -89,7 +89,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testStaffCantImpersonate()
+    public function testStaffCantImpersonate(): void
     {
         $login = $this->getMockBuilder(\Galette\Core\Login::class)
             ->setConstructorArgs(array($this->zdb, $this->i18n))
@@ -110,7 +110,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testAdminCantImpersonate()
+    public function testAdminCantImpersonate(): void
     {
         $login = $this->getMockBuilder(\Galette\Core\Login::class)
             ->setConstructorArgs(array($this->zdb, $this->i18n))
@@ -131,7 +131,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testImpersonateExistsWException()
+    public function testImpersonateExistsWException(): void
     {
         $zdb = $this->getMockBuilder(\Galette\Core\Db::class)
             ->onlyMethods(array('execute'))
@@ -139,7 +139,7 @@ class Login extends GaletteTestCase
 
         $zdb->method('execute')
             ->willReturnCallback(
-                function ($o) {
+                function ($o): void {
                     throw new \LogicException('Error executing query!', 123);
                 }
             );
@@ -159,7 +159,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testSuperadminCanImpersonate()
+    public function testSuperadminCanImpersonate(): void
     {
         $login = $this->getMockBuilder(\Galette\Core\Login::class)
             ->setConstructorArgs(array($this->zdb, $this->i18n))
@@ -177,7 +177,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testInexistingGetter()
+    public function testInexistingGetter(): void
     {
         $this->expectException('RuntimeException');
         $this->expectExceptionMessage('Property doesnotexists is not set!');
@@ -189,7 +189,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testLoginExists()
+    public function testLoginExists(): void
     {
         $this->assertFalse($this->login->loginExists('exists'));
         $this->assertFalse($this->login->loginExists('doesnotexists'));
@@ -200,7 +200,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testLoginExistsWException()
+    public function testLoginExistsWException(): void
     {
         $zdb = $this->getMockBuilder(\Galette\Core\Db::class)
             ->onlyMethods(array('execute'))
@@ -208,7 +208,7 @@ class Login extends GaletteTestCase
 
         $zdb->method('execute')
             ->willReturnCallback(
-                function ($o) {
+                function ($o): void {
                     if ($o instanceof \Laminas\Db\Sql\Select) {
                         throw new \LogicException('Error executing query!', 123);
                     }
@@ -224,7 +224,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testLogAdmin()
+    public function testLogAdmin(): void
     {
         $this->login->logAdmin('superadmin', $this->preferences);
         $this->assertTrue($this->login->isLogged());
@@ -247,7 +247,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    private function createUser()
+    private function createUser(): void
     {
         $select = $this->zdb->select(\Galette\Entity\Adherent::TABLE, 'a');
         $select->where(array('a.fingerprint' => 'FAKER' . $this->seed));
@@ -319,7 +319,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testLoginExistsDb()
+    public function testLoginExistsDb(): void
     {
         $this->createUser();
         $this->assertTrue($this->login->loginExists('dumas.roger'));
@@ -330,7 +330,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testLogin()
+    public function testLogin(): void
     {
         $this->createUser();
         $this->assertFalse($this->login->login('doenotexists', 'empty'));
@@ -342,7 +342,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testLoggedInAs()
+    public function testLoggedInAs(): void
     {
         global $translator;
 
@@ -372,7 +372,7 @@ class Login extends GaletteTestCase
      *
      * @return void
      */
-    public function testLogCron()
+    public function testLogCron(): void
     {
         $this->login->logCron('reminder', $this->preferences);
         $this->assertTrue($this->login->isLogged());
index bd6ebfba17d5f963fcd22c00edf1cbcb3b3957dd..a99f86adfa61719caeba933ea2b50059483717ad 100644 (file)
@@ -61,7 +61,7 @@ class Logo extends TestCase
      *
      * @return void
      */
-    public function testDefaults()
+    public function testDefaults(): void
     {
         global $zdb;
         $zdb = $this->zdb;
index b8868225d67736fdf73cc468d584a97019cab763..6273516b2ecabb0fec8d94f2ae8824d7f15dfc2d 100644 (file)
@@ -51,7 +51,7 @@ class MailingHistory extends GaletteTestCase
      *
      * @return void
      */
-    public function testHistoryFlow()
+    public function testHistoryFlow(): void
     {
         $this->logSuperAdmin();
         $mh = new \Galette\Core\MailingHistory(
index eaa9de81251becd28a577d49f5daf0c21dd5ec33..6219a1e215fc02ecd98e497a1b5dc423f1d638db 100644 (file)
@@ -61,7 +61,7 @@ class Password extends TestCase
      *
      * @return void
      */
-    public function testRandom()
+    public function testRandom(): void
     {
         $results = array();
 
@@ -85,7 +85,7 @@ class Password extends TestCase
      *
      * @return int
      */
-    private function createMember()
+    private function createMember(): int
     {
         try {
             $this->deleteMember();
@@ -122,7 +122,7 @@ class Password extends TestCase
      *
      * @return void
      */
-    private function deleteMember()
+    private function deleteMember(): void
     {
         $delete = $this->zdb->delete(\Galette\Entity\Adherent::TABLE);
         $delete->where(['login_adh' => 'test_password_user']);
@@ -134,7 +134,7 @@ class Password extends TestCase
      *
      * @return void
      */
-    public function testGenerateNewPassword()
+    public function testGenerateNewPassword(): void
     {
         $id_adh = $this->createMember();
         $pass = $this->pass;
@@ -166,7 +166,7 @@ class Password extends TestCase
      *
      * @return void
      */
-    public function testCleanExpired()
+    public function testCleanExpired(): void
     {
         $id_adh = $this->createMember();
 
@@ -200,7 +200,7 @@ class Password extends TestCase
      *
      * @return void
      */
-    public function testGenerateNewPasswordWException()
+    public function testGenerateNewPasswordWException(): void
     {
         $this->zdb = $this->getMockBuilder(\Galette\Core\Db::class)
             ->onlyMethods(array('execute'))
@@ -209,7 +209,7 @@ class Password extends TestCase
         $this->zdb->method('execute')
             ->will(
                 $this->returnCallback(
-                    function ($o) {
+                    function ($o): void {
                         throw new \LogicException('Error executing query!', 123);
                     }
                 )
@@ -225,7 +225,7 @@ class Password extends TestCase
      *
      * @return void
      */
-    public function testGenerateNewPasswordWFalseInsert()
+    public function testGenerateNewPasswordWFalseInsert(): void
     {
         $this->zdb = $this->getMockBuilder(\Galette\Core\Db::class)
             ->onlyMethods(array('execute'))
@@ -234,7 +234,7 @@ class Password extends TestCase
         $this->zdb->method('execute')
             ->will(
                 $this->returnCallback(
-                    function ($o) {
+                    function ($o): void {
                         throw new \LogicException('Error executing query!', 123);
                     }
                 )
@@ -250,7 +250,7 @@ class Password extends TestCase
      *
      * @return void
      */
-    public function testCleanExpiredWException()
+    public function testCleanExpiredWException(): void
     {
         $this->zdb = $this->getMockBuilder(\Galette\Core\Db::class)
             ->onlyMethods(array('execute'))
@@ -259,7 +259,7 @@ class Password extends TestCase
         $this->zdb->method('execute')
             ->will(
                 $this->returnCallback(
-                    function ($o) {
+                    function ($o): void {
                         throw new \LogicException('Error executing query!', 123);
                     }
                 )
@@ -274,7 +274,7 @@ class Password extends TestCase
      *
      * @return void
      */
-    public function testIsHashValidWException()
+    public function testIsHashValidWException(): void
     {
         $this->zdb = $this->getMockBuilder(\Galette\Core\Db::class)
             ->onlyMethods(array('execute'))
@@ -283,7 +283,7 @@ class Password extends TestCase
         $this->zdb->method('execute')
             ->will(
                 $this->returnCallback(
-                    function ($o) {
+                    function ($o): void {
                         throw new \LogicException('Error executing query!', 123);
                     }
                 )
@@ -299,7 +299,7 @@ class Password extends TestCase
      *
      * @return void
      */
-    public function testRemoveHashWException()
+    public function testRemoveHashWException(): void
     {
         $this->zdb = $this->getMockBuilder(\Galette\Core\Db::class)
             ->onlyMethods(array('execute'))
@@ -308,7 +308,7 @@ class Password extends TestCase
         $this->zdb->method('execute')
             ->will(
                 $this->returnCallback(
-                    function ($o) {
+                    function ($o): void {
                         throw new \LogicException('Error executing query!', 123);
                     }
                 )
index d5a6786995fe7f7e574e2621f54038e7c32b48af..1837655b3bba7b8410648f3219abb0efec993583 100644 (file)
@@ -75,7 +75,7 @@ class Picture extends TestCase
      *
      * @return void
      */
-    public function testDefaults()
+    public function testDefaults(): void
     {
         $picture = new \Galette\Core\Picture();
         $this->assertNull($picture->getDestDir());
@@ -103,7 +103,7 @@ class Picture extends TestCase
      *
      * @return void
      */
-    public function testSetters()
+    public function testSetters(): void
     {
         $this->assertNull($this->picture->getDestDir());
         $this->assertNull($this->picture->getFileName());
@@ -121,7 +121,7 @@ class Picture extends TestCase
      *
      * @return void
      */
-    public function testFileInfoMimeType()
+    public function testFileInfoMimeType(): void
     {
         $url = realpath(GALETTE_ROOT . '../tests/fake_image.jpg');
         $this->assertNotFalse($url);
@@ -163,7 +163,7 @@ class Picture extends TestCase
      *
      * @return void
      */
-    public function testStore()
+    public function testStore(): void
     {
         foreach ($this->expected_badchars as $badchar) {
             $expected = \Galette\Core\Picture::INVALID_FILENAME;
@@ -203,7 +203,7 @@ class Picture extends TestCase
      *
      * @return void
      */
-    public function testErrorMessages()
+    public function testErrorMessages(): void
     {
         $this->assertSame(
             'File name is invalid, it should not contain any special character or space.',
index cd579b3d306805db61360c48c473383460aeb7ba..8cadc87d5198367d264f9d7a3af3253a89ce6d67 100644 (file)
@@ -51,11 +51,11 @@ class Plugins extends TestCase
     );
 
     /**
-     * Get instanciated plugins instance
+     * Get instantiated plugins instance
      *
-     * @return Galette\Core\Plugins
+     * @return \Galette\Core\Plugins
      */
-    private function getPlugins()
+    private function getPlugins(): \Galette\Core\Plugins
     {
         $plugins = new \Galette\Core\Plugins();
         $plugins->autoload(GALETTE_PLUGINS_PATH);
@@ -96,7 +96,7 @@ class Plugins extends TestCase
      *
      * @return void
      */
-    public function testLoadModules()
+    public function testLoadModules(): void
     {
         $plugins = $this->getPlugins();
         $this->assertCount(3, $this->plugins->getModules());
@@ -112,7 +112,7 @@ class Plugins extends TestCase
      *
      * @return void
      */
-    public function testModuleExists()
+    public function testModuleExists(): void
     {
         $this->assertTrue($this->plugins->moduleExists('plugin-test2'));
         $this->assertFalse($this->plugins->moduleExists('plugin-disabled'));
@@ -123,7 +123,7 @@ class Plugins extends TestCase
      *
      * @return void
      */
-    public function testDisabledModules()
+    public function testDisabledModules(): void
     {
         $disabled_modules = $this->plugins->getDisabledModules();
         $this->assertTrue(isset($disabled_modules['plugin-disabled']));
@@ -136,7 +136,7 @@ class Plugins extends TestCase
      *
      * @return void
      */
-    public function testModuleRoot()
+    public function testModuleRoot(): void
     {
         $this->assertSame($this->plugin2['root'], $this->plugins->moduleRoot('plugin-test2'));
     }
@@ -160,7 +160,7 @@ class Plugins extends TestCase
      *
      * @return void
      */
-    public function testResetModulesList()
+    public function testResetModulesList(): void
     {
         $this->plugins->resetModulesList();
 
@@ -172,7 +172,7 @@ class Plugins extends TestCase
      *
      * @return void
      */
-    public function testModuleActivation()
+    public function testModuleActivation(): void
     {
         $plugins = $this->getPlugins();
         $modules = $plugins->getModules();
@@ -205,7 +205,7 @@ class Plugins extends TestCase
      *
      * @return void
      */
-    public function testNeedDatabse()
+    public function testNeedDatabse(): void
     {
         $this->assertTrue($this->plugins->needsDatabase('plugin-db'));
         $this->assertFalse($this->plugins->needsDatabase('plugin-test2'));
index 8ddb4da675d47308e41b9985ea9be3377b90b66c..b638956f4f051a4f50c046059d3b91d575ff3367 100644 (file)
@@ -83,7 +83,7 @@ class Preferences extends TestCase
      *
      * @return void
      */
-    public function testInstallInit()
+    public function testInstallInit(): void
     {
         $result = $this->preferences->installInit(
             'en_US',
@@ -171,7 +171,7 @@ class Preferences extends TestCase
      *
      * @return void
      */
-    public function testFieldsNames()
+    public function testFieldsNames(): void
     {
         $this->preferences->load();
         $fields_names = $this->preferences->getFieldsNames();
@@ -188,7 +188,7 @@ class Preferences extends TestCase
      *
      * @return void
      */
-    public function testUpdate()
+    public function testUpdate(): void
     {
         $delete = $this->zdb->delete(\Galette\Core\Preferences::TABLE);
         $delete->where(
@@ -226,7 +226,7 @@ class Preferences extends TestCase
      *
      * @return void
      */
-    public function testPublicPagesVisibility()
+    public function testPublicPagesVisibility(): void
     {
         $this->preferences->load();
 
@@ -292,7 +292,7 @@ class Preferences extends TestCase
      *
      * @return array
      */
-    public static function sizesProvider()
+    public static function sizesProvider(): array
     {
         return [
             [//defaults
@@ -348,7 +348,7 @@ class Preferences extends TestCase
      *
      * @return void
      */
-    public function testCheckCardsSizes($vm, $hm, $vs, $hs, $count)
+    public function testCheckCardsSizes(int $vm, int $hm, int $vs, int $hs, int $count): void
     {
         $this->preferences->pref_card_marges_v = $vm;
         $this->preferences->pref_card_marges_h = $hm;
@@ -397,7 +397,7 @@ class Preferences extends TestCase
      *
      * @return void
      */
-    public function testColors($prop, $color, $expected)
+    public function testColors(string $prop, string $color, string $expected): void
     {
         $prop = 'pref_card_' . $prop;
         $this->preferences->$prop = $color;
@@ -409,7 +409,7 @@ class Preferences extends TestCase
      *
      * @return void
      */
-    public function testSocials()
+    public function testSocials(): void
     {
         $preferences = [];
         foreach ($this->preferences->getDefaults() as $key => $value) {
@@ -540,7 +540,7 @@ class Preferences extends TestCase
      *
      * @return void
      */
-    public function testGetMailSignature()
+    public function testGetMailSignature(): void
     {
         $mail = new PHPMailer();
         $this->assertSame("\r\n-- \r\nGalette", $this->preferences->getMailSignature($mail));
@@ -600,7 +600,7 @@ class Preferences extends TestCase
      *
      * @return void
      */
-    public function testGetLegend()
+    public function testGetLegend(): void
     {
         $legend = $this->preferences->getLegend();
         $this->assertCount(2, $legend);
index 2aff720764fe78b9d29d8a27555340fead771e9a..d64ef1a1f1305cc276330daa5dd19aa7beb6f761 100644 (file)
@@ -61,7 +61,7 @@ class PrintLogo extends TestCase
      *
      * @return void
      */
-    public function testDefaults()
+    public function testDefaults(): void
     {
         global $zdb;
         $zdb = $this->zdb;
index f59bfee52c43439c0f6c14059353402791df5785..bf5ecb4f91ec2e746b28ab2c9f8a2d2fa257f9b4 100644 (file)
@@ -49,7 +49,7 @@ class Boolean extends TestCase
      *
      * @return void
      */
-    public function testConstructor()
+    public function testConstructor(): void
     {
         $o = new \Galette\DynamicFields\Boolean($this->zdb, 10);
         $this->assertNull($o->getId());
@@ -60,7 +60,7 @@ class Boolean extends TestCase
      *
      * @return void
      */
-    public function testGetTypeName()
+    public function testGetTypeName(): void
     {
         $this->assertSame(_T('boolean'), $this->bool->getTypeName());
     }
@@ -70,7 +70,7 @@ class Boolean extends TestCase
      *
      * @return void
      */
-    public function testBaseProperties()
+    public function testBaseProperties(): void
     {
         $muliple = $this->bool->isMultiValued();
         $this->assertFalse($muliple);
index e71fcd6294af888603814710eedfba624040d049..a3e048592d8aefa21a68451ae3f52f917e1b39cf 100644 (file)
@@ -49,7 +49,7 @@ class Choice extends TestCase
      *
      * @return void
      */
-    public function testConstructor()
+    public function testConstructor(): void
     {
         $o = new \Galette\DynamicFields\Choice($this->zdb, 10);
         $this->assertNull($o->getId());
@@ -60,7 +60,7 @@ class Choice extends TestCase
      *
      * @return void
      */
-    public function testGetTypeName()
+    public function testGetTypeName(): void
     {
         $this->assertSame(_T('choice'), $this->choice->getTypeName());
     }
@@ -70,7 +70,7 @@ class Choice extends TestCase
      *
      * @return void
      */
-    public function testBaseProperties()
+    public function testBaseProperties(): void
     {
         $muliple = $this->choice->isMultiValued();
         $this->assertFalse($muliple);
index e81640e1066f1e027287c34980aca18ab4cd5015..ca5be30d0d71b01c373f889143e98436b8c61af5 100644 (file)
@@ -49,7 +49,7 @@ class Date extends TestCase
      *
      * @return void
      */
-    public function testConstructor()
+    public function testConstructor(): void
     {
         $o = new \Galette\DynamicFields\Date($this->zdb, 10);
         $this->assertNull($o->getId());
@@ -60,7 +60,7 @@ class Date extends TestCase
      *
      * @return void
      */
-    public function testGetTypeName()
+    public function testGetTypeName(): void
     {
         $this->assertSame(_T('date'), $this->date->getTypeName());
     }
@@ -70,7 +70,7 @@ class Date extends TestCase
      *
      * @return void
      */
-    public function testBaseProperties()
+    public function testBaseProperties(): void
     {
         $muliple = $this->date->isMultiValued();
         $this->assertFalse($muliple);
index 984fc71e492a1b6be93531d15ef203bf459d5478..f503593a116e717f61e025c3d187661944f8354b 100644 (file)
@@ -71,7 +71,7 @@ class DynamicField extends TestCase
      *
      * @return void
      */
-    public function testLoadFieldType()
+    public function testLoadFieldType(): void
     {
         $this->assertFalse(\Galette\DynamicFields\DynamicField::loadFieldType($this->zdb, 10));
 
@@ -154,7 +154,7 @@ class DynamicField extends TestCase
      *
      * @return void
      */
-    public function testGetPermissionsList()
+    public function testGetPermissionsList(): void
     {
         $expected = [];
         foreach (self::permsProvider() as $perm) {
@@ -179,7 +179,7 @@ class DynamicField extends TestCase
      *
      * @return void
      */
-    public function testGetPermissionName(int $perm, string $name)
+    public function testGetPermissionName(int $perm, string $name): void
     {
         $field_data = [
             'form_name'         => 'adh',
@@ -208,7 +208,7 @@ class DynamicField extends TestCase
      *
      * @return void
      */
-    public function testGetFormsNames()
+    public function testGetFormsNames(): void
     {
         $expected = [];
         foreach ($this->formNamesProvider() as $form) {
@@ -250,7 +250,7 @@ class DynamicField extends TestCase
      *
      * @return void
      */
-    public function testGetFormTitle(string $form, string $expected)
+    public function testGetFormTitle(string $form, string $expected): void
     {
         $this->assertSame($expected, \Galette\DynamicFields\DynamicField::getFormTitle($form));
     }
@@ -260,7 +260,7 @@ class DynamicField extends TestCase
      *
      * @return void
      */
-    public function testGetFixedValuesTableName()
+    public function testGetFixedValuesTableName(): void
     {
         $this->assertSame('field_contents_10', \Galette\DynamicFields\DynamicField::getFixedValuesTableName(10));
         $this->assertSame('field_contents_10', \Galette\DynamicFields\DynamicField::getFixedValuesTableName(10, false));
@@ -272,7 +272,7 @@ class DynamicField extends TestCase
      *
      * @return void
      */
-    public function testGetValues()
+    public function testGetValues(): void
     {
         $field_data = [
             'form_name'         => 'adh',
@@ -310,7 +310,7 @@ class DynamicField extends TestCase
      *
      * @return void
      */
-    public function testCheck()
+    public function testCheck(): void
     {
         $values = [
             'form_name'         => 'adh',
@@ -471,7 +471,7 @@ class DynamicField extends TestCase
      *
      * @return void
      */
-    public function testMove()
+    public function testMove(): void
     {
         $field_data = [
             'form_name'         => 'adh',
@@ -562,7 +562,7 @@ class DynamicField extends TestCase
      *
      * @return void
      */
-    public function testRemove()
+    public function testRemove(): void
     {
         $field_data = [
             'form_name'         => 'adh',
@@ -607,7 +607,7 @@ class DynamicField extends TestCase
      *
      * @return void
      */
-    public function testInformation()
+    public function testInformation(): void
     {
         $field_data = [
             'form_name'         => 'adh',
index 4cb0247595fe66d902f0640f7c00236792310452..3d3e24da648e8bda71f98c7780268c96e2b7fd19 100644 (file)
@@ -49,7 +49,7 @@ class File extends TestCase
      *
      * @return void
      */
-    public function testConstructor()
+    public function testConstructor(): void
     {
         $o = new \Galette\DynamicFields\File($this->zdb, 10);
         $this->assertNull($o->getId());
@@ -60,7 +60,7 @@ class File extends TestCase
      *
      * @return void
      */
-    public function testGetTypeName()
+    public function testGetTypeName(): void
     {
         $this->assertSame(_T('file'), $this->file->getTypeName());
     }
@@ -70,7 +70,7 @@ class File extends TestCase
      *
      * @return void
      */
-    public function testBaseProperties()
+    public function testBaseProperties(): void
     {
         $muliple = $this->file->isMultiValued();
         $this->assertFalse($muliple);
index 16f77787f27430bea49a6c738c4c062bfb56ec7e..edaca553dfc4401d545d49e9b45e34efee1c3a7a 100644 (file)
@@ -49,7 +49,7 @@ class Line extends TestCase
      *
      * @return void
      */
-    public function testConstructor()
+    public function testConstructor(): void
     {
         $o = new \Galette\DynamicFields\Line($this->zdb, 10);
         $this->assertNull($o->getId());
@@ -60,7 +60,7 @@ class Line extends TestCase
      *
      * @return void
      */
-    public function testGetTypeName()
+    public function testGetTypeName(): void
     {
         $this->assertSame(_T('single line'), $this->line->getTypeName());
     }
@@ -70,7 +70,7 @@ class Line extends TestCase
      *
      * @return void
      */
-    public function testBaseProperties()
+    public function testBaseProperties(): void
     {
         $muliple = $this->line->isMultiValued();
         $this->assertTrue($muliple);
index 4d5470901bf50637d79eb5a9daba00804935b789..0485d1cd8e20098be8bd3d96313b06558cf4f4a2 100644 (file)
@@ -49,7 +49,7 @@ class Separator extends TestCase
      *
      * @return void
      */
-    public function testConstructor()
+    public function testConstructor(): void
     {
         $o = new \Galette\DynamicFields\Separator($this->zdb, 10);
         $this->assertNull($o->getId());
@@ -60,7 +60,7 @@ class Separator extends TestCase
      *
      * @return void
      */
-    public function testGetTypeName()
+    public function testGetTypeName(): void
     {
         $this->assertSame(_T('separator'), $this->separator->getTypeName());
     }
@@ -70,7 +70,7 @@ class Separator extends TestCase
      *
      * @return void
      */
-    public function testBaseProperties()
+    public function testBaseProperties(): void
     {
         $muliple = $this->separator->isMultiValued();
         $this->assertFalse($muliple);
index 48883b22c241c94dd156374fbee753de2f8051aa..f2e1965036863191ede1de64b1e0bcb23b5e9ff1 100644 (file)
@@ -49,7 +49,7 @@ class Text extends TestCase
      *
      * @return void
      */
-    public function testConstructor()
+    public function testConstructor(): void
     {
         $o = new \Galette\DynamicFields\Text($this->zdb, 10);
         $this->assertNull($o->getId());
@@ -60,7 +60,7 @@ class Text extends TestCase
      *
      * @return void
      */
-    public function testGetTypeName()
+    public function testGetTypeName(): void
     {
         $this->assertSame(_T('free text'), $this->text->getTypeName());
     }
@@ -70,7 +70,7 @@ class Text extends TestCase
      *
      * @return void
      */
-    public function testBaseProperties()
+    public function testBaseProperties(): void
     {
         $muliple = $this->text->isMultiValued();
         $this->assertFalse($muliple);
index 816e23fac0265631ec9da97fa1f8aa8fd5ef8b68..d5c93ac664f17c160a88799ad46d1b7dac09d069 100644 (file)
@@ -99,7 +99,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testEmpty()
+    public function testEmpty(): void
     {
         $adh = $this->adh;
         $this->assertFalse($adh->isAdmin());
@@ -129,7 +129,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testDependencies()
+    public function testDependencies(): void
     {
         $adh = $this->adh;
         $this->assertSame($this->default_deps, $adh->deps);
@@ -195,7 +195,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetterWException()
+    public function testGetterWException(): void
     {
         $adh = $this->adh;
 
@@ -208,7 +208,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testDepsAtConstuct()
+    public function testDepsAtConstuct(): void
     {
         $deps = [
             'picture'   => false,
@@ -233,7 +233,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testSimpleMember()
+    public function testSimpleMember(): void
     {
         $this->getMemberOne();
         $this->checkMemberOneExpected();
@@ -248,7 +248,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testLoadForLogin()
+    public function testLoadForLogin(): void
     {
         $this->getMemberOne();
 
@@ -269,7 +269,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testUpdatePassword()
+    public function testUpdatePassword(): void
     {
         $this->getMemberOne();
 
@@ -290,7 +290,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testCheckErrors()
+    public function testCheckErrors(): void
     {
         $adh = $this->adh;
 
@@ -398,7 +398,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testPhoto()
+    public function testPhoto(): void
     {
         $this->getMemberOne();
 
@@ -416,7 +416,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testCanEdit()
+    public function testCanEdit(): void
     {
         $adh = new \Galette\Entity\Adherent($this->zdb);
 
@@ -490,7 +490,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testDuplicate()
+    public function testDuplicate(): void
     {
         $this->getMemberOne();
 
@@ -515,7 +515,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testParents()
+    public function testParents(): void
     {
         $this->getMemberOne();
 
@@ -554,7 +554,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testInjection()
+    public function testInjection(): void
     {
         $data = [
             'nom_adh'           => 'Doe',
@@ -575,7 +575,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testCan()
+    public function testCan(): void
     {
         $this->getMemberOne();
         //load member from db
@@ -772,14 +772,20 @@ class Adherent extends GaletteTestCase
      * @param string                      $name     Name
      * @param string                      $surname  Surname
      * @param \Galette\Entity\Title|false $title    Title
-     * @param string|false                $id       ID
+     * @param int|false                   $id       ID
      * @param string|false                $nick     Nick
-     * @param  string                      $expected Expected result
+     * @param string                      $expected Expected result
      *
      * @return void
      */
-    public function testsGetNameWithCase(string $name, string $surname, $title, $id, $nick, string $expected)
-    {
+    public function testsGetNameWithCase(
+        string $name,
+        string $surname,
+        \Galette\Entity\Title|false $title,
+        int|false $id,
+        string|false $nick,
+        string $expected
+    ): void {
         $this->assertSame(
             $expected,
             \Galette\Entity\Adherent::getNameWithCase(
@@ -815,7 +821,7 @@ class Adherent extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetDueStatus()
+    public function testGetDueStatus(): void
     {
         $now = new \DateTime();
         $member = new \Galette\Entity\Adherent($this->zdb);
index ef3ae9297ce09f96c12a4313d1d4fe7090661be9..cacce50be645377d668d220920fa95fc05bfbbb4 100644 (file)
@@ -80,7 +80,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testEmpty()
+    public function testEmpty(): void
     {
         $contrib = $this->contrib;
         $this->assertNull($contrib->id);
@@ -122,7 +122,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetterSetter()
+    public function testGetterSetter(): void
     {
         $contrib = $this->contrib;
 
@@ -189,7 +189,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testCreation()
+    public function testCreation(): void
     {
         $this->getMemberOne();
         //create contribution for member
@@ -201,7 +201,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testDonationUpdate()
+    public function testDonationUpdate(): void
     {
         $this->getMemberOne();
         //create contribution for member
@@ -274,7 +274,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testContributionUpdate()
+    public function testContributionUpdate(): void
     {
         $this->logSuperAdmin();
 
@@ -360,7 +360,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testRetrieveEndDate()
+    public function testRetrieveEndDate(): void
     {
         global $preferences;
         $orig_pref_beg_membership = $this->preferences->pref_beg_membership;
@@ -433,7 +433,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testCheckOverlap()
+    public function testCheckOverlap(): void
     {
         $adh = new \Galette\Entity\Adherent($this->zdb);
         $adh->setDependencies(
@@ -527,7 +527,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetFieldLabel()
+    public function testGetFieldLabel(): void
     {
         $this->assertSame(
             'Amount',
@@ -556,7 +556,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testLoad()
+    public function testLoad(): void
     {
         $this->login = $this->getMockBuilder(\Galette\Core\Login::class)
             ->setConstructorArgs(array($this->zdb, $this->i18n))
@@ -585,7 +585,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testRemove()
+    public function testRemove(): void
     {
         $this->getMemberOne();
         $this->createContribution();
@@ -599,7 +599,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testCan()
+    public function testCan(): void
     {
         $this->getMemberOne();
         //create contribution for member
@@ -710,7 +710,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testNextYear()
+    public function testNextYear(): void
     {
         $this->logSuperAdmin();
         $this->getMemberOne();
@@ -747,7 +747,7 @@ class Contribution extends GaletteTestCase
      *
      * @return void
      */
-    public function testNextYearFrom096()
+    public function testNextYearFrom096(): void
     {
         $this->logSuperAdmin();
         $this->getMemberOne();
index fa89b0063ea917d0682ee1168f4d960e4af5f987..db889073326690786d3e233b06fda4ad364efedd 100644 (file)
@@ -66,7 +66,7 @@ class ContributionsTypes extends TestCase
      *
      * @return void
      */
-    private function deleteTypes()
+    private function deleteTypes(): void
     {
         if (is_array($this->remove) && count($this->remove) > 0) {
             $delete = $this->zdb->delete(\Galette\Entity\ContributionsTypes::TABLE);
@@ -86,7 +86,7 @@ class ContributionsTypes extends TestCase
      *
      * @return void
      */
-    public function testContributionsTypes()
+    public function testContributionsTypes(): void
     {
         global $i18n; // globals :(
         $i18n = $this->i18n;
@@ -192,7 +192,7 @@ class ContributionsTypes extends TestCase
      *
      * @return void
      */
-    public function testGetList()
+    public function testGetList(): void
     {
         $ctypes = new \Galette\Entity\ContributionsTypes($this->zdb);
 
index e634f863a0bd124dfd34854d7d13e37866455259..cd77abbf317e4d6db03d413aa54bcb8d1734cfae 100644 (file)
@@ -63,7 +63,7 @@ class FieldsConfig extends TestCase
      *
      * @return void
      */
-    public function testNonRequired()
+    public function testNonRequired(): void
     {
         $nrequired = $this->fields_config->getNonRequired();
         $expected = [
@@ -89,7 +89,7 @@ class FieldsConfig extends TestCase
      *
      * @return void
      */
-    public function testInstallInit()
+    public function testInstallInit(): void
     {
         $result = $this->fields_config->installInit();
         $this->assertTrue($result);
@@ -151,7 +151,7 @@ class FieldsConfig extends TestCase
      *
      * @return void
      */
-    private function countCategorizedFields($categorized)
+    private function countCategorizedFields(array $categorized): void
     {
         $this->assertCount(3, $categorized);
         $this->assertCount(13, $categorized[\Galette\Entity\FieldsCategories::ADH_CATEGORY_IDENTITY]);
@@ -164,7 +164,7 @@ class FieldsConfig extends TestCase
      *
      * @return void
      */
-    public function testSetNotRequired()
+    public function testSetNotRequired(): void
     {
         $fields_config = $this->fields_config;
         $fields_config->load();
@@ -190,7 +190,7 @@ class FieldsConfig extends TestCase
      *
      * @return void
      */
-    public function testGetVisibility()
+    public function testGetVisibility(): void
     {
         $this->fields_config->load();
 
@@ -209,7 +209,7 @@ class FieldsConfig extends TestCase
      *
      * @return void
      */
-    public function testSetFields()
+    public function testSetFields(): void
     {
         $fields_config = $this->fields_config;
         $fields_config->installInit();
@@ -250,7 +250,7 @@ class FieldsConfig extends TestCase
      *
      * @return void
      */
-    public function testIsSelfExcluded()
+    public function testIsSelfExcluded(): void
     {
         $this->assertTrue($this->fields_config->isSelfExcluded('bool_admin_adh'));
         $this->assertTrue($this->fields_config->isSelfExcluded('info_adh'));
@@ -262,7 +262,7 @@ class FieldsConfig extends TestCase
      *
      * @return void
      */
-    public function testCheckUpdate()
+    public function testCheckUpdate(): void
     {
         $fields_config = $this->fields_config;
         $fields_config->load();
@@ -313,7 +313,7 @@ class FieldsConfig extends TestCase
      *
      * @return void
      */
-    public function testCheckUpdateWhenEmpty()
+    public function testCheckUpdateWhenEmpty(): void
     {
         $this->zdb->db->query(
             'TRUNCATE ' . PREFIX_DB . \Galette\Entity\FieldsConfig::TABLE,
@@ -341,7 +341,7 @@ class FieldsConfig extends TestCase
      *
      * @return void
      */
-    public function testGetDisplayElements()
+    public function testGetDisplayElements(): void
     {
         $fields_config = $this->fields_config;
         $fields_config->load();
@@ -397,7 +397,7 @@ class FieldsConfig extends TestCase
      *
      * @return void
      */
-    public function testGetFormElements()
+    public function testGetFormElements(): void
     {
         $fields_config = $this->fields_config;
         $fields_config->load();
index 6721231f289214b3fb329cbd97cc2484e709afe9..63dd02c65f6425880f38d6cf2655bd8ccab14474 100644 (file)
@@ -50,7 +50,7 @@ class Group extends GaletteTestCase
      *
      * @return void
      */
-    private function deleteGroups()
+    private function deleteGroups(): void
     {
         $delete = $this->zdb->delete(\Galette\Entity\Group::TABLE);
         $delete->where('parent_group IS NOT NULL');
@@ -71,7 +71,7 @@ class Group extends GaletteTestCase
      *
      * @return void
      */
-    public function testGroup()
+    public function testGroup(): void
     {
         global $zdb;
         $zdb = $this->zdb;
@@ -93,7 +93,7 @@ class Group extends GaletteTestCase
      *
      * @return void
      */
-    public function testSingleGroup()
+    public function testSingleGroup(): void
     {
         global $zdb;
         $zdb = $this->zdb;
@@ -134,7 +134,7 @@ class Group extends GaletteTestCase
      *
      * @return void
      */
-    public function testUnicity()
+    public function testUnicity(): void
     {
         global $zdb;
         $zdb = $this->zdb;
@@ -178,7 +178,7 @@ class Group extends GaletteTestCase
      *
      * @return void
      */
-    public function testSubGroup()
+    public function testSubGroup(): void
     {
         global $zdb;
         $zdb = $this->zdb;
@@ -247,7 +247,7 @@ class Group extends GaletteTestCase
      *
      * @return void
      */
-    public function testRemove()
+    public function testRemove(): void
     {
         global $zdb;
         $zdb = $this->zdb;
index cf9792f114cc173932b3d44c2755df869b8b7de7..1b1fb82d66b155a90bab8a40ac7522a258245a62 100644 (file)
@@ -84,7 +84,7 @@ class ListsConfig extends TestCase
      *
      * @return void
      */
-    private function resetListsConfig()
+    private function resetListsConfig(): void
     {
         $new_list = [];
         foreach ($this->default_lists as $key) {
@@ -99,7 +99,7 @@ class ListsConfig extends TestCase
      *
      * @return void
      */
-    public function testGetVisibility()
+    public function testGetVisibility(): void
     {
         $this->lists_config->load();
 
@@ -123,7 +123,7 @@ class ListsConfig extends TestCase
      *
      * @return void
      */
-    public function testSetFields()
+    public function testSetFields(): void
     {
         $lists_config = $this->lists_config;
         $lists_config->installInit();
@@ -208,7 +208,7 @@ class ListsConfig extends TestCase
      *
      * @return void
      */
-    public function testGetDisplayElements()
+    public function testGetDisplayElements(): void
     {
         $lists_config = $this->lists_config;
         $lists_config->load();
index de9f53fa106be91756e44b34195c6b195e845cac..e224032608ca000035aefae9cd6178b4f2388486 100644 (file)
@@ -73,7 +73,7 @@ class PaymentType extends TestCase
      *
      * @return void
      */
-    private function deletePaymentType()
+    private function deletePaymentType(): void
     {
         if (is_array($this->remove) && count($this->remove) > 0) {
             $delete = $this->zdb->delete(\Galette\Entity\PaymentType::TABLE);
@@ -93,7 +93,7 @@ class PaymentType extends TestCase
      *
      * @return void
      */
-    public function testPaymentType()
+    public function testPaymentType(): void
     {
         global $i18n; // globals :(
         $i18n = $this->i18n;
index 4f9f2dc4062c21978982a621f5ddb404f3b30850..8dbc1ddcf2246df72898188d2ee729c6ffde7b6d 100644 (file)
@@ -92,7 +92,7 @@ class PdfModel extends GaletteTestCase
      *
      * @return void
      */
-    public function testExpectedPatterns()
+    public function testExpectedPatterns(): void
     {
         $model = new class ($this->zdb, $this->preferences, 1) extends \Galette\Entity\PdfModel {
         };
@@ -219,7 +219,7 @@ class PdfModel extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetypeClass($type, $expected)
+    public function testGetypeClass(int $type, string $expected): void
     {
         $this->assertSame($expected, \Galette\Entity\PdfModel::getTypeClass($type));
     }
@@ -229,7 +229,7 @@ class PdfModel extends GaletteTestCase
      *
      * @return void
      */
-    public function testReplacements()
+    public function testReplacements(): void
     {
         //create dynamic fields
         $field_data = [
@@ -357,7 +357,7 @@ Au milieu
      *
      * @return void
      */
-    protected function createPdfContribution($cdf)
+    protected function createPdfContribution(DynamicField $cdf): void
     {
         $bdate = new \DateTime(); // 2020-11-07
         $bdate->sub(new \DateInterval('P5M')); // 2020-06-07
@@ -387,7 +387,7 @@ Au milieu
      *
      * @return void
      */
-    public function testStorage()
+    public function testStorage(): void
     {
         $model = new \Galette\Entity\PdfInvoice($this->zdb, $this->preferences);
 
index 822f75a38a28552f41b3776d30ee6062448e369b..91faf716c8e604c8bfdbc5873a0d674c0ad4a6ae 100644 (file)
@@ -72,7 +72,7 @@ class SavedSearch extends TestCase
      *
      * @return void
      */
-    private function deleteCreated()
+    private function deleteCreated(): void
     {
         $this->zdb->db->query(
             'TRUNCATE TABLE ' . PREFIX_DB . \Galette\Entity\SavedSearch::TABLE,
@@ -85,7 +85,7 @@ class SavedSearch extends TestCase
      *
      * @return void
      */
-    public function testSave()
+    public function testSave(): void
     {
         global $i18n, $translator; // globals :(
         $i18n = $this->i18n;
index 7c11a122a3fdf306e7c58bc3b1afb285abf472a7..feddaa6109709b833cfbb4480b38babf95ee3783 100644 (file)
@@ -48,7 +48,7 @@ class ScheduledPayment extends GaletteTestCase
      *
      * @return void
      */
-    private function deleteScheduledPayments()
+    private function deleteScheduledPayments(): void
     {
         $delete = $this->zdb->delete(\Galette\Entity\ScheduledPayment::TABLE);
         $delete->where(['comment' => 'FAKER' . $this->seed]);
index cc74d7490b86b2bd6ef57d46390a941221575129..2188340d5e0c6510f1b160acfb583e9bd4d139c5 100644 (file)
@@ -57,7 +57,7 @@ class Social extends GaletteTestCase
      *
      * @return void
      */
-    private function deleteSocials()
+    private function deleteSocials(): void
     {
         $delete = $this->zdb->delete(\Galette\Entity\Social::TABLE);
         $this->zdb->execute($delete);
@@ -68,7 +68,7 @@ class Social extends GaletteTestCase
      *
      * @return void
      */
-    public function testObject()
+    public function testObject(): void
     {
         $social = new \Galette\Entity\Social($this->zdb);
 
@@ -96,7 +96,7 @@ class Social extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetSystemTypes()
+    public function testGetSystemTypes(): void
     {
         $social = new \Galette\Entity\Social($this->zdb);
         $this->assertCount(10, $social->getSystemTypes());
index fc8ccef3af1d3966255c3ca1474618451c82ac1c..47cf56d7b21cd4fcba5d995083b4d93def5eb7ac 100644 (file)
@@ -66,7 +66,7 @@ class Status extends TestCase
      *
      * @return void
      */
-    private function deleteStatus()
+    private function deleteStatus(): void
     {
         if (is_array($this->remove) && count($this->remove) > 0) {
             $delete = $this->zdb->delete(\Galette\Entity\Status::TABLE);
@@ -86,7 +86,7 @@ class Status extends TestCase
      *
      * @return void
      */
-    public function testStatus()
+    public function testStatus(): void
     {
         global $i18n; // globals :(
         $i18n = $this->i18n;
@@ -175,7 +175,7 @@ class Status extends TestCase
      *
      * @return void
      */
-    public function testGetList()
+    public function testGetList(): void
     {
         $status = new \Galette\Entity\Status($this->zdb);
 
index 8f723b58cfb71892c89b4bea0ba4b4340b94666d..3191336b27edf7736cd06177fbc9a2d1c183907f 100644 (file)
@@ -39,7 +39,7 @@ class Texts extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetList()
+    public function testGetList(): void
     {
         $count_texts = 13;
         $texts = new \Galette\Entity\Texts(
index 12be0ac822bce194839d8c5e35043b9d7d93e6db..addd671b0c6edde1442a35e2e174f5fb05b8746a 100644 (file)
@@ -62,7 +62,7 @@ class Title extends TestCase
      *
      * @return void
      */
-    private function deleteTitle()
+    private function deleteTitle(): void
     {
         if (is_array($this->remove) && count($this->remove) > 0) {
             $delete = $this->zdb->delete(\Galette\Entity\Title::TABLE);
@@ -82,7 +82,7 @@ class Title extends TestCase
      *
      * @return void
      */
-    public function testTitle()
+    public function testTitle(): void
     {
         global $zdb;
         $zdb = $this->zdb;
index 6bd2e8be4b86b696dd2024e88924474aa1b2a0ec..ac093f1fe697575af6e077f8c01d1e5e5bcf98d5 100644 (file)
@@ -31,7 +31,6 @@ use Galette\GaletteTestCase;
 class Transaction extends GaletteTestCase
 {
     protected int $seed = 95842354;
-    /** @var \Galette\Entity\Transaction */
     private \Galette\Entity\Transaction $transaction;
 
     /**
@@ -90,9 +89,9 @@ class Transaction extends GaletteTestCase
     /**
      * Create test transaction in database
      *
-     * @return void
+     * @return \Galette\Entity\Transaction
      */
-    private function createTransaction()
+    private function createTransaction(): \Galette\Entity\Transaction
     {
         $date = new \DateTime(); // 2020-11-07
         $data = [
@@ -120,7 +119,7 @@ class Transaction extends GaletteTestCase
      *
      * @return void
      */
-    public function testEmpty()
+    public function testEmpty(): void
     {
         $this->assertNull($this->transaction->id);
         $this->assertEquals(date('Y-m-d'), $this->transaction->date);
@@ -146,7 +145,7 @@ class Transaction extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetterSetter()
+    public function testGetterSetter(): void
     {
         $transaction = $this->transaction;
 
@@ -186,7 +185,7 @@ class Transaction extends GaletteTestCase
      *
      * @return void
      */
-    public function testCreation()
+    public function testCreation(): void
     {
         $this->getMemberOne();
         //create transaction for member
@@ -198,7 +197,7 @@ class Transaction extends GaletteTestCase
      *
      * @return void
      */
-    public function testUpdate()
+    public function testUpdate(): void
     {
         $this->getMemberOne();
         //create transaction for member
@@ -226,7 +225,7 @@ class Transaction extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetFieldLabel()
+    public function testGetFieldLabel(): void
     {
         $this->assertSame(
             'Amount',
@@ -254,7 +253,7 @@ class Transaction extends GaletteTestCase
      *
      * @return void
      */
-    public function testLoad()
+    public function testLoad(): void
     {
         $this->login = $this->getMockBuilder(\Galette\Core\Login::class)
             ->setConstructorArgs(array($this->zdb, new \Galette\Core\I18n()))
@@ -281,7 +280,7 @@ class Transaction extends GaletteTestCase
      *
      * @return void
      */
-    public function testRemove()
+    public function testRemove(): void
     {
         $this->logSuperAdmin();
 
@@ -300,7 +299,7 @@ class Transaction extends GaletteTestCase
      *
      * @return void
      */
-    public function testCan()
+    public function testCan(): void
     {
         $this->getMemberOne();
         //create transaction for member
index 26b32d084664fc13d01bb557fead25c40f1e659f..0b2980aed1ed3c850b2d82e7d578e0795c9838cf 100644 (file)
@@ -58,7 +58,7 @@ class ContributionsList extends GaletteTestCase
      *
      * @return void
      */
-    public function testCreate()
+    public function testCreate(): void
     {
         $filters = new \Galette\Filters\ContributionsList();
 
index f38b6d6a5755f4577becaf39f5c67dc76e572dd2..ce9b8bba0ecfeb3fd15fb5eaec77be091cdbe745 100644 (file)
@@ -52,7 +52,7 @@ class HistoryList extends GaletteTestCase
      *
      * @return void
      */
-    public function testCreate()
+    public function testCreate(): void
     {
         $filters = new \Galette\Filters\HistoryList();
 
index 9cc3193c380f21797912b9b8e129e4be41c65617..6a2de02e45f8145f8a1b96b8db47e261feee97b7 100644 (file)
@@ -52,7 +52,7 @@ class TransactionsList extends GaletteTestCase
      *
      * @return void
      */
-    public function testCreate()
+    public function testCreate(): void
     {
         $filters = new \Galette\Filters\TransactionsList();
 
index daf5decd4eb187f06bcf0be404649780b9f62bea..3172ec14bc6f73599056c4e63514ce5324dca996 100644 (file)
@@ -93,13 +93,13 @@ class CsvIn extends GaletteTestCase
      */
     private function doImportFileTest(
         array $fields,
-        $file_name,
+        string $file_name,
         array $flash_messages,
         array $members_list,
-        $count_before = null,
-        $count_after = null,
+        int $count_before = null,
+        int $count_after = null,
         array $values = []
-    ) {
+    ): void {
         if ($count_before === null) {
             $count_before = 0;
         }
@@ -223,7 +223,7 @@ class CsvIn extends GaletteTestCase
      *
      * @return void
      */
-    public function testImport()
+    public function testImport(): void
     {
         $fields = ['nom_adh', 'ville_adh', 'bool_exempt_adh', 'fingerprint'];
         $file_name = 'test-import-atoum.csv';
@@ -259,7 +259,7 @@ class CsvIn extends GaletteTestCase
      *
      * @return \Galette\Entity\ImportModel
      */
-    protected function getModel($fields): \Galette\Entity\ImportModel
+    protected function getModel(array $fields): \Galette\Entity\ImportModel
     {
         $model = new \Galette\Entity\ImportModel();
         $this->assertTrue($model->remove($this->zdb));
@@ -278,7 +278,7 @@ class CsvIn extends GaletteTestCase
      *
      * @return void
      */
-    protected function checkDynamicTranslation($text_orig, $lang = 'fr_FR.utf8')
+    protected function checkDynamicTranslation(string $text_orig, string $lang = 'fr_FR.utf8'): void
     {
         $langs = array_keys($this->i18n->getArrayList());
         $select = $this->zdb->select(\Galette\Core\L10n::TABLE);
@@ -306,7 +306,7 @@ class CsvIn extends GaletteTestCase
      *
      * @return void
      */
-    public function testImportDynamics()
+    public function testImportDynamics(): void
     {
 
         $field_data = [
@@ -551,7 +551,7 @@ class CsvIn extends GaletteTestCase
      *
      * @return array
      */
-    private function getMemberData1()
+    private function getMemberData1(): array
     {
         return array(
             'FAKER_0' => array (
@@ -837,7 +837,7 @@ class CsvIn extends GaletteTestCase
      *
      * @return array
      */
-    private function getMemberData2()
+    private function getMemberData2(): array
     {
         return array (
             'FAKER_0' => array (
@@ -1120,7 +1120,7 @@ class CsvIn extends GaletteTestCase
      *
      * @return array
      */
-    private function getMemberData2NoName()
+    private function getMemberData2NoName(): array
     {
         $data = $this->getMemberData2();
         $data['FAKER_2']['nom_adh'] = '';
index 8ed44da0778a024ffed58c729db0d7b63178f029..940101134e59fd41206a8b52d7d86f4754f62e3a 100644 (file)
@@ -51,7 +51,7 @@ class News extends TestCase
      *
      * @return void
      */
-    public function testLoadNews()
+    public function testLoadNews(): void
     {
         //ensure allow_url_fopen is on
         ini_set('allow_url_fopen', true);
@@ -66,7 +66,7 @@ class News extends TestCase
      *
      * @return void
      */
-    public function testCacheNews()
+    public function testCacheNews(): void
     {
         //will use default lang to build RSS URL
         $file = GALETTE_CACHE_DIR . md5($this->local_url) . '.cache';
@@ -119,7 +119,7 @@ class News extends TestCase
      *
      * @return void
      */
-    public function testLoadNewsWExeption()
+    public function testLoadNewsWExeption(): void
     {
         $news = $this->getMockBuilder(\Galette\IO\News::class)
             ->setConstructorArgs(array($this->local_url, true))
index 070cf43212ebea514d91b34731afb588b494d41e..18d09815fc4d9076d29a03f788ffba3d583a862e 100644 (file)
@@ -61,7 +61,7 @@ class Contributions extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetList()
+    public function testGetList(): void
     {
         $this->logSuperAdmin();
         $contributions = new \Galette\Repository\Contributions($this->zdb, $this->login);
@@ -194,7 +194,7 @@ class Contributions extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetArrayList()
+    public function testGetArrayList(): void
     {
         $this->logSuperAdmin();
         $contributions = new \Galette\Repository\Contributions($this->zdb, $this->login);
@@ -221,7 +221,7 @@ class Contributions extends GaletteTestCase
      *
      * @return void
      */
-    public function testRemove()
+    public function testRemove(): void
     {
         $this->logSuperAdmin();
         $contributions = new \Galette\Repository\Contributions($this->zdb, $this->login);
index 589fda9163d571815c623cde29c1c41dc0f78582..aacfd9bf7ba44b33f2d00bc88762ea7472757b38 100644 (file)
@@ -50,7 +50,7 @@ class Groups extends GaletteTestCase
      *
      * @return void
      */
-    private function deleteGroups()
+    private function deleteGroups(): void
     {
         $zdb = new \Galette\Core\Db();
 
@@ -136,7 +136,7 @@ class Groups extends GaletteTestCase
      *
      * @return void
      */
-    public function testCreateGroups(string $parent_name, array $children)
+    public function testCreateGroups(string $parent_name, array $children): void
     {
         $group = new \Galette\Entity\Group();
         $group->setName($parent_name);
@@ -167,7 +167,7 @@ class Groups extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetSimpleList()
+    public function testGetSimpleList(): void
     {
         $groups = self::groupsProvider();
         foreach ($groups as $group) {
@@ -193,7 +193,7 @@ class Groups extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetList()
+    public function testGetList(): void
     {
         $this->logSuperAdmin();
 
@@ -235,7 +235,7 @@ class Groups extends GaletteTestCase
      *
      * @return void
      */
-    public function testUniqueness()
+    public function testUniqueness(): void
     {
         $groups = self::groupsProvider();
         foreach ($groups as $group) {
index 6f325f719ae7f8e7a018442f7dda2cb4f752b2b9..f870b9df20d213fe2eda505e81595e624a1017fe 100644 (file)
@@ -80,11 +80,11 @@ class Members extends GaletteTestCase
     }
 
     /**
-     * Create members and get their id
+     * Create members and store their id
      *
-     * @return int[]
+     * @return void
      */
-    private function createMembers()
+    private function createMembers(): void
     {
         global $zdb, $login, $hist, $i18n; // globals :(
         $zdb = $this->zdb;
@@ -184,7 +184,7 @@ class Members extends GaletteTestCase
      *
      * @return void
      */
-    private function deleteMembers()
+    private function deleteMembers(): void
     {
         if (is_array($this->mids) && count($this->mids) > 0) {
             $delete = $this->zdb->delete(\Galette\Entity\Contribution::TABLE);
@@ -214,7 +214,7 @@ class Members extends GaletteTestCase
      *
      * @return void
      */
-    private function deleteGroups()
+    private function deleteGroups(): void
     {
         //clean groups
         $delete = $this->zdb->delete(\Galette\Entity\Group::GROUPSUSERS_TABLE);
@@ -233,7 +233,7 @@ class Members extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetList()
+    public function testGetList(): void
     {
         $members = new \Galette\Repository\Members();
 
@@ -613,7 +613,7 @@ class Members extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetListContributionDynamics()
+    public function testGetListContributionDynamics(): void
     {
         // Advanced search on contributions dynamic fields
 
@@ -784,7 +784,7 @@ class Members extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetPublicList()
+    public function testGetPublicList(): void
     {
         $members = new \Galette\Repository\Members();
 
@@ -825,7 +825,7 @@ class Members extends GaletteTestCase
      *
      * @return void
      */
-    public function testGroupsSearch()
+    public function testGroupsSearch(): void
     {
         $members = new \Galette\Repository\Members();
         $list = $members->getList(true);
@@ -952,7 +952,7 @@ class Members extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetRemindersCount()
+    public function testGetRemindersCount(): void
     {
         $members = new \Galette\Repository\Members();
         $counts = $members->getRemindersCount();
@@ -1123,7 +1123,7 @@ class Members extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetDropdownMembers()
+    public function testGetDropdownMembers(): void
     {
         $members = new \Galette\Repository\Members();
         $this->logSuperAdmin();
@@ -1136,7 +1136,7 @@ class Members extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetArrayList()
+    public function testGetArrayList(): void
     {
         $members = new \Galette\Repository\Members();
 
index 5dbb5bd9941a804151de68766f8674659271b92c..89cf83ed9b80fc8dfe18c23b3d25893ef314698c 100644 (file)
@@ -62,7 +62,7 @@ class PaymentTypes extends GaletteTestCase
      *
      * @return void
      */
-    private function deletePaymentType()
+    private function deletePaymentType(): void
     {
         if (is_array($this->remove) && count($this->remove) > 0) {
             $delete = $this->zdb->delete(\Galette\Entity\PaymentType::TABLE);
@@ -82,7 +82,7 @@ class PaymentTypes extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetList()
+    public function testGetList(): void
     {
         $types = new \Galette\Repository\PaymentTypes($this->zdb, $this->preferences, $this->login);
 
index 8780d8c8904888790982933497adb2fb7c4af670..5514c055dcc1b3ad4dd2ed4bb522d9f604fb7d67 100644 (file)
@@ -62,7 +62,7 @@ class PdfModels extends GaletteTestCase
      *
      * @return void
      */
-    private function deletePdfModels()
+    private function deletePdfModels(): void
     {
         if (is_array($this->remove) && count($this->remove) > 0) {
             $delete = $this->zdb->delete(\Galette\Entity\PdfModel::TABLE);
@@ -82,7 +82,7 @@ class PdfModels extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetList()
+    public function testGetList(): void
     {
         global $zdb;
         $zdb = $this->zdb; //globals '(
index 9067f388d2f698a6e43fb9102204753c44960309..b62ee01d99e33f6dbb65dbdc1e3e88dfd9e1ef52 100644 (file)
@@ -88,7 +88,7 @@ class Reminders extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetList()
+    public function testGetList(): void
     {
         //impendings
         $ireminders = new \Galette\Repository\Reminders([\Galette\Entity\Reminder::IMPENDING]);
index dacf4b301bbccb1141d4c13a5b32846a1d5b408d..612077b8d6f81f68115ca4a51817d7db74e02e73 100644 (file)
@@ -48,7 +48,7 @@ class ScheduledPayments extends GaletteTestCase
      *
      * @return void
      */
-    private function deleteScheduledPayments()
+    private function deleteScheduledPayments(): void
     {
         $delete = $this->zdb->delete(\Galette\Entity\ScheduledPayment::TABLE);
         $delete->where(['comment' => 'FAKER' . $this->seed]);
@@ -68,7 +68,7 @@ class ScheduledPayments extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetList()
+    public function testGetList(): void
     {
         $this->logSuperAdmin();
         $scheduledPayments = new \Galette\Repository\ScheduledPayments($this->zdb, $this->login);
@@ -152,7 +152,7 @@ class ScheduledPayments extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetArrayList()
+    public function testGetArrayList(): void
     {
         $this->logSuperAdmin();
         $scheduledPayments = new \Galette\Repository\ScheduledPayments($this->zdb, $this->login);
@@ -222,7 +222,7 @@ class ScheduledPayments extends GaletteTestCase
      *
      * @return void
      */
-    public function testRemove()
+    public function testRemove(): void
     {
         $this->logSuperAdmin();
         $scheduledPayments = new \Galette\Repository\ScheduledPayments($this->zdb, $this->login);
index 8a71d8e7aa00520f12a7c2c5dbcffc373ce089c1..fa9d232590edd60ea5a5c0aa25e6331d9d32280e 100644 (file)
@@ -31,7 +31,6 @@ use Galette\GaletteTestCase;
 class Transactions extends GaletteTestCase
 {
     protected int $seed = 20230328103438;
-    /** @var \Galette\Entity\Transaction */
     private \Galette\Entity\Transaction $transaction;
 
     /**
@@ -88,7 +87,7 @@ class Transactions extends GaletteTestCase
      *
      * @return void
      */
-    private function createTransaction()
+    private function createTransaction(): void
     {
         $date = new \DateTime();
         $data = [
@@ -114,7 +113,7 @@ class Transactions extends GaletteTestCase
      *
      * @return void
      */
-    public function testGetList()
+    public function testGetList(): void
     {
         $this->logSuperAdmin();
         $transactions = new \Galette\Repository\Transactions($this->zdb, $this->login);
@@ -221,7 +220,7 @@ class Transactions extends GaletteTestCase
      *
      * @return void
      */
-    public function testRemove()
+    public function testRemove(): void
     {
         $this->logSuperAdmin();
         $transactions = new \Galette\Repository\Transactions($this->zdb, $this->login);
index ec52fcd02c85928b71f4c3b33f8e746a62668e3f..a2edfb8020c30e4558ddb508500e3013345fc170 100644 (file)
@@ -67,7 +67,7 @@ class Password extends TestCase
      *
      * @return array
      */
-    public static function passProvider()
+    public static function passProvider(): array
     {
         return [
             // [strength, password, errors]
@@ -112,7 +112,7 @@ class Password extends TestCase
      * @return void
      */
     #[DataProvider('passProvider')]
-    public function testValidatePassword($level, $pass, $errors)
+    public function testValidatePassword(int $level, string $pass, array $errors): void
     {
         //errror messages mapping
         foreach ($errors as &$err) {
@@ -154,7 +154,7 @@ class Password extends TestCase
      *
      * @return array
      */
-    public static function blacklistProvider()
+    public static function blacklistProvider(): array
     {
         return [
             ['galette', true],
@@ -175,7 +175,7 @@ class Password extends TestCase
      * @return void
      */
     #[DataProvider('blacklistProvider')]
-    public function testBlacklist($pass, $expected)
+    public function testBlacklist(string $pass, bool $expected): void
     {
         $this->preferences->pref_password_blacklist = true;
         $password = new \Galette\Util\Password($this->preferences);
@@ -191,7 +191,7 @@ class Password extends TestCase
      *
      * @return void
      */
-    public function testPersonalInformation()
+    public function testPersonalInformation(): void
     {
         $infos = [
             'login'     => 'mylogin',
index f0524a84761d379a3dfef81e46702838dd0a77f2..d5aff97029c400217486881cfb925522d9e4e41b 100644 (file)
@@ -68,7 +68,7 @@ class Telemetry extends TestCase
      *
      * @return void
      */
-    public function testGrabGaletteInfos()
+    public function testGrabGaletteInfos(): void
     {
         $expected = [
             'uuid'               => 'TO BE SET',
@@ -142,7 +142,7 @@ class Telemetry extends TestCase
      *
      * @return void
      */
-    public function testGrabDbInfos()
+    public function testGrabDbInfos(): void
     {
         $telemetry = new \Galette\Util\Telemetry(
             $this->zdb,
@@ -166,7 +166,7 @@ class Telemetry extends TestCase
      *
      * @return void
      */
-    public function testGrabWebserverInfos()
+    public function testGrabWebserverInfos(): void
     {
         $telemetry = new \Galette\Util\Telemetry(
             $this->zdb,
@@ -186,7 +186,7 @@ class Telemetry extends TestCase
      *
      * @return void
      */
-    public function testGrabPhpInfos()
+    public function testGrabPhpInfos(): void
     {
         $expected = [
             'version'   => str_replace(PHP_EXTRA_VERSION, '', PHP_VERSION),
@@ -215,7 +215,7 @@ class Telemetry extends TestCase
      *
      * @return void
      */
-    public function testGrabOsInfos()
+    public function testGrabOsInfos(): void
     {
         $distro = '';
         if (file_exists('/etc/redhat-release')) {
@@ -245,7 +245,7 @@ class Telemetry extends TestCase
      *
      * @return void
      */
-    public function testGetTelemetryInfos()
+    public function testGetTelemetryInfos(): void
     {
         $telemetry = new \Galette\Util\Telemetry(
             $this->zdb,
index 5bd5437e0a4fb13c9cd009f2d952f30ad793eab7..dfbbc35b0a5b1051c233672a95d372e2e8f5d628 100644 (file)
@@ -32,6 +32,7 @@ use PHPUnit\Framework\TestCase;
 class Install extends TestCase
 {
     private \Galette\Core\Db $zdb;
+    /** @var array<string> */
     private array $flash_data;
     private \Slim\Flash\Messages $flash;
     private \DI\Container $container;
@@ -81,7 +82,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testDbSupport()
+    public function testDbSupport(): void
     {
         $this->assertFalse($this->zdb->isEngineSUpported());
     }
@@ -91,7 +92,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testGetUnsupportedMessage()
+    public function testGetUnsupportedMessage(): void
     {
         $this->assertMatchesRegularExpression(
             '/Minimum version for .+ engine is .+, .+ .+ found!/',
index b4a3da3be4d3cfbb5ea86769b9b2ff9b8b9b31f1..737555590f9fdd9c587a335a0b18abe0c80a03e6 100644 (file)
@@ -30,30 +30,22 @@ use PHPUnit\Framework\TestCase;
  */
 abstract class GaletteTestCase extends TestCase
 {
-    /** @var \Galette\Core\Db */
     protected \Galette\Core\Db $zdb;
     protected array $members_fields;
     protected array $members_fields_cats;
-    /** @var \Galette\Core\I18n */
     protected \Galette\Core\I18n $i18n;
-    /** @var \Galette\Core\Preferences */
     protected \Galette\Core\Preferences $preferences;
     protected \RKA\Session $session;
-    /** @var \Galette\Core\Login */
     protected \Galette\Core\Login $login;
-    /** @var \Galette\Core\History */
     protected \Galette\Core\History $history;
-    protected $logger_storage = '';
+    protected string $logger_storage = '';
 
-    /** @var \Galette\Entity\Adherent */
     protected \Galette\Entity\Adherent $adh;
-    /** @var \Galette\Entity\Contribution */
     protected \Galette\Entity\Contribution $contrib;
     protected array $adh_ids = [];
     protected array $contrib_ids = [];
     /** @var array */
     protected array $flash_data;
-    /** @var \Slim\Flash\Messages */
     protected \Slim\Flash\Messages $flash;
     protected \DI\Container $container;
     protected int $seed;
@@ -141,7 +133,7 @@ abstract class GaletteTestCase extends TestCase
      *
      * @return void
      */
-    protected function loadAdherent($id)
+    protected function loadAdherent(int $id): void
     {
         $this->adh = new \Galette\Entity\Adherent($this->zdb, (int)$id);
         $this->adh->setDependencies(
@@ -251,7 +243,7 @@ abstract class GaletteTestCase extends TestCase
      *
      * @return \Galette\Entity\Adherent
      */
-    public function createMember(array $data)
+    public function createMember(array $data): \Galette\Entity\Adherent
     {
         $this->adh = new \Galette\Entity\Adherent($this->zdb);
         $this->adh->setDependencies(
@@ -280,7 +272,7 @@ abstract class GaletteTestCase extends TestCase
      *
      * @return void
      */
-    protected function checkMemberOneExpected($adh = null, $new_expecteds = [])
+    protected function checkMemberOneExpected(\Galette\Entity\Adherent $adh = null, array $new_expecteds = []): void
     {
         if ($adh === null) {
             $adh = $this->adh;
@@ -383,7 +375,7 @@ abstract class GaletteTestCase extends TestCase
      *
      * @return void
      */
-    protected function checkMemberTwoExpected($adh = null, $new_expecteds = [])
+    protected function checkMemberTwoExpected(\Galette\Entity\Adherent $adh = null, array $new_expecteds = []): void
     {
         if ($adh === null) {
             $adh = $this->adh;
@@ -482,7 +474,7 @@ abstract class GaletteTestCase extends TestCase
      *
      * @return false|\Laminas\Db\ResultSet\ResultSet
      */
-    protected function adhOneExists()
+    protected function adhOneExists(): false|\Laminas\Db\ResultSet\ResultSet
     {
         $mdata = $this->dataAdherentOne();
         $select = $this->zdb->select(\Galette\Entity\Adherent::TABLE, 'a');
@@ -506,7 +498,7 @@ abstract class GaletteTestCase extends TestCase
      *
      * @return false|\Laminas\Db\ResultSet\ResultSet
      */
-    protected function adhTwoExists()
+    protected function adhTwoExists(): false|\Laminas\Db\ResultSet\ResultSet
     {
         $mdata = $this->dataAdherentTwo();
         $select = $this->zdb->select(\Galette\Entity\Adherent::TABLE, 'a');
@@ -530,7 +522,7 @@ abstract class GaletteTestCase extends TestCase
      *
      * @return \Galette\Entity\Adherent
      */
-    protected function getMemberOne()
+    protected function getMemberOne(): \Galette\Entity\Adherent
     {
         $rs = $this->adhOneExists();
         if ($rs === false) {
@@ -546,7 +538,7 @@ abstract class GaletteTestCase extends TestCase
      *
      * @return \Galette\Entity\Adherent
      */
-    protected function getMemberTwo()
+    protected function getMemberTwo(): \Galette\Entity\Adherent
     {
         $rs = $this->adhTwoExists();
         if ($rs === false) {
@@ -565,7 +557,7 @@ abstract class GaletteTestCase extends TestCase
      *
      * @return \Galette\Entity\Contribution
      */
-    public function createContrib(array $data, \Galette\Entity\Contribution $contrib = null)
+    public function createContrib(array $data, \Galette\Entity\Contribution $contrib = null): \Galette\Entity\Contribution
     {
         if ($contrib === null) {
             $this->contrib = new \Galette\Entity\Contribution($this->zdb, $this->login);
@@ -589,7 +581,7 @@ abstract class GaletteTestCase extends TestCase
      *
      * @return void
      */
-    protected function createContribution()
+    protected function createContribution(): void
     {
         $now = new \DateTime(); // 2020-11-07
         $begin_date = clone $now;
@@ -617,12 +609,12 @@ abstract class GaletteTestCase extends TestCase
     /**
      * Check contributions expected
      *
-     * @param \Galette\Entity\Contribution $contrib       Contribution instance, if any
-     * @param array                        $new_expecteds Changes on expected values
+     * @param ?\Galette\Entity\Contribution $contrib       Contribution instance, if any
+     * @param array<string,mixed>           $new_expecteds Changes on expected values
      *
      * @return void
      */
-    protected function checkContribExpected($contrib = null, $new_expecteds = [])
+    protected function checkContribExpected(\Galette\Entity\Contribution $contrib = null, array $new_expecteds = []): void
     {
         if ($contrib === null) {
             $contrib = $this->contrib;
index 7528e0e2e6112ae74827220ba9ce18c15011dac4..52fae1d3b35004f6d4c5952f645337cb1d42d14a 100644 (file)
@@ -32,6 +32,7 @@ use PHPUnit\Framework\TestCase;
 class Install extends TestCase
 {
     private \Galette\Core\Db $zdb;
+    /** @var array<string> */
     private array $flash_data;
     private \Slim\Flash\Messages $flash;
     private \DI\Container $container;
@@ -81,7 +82,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testDbSupport()
+    public function testDbSupport(): void
     {
         $this->assertTrue($this->zdb->isEngineSUpported());
     }
@@ -91,7 +92,7 @@ class Install extends TestCase
      *
      * @return void
      */
-    public function testUpdates()
+    public function testUpdates(): void
     {
         $install = new \Galette\Core\Install();
         $update_scripts = \Galette\Core\Install::getUpdateScripts(