Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 9 additions & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\StrictStringParamConcatRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withSets([
LevelSetList::UP_TO_PHP_80,
SetList::TYPE_DECLARATION,
])
->withSkip([
StrictStringParamConcatRector::class => [
__DIR__ . '/src/Database/Adapters/Idiorm/Statements/Criteria.php',
],
]);
3 changes: 0 additions & 3 deletions src/App/Adapters/AppAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ abstract class AppAdapter implements AppInterface
{
use AppTrait;

/**
* @var string
*/
private static string $baseDir;

/**
Expand Down
10 changes: 0 additions & 10 deletions src/App/Adapters/ConsoleAppAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,10 @@ class ConsoleAppAdapter extends AppAdapter
{
use ConsoleAppTrait;

/**
* @var ArgvInput
*/
protected ArgvInput $input;

/**
* @var ConsoleOutput
*/
protected ConsoleOutput $output;

/**
* @var Application|null
*/
protected ?Application $application = null;

public function __construct()
Expand All @@ -69,7 +60,6 @@ public function __construct()
}

/**
* @return int|null
* @throws DiException
* @throws EnvException
* @throws BaseException
Expand Down
3 changes: 1 addition & 2 deletions src/App/Adapters/WebAppAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public function __construct()

/**
* Starts the web app
* @return int|null
* @throws BaseException
* @throws ConfigException
* @throws CsrfException
Expand Down Expand Up @@ -147,7 +146,7 @@ public function start(): ?int
}

$dispatcher = new RouteDispatcher();
$dispatcher->dispatch($matchedRoute, $this->request, $this->response);
$dispatcher->dispatch($matchedRoute, $this->request);
stop();
} catch (StopExecutionException $exception) {
$this->handleCors($this->response);
Expand Down
26 changes: 3 additions & 23 deletions src/App/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,51 +34,31 @@ class App
*/
public const CONSOLE = 'console';

/**
* @var string
*/
private static $baseDir;
private static ?string $baseDir = null;

/**
* @var AppInterface
*/
private $adapter;
private AppInterface $adapter;

/**
* @param AppInterface $adapter
*/
public function __construct(AppInterface $adapter)
{
$this->adapter = $adapter;
}

/**
* @param string $baseDir
*/
public static function setBaseDir(string $baseDir)
public static function setBaseDir(string $baseDir): void
{
self::$baseDir = $baseDir;
}

/**
* @return string
*/
public static function getBaseDir(): string
{
return self::$baseDir;
}

/**
* @return AppInterface
*/
public function getAdapter(): AppInterface
{
return $this->adapter;
}

/**
* @param string $method
* @param array|null $arguments
* @return mixed
* @throws BaseException
*/
Expand Down
1 change: 0 additions & 1 deletion src/App/Contracts/AppInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interface AppInterface
{
/**
* Starts the app
* @return int|null
*/
public function start(): ?int;
}
3 changes: 0 additions & 3 deletions src/App/Exceptions/AppException.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
*/
class AppException extends BaseException
{
/**
* @return AppException
*/
public static function missingAppKey(): self
{
return new self(
Expand Down
17 changes: 0 additions & 17 deletions src/App/Exceptions/BaseException.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,12 @@
*/
abstract class BaseException extends Exception
{
/**
* @param string $message
* @param int $code
*/
final public function __construct(string $message = '', int $code = 0)
{
parent::__construct($message, $code);
}

/**
* @param string $methodName
* @param string $className
* @return static
*/
public static function methodNotSupported(string $methodName, string $className)
Expand All @@ -48,7 +42,6 @@ public static function methodNotSupported(string $methodName, string $className)
}

/**
* @param string $name
* @return static
*/
public static function adapterNotSupported(string $name)
Expand All @@ -60,7 +53,6 @@ public static function adapterNotSupported(string $name)
}

/**
* @param string $name
* @return static
*/
public static function driverNotSupported(string $name)
Expand All @@ -72,7 +64,6 @@ public static function driverNotSupported(string $name)
}

/**
* @param string $name
* @return static
*/
public static function fileNotFound(string $name)
Expand All @@ -84,8 +75,6 @@ public static function fileNotFound(string $name)
}

/**
* @param string $subject
* @param string $name
* @return static
*/
public static function notFound(string $subject, string $name)
Expand All @@ -97,8 +86,6 @@ public static function notFound(string $subject, string $name)
}

/**
* @param string $instance
* @param string $name
* @return static
*/
public static function notInstanceOf(string $instance, string $name)
Expand All @@ -110,7 +97,6 @@ public static function notInstanceOf(string $instance, string $name)
}

/**
* @param string $name
* @return static
*/
public static function cantConnect(string $name)
Expand All @@ -122,10 +108,8 @@ public static function cantConnect(string $name)
}

/**
* @param string $name
* @return static
*/

public static function missingConfig(string $name)
{
return new static(
Expand All @@ -135,7 +119,6 @@ public static function missingConfig(string $name)
}

/**
* @param string $name
* @return static
*/
public static function requestMethodNotAvailable(string $name)
Expand Down
4 changes: 0 additions & 4 deletions src/App/Exceptions/StopExecutionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
*/
class StopExecutionException extends BaseException
{
/**
* @param int|null $code
* @return StopExecutionException
*/
public static function executionTerminated(?int $code): self
{
return new self(
Expand Down
17 changes: 2 additions & 15 deletions src/App/Factories/AppFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,9 @@ class AppFactory
App::CONSOLE => ConsoleAppAdapter::class,
];

/**
* @var array
*/
private static $instances = [];
private static array $instances = [];

/**
* @param string $type
* @param string $baseDir
* @return App
* @throws BaseException
*/
public static function create(string $type, string $baseDir): App
Expand All @@ -55,19 +49,12 @@ public static function create(string $type, string $baseDir): App
return self::$instances[$type];
}

/**
* @param string $type
* @return void
*/
public static function destroy(string $type)
public static function destroy(string $type): void
{
unset(self::$instances[$type]);
}

/**
* @param string $type
* @param string $baseDir
* @return App
* @throws BaseException
*/
private static function createInstance(string $type, string $baseDir): App
Expand Down
6 changes: 2 additions & 4 deletions src/App/Helpers/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@

/**
* Stops the app execution
* @param Closure|null $closure
* @param int|null $code
* @return never
* @throws StopExecutionException
*/
function stop(?Closure $closure = null, ?int $code = 0)
function stop(?Closure $closure = null, ?int $code = 0): void
{
if ($closure instanceof \Closure) {
if ($closure instanceof Closure) {
$closure();
}

Expand Down
13 changes: 0 additions & 13 deletions src/App/Helpers/dir.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

/**
* Gets base directory
* @return string
*/
function base_dir(): string
{
Expand All @@ -25,7 +24,6 @@ function base_dir(): string

/**
* Gets the log directory
* @return string
*/
function logs_dir(): string
{
Expand All @@ -34,7 +32,6 @@ function logs_dir(): string

/**
* Gets the framework directory
* @return string
*/
function framework_dir(): string
{
Expand All @@ -43,8 +40,6 @@ function framework_dir(): string

/**
* Gets modules directory
* @param string|null $moduleDir
* @return string
*/
function modules_dir(?string $moduleDir = null): string
{
Expand All @@ -53,7 +48,6 @@ function modules_dir(?string $moduleDir = null): string

/**
* Gets public directory
* @return string
*/
function public_dir(): string
{
Expand All @@ -62,7 +56,6 @@ function public_dir(): string

/**
* Gets uploads directory
* @return string
*/
function uploads_dir(): string
{
Expand All @@ -71,7 +64,6 @@ function uploads_dir(): string

/**
* Gets assets directory
* @return string
*/
function assets_dir(): string
{
Expand All @@ -80,7 +72,6 @@ function assets_dir(): string

/**
* Gets hooks directory
* @return string
*/
function hooks_dir(): string
{
Expand All @@ -89,8 +80,6 @@ function hooks_dir(): string

/**
* Recursively deletes folder
* @param string $dir
* @return bool
*/
function deleteDirectoryWithFiles(string $dir): bool
{
Expand All @@ -110,8 +99,6 @@ function deleteDirectoryWithFiles(string $dir): bool

/**
* Gets directory classes
* @param string $path
* @return array
*/
function get_directory_classes(string $path): array
{
Expand Down
Loading