Skip to content

Conversation

@sgiehl
Copy link
Member

@sgiehl sgiehl commented Nov 21, 2025

Description

Checklist

  • [NA] I have understood, reviewed, and tested all AI outputs before use
  • [NA] All AI instructions respect security, IP, and privacy rules

Review

@sgiehl sgiehl added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Technical debt Issues the will help to reduce technical debt labels Nov 21, 2025
@sgiehl sgiehl added this to the 5.7.0 milestone Nov 21, 2025
@sgiehl sgiehl force-pushed the dev-19713 branch 2 times, most recently from 1d6db1b to 5e516bd Compare November 21, 2025 15:42
* @return mixed
* @template T of object
* @param class-string<T>|string $name Container entry name.
* @return ($name is class-string<T> ? T : mixed)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should ensure that for something like StaticContainer('Piwik/Auth') an object of Piwik/Auth will be expected as returned value.

{
$tasks = array();

/** @var Tasks[] $pluginTasks */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect type hint, as findComponents actually returns class names not objects.

public static function findAvailableSmsProviders()
{
/** @var SMSProvider[] $smsProviders */
$smsProviders = Plugin\Manager::getInstance()->findMultipleComponents('SMSProvider', 'Piwik\Plugins\MobileMessaging\SMSProvider');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findMultipleComponents returns an array of class names, not objects.

}

$auth = StaticContainer::get('Piwik\Auth');
if ($auth && !$auth->getLogin() && method_exists($auth, 'getTokenAuth') && $auth->getTokenAuth()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Piwik\Auth object can't be created an exception should be thrown, so checking for its existence should be unneeded.

Comment on lines +68 to +69
$string = $env->getRuntime(\Twig\Runtime\EscaperRuntime::class)
->escape($string, $strategy, $charset, $autoescape);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

´twig_escape_filter´ is deprecated since a while already, so using an alternative way to achieve the same result.

$this->twig->addFilter($percentage);
}

private function getProfessionalServicesAdvertising()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method was unused

* @param int $key (don't care)
* @param string $path Piwik root
*/
public static function addPiwikPath(&$value, $key, $path)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another unused method

@sgiehl sgiehl requested a review from a team November 21, 2025 15:49

/**
* @template T of object
* @param class-string<T>|string $name Container entry name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add this too?

Suggested change
* @param class-string<T>|string $name Container entry name.
* @param class-string<T>|string $name Container entry name.
* @throws NotFoundException

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be "auto-detectable"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure to understand what you mean here. There is no need to precise it since it’s auto-detectable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's something we need to decide in general. I'm currently only trying to add type hints for those variables, where the code doesn't or can't define the explicitly. We can for sure consider to add doc blocks that contain everything, but that will also cause more maintaining work to keep everything up to date

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Technical debt Issues the will help to reduce technical debt

Development

Successfully merging this pull request may close these issues.

3 participants