Skip to content

Commit 8a00ea4

Browse files
committed
Fix codestyle
1 parent 8d3142d commit 8a00ea4

File tree

17 files changed

+137
-146
lines changed

17 files changed

+137
-146
lines changed

ruleset.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
<exclude-pattern type="relative">src/administrator/manifests/packages/**/script\.php</exclude-pattern>
2828
</rule>
2929

30+
<rule ref="PSR1.Classes.ClassDeclaration">
31+
<exclude-pattern type="relative">src/administrator/components/**/script\.php</exclude-pattern>
32+
</rule>
33+
3034
<rule ref="Squiz.Classes.ValidClassName">
3135
<exclude-pattern type="relative">src/administrator/components/**/script\.php</exclude-pattern>
3236
<exclude-pattern type="relative">src/administrator/manifests/packages/**/script\.php</exclude-pattern>

src/administrator/components/com_patchtester/services/provider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @license GNU General Public License version 2 or later
88
*/
99

10-
defined('_JEXEC') or die;
10+
\defined('_JEXEC') or die;
1111

1212
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
1313
use Joomla\CMS\Extension\ComponentInterface;
@@ -41,7 +41,7 @@ public function register(Container $container)
4141
$container->set(
4242
ComponentInterface::class,
4343
function (Container $container) {
44-
require_once dirname(__DIR__) . '/vendor/autoload.php';
44+
require_once \dirname(__DIR__) . '/vendor/autoload.php';
4545

4646
$component = new PatchtesterComponent($container->get(ComponentDispatcherFactoryInterface::class));
4747

src/administrator/components/com_patchtester/src/Controller/ApplyController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function execute($task): void
3939
try {
4040
/** @var PullModel $model */
4141
$model = Factory::getApplication()->bootComponent('com_patchtester')->getMVCFactory()->createModel('Pull', 'Administrator', ['ignore_request' => true]);
42-
$msg = Text::_('COM_PATCHTESTER_NO_FILES_TO_PATCH');
42+
$msg = Text::_('COM_PATCHTESTER_NO_FILES_TO_PATCH');
4343

4444
if ($model->apply($this->input->getUint('pull_id'))) {
4545
$msg = Text::_('COM_PATCHTESTER_APPLY_OK');

src/administrator/components/com_patchtester/src/Controller/FetchController.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
namespace Joomla\Component\Patchtester\Administrator\Controller;
1111

12-
use Exception;
1312
use Joomla\CMS\Factory;
1413
use Joomla\CMS\Language\Text;
1514
use Joomla\CMS\MVC\Controller\BaseController;
@@ -32,7 +31,7 @@ class FetchController extends BaseController
3231
*
3332
* @return void Redirects the application
3433
*
35-
* @throws Exception
34+
* @throws \Exception
3635
* @since 2.0
3736
*/
3837
public function execute($task)
@@ -50,7 +49,7 @@ public function execute($task)
5049
$model = $this->app->bootComponent('com_patchtester')->getMVCFactory()->createModel('Pulls', 'Administrator');
5150

5251
$status = $model->requestFromGithub($page);
53-
} catch (Exception $e) {
52+
} catch (\Exception $e) {
5453
$response = new JsonResponse($e);
5554
$this->app->sendHeaders();
5655
echo json_encode($response);
@@ -64,7 +63,7 @@ public function execute($task)
6463
if ($status['complete'] || $page === $session->get('com_patchtester_fetcher_last_page', false)) {
6564
$status['complete'] = true;
6665
$status['header'] = Text::_('COM_PATCHTESTER_FETCH_SUCCESSFUL', true);
67-
$message = Text::_('COM_PATCHTESTER_FETCH_COMPLETE_CLOSE_WINDOW', true);
66+
$message = Text::_('COM_PATCHTESTER_FETCH_COMPLETE_CLOSE_WINDOW', true);
6867
} elseif (isset($status['page'])) {
6968
$session->set('com_patchtester_fetcher_page', $status['page']);
7069
$message = Text::sprintf('COM_PATCHTESTER_FETCH_PAGE_NUMBER', $status['page']);

src/administrator/components/com_patchtester/src/Controller/ResetController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function execute($task): void
4343
try {
4444
$hasErrors = false;
4545
$revertErrored = false;
46-
$mvcFactory = Factory::getApplication()->bootComponent('com_patchtester')->getMVCFactory();
46+
$mvcFactory = Factory::getApplication()->bootComponent('com_patchtester')->getMVCFactory();
4747
/** @var PullModel $pullModel */
4848
$pullModel = $mvcFactory->createModel('Pull', 'Administrator', ['ignore_request' => true]);
4949
/** @var PullsModel $pullModel */
@@ -53,7 +53,7 @@ public function execute($task): void
5353

5454
// Check the applied patches in the database first
5555
$appliedPatches = $testsModel->getAppliedPatches();
56-
$params = ComponentHelper::getParams('com_patchtester');
56+
$params = ComponentHelper::getParams('com_patchtester');
5757
// Decide based on repository settings whether patch will be applied through Github or CIServer
5858
if ((bool) $params->get('ci_switch', 1)) {
5959
// Let's try to cleanly revert all applied patches with ci
@@ -65,7 +65,7 @@ public function execute($task): void
6565
}
6666
}
6767
} else {
68-
// Let's try to cleanly revert all applied patches
68+
// Let's try to cleanly revert all applied patches
6969
foreach ($appliedPatches as $patch) {
7070
try {
7171
$pullModel->revertWithGitHub($patch->id);
@@ -104,7 +104,7 @@ public function execute($task): void
104104
// Check the backups directory to see if any .txt files remain; clear them if so
105105
$backups = Folder::files(JPATH_COMPONENT . '/backups', '.txt');
106106

107-
if (count($backups)) {
107+
if (\count($backups)) {
108108
foreach ($backups as $file) {
109109
if (!File::delete(JPATH_COMPONENT . '/backups/' . $file)) {
110110
$this->app->enqueueMessage(

src/administrator/components/com_patchtester/src/Controller/StartfetchController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function execute($task): void
7171
$testsModel = Factory::getApplication()->bootComponent('com_patchtester')->getMVCFactory()->createModel('Tests', 'Administrator', ['ignore_request' => true]);
7272
try {
7373
// Sanity check, ensure there aren't any applied patches
74-
if (count($testsModel->getAppliedPatches()) >= 1) {
74+
if (\count($testsModel->getAppliedPatches()) >= 1) {
7575
$response = new JsonResponse(new \Exception(Text::_('COM_PATCHTESTER_ERROR_APPLIED_PATCHES'), 500));
7676
$this->app->sendHeaders();
7777
echo json_encode($response);
@@ -89,7 +89,7 @@ public function execute($task): void
8989
$response = new JsonResponse(
9090
[
9191
'complete' => false,
92-
'header' => Text::_('COM_PATCHTESTER_FETCH_PROCESSING', true)
92+
'header' => Text::_('COM_PATCHTESTER_FETCH_PROCESSING', true),
9393
],
9494
Text::sprintf('COM_PATCHTESTER_FETCH_PAGE_NUMBER', 1),
9595
false,

src/administrator/components/com_patchtester/src/Exception/UnexpectedResponse.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@
99

1010
namespace Joomla\Component\Patchtester\Administrator\Exception;
1111

12-
use DomainException;
13-
use Exception;
1412
use Joomla\Http\Response;
1513

1614
/**
1715
* Exception representing an unexpected response
1816
*
1917
* @since 3.0.0
2018
*/
21-
class UnexpectedResponse extends DomainException
19+
class UnexpectedResponse extends \DomainException
2220
{
2321
/**
2422
* The Response object.
@@ -34,15 +32,15 @@ class UnexpectedResponse extends DomainException
3432
* @param Response $response The Response object.
3533
* @param string $message The Exception message to throw.
3634
* @param int $code The Exception code.
37-
* @param Exception|null $previous The previous exception used for the exception chaining.
35+
* @param \Exception|null $previous The previous exception used for the exception chaining.
3836
*
3937
* @since 3.0.0
4038
*/
4139
public function __construct(
4240
Response $response,
4341
$message = '',
4442
$code = 0,
45-
Exception $previous = null
43+
?\Exception $previous = null
4644
) {
4745
parent::__construct($message, $code, $previous);
4846
$this->response = $response;

src/administrator/components/com_patchtester/src/Field/BranchField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class BranchField extends ListField
4141
*/
4242
public function getOptions(): array
4343
{
44-
$db = Factory::getContainer()->get('DatabaseDriver');
44+
$db = Factory::getContainer()->get('DatabaseDriver');
4545
$query = $db->getQuery(true);
4646
$query->select(
4747
'DISTINCT(' . $db->quoteName('branch') . ') AS ' . $db->quoteName(

src/administrator/components/com_patchtester/src/Field/LabelField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class LabelField extends ListField
4141
*/
4242
public function getOptions(): array
4343
{
44-
$db = Factory::getContainer()->get('DatabaseDriver');
44+
$db = Factory::getContainer()->get('DatabaseDriver');
4545
$query = $db->getQuery(true);
4646
$query->select(
4747
'DISTINCT(' . $db->quoteName('name') . ') AS ' . $db->quoteName(

src/administrator/components/com_patchtester/src/GitHub/GitHub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class GitHub
4646
*
4747
* @since 3.0.0
4848
*/
49-
public function __construct(Registry $options = null, Http $client = null)
49+
public function __construct(?Registry $options = null, ?Http $client = null)
5050
{
5151
$this->options = $options ?: new Registry();
5252
$this->client = $client ?: HttpFactory::getHttp($options);

0 commit comments

Comments
 (0)