[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Class Name Case Violations

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69d8f8c683620_3c18dd786185@gitlab-sidekiq-low-urgency-cpu-bound-v2-5ffb5b8455-pbv7q.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
7d08f39e by Sacha Pignot at 2026-04-10T13:10:13+00:00
[FIX] Class Name Case Violations
---
* [FIX] Fedex: use single-line phpstan-ignore to avoid PHPCS docblock error

* [FIX] Activate class.nameCase PHPStan rule and fix all violations

- Remove class.nameCase from ignoreErrors in phpstan-tikiCi.neon
- Fix TikiLib case in lib/Auth/PhpCAS.php (Tikilib → TikiLib)
- Fix SoapClient false positive in lib/Shipping/Provider/Fedex.php with inline @phpstan-ignore (PHPStan 2.x stubs bug)
- Fix TikiDb case in lib/core/Search/MySql/QueryBuffer.php and Table.php (TikiDB → TikiDb)
- Fix JitFilter case in lib/core/Services/Comment/AnnotationController.php and Payment/Controller.php (jitFilter → JitFilter)
- Fix Tiki_Profile_Writer_Helper case in lib/core/Tiki/Profile/Writer/SearchFieldHelper.php
- Fix Tracker_Item case in lib/core/Tracker/Tabular/Source/TrackerItemSource.php (Tracker_item → Tracker_Item)
- Fix I18n namespace case in lib/language/LanguageTranslations.php and FunctionHandler/InteractiveTranslation.php (I18N → I18n)
- Fix TikiLib case in lib/smarty_tiki/FunctionHandler/JsInsertIcon.php
- Fix SocialNetworksLib case in lib/socialnetworkslib.php (socialNetworksLib → SocialNetworksLib)
- Fix WikiPluginBackLinks case in lib/wiki-plugins/wikiplugin_backlinks.php (wikipluginbacklinks → WikiPluginBackLinks)

* [FIX] Fix SmartyTiki namespace case in 6 legacy Smarty wrapper files

See merge request tikiwiki/tiki!9890

- - - - -


20 changed files:

- lib/Auth/PhpCAS.php
- lib/Shipping/Provider/Fedex.php
- lib/core/Search/MySql/QueryBuffer.php
- lib/core/Search/MySql/Table.php
- lib/core/Services/Comment/AnnotationController.php
- lib/core/Services/Payment/Controller.php
- lib/core/Tiki/Profile/Writer/SearchFieldHelper.php
- lib/core/Tracker/Tabular/Source/TrackerItemSource.php
- lib/language/LanguageTranslations.php
- lib/smarty_tiki/FunctionHandler/InteractiveTranslation.php
- lib/smarty_tiki/FunctionHandler/JsInsertIcon.php
- lib/smarty_tiki/function.attachments.php
- lib/smarty_tiki/function.bootstrap_modal.php
- lib/smarty_tiki/function.breadcrumbs.php
- lib/smarty_tiki/function.html_body_attributes.php
- lib/smarty_tiki/function.rating.php
- lib/smarty_tiki/modifier.zone_is_empty.php
- lib/socialnetworkslib.php
- lib/wiki-plugins/wikiplugin_backlinks.php
- phpstan-tikiCi.neon


Changes:

=====================================
lib/Auth/PhpCAS.php
=====================================
@@ -65,7 +65,7 @@ class PhpCAS
         $nyholm = new Psr17Factory();
         $psr17  = new Psr17($nyholm, $nyholm, $nyholm, $nyholm, $nyholm, $nyholm);
 
-        $laminasClient = \Tikilib::lib('tiki')->get_http_client();
+        $laminasClient = \TikiLib::lib('tiki')->get_http_client();
         if ($serverValidation === false && method_exists($laminasClient, 'setOptions')) {
             $laminasClient->setOptions([
                 'sslverifypeer' => false,
@@ -232,7 +232,7 @@ class PhpCAS
             $qs  = http_build_query(['format' => 'JSON', 'service' => $service, 'ticket' => $ticket], '', '&', PHP_QUERY_RFC3986);
             $url = rtrim($baseUrl, '/') . '/p3/serviceValidate?' . $qs;
 
-            $laminas = \Tikilib::lib('tiki')->get_http_client();
+            $laminas = \TikiLib::lib('tiki')->get_http_client();
             if (method_exists($laminas, 'setOptions')) {
                 $laminas->setOptions(['maxredirects' => 0, 'timeout' => 30]);
             }


=====================================
lib/Shipping/Provider/Fedex.php
=====================================
@@ -6,6 +6,7 @@
 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
 namespace Tiki\Lib\Shipping\Provider;
 
+// @phpstan-ignore-next-line class.nameCase (PHPStan 2.x stubs incorrectly define SoapClient as soapclient)
 use SoapClient;
 use SoapFault;
 use Tiki\Lib\Shipping\Provider\ShippingProviderInterface as ShippingProvider;
@@ -36,7 +37,7 @@ class Fedex implements ShippingProvider
         $request = $this->getRequest($from, $to, $packages);
 
         try {
-            $client = new SoapClient($wsdl, $args);
+            $client = new SoapClient($wsdl, $args); // @phpstan-ignore class.nameCase
             $response = $client->getRates($request);
 
             $options = $response->RateReplyDetails;


=====================================
lib/core/Search/MySql/QueryBuffer.php
=====================================
@@ -51,7 +51,7 @@ class Search_MySql_QueryBuffer
         $result = $this->db->queryError(
             $query,
             $error,
-            options: [TikiDB::QUERY_OPTION_LOG_GROUP => Search_MySql_Table::UNIFIED_MYSQL_WRITE_LOG_GROUP]
+            options: [TikiDb::QUERY_OPTION_LOG_GROUP => Search_MySql_Table::UNIFIED_MYSQL_WRITE_LOG_GROUP]
         );
 
         $this->clear();


=====================================
lib/core/Search/MySql/Table.php
=====================================
@@ -64,12 +64,12 @@ class Search_MySql_Table extends TikiDb_Table
     {
         $stopwordTableName = $this->tableName . '_stopwords';
         $escapedStopwordTable = $this->escapeIdentifier($stopwordTableName);
-        $this->db->query("DROP TABLE IF EXISTS $escapedStopwordTable", options: [TikiDB::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_WRITE_LOG_GROUP]);
+        $this->db->query("DROP TABLE IF EXISTS $escapedStopwordTable", options: [TikiDb::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_WRITE_LOG_GROUP]);
 
         $tables = $this->indexTables();
         foreach ($tables as $table) {
             $table = $this->escapeIdentifier($table);
-            $this->db->query("DROP TABLE IF EXISTS $table", options: [TikiDB::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_WRITE_LOG_GROUP]);
+            $this->db->query("DROP TABLE IF EXISTS $table", options: [TikiDb::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_WRITE_LOG_GROUP]);
         }
 
         $this->definition = false;
@@ -215,7 +215,7 @@ class Search_MySql_Table extends TikiDb_Table
     {
         $tables = $this->indexTables();
         $join = $this->getIndexTablesSqlJoins();
-        if ($result = $this->fetchAll([$this->count()], $conditions, 1, 0, null, $join, options: [TikiDB::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_READ_LOG_GROUP])) {
+        if ($result = $this->fetchAll([$this->count()], $conditions, 1, 0, null, $join, options: [TikiDb::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_READ_LOG_GROUP])) {
             $result = reset($result);
             if ($result) {
                 return reset($result);
@@ -249,7 +249,7 @@ class Search_MySql_Table extends TikiDb_Table
     {
         $available_fields = TikiLib::lib('unifiedsearch')->getAvailableFields();
         $join = $this->getIndexTablesSqlJoins();
-        $resultset = $this->query($selectFields, $conditions, $numrows, $offset, $orderClause, $join, options: [TikiDB::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_READ_LOG_GROUP]);
+        $resultset = $this->query($selectFields, $conditions, $numrows, $offset, $orderClause, $join, options: [TikiDb::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_READ_LOG_GROUP]);
         $hasCustomSelect = ! (isset($selectFields[0]) && ($selectFields[0] instanceof TikiDb_Expr) && $selectFields[0]->getQueryPart(null) === '*');
         $result = [];
         while ($row = $resultset->fetchRow()) {
@@ -281,14 +281,14 @@ class Search_MySql_Table extends TikiDb_Table
     public function deleteMultipleIndex(array $conditions)
     {
         $tables = $this->indexTables();
-        $matches = $this->fetchAll(['id'], $conditions, options: [TikiDB::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_WRITE_LOG_GROUP]);
+        $matches = $this->fetchAll(['id'], $conditions, options: [TikiDb::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_WRITE_LOG_GROUP]);
         foreach ($matches as $row) {
             $conditions = ['id' => $row['id']];
             foreach ($tables as $table) {
                 $bindvars = [];
                 $query = "DELETE FROM {$this->escapeIdentifier($table)}";
                 $query .= $this->buildConditions($conditions, $bindvars);
-                $this->db->queryException($query, $bindvars, options: [TikiDB::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_WRITE_LOG_GROUP]);
+                $this->db->queryException($query, $bindvars, options: [TikiDb::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_WRITE_LOG_GROUP]);
             }
         }
     }
@@ -302,7 +302,7 @@ class Search_MySql_Table extends TikiDb_Table
                 $tableName = $this->tableName;
             }
             $tables = [$tableName];
-            $result = $this->db->fetchAll("SHOW TABLES LIKE '" . $tableName . "_%'", options: [TikiDB::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_READ_LOG_GROUP]);
+            $result = $this->db->fetchAll("SHOW TABLES LIKE '" . $tableName . "_%'", options: [TikiDb::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_READ_LOG_GROUP]);
 
             $partitions = array_filter(
                 array_map(fn($row) => array_shift($row), $result),
@@ -331,7 +331,7 @@ class Search_MySql_Table extends TikiDb_Table
 
         $tables = $this->indexTables();
         foreach ($tables as $table) {
-            $result = $this->db->fetchAll("DESC {$this->escapeIdentifier($table)}", options: [TikiDB::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_READ_LOG_GROUP]);
+            $result = $this->db->fetchAll("DESC {$this->escapeIdentifier($table)}", options: [TikiDb::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_READ_LOG_GROUP]);
             foreach ($result as $row) {
                 $this->definition[$this->tfTranslator->normalize($row['Field'])] = [
                     'table' => $table,
@@ -340,7 +340,7 @@ class Search_MySql_Table extends TikiDb_Table
                 $this->tableFields[$table][] = $this->tfTranslator->normalize($row['Field']);
             }
 
-            $result = $this->db->fetchAll("SHOW INDEXES FROM {$this->escapeIdentifier($table)}", options: [TikiDB::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_READ_LOG_GROUP]);
+            $result = $this->db->fetchAll("SHOW INDEXES FROM {$this->escapeIdentifier($table)}", options: [TikiDb::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_READ_LOG_GROUP]);
             foreach ($result as $row) {
                 $this->indexes[$this->tfTranslator->normalize($row['Key_name'])] = [
                     'table' => $table,
@@ -360,7 +360,7 @@ class Search_MySql_Table extends TikiDb_Table
                 PRIMARY KEY(`id`),
                 INDEX (`object_type`, `object_id`(160))
             ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC",
-            options: [TikiDB::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_WRITE_LOG_GROUP]
+            options: [TikiDb::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_WRITE_LOG_GROUP]
         );
         $this->exists = true;
 
@@ -376,7 +376,7 @@ class Search_MySql_Table extends TikiDb_Table
                 `id` INT NOT NULL AUTO_INCREMENT,
                 PRIMARY KEY(`id`)
             ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC",
-            options: [TikiDB::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_WRITE_LOG_GROUP]
+            options: [TikiDb::QUERY_OPTION_LOG_GROUP => self::UNIFIED_MYSQL_WRITE_LOG_GROUP]
         );
     }
 


=====================================
lib/core/Services/Comment/AnnotationController.php
=====================================
@@ -55,7 +55,7 @@ class Services_Comment_AnnotationController
 
         // annotatejs sends the params in the request payload by default, so we use option emulateJSON
         // but then need to decode the json string here
-        $params = new jitFilter(json_decode($input->json->none(), true));
+        $params = new JitFilter(json_decode($input->json->none(), true));
 
         $text = $params->text->wikicontent();
         $quote = $params->quote->text();
@@ -120,7 +120,7 @@ class Services_Comment_AnnotationController
     public function action_update($input)
     {
         $threadId = $input->threadId->int();
-        $params = new jitFilter(json_decode($input->json->none(), true));
+        $params = new JitFilter(json_decode($input->json->none(), true));
 
         $ranges = $params->asArray('ranges');
         $text = $params->text->wikicontent();
@@ -190,7 +190,7 @@ class Services_Comment_AnnotationController
         $identifier = urldecode($input->uri->url());
         $object = explode(':', $identifier);
 
-        $list = $this->commentController->action_list(new jitFilter([
+        $list = $this->commentController->action_list(new JitFilter([
             'type' => $object[0],
             'objectId' => $object[1],
         ]));


=====================================
lib/core/Services/Payment/Controller.php
=====================================
@@ -28,7 +28,7 @@ class Services_Payment_Controller
         $ret = [];
 
         foreach ($items as $item) {
-            $ret[] = $cartlib->add_to_cart($item['params'], new jitFilter($item));
+            $ret[] = $cartlib->add_to_cart($item['params'], new JitFilter($item));
         }
 
         return $ret;


=====================================
lib/core/Tiki/Profile/Writer/SearchFieldHelper.php
=====================================
@@ -63,7 +63,7 @@ class Tiki_Profile_Writer_SearchFieldHelper
             $trklib = TikiLib::lib('trk');
             $field = $trklib->get_field_by_perm_name($args['field']);
             if ($field && isset($field['type']) && $field['type'] == 'e') { // category field
-                $args['value'] = Tiki_profile_Writer_Helper::uniform_string('category', $writer, $args['value']);
+                $args['value'] = Tiki_Profile_Writer_Helper::uniform_string('category', $writer, $args['value']);
             }
         }
 


=====================================
lib/core/Tracker/Tabular/Source/TrackerItemSource.php
=====================================
@@ -7,7 +7,7 @@
 namespace Tracker\Tabular\Source;
 
 use Tracker\Tabular\Schema;
-use Tracker_item;
+use Tracker_Item;
 
 class TrackerItemSource implements SourceInterface
 {


=====================================
lib/language/LanguageTranslations.php
=====================================
@@ -65,7 +65,7 @@ class LanguageTranslations extends TikiDb_Bridge
 
         $this->filePath = "lang/{$this->lang}/language.php";
         $this->customFilePath = "lang/{$this->lang}/" . LANG_CUSTOM_PHP_BASENAME;
-        $this->translator = \I18N\LanguageTranslator::getInstance($this->lang);
+        $this->translator = \I18n\LanguageTranslator::getInstance($this->lang);
     }
 
     /**
@@ -115,7 +115,7 @@ class LanguageTranslations extends TikiDb_Bridge
         }
 
         // If the translation is not in the database and the new translation is the same as the translation defined by the filesystem, ignore it (do not insert in the database)
-        $noDbTranslator = \I18N\LanguageTranslator::getInstance($this->lang, ['skipDb' => true]);
+        $noDbTranslator = \I18n\LanguageTranslator::getInstance($this->lang, ['skipDb' => true]);
         if ($noDbTranslator->translate($originalStr) == $translatedStr) {
             static $initialDatabaseTranslations = [];
 


=====================================
lib/smarty_tiki/FunctionHandler/InteractiveTranslation.php
=====================================
@@ -18,7 +18,7 @@ class InteractiveTranslation extends Base
         $headerlib = \TikiLib::lib('header');
         $smarty = \TikiLib::lib('smarty');
 
-        $translator = \I18N\LanguageTranslator::getInstance(Language::getCurrentLanguage());
+        $translator = \I18n\LanguageTranslator::getInstance(Language::getCurrentLanguage());
         $strings = $translator->getInteractiveCollectedStrings();
         if (count($strings) == 0) {
             return;


=====================================
lib/smarty_tiki/FunctionHandler/JsInsertIcon.php
=====================================
@@ -22,7 +22,7 @@ class JsInsertIcon extends Base
 {
     public function handle($params, Template $template)
     {
-        $smarty = \Tikilib::lib("smarty");
+        $smarty = \TikiLib::lib("smarty");
         if (! empty($params['type'])) {
             //set icon
             $iconmap = [


=====================================
lib/smarty_tiki/function.attachments.php
=====================================
@@ -8,6 +8,6 @@
 
 function smarty_function_attachments($params, \Smarty\Template $template)
 {
-    $smartyFunctionAttachmentsHandler = new \smartytiki\FunctionHandler\Attachments();
+    $smartyFunctionAttachmentsHandler = new \SmartyTiki\FunctionHandler\Attachments();
     return $smartyFunctionAttachmentsHandler->handle($params, $template);
 }


=====================================
lib/smarty_tiki/function.bootstrap_modal.php
=====================================
@@ -7,6 +7,6 @@
 
 function smarty_function_bootstrap_modal($params, \Smarty\Template $template)
 {
-    $smartyFunctionBootstrapModalHandler = new \smartytiki\FunctionHandler\BootstrapModal();
+    $smartyFunctionBootstrapModalHandler = new \SmartyTiki\FunctionHandler\BootstrapModal();
     return $smartyFunctionBootstrapModalHandler->handle($params, $template);
 }


=====================================
lib/smarty_tiki/function.breadcrumbs.php
=====================================
@@ -7,6 +7,6 @@
 
 function smarty_function_breadcrumbs($params, \Smarty\Template $template)
 {
-    $smartyFunctionBreadcrumbsHandler = new \smartytiki\FunctionHandler\Breadcrumbs();
+    $smartyFunctionBreadcrumbsHandler = new \SmartyTiki\FunctionHandler\Breadcrumbs();
     return $smartyFunctionBreadcrumbsHandler->handle($params, $template);
 }


=====================================
lib/smarty_tiki/function.html_body_attributes.php
=====================================
@@ -11,6 +11,6 @@
 
 function smarty_function_html_body_attributes($params, \Smarty\Template $template)
 {
-    $smartyFunctionHmlBodyAttributesHandler = new \smartytiki\FunctionHandler\HtmlBodyAttributes();
+    $smartyFunctionHmlBodyAttributesHandler = new \SmartyTiki\FunctionHandler\HtmlBodyAttributes();
     return $smartyFunctionHmlBodyAttributesHandler->handle($params, $template);
 }


=====================================
lib/smarty_tiki/function.rating.php
=====================================
@@ -6,6 +6,6 @@
 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
 function smarty_function_rating($params, \Smarty\Template $template)
 {
-    $smartyFunctionRatingHandler = new \smartytiki\FunctionHandler\Rating();
+    $smartyFunctionRatingHandler = new \SmartyTiki\FunctionHandler\Rating();
     return $smartyFunctionRatingHandler->handle($params, $template);
 }


=====================================
lib/smarty_tiki/modifier.zone_is_empty.php
=====================================
@@ -7,6 +7,6 @@
 
 function smarty_modifier_zone_is_empty($zoneName)
 {
-    $SmartyTikiExtension = new \smartytiki\Extension\SmartyTikiExtension();
+    $SmartyTikiExtension = new \SmartyTiki\Extension\SmartyTikiExtension();
     return $SmartyTikiExtension->smartyModifierZoneIsEmpty($zoneName);
 }


=====================================
lib/socialnetworkslib.php
=====================================
@@ -992,4 +992,4 @@ class SocialNetworksLib extends LogsLib
 
 global $socialnetworkslib;
 
-$socialnetworkslib = new socialNetworksLib();
+$socialnetworkslib = new SocialNetworksLib();


=====================================
lib/wiki-plugins/wikiplugin_backlinks.php
=====================================
@@ -267,7 +267,7 @@ function wikiplugin_backlinks_info()
 
 function wikiplugin_backlinks($data, $params)
 {
-    $plugin = new wikipluginbacklinks();
+    $plugin = new WikiPluginBackLinks();
     $data = $plugin->run($data, $params);
     if (TikiLib::lib('parser')->option['is_markdown']) {
         $data = "\n" . $data;


=====================================
phpstan-tikiCi.neon
=====================================
@@ -34,8 +34,6 @@ parameters:
       identifier: method.void
     -
       identifier: variable.undefined
-    -
-      identifier: class.nameCase
   # TODO: phpstan level 0 tests that represents things that Maybe that still work, but in this day and age...
     -
-      identifier: method.staticCall                                 
+      identifier: method.staticCall



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/7d08f39ec86dfd1a8cfbb389f2ec94ad93743be5

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/7d08f39ec86dfd1a8cfbb389f2ec94ad93743be5
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.