[ticket/16955] Clean up debug, event, and extension classes

PHPBB3-16955
This commit is contained in:
Marc Alexander 2022-12-26 22:46:43 +01:00
parent e1a3b6b552
commit de9019d64e
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
6 changed files with 20 additions and 13 deletions

View file

@ -15,8 +15,14 @@ namespace phpbb\debug;
use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\Debug\ErrorHandler;
/**
* @psalm-suppress InvalidExtendClass
*/
class error_handler extends ErrorHandler class error_handler extends ErrorHandler
{ {
/**
* @psalm-suppress MethodSignatureMismatch
*/
public function handleError($type, $message, $file, $line) public function handleError($type, $message, $file, $line)
{ {
if ($type === E_USER_WARNING || $type === E_USER_NOTICE) if ($type === E_USER_WARNING || $type === E_USER_NOTICE)

View file

@ -461,7 +461,7 @@ class md_exporter
* Validate "Changed" Information * Validate "Changed" Information
* *
* @param string $changed * @param string $changed
* @return string * @return array{string, string} Changed information containing version and description in respective order
* @throws \LogicException * @throws \LogicException
*/ */
public function validate_changed($changed) public function validate_changed($changed)
@ -481,7 +481,7 @@ class md_exporter
throw new \LogicException("Invalid changed information found for event '{$this->current_event}'"); throw new \LogicException("Invalid changed information found for event '{$this->current_event}'");
} }
return array($version, $description); return [$version, $description];
} }
/** /**
@ -492,7 +492,7 @@ class md_exporter
*/ */
public function validate_version($version) public function validate_version($version)
{ {
return preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?$#', $version); return (bool) preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?$#', $version);
} }
/** /**

View file

@ -148,8 +148,9 @@ class php_exporter
$files = array(); $files = array();
foreach ($iterator as $file_info) foreach ($iterator as $file_info)
{ {
/** @var \RecursiveDirectoryIterator $file_info */ /** @var \RecursiveDirectoryIterator $inner_iterator */
$relative_path = $iterator->getInnerIterator()->getSubPathname(); $inner_iterator = $iterator->getInnerIterator();
$relative_path = $inner_iterator->getSubPathname();
$files[] = str_replace(DIRECTORY_SEPARATOR, '/', $relative_path); $files[] = str_replace(DIRECTORY_SEPARATOR, '/', $relative_path);
} }

View file

@ -41,7 +41,9 @@ class recursive_event_filter_iterator extends \RecursiveFilterIterator
*/ */
public function getChildren() public function getChildren()
{ {
return new self($this->getInnerIterator()->getChildren(), $this->root_path); $inner_iterator = $this->getInnerIterator();
assert($inner_iterator instanceof \RecursiveIterator);
return new self($inner_iterator->getChildren(), $this->root_path);
} }
/** /**

View file

@ -35,7 +35,7 @@ class base implements \phpbb\extension\extension_interface
/** @var string */ /** @var string */
protected $extension_path; protected $extension_path;
/** @var string[]|bool */ /** @var string[]|false */
private $migrations = false; private $migrations = false;
/** /**
@ -69,7 +69,7 @@ class base implements \phpbb\extension\extension_interface
* Single enable step that installs any included migrations * Single enable step that installs any included migrations
* *
* @param mixed $old_state State returned by previous call of this method * @param mixed $old_state State returned by previous call of this method
* @return false Indicates no further steps are required * @return bool True if further steps are necessary, otherwise false
*/ */
public function enable_step($old_state) public function enable_step($old_state)
{ {
@ -95,7 +95,7 @@ class base implements \phpbb\extension\extension_interface
* Single purge step that reverts any included and installed migrations * Single purge step that reverts any included and installed migrations
* *
* @param mixed $old_state State returned by previous call of this method * @param mixed $old_state State returned by previous call of this method
* @return false Indicates no further steps are required * @return bool True if further steps are necessary, otherwise false
*/ */
public function purge_step($old_state) public function purge_step($old_state)
{ {
@ -135,8 +135,6 @@ class base implements \phpbb\extension\extension_interface
$this->migrator->set_migrations($migrations); $this->migrator->set_migrations($migrations);
$migrations = $this->migrator->get_migrations(); return $this->migrator->get_migrations();
return $migrations;
} }
} }

View file

@ -69,7 +69,7 @@ class manager
/** /**
* Loads all extension information from the database * Loads all extension information from the database
* *
* @return null * @return void
*/ */
public function load_extensions() public function load_extensions()
{ {