Your project should not use invalid parameter and return typehints 6

More information: https://insight.symfony.com/what-we-analyse/php.invalid_typehint

in src/Flash.php, line 84
  1. * @param string $method - method to invoke
  2. * @param array $arguments - arguments for method
  3. *
  4. * @return mixed
  5. */
  6. protected static function invoke(string $method, array $arguments)
    Method Tamtamchik\SimpleFlash\Flash::invoke() has parameter $arguments with no value type specified in iterable type array.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Yuri Tkachenko
  7. {
  8. return call_user_func_array([self::$engine, $method], $arguments);
  9. }
  10. /**
in src/Flash.php, line 69
  1. * @param string $method - method to invoke
  2. * @param array $arguments - arguments for method
  3. *
  4. * @return mixed
  5. */
  6. public static function __callStatic(string $method, array $arguments)
    Method Tamtamchik\SimpleFlash\Flash::__callStatic() has parameter $arguments with no value type specified in iterable type array.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Yuri Tkachenko
  7. {
  8. new self();
  9. return self::invoke($method, $arguments);
  10. }
in src/Flash.php, line 105
  1. * @param string $method - method to invoke
  2. * @param array $arguments - arguments for method
  3. *
  4. * @return mixed
  5. */
  6. public function __call(string $method, array $arguments)
    Method Tamtamchik\SimpleFlash\Flash::__call() has parameter $arguments with no value type specified in iterable type array.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Yuri Tkachenko
  7. {
  8. return $this->invoke($method, $arguments);
  9. }
  10. /**
  1. protected function getSession(): array
  2. {
  3. return $_SESSION[$this->key];
  4. }
  5. protected function setSession(array $session): void
    Method Tamtamchik\SimpleFlash\Core\SessionManager::setSession() has parameter $session with no value type specified in iterable type array.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Yuri Tkachenko
  6. {
  7. $_SESSION[$this->key] = $session;
  8. }
  9. }
  1. * @param array $flashes - array of messages to show
  2. * @param string $type - message type: success, info, warning, error
  3. *
  4. * @return string - HTML with flash messages
  5. */
  6. protected function compileMessages(array $flashes, string $type): string
    Method Tamtamchik\SimpleFlash\Core\MessageManager::compileMessages() has parameter $flashes with no value type specified in iterable type array.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Yuri Tkachenko
  7. {
  8. $messages = '';
  9. foreach ($flashes as $msg) {
  10. $messages .= $this->template->getTemplate()->wrapMessage($msg);
  11. }
in src/Core/Engine.php, line 100
  1. /**
  2. * @param array $session
  3. * @param string|null $type
  4. * @return bool
  5. */
  6. private function isReadyForDisplay(array $session, ?string $type = null): bool
    Method Tamtamchik\SimpleFlash\Core\Engine::isReadyForDisplay() has parameter $session with no value type specified in iterable type array.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Yuri Tkachenko
  7. {
  8. $isEmptySession = empty($session);
  9. $isTypeNotInSession = ! is_null($type) && ! array_key_exists($type, $session);
  10. $isTypeNotInTypes = ! is_null($type) && ! $this->hasMessageType($type);

Your project must not contain invalid function or method calls

More information: https://insight.symfony.com/what-we-analyse/php.invalid_call

in src/Flash.php, line 86
  1. *
  2. * @return mixed
  3. */
  4. protected static function invoke(string $method, array $arguments)
  5. {
  6. return call_user_func_array([self::$engine, $method], $arguments);
    Parameter #1 $function of function call_user_func_array expects callable(): mixed, array{Tamtamchik\SimpleFlash\Core\Engine, string} given.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Yuri Tkachenko
  7. }
  8. /**
  9. * @throws FlashSingletonException
  10. */

Your project should not use invalid return types

More information: https://insight.symfony.com/what-we-analyse/php.invalid_return_typehint

  1. public static function create(string $name = Templates::BASE): TemplateInterface
  2. {
  3. $class = __NAMESPACE__ . '\\Templates\\' . ucwords($name) . 'Template';
  4. if (class_exists($class)) {
  5. return new $class();
    Method Tamtamchik\SimpleFlash\TemplateFactory::create() should return Tamtamchik\SimpleFlash\TemplateInterface but returns object.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Yuri Tkachenko
  6. }
  7. throw new FlashTemplateNotFoundException("Template \"{$name}\" not found!");
  8. }
  9. }

Your project should use return types

More information: https://insight.symfony.com/what-we-analyse/php.missing_return_typehint

  1. if ( ! array_key_exists($this->key, $_SESSION)) {
  2. $_SESSION[$this->key] = [];
  3. }
  4. }
  5. protected function getSession(): array
    Method Tamtamchik\SimpleFlash\Core\SessionManager::getSession() return type has no value type specified in iterable type array.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Yuri Tkachenko
  6. {
  7. return $_SESSION[$this->key];
  8. }
  9. protected function setSession(array $session): void

Your project is using a unnecessary isset call

More information: https://insight.symfony.com/what-we-analyse/php.invalid_isset_use

in src/Flash.php, line 56
  1. {
  2. if ($assigned = is_null($template)) {
  3. $template = TemplateFactory::create();
  4. }
  5. if ( ! $assigned || ! isset(self::$engine)) {
    Static property Tamtamchik\SimpleFlash\Flash::$engine (Tamtamchik\SimpleFlash\Core\Engine) in isset() is not nullable.
    Time to fix: about 9 minutes
    Read doc Permalink Copy Prompt
    Last edited by Yuri Tkachenko
  6. self::$engine = new Engine($template);
  7. }
  8. }
  9. /**