[TikiWiki-commits] [Git][tikiwiki/tiki][master] 8 commits: [REF] phpstan make new.noConstructor test pass
Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <69939de8de61a_3b8326d870063@gitlab-sidekiq-low-urgency-cpu-bound-v2-5cb68884d8-kb4jp.mail> |
Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
8d613441 by Benoit Grégoire at 2026-02-16T16:05:07-05:00
[REF] phpstan make new.noConstructor test pass
- - - - -
5cb354a9 by Benoit Grégoire at 2026-02-16T16:09:29-05:00
[REF] phpstan make new.interface test pass
- - - - -
7e362d71 by Benoit Grégoire at 2026-02-16T16:27:34-05:00
[REF] phpstan make method.notFound test pass
- - - - -
9d228352 by Benoit Grégoire at 2026-02-16T16:40:49-05:00
[REF] phpstan make staticMethod.notFound test pass
- - - - -
f344a09d by Benoit Grégoire at 2026-02-16T16:52:19-05:00
[REF] phpstan make staticProperty.notFound test pass
- - - - -
f8e2b482 by Benoit Grégoire at 2026-02-16T16:54:38-05:00
[REF] phpstan make classConstant.notFound test pass
- - - - -
1f535fc0 by Benoit Grégoire at 2026-02-16T17:24:00-05:00
[REF] phpstan make property.notFound test pass
- - - - -
aac8483d by Benoit Grégoire at 2026-02-16T17:26:37-05:00
[DOC] phpstan-tikiCi.neon: clarify the TODOs
- - - - -
18 changed files:
- lib/Quizzes/Quiz.php
- lib/core/Tiki/Command/FakerCommentsCommand.php
- lib/core/Tiki/Command/FakerTrackerCommand.php
- lib/core/Tiki/Package/Extension/Api/Events.php
- lib/core/Tiki/Smarty/SmartyTiki.php
- lib/core/Tracker/Field/BigBlueButton.php
- lib/core/WikiParser/Parsable.php
- lib/init/initlib.php
- lib/modules/modlib.php
- lib/oauthserver/TikiCryptKey.php
- lib/prefs/server.php
- lib/soap/wsdllib.php
- lib/wiki-plugins/wikiplugin_dbreport.php
- phpstan-tikiCi.neon
- src/php/external_lib_sources/htmlparser/htmlgrammarparser.php
- src/php/external_lib_sources/htmlparser/htmlparser.php
- lib/soap/nusoap/nusoap.php → src/php/external_lib_sources/nusoap/nusoap.php
- tiki-rename_page.php
Changes:
=====================================
lib/Quizzes/Quiz.php
=====================================
@@ -105,14 +105,14 @@ class Quiz
];
$this->id = 0;
$this->bDeleted = 0;
- $this->timestamp = $this->now;
+ $this->timestamp = time();
$this->nAuthor = $userlib->get_user_id($user);
$this->sAuthor = $user;
$this->bOnline = 'n';
$this->nTaken = 'n';
$this->sName = "";
$this->sDescription = "";
- $this->datePub = $this->now;
+ $this->datePub = time();
$this->dateExp = TikiLib::make_time(0, 0, 0, 1, 1, TikiLib::date_format("%Y") + 10);
$this->bRandomQuestions = "y";
$this->nRandomQuestions = 10;
@@ -137,48 +137,6 @@ class Quiz
$this->epilogue = "";
}
- // dump as html text
- /**
- * @return array
- */
- public function show_html()
- {
- $userlib = TikiLib::lib('user');
- $lines = [];
- $lines[] = "id = " . $this->id . "<br />";
- $lines[] = "deleted = " . $this->deleted . "<br />";
- $authorInfo = $userlib->get_userid_info($this->author);
- $lines[] = "author id = " . $this->author . "; author login = " . $authorInfo["login"] . "<br />";
- $lines[] = "version = " . $this->version . "<br />";
- $lines[] = "timestamp = " . $this->date_format("%a, %e %b %Y %H:%M:%S %O", $this->timestamp) . "<br />";
- $lines[] = "online = " . $this->online . "<br />";
- $lines[] = "studentAttempts = " . $this->studentAttempts . "<br />";
- $lines[] = "name = " . $this->name . "<br />";
- $lines[] = "description = " . $this->description . "<br />";
- $lines[] = "datePub = " . $this->date_format("%a, %e %b %Y %H:%M:%S %O", $this->datePub) . "<br />";
- $lines[] = "dateExp = " . $this->date_format("%a, %e %b %Y %H:%M:%S %O", $this->dateExp) . "<br />";
- $lines[] = "nQuestion = " . $this->nQuestion . "<br />";
- $lines[] = "nQuestions = " . $this->nQuestions . "<br />";
- $lines[] = "shuffleQuestions = " . $this->shuffleQuestions . "<br />";
- $lines[] = "shuffleAnswers = " . $this->shuffleAnswers . "<br />";
- $lines[] = "limitDisplay = " . $this->limitDisplay . "<br />";
- $lines[] = "questionsPerPage = " . $this->questionsPerPage . "<br />";
- $lines[] = "timeLimited = " . $this->timeLimited . "<br />";
- $lines[] = "timeLimit = " . $this->timeLimit . "<br />";
- $lines[] = "multiSession = " . $this->multiSession . "<br />";
- $lines[] = "canRepeat = " . $this->canRepeat . "<br />";
- $lines[] = "repetitions = " . $this->repetitions . "<br />";
- $lines[] = "gradingMethod = " . $this->gradingMethod . "<br />";
- $lines[] = "showScore = " . $this->showScore . "<br />";
- $lines[] = "showCorrectAnswers = " . $this->showCorrectAnswers . "<br />";
- $lines[] = "publishStats = " . $this->publishStats . "<br />";
- $lines[] = "additionalQuestions = " . $this->additionalQuestions . "<br />";
- $lines[] = "forum = " . $this->forum . "<br />";
- $lines[] = "forumName = " . $this->forumName . "<br />";
- $lines[] = "data = " . $this->data . "<br />";
- return $lines;
- }
-
// Use any data in the array to replace the instance data.
/**
* @param $data
=====================================
lib/core/Tiki/Command/FakerCommentsCommand.php
=====================================
@@ -17,7 +17,6 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Faker\Factory as FakerFactory;
use TikiLib;
-use Tiki\Faker as TikiFaker;
/**
* Enabled the usage of Faker as a way to load random data to trackers
@@ -144,7 +143,7 @@ class FakerCommentsCommand extends Command
$maxGap = $input->getOption('maxgap');
$faker = FakerFactory::create();
- $tikiFaker = new TikiFaker($faker);
+ $tikiFaker = new \Tiki\Faker($faker); // @phpstan-ignore new.noConstructor (depends on fakerphp/faker installed only through packages)
$faker->addProvider($tikiFaker);
$startDate = $faker->dateTimeBetween($minStart, $maxStart);
=====================================
lib/core/Tiki/Command/FakerTrackerCommand.php
=====================================
@@ -14,7 +14,6 @@ use Symfony\Component\Console\Output\OutputInterface;
use Faker\Factory as FakerFactory;
use Symfony\Component\Console\Attribute\AsCommand;
use TikiLib;
-use Tiki\Faker as TikiFaker;
use Tracker_Definition;
/**
@@ -149,7 +148,7 @@ class FakerTrackerCommand extends Command
/** @var \TrackerLib $trackerLib */
$trackerLib = TikiLib::lib('trk');
$faker = FakerFactory::create();
- $tikiFaker = new TikiFaker($faker);
+ $tikiFaker = new \Tiki\Faker($faker);// @phpstan-ignore new.noConstructor (depends on fakerphp/faker installed only through packages)
$tikiFaker->setTikiFilesReuseFiles($reuseFiles);
$faker->addProvider($tikiFaker);
=====================================
lib/core/Tiki/Package/Extension/Api/Events.php
=====================================
@@ -7,6 +7,7 @@
namespace Tiki\Package\Extension\Api;
use Tiki\Package\Extension\Api;
+use Tiki\Package\ExtensionManager;
class Events extends Api
{
@@ -14,7 +15,8 @@ class Events extends Api
public function isInstalled($folder)
{
- $installed1 = array_keys(self::$parents);
+ $installed1 = array_keys(ExtensionManager::getInstalled()); //Not sure of this fix, line was $installed1 = array_keys(self::$parents);, but most likely this code isn't run. There is no way that worked before. benoitg - 2026-02-16
+
if (str_contains($folder, '/') && ! str_contains($folder, '_')) {
$folder = str_replace('/', '_', $folder);
}
=====================================
lib/core/Tiki/Smarty/SmartyTiki.php
=====================================
@@ -752,7 +752,7 @@ class SmartyTiki extends Smarty
/**
* When calling directly smarty functions, from PHP, you need to provide a object of type \Smarty\Template
- * The method signature for smarty functions is: smarty_function_xxxx($params, \Smarty\Template $template)
+ * The method signature for smarty functions is: smarty_function_xxxx($params, Smarty\Template $template)
*
* @return \Smarty\Template
*/
=====================================
lib/core/Tracker/Field/BigBlueButton.php
=====================================
@@ -221,14 +221,14 @@ class Tracker_Field_BigBlueButton extends \Tracker\Field\AbstractItemField imple
public function getFilterCollection(): Tracker\Filter\Collection
{
- $filters = parent::getFilterCollection();
+ $collection = new Tracker\Filter\Collection($this->getTrackerDefinition());
$permName = $this->getFieldDefinition()['permName'] ?? '';
- $filters->addNew($permName, 'manual')
+ $collection->addNew($permName, 'manual')
->setLabel($this->getFieldDefinition()['name'] ?? '')
->setControl(new Tracker\Filter\Control\TextField("tf_{$permName}"));
- return $filters;
+ return $collection;
}
public function handleSave($value, $oldValue): array
=====================================
lib/core/WikiParser/Parsable.php
=====================================
@@ -150,7 +150,7 @@ class WikiParser_Parsable extends ParserLib
$argumentParser = new WikiParser_PluginArgumentParser();
foreach ($matches as $match) {
- if ($this->option['parseimgonly'] && $this->getName() != 'img') {
+ if ($this->option['parseimgonly'] && $match->getName() != 'img') {
continue;
}
=====================================
lib/init/initlib.php
=====================================
@@ -80,7 +80,7 @@ if (is_dir(__DIR__ . '/../../' . TIKI_VENDOR_CUSTOM_PATH)) {
$packagePath = $fileInfo->getPathname();
if (is_dir($packagePath . '/lib/') && $composerJson = json_decode(file_get_contents($packagePath . '/composer.json'), true)) {
$packageName = $composerJson['name'] ?? '';
- if ($packageName && \Tiki\Package\ExtensionManager::isExtension($packageName, $packagePath) && \Tiki\Package\ExtensionManager::isEnabled($packageName)) {
+ if ($packageName && \Tiki\Package\ExtensionManager::isExtension($packageName, $packagePath) && \Tiki\Package\ExtensionManager::isExtensionEnabled($packageName)) {
$autoloader->addPsr4(str_replace('/', '\\', $packageName) . '\\', $packagePath . '/lib/');
}
}
=====================================
lib/modules/modlib.php
=====================================
@@ -1147,7 +1147,7 @@ class ModLib extends TikiLib
if (! $cachefile || $this->require_cache_build($mod_reference, $cachefile) || $this->is_admin_mode()) {
if ($this->is_admin_mode()) {
- $timer = new Timer('module');
+ $timer = new Timer();
$timer->start('module');
}
if ($info['type'] == "function") { // Use the module name as default module title. This can be overriden later. A module can opt-out of this in favor of a dynamic default title set in the TPL using clear_assign in the main module function. It can also be overwritten in the main module function.
=====================================
lib/oauthserver/TikiCryptKey.php
=====================================
@@ -18,7 +18,7 @@ class TikiCryptKey extends CryptKey
public function getKeyPath()
{
- return new Key($this->key);
+ return $this->key; //This used to be new Key($this->key), which is impossible, Lcobucci\JWT\Signer\Key is an interface. Returned $this->key as per League\OAuth2\Server\CryptKey base implementation, but it doesn't mean that it works. benoitg - 2026-02-16.
}
public function isNullKey()
=====================================
lib/prefs/server.php
=====================================
@@ -14,8 +14,6 @@ function prefs_server_list($partial = false)
// Generating it is extremely costly in terms of memory.
if (class_exists('DateTimeZone')) {
$timezones = DateTimeZone::listIdentifiers();
- } elseif (class_exists('DateTime')) {
- $timezones = array_keys(DateTime::getTimeZoneList());
} else {
$timezones = TikiDate::getTimeZoneList();
$timezones = array_keys($timezones);
=====================================
lib/soap/wsdllib.php
=====================================
@@ -10,7 +10,7 @@ if (str_contains($_SERVER["SCRIPT_NAME"], basename(__FILE__))) {
die;
}
-require_once 'lib/soap/nusoap/nusoap.php';
+require_once 'src/php/external_lib_sources/nusoap/nusoap.php';
class Tiki_Wsdl
{
=====================================
lib/wiki-plugins/wikiplugin_dbreport.php
=====================================
@@ -583,7 +583,7 @@ function wikiplugin_dbreport_parse(&$code)
switch (TikiLib::strtoupper($token->content)) {
case '<':
unset($parse_link);
- $parse_link = new Link($token); // create the link object
+ $parse_link = new Link(); // create the link object
$parse_object->link =& $parse_link;
$parse_link_return = $parse_state; // return to this state
$parse_state = 5; // switch state
@@ -721,7 +721,7 @@ function wikiplugin_dbreport_parse(&$code)
break;
case '<':
unset($parse_link);
- $parse_link = new Link($token); // create the link object
+ $parse_link = new Link(); // create the link object
$parse_line->link =& $parse_link;
$parse_link_return = $parse_state; // return to this state
$parse_state = 5; // switch state
@@ -765,7 +765,7 @@ function wikiplugin_dbreport_parse(&$code)
switch (TikiLib::strtoupper($token->content)) {
case '<':
unset($parse_link);
- $parse_link = new Link($token); // create the link object
+ $parse_link = new Link(); // create the link object
$parse_cell->link =& $parse_link;
$parse_link_return = $parse_state; // return to this state
$parse_state = 5; // switch state
@@ -832,7 +832,7 @@ function wikiplugin_dbreport_parse(&$code)
switch (TikiLib::strtoupper($token->content)) {
case '<':
unset($parse_link);
- $parse_link = new Link($token); // create the link object
+ $parse_link = new Link(); // create the link object
$parse_text->link =& $parse_link;
$parse_link_return = $parse_state; // return to this state
$parse_state = 5; // switch state
@@ -871,7 +871,7 @@ function wikiplugin_dbreport_parse(&$code)
switch (TikiLib::strtoupper($token->content)) {
case '<':
unset($parse_link);
- $parse_link = new Link($token); // create the link object
+ $parse_link = new Link(); // create the link object
$parse_object->link =& $parse_link;
$parse_link_return = $parse_state; // return to this state
$parse_state = 5; // switch state
=====================================
phpstan-tikiCi.neon
=====================================
@@ -10,22 +10,7 @@ parameters:
#customRulesetUsed: true
level: 0
ignoreErrors:
- # This is what I want to fix right now, but let's get the CI plumbing in place first.
- -
- identifier: new.noConstructor
- -
- identifier: new.interface
- -
- identifier: method.notFound
- -
- identifier: staticMethod.notFound
- -
- identifier: staticProperty.notFound
- -
- identifier: property.notFound
- -
- identifier: classConstant.notFound
- # Real bugs or phpstan misconfiguration for sure, but we have to start somewhere
+ # TODO: phpstan level 0 tests representing Real bugs or phpstan misconfiguration for sure
-
identifier: requireOnce.fileNotFound
-
@@ -36,7 +21,7 @@ parameters:
identifier: arguments.count
-
identifier: unset.offset
- # Likely bugs...
+ # TODO: phpstan level 0 tests representing Likely bugs...
-
identifier: unset.variable
-
@@ -51,6 +36,6 @@ parameters:
identifier: variable.undefined
-
identifier: class.nameCase
- # Maybe that still works, but in this day and age...
+ # TODO: phpstan level 0 tests that represents things that Maybe that still work, but in this day and age...
-
identifier: method.staticCall
=====================================
src/php/external_lib_sources/htmlparser/htmlgrammarparser.php
=====================================
@@ -23,6 +23,8 @@ if (! defined("_ECHOSERVER_HTML_GRAMMARPARSER")) {
public $name;
public $allreadyparsed;
public $errors;
+ public $err;
+ public $errstr;
public $errpos;
public $quotstate;
public $firstprev;
@@ -33,6 +35,7 @@ if (! defined("_ECHOSERVER_HTML_GRAMMARPARSER")) {
public $mode;
public $tagname;
public $parname;
+
/**********************************************************************************
* Class constructor
**********************************************************************************/
=====================================
src/php/external_lib_sources/htmlparser/htmlparser.php
=====================================
@@ -91,7 +91,8 @@ if (! defined("_ECHOSERVER_HTML_PARSER")) {
return;
}
if (! $fp = fopen($this->name, "rb")) {
- $this->SetError(1, "Can't open file $this->name.", 0, 0, "Error");
+ //This error handler does not exist, but we don't use that codepath in tiki, so... - benoitg - 2026-02-16
+ //$this->SetError(1, "Can't open file $this->name.", 0, 0, "Error");
return;
}
flock($fp, 1);
=====================================
lib/soap/nusoap/nusoap.php → src/php/external_lib_sources/nusoap/nusoap.php
=====================================
@@ -2202,6 +2202,11 @@ class soap_transport_http extends nusoap_base {
// certpassword: SSL certificate password
// verifypeer: default is 1
// verifyhost: default is 1
+ public $fragment;
+ public $pass;
+ public $query;
+ public $user;
+
/**
* constructor
=====================================
tiki-rename_page.php
=====================================
@@ -53,7 +53,7 @@ if ((isset($_REQUEST["rename"]) || isset($_REQUEST["confirm"])) && $access->chec
// If the new pagename does match userpage prefix then display an error
$newName = isset($_REQUEST["confirm"]) ? $_REQUEST['badname'] : $_REQUEST['newpage'];
if (stristr($newName, $prefs['feature_wiki_userpage_prefix']) == $newName) {
- Feedback::errorAndDie(tra("Cannot rename page because the new name begins with reserved prefix") . ' (' . $prefs['feature_wiki_userpage_prefix'] . ').', \Laminas\Http\Response::STATUS_CODE_4009);
+ Feedback::errorAndDie(tra("Cannot rename page because the new name begins with reserved prefix") . ' (' . $prefs['feature_wiki_userpage_prefix'] . ').', \Laminas\Http\Response::STATUS_CODE_409);
}
$max_pagename_length = $wikilib->max_pagename_length();
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/compare/3555d4bfbbf86e4cfb7eb0340f604c65f84d4067...aac8483d8a24d921203a6ed71189f12975e8ee06
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/compare/3555d4bfbbf86e4cfb7eb0340f604c65f84d4067...aac8483d8a24d921203a6ed71189f12975e8ee06
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs