Your project must not contain invalid function or method calls
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_call
- *
- * @return mixed
- */
- protected static function invoke(string $method, array $arguments)
- {
- return call_user_func_array([self::$engine, $method], $arguments);
- }
- /**
- * @throws FlashSingletonException
- */
Your project should not use invalid parameter and return typehints 6
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_typehint
- * @param string $method - method to invoke
- * @param array $arguments - arguments for method
- *
- * @return mixed
- */
- public static function __callStatic(string $method, array $arguments)
- {
- new self();
- return self::invoke($method, $arguments);
- }
- * @param string $method - method to invoke
- * @param array $arguments - arguments for method
- *
- * @return mixed
- */
- protected static function invoke(string $method, array $arguments)
- {
- return call_user_func_array([self::$engine, $method], $arguments);
- }
- /**
- * @param string $method - method to invoke
- * @param array $arguments - arguments for method
- *
- * @return mixed
- */
- public function __call(string $method, array $arguments)
- {
- return $this->invoke($method, $arguments);
- }
- /**
- /**
- * @param array $session
- * @param string|null $type
- * @return bool
- */
- private function isReadyForDisplay(array $session, ?string $type = null): bool
- {
- $isEmptySession = empty($session);
- $isTypeNotInSession = ! is_null($type) && ! array_key_exists($type, $session);
- $isTypeNotInTypes = ! is_null($type) && ! $this->hasMessageType($type);
- * @param array $flashes - array of messages to show
- * @param string $type - message type: success, info, warning, error
- *
- * @return string - HTML with flash messages
- */
- protected function compileMessages(array $flashes, string $type): string
- {
- $messages = '';
- foreach ($flashes as $msg) {
- $messages .= $this->template->getTemplate()->wrapMessage($msg);
- }
- protected function getSession(): array
- {
- return $_SESSION[$this->key];
- }
- protected function setSession(array $session): void
- {
- $_SESSION[$this->key] = $session;
- }
- }
Your project should not use invalid return types
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_return_typehint
- public static function create(string $name = Templates::BASE): TemplateInterface
- {
- $class = __NAMESPACE__ . '\\Templates\\' . ucwords($name) . 'Template';
- if (class_exists($class)) {
- return new $class();
- }
- throw new FlashTemplateNotFoundException("Template \"{$name}\" not found!");
- }
- }
Your project should use return types
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.missing_return_typehint
- if ( ! array_key_exists($this->key, $_SESSION)) {
- $_SESSION[$this->key] = [];
- }
- }
- protected function getSession(): array
- {
- return $_SESSION[$this->key];
- }
- protected function setSession(array $session): void
Your project is using a unnecessary isset call
- Read doc
- Productivity
- Minor
More information: https://insight.symfony.com/what-we-analyse/php.invalid_isset_use
- {
- if ($assigned = is_null($template)) {
- $template = TemplateFactory::create();
- }
- if ( ! $assigned || ! isset(self::$engine)) {
- self::$engine = new Engine($template);
- }
- }
- /**