mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/16955] Clean up composer classes and fix typos in exceptions
PHPBB3-16955
This commit is contained in:
parent
35228ffd62
commit
2aed7ff4e3
6 changed files with 36 additions and 23 deletions
|
@ -29,7 +29,7 @@ class managed_with_clean_error_exception extends managed_with_error_exception
|
||||||
*/
|
*/
|
||||||
public function __construct($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
|
public function __construct($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
|
||||||
{
|
{
|
||||||
parent::__construct($prefix . $message, $parameters, $previous, $code);
|
parent::__construct($prefix, $message, $parameters, $previous, $code);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ class managed_with_enable_error_exception extends managed_with_error_exception
|
||||||
*/
|
*/
|
||||||
public function __construct($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
|
public function __construct($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
|
||||||
{
|
{
|
||||||
parent::__construct($prefix . $message, $parameters, $previous, $code);
|
parent::__construct($prefix, $message, $parameters, $previous, $code);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ class managed_with_error_exception extends runtime_exception
|
||||||
*/
|
*/
|
||||||
public function __construct($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
|
public function __construct($prefix, $message = '', array $parameters = [], \Exception $previous = null, $code = 0)
|
||||||
{
|
{
|
||||||
parent::__construct($prefix . $message, $parameters, $previous, $code);
|
parent::__construct($prefix, $message, $parameters, $previous, $code);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ use phpbb\filesystem\filesystem;
|
||||||
class extension_manager extends manager
|
class extension_manager extends manager
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var manager
|
* @var ext_manager
|
||||||
*/
|
*/
|
||||||
protected $extension_manager;
|
protected $extension_manager;
|
||||||
|
|
||||||
|
@ -102,7 +102,8 @@ class extension_manager extends manager
|
||||||
{
|
{
|
||||||
if ($this->enable_on_install)
|
if ($this->enable_on_install)
|
||||||
{
|
{
|
||||||
$io->writeError([['ENABLING_EXTENSIONS', [], 1]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([['ENABLING_EXTENSIONS', [], 1]]);
|
||||||
foreach ($packages as $package => $version)
|
foreach ($packages as $package => $version)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -111,11 +112,13 @@ class extension_manager extends manager
|
||||||
}
|
}
|
||||||
catch (\phpbb\exception\runtime_exception $e)
|
catch (\phpbb\exception\runtime_exception $e)
|
||||||
{
|
{
|
||||||
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]]);
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
$io->writeError([[$e->getMessage(), [], 4]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([[$e->getMessage(), [], 4]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,7 +129,8 @@ class extension_manager extends manager
|
||||||
*/
|
*/
|
||||||
protected function pre_update(array $packages, IOInterface $io = null)
|
protected function pre_update(array $packages, IOInterface $io = null)
|
||||||
{
|
{
|
||||||
$io->writeError([['DISABLING_EXTENSIONS', [], 1]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([['DISABLING_EXTENSIONS', [], 1]]);
|
||||||
$this->enabled_extensions = [];
|
$this->enabled_extensions = [];
|
||||||
foreach ($packages as $package => $version)
|
foreach ($packages as $package => $version)
|
||||||
{
|
{
|
||||||
|
@ -140,11 +144,13 @@ class extension_manager extends manager
|
||||||
}
|
}
|
||||||
catch (\phpbb\exception\runtime_exception $e)
|
catch (\phpbb\exception\runtime_exception $e)
|
||||||
{
|
{
|
||||||
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]]);
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
$io->writeError([[$e->getMessage(), [], 4]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([[$e->getMessage(), [], 4]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +160,8 @@ class extension_manager extends manager
|
||||||
*/
|
*/
|
||||||
protected function post_update(array $packages, IOInterface $io = null)
|
protected function post_update(array $packages, IOInterface $io = null)
|
||||||
{
|
{
|
||||||
$io->writeError([['ENABLING_EXTENSIONS', [], 1]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([['ENABLING_EXTENSIONS', [], 1]]);
|
||||||
foreach ($this->enabled_extensions as $package)
|
foreach ($this->enabled_extensions as $package)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -163,11 +170,13 @@ class extension_manager extends manager
|
||||||
}
|
}
|
||||||
catch (\phpbb\exception\runtime_exception $e)
|
catch (\phpbb\exception\runtime_exception $e)
|
||||||
{
|
{
|
||||||
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]]);
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
$io->writeError([[$e->getMessage(), [], 4]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([[$e->getMessage(), [], 4]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,7 +204,8 @@ class extension_manager extends manager
|
||||||
{
|
{
|
||||||
if ($this->purge_on_remove)
|
if ($this->purge_on_remove)
|
||||||
{
|
{
|
||||||
$io->writeError([['DISABLING_EXTENSIONS', [], 1]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([['DISABLING_EXTENSIONS', [], 1]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($packages as $package => $version)
|
foreach ($packages as $package => $version)
|
||||||
|
@ -216,11 +226,13 @@ class extension_manager extends manager
|
||||||
}
|
}
|
||||||
catch (\phpbb\exception\runtime_exception $e)
|
catch (\phpbb\exception\runtime_exception $e)
|
||||||
{
|
{
|
||||||
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([[$e->getMessage(), $e->get_parameters(), 4]]);
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
$io->writeError([[$e->getMessage(), [], 4]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([[$e->getMessage(), [], 4]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,7 +256,8 @@ class extension_manager extends manager
|
||||||
if ($this->extension_manager->is_enabled($package))
|
if ($this->extension_manager->is_enabled($package))
|
||||||
{
|
{
|
||||||
$enabled = true;
|
$enabled = true;
|
||||||
$io->writeError([['DISABLING_EXTENSIONS', [], 1]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([['DISABLING_EXTENSIONS', [], 1]]);
|
||||||
$this->extension_manager->disable($package);
|
$this->extension_manager->disable($package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +292,8 @@ class extension_manager extends manager
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$io->writeError([['ENABLING_EXTENSIONS', [], 1]], true);
|
/** @psalm-suppress InvalidArgument */
|
||||||
|
$io->writeError([['ENABLING_EXTENSIONS', [], 1]]);
|
||||||
$this->extension_manager->enable($package);
|
$this->extension_manager->enable($package);
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
|
|
|
@ -147,11 +147,11 @@ class installer
|
||||||
* @param array $packages Packages to install.
|
* @param array $packages Packages to install.
|
||||||
* Each entry may be a name or an array associating a version constraint to a name
|
* Each entry may be a name or an array associating a version constraint to a name
|
||||||
* @param array $whitelist White-listed packages (packages that can be installed/updated/removed)
|
* @param array $whitelist White-listed packages (packages that can be installed/updated/removed)
|
||||||
* @param IOInterface|null $io IO object used for the output
|
* @param io\io_interface|null $io IO object used for the output
|
||||||
*
|
*
|
||||||
* @throws runtime_exception
|
* @throws runtime_exception
|
||||||
*/
|
*/
|
||||||
protected function do_install(array $packages, $whitelist, IOInterface $io = null)
|
protected function do_install(array $packages, $whitelist, io\io_interface $io = null)
|
||||||
{
|
{
|
||||||
if (!$io)
|
if (!$io)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,11 +57,11 @@ interface manager_interface
|
||||||
/**
|
/**
|
||||||
* Tells whether or not a package is managed by Composer.
|
* Tells whether or not a package is managed by Composer.
|
||||||
*
|
*
|
||||||
* @param string $packages Package name
|
* @param string $package Package name
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function is_managed($packages);
|
public function is_managed($package);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of managed packages for the current type
|
* Returns the list of managed packages for the current type
|
||||||
|
|
Loading…
Add table
Reference in a new issue