Skip to content

Commit

Permalink
chore: final classes & unused imports
Browse files Browse the repository at this point in the history
- Add 'final' keyword to classes that are not meant to be extended
- Remove unused imports
  • Loading branch information
PAXANDDOS committed Mar 21, 2023
1 parent 010bc56 commit 07e879c
Show file tree
Hide file tree
Showing 28 changed files with 13 additions and 39 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
'phpdoc_types' => true,
'phpdoc_scalar' => true,
'phpdoc_align' => true,
'no_unused_imports' => true,
'array_syntax' => ['syntax' => 'short'],
'header_comment' => ['header' => $header],
])
Expand Down
3 changes: 0 additions & 3 deletions bin/resque
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
* file that was distributed with this source code.
*/

/**
* The main point of entry for the php-resque commands
*/
if (!ini_get('date.timezone') or ! date_default_timezone_get()) {
date_default_timezone_set('UTC');
}
Expand Down
9 changes: 2 additions & 7 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use InvalidArgumentException;
use Resque\Helpers\Util;
use Resque\Redis;
use RuntimeException;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Yaml;
Expand All @@ -24,7 +23,7 @@
* @package Resque
* @author Paul Litovka
*/
class Config
final class Config
{
/**
* Default config file name
Expand All @@ -51,10 +50,8 @@ class Config
* Reads and loads data from a config file
*
* @param string $file The config file path
*
* @return bool
*/
public static function loadConfig(string $file = self::DEFAULT_CONFIG_FILE): bool
public static function loadConfig(string $file = self::DEFAULT_CONFIG_FILE): void
{
static::$config = static::parseConfig($file);

Expand All @@ -68,8 +65,6 @@ public static function loadConfig(string $file = self::DEFAULT_CONFIG_FILE): boo
'phpiredis' => static::read('redis.phpiredis', Redis::DEFAULT_PHPIREDIS),
'predis' => static::read('predis'),
]);

return true;
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Resque\Console\Command;

use Resque\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Clear.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Resque\Console\Command;

use Resque\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down
2 changes: 0 additions & 2 deletions src/Console/Command/Hosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace Resque\Console\Command;

use Resque\Resque;
use Resque\Console\Command\Command;
use Resque\Host;
use Resque\Redis;
use Symfony\Component\Console\Input\InputInterface;
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Queues.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Resque\Console\Command;

use Resque\Console\Command\Command;
use Resque\Queue;
use Resque\Redis;
use Symfony\Component\Console\Input\InputInterface;
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Socket/Connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Resque\Console\Command\Socket;

use Resque\Resque;
use Resque\Console\Command\Command;
use Resque\Socket\Server;
use Symfony\Component\Console\Input\InputInterface;
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Socket/Receive.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Resque\Console\Command\Socket;

use Resque\Resque;
use Resque\Job;
use Resque\Host;
use Resque\Worker;
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Socket/Send.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Resque\Console\Command\Socket;

use Resque\Resque;
use Resque\Console\Command\Command;
use Resque\Socket\Server;
use Symfony\Component\Console\Input\InputArgument;
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/SpeedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Resque\Console\Command;

use Resque\Console\Command\Command;
use Resque\Redis;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Worker/Cancel.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Resque\Console\Command\Worker;

use Resque\Resque;
use Resque\Console\Command\Command;
use Resque\Worker;
use Symfony\Component\Console\Input\InputArgument;
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Worker/Pause.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Resque\Console\Command\Worker;

use Resque\Resque;
use Resque\Console\Command\Command;
use Resque\Worker;
use Symfony\Component\Console\Input\InputArgument;
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Worker/Restart.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Resque\Console\Command\Worker;

use Resque\Resque;
use Resque\Console\Command\Command;
use Resque\Worker;
use Symfony\Component\Console\Input\InputArgument;
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Worker/Resume.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Resque\Console\Command\Worker;

use Resque\Resque;
use Resque\Console\Command\Command;
use Resque\Worker;
use Symfony\Component\Console\Input\InputArgument;
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/Worker/Stop.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Resque\Console\Command\Worker;

use Resque\Resque;
use Resque\Console\Command\Command;
use Resque\Worker;
use Symfony\Component\Console\Input\InputArgument;
Expand Down
2 changes: 0 additions & 2 deletions src/Console/Command/Workers.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace Resque\Console\Command;

use Resque\Resque;
use Resque\Console\Command\Command;
use Resque\Helpers\Util;
use Resque\Worker;
use Symfony\Component\Console\Input\InputInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @package Resque
* @author Michael Haynes
*/
class Event
final class Event
{
// Worker event constants
public const WORKER_INSTANCE = 100;
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/CatchOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @package Resque
* @author Michael Haynes
*/
class CatchOutput extends \Symfony\Component\Console\Output\Output
final class CatchOutput extends \Symfony\Component\Console\Output\Output
{
/**
* @var string Stored output string
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/ClosureJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @package Resque
* @author Michael Haynes
*/
class ClosureJob
final class ClosureJob
{
/**
* Fire the Closure based queue job.
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/SerializableClosure.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @package Resque
* @author Michael Haynes
*/
class SerializableClosure
final class SerializableClosure
{
/**
* The Closure instance.
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/Stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @package Resque
* @author Michael Haynes
*/
class Stats
final class Stats
{
public const DEFAULT_KEY = 'stats';

Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @package Resque
* @author Michael Haynes
*/
class Table
final class Table
{
/**
* @var TableHelper
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @package Resque
* @author Michael Haynes
*/
class Util
final class Util
{
/**
* Returns human readable sizes. Based on original functions written by
Expand Down
2 changes: 1 addition & 1 deletion src/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @package Resque
* @author Michael Haynes
*/
class Logger
final class Logger
{
/**
* Detailed debug information
Expand Down
2 changes: 1 addition & 1 deletion src/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @package Resque
* @author Michael Haynes
*/
class Queue
final class Queue
{
/**
* @var Redis The Redis instance
Expand Down
2 changes: 1 addition & 1 deletion src/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @package Resque
* @author Michael Haynes
*/
class Redis
final class Redis
{
/**
* Default Redis connection scheme
Expand Down
3 changes: 0 additions & 3 deletions src/Resque.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

namespace Resque;

use Resque\Redis;
use Resque\Queue;

/**
* Main Resque class
*
Expand Down

0 comments on commit 07e879c

Please sign in to comment.