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
  •  
  •  
  •  
9 changes: 6 additions & 3 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Start Memcached
uses: niden/actions-memcached@v7
Expand All @@ -44,7 +44,7 @@ jobs:

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
Expand All @@ -54,14 +54,17 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run PHP-CS-Fixer
run: composer cs:check

- name: Run PHPStan
run: composer phpstan

- name: Run tests
run: composer test -- --fail-on-warning --fail-on-risky

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

32 changes: 27 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
/vendor
/.idea
/nbproject/*
/tests/_root/shared/store/*
# =========================
# Dependencies (Composer)
# =========================
/vendor/
composer.lock
.phpunit.result.cache

# =========================
# IDE / Editor files
# =========================
/.idea/
/nbproject/
.DS_Store
Thumbs.db

# =========================
# Test & Runtime artifacts
# =========================
/tests/_root/shared/store/*
/coverage/
*.log

# =========================
# Tooling cache files
# =========================
/.php-cs-fixer.cache
/.phpunit.result.cache
/.phpunit.cache
/.cache/
28 changes: 28 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = Finder::create()
->in(__DIR__)
->exclude(['vendor'])
->name('*.php');

return (new Config())
->setRiskyAllowed(false)
->setRules([
// Base standard
'@PSR12' => true,

// Syntax & consistency
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => ['default' => 'single_space'],
'concat_space' => ['spacing' => 'one'],
'single_quote' => true,
'trailing_comma_in_multiline' => true,
'no_unused_imports' => true,
'no_extra_blank_lines' => true,
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
])
->setFinder($finder);
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"mockery/mockery": "^1.4",
"mikey179/vfsstream": "^1.6",
"rector/rector": "^2.3",
"phpstan/phpstan": "^2.1"
"phpstan/phpstan": "^2.1",
"friendsofphp/php-cs-fixer": "^3.92"
},
"suggest": {
"ext-dom": "Required for XML/HTML processing",
Expand All @@ -76,7 +77,9 @@
}
},
"scripts": {
"phpstan": "phpstan analyse --memory-limit=512M --no-progress --error-format=github",
"cs:check": "vendor/bin/php-cs-fixer check",
"cs:fix": "vendor/bin/php-cs-fixer fix",
"phpstan": "vendor/bin/phpstan analyse --memory-limit=-1 --error-format=github",
"test": "vendor/bin/phpunit --stderr --testdox --coverage-clover coverage.xml"
},
"minimum-stability": "stable",
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
])
->withSets([
LevelSetList::UP_TO_PHP_80,
]);
]);
6 changes: 2 additions & 4 deletions src/App/Adapters/AppAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 2.9.8
* @since 3.0.0
*/

namespace Quantum\App\Adapters;
Expand All @@ -19,15 +19,13 @@
use Quantum\Di\Exceptions\DiException;
use Quantum\App\Traits\AppTrait;
use ReflectionException;
use Quantum\Di\Di;

/**
* Class AppAdapter
* @package Quantum\App
*/
abstract class AppAdapter implements AppInterface
{

use AppTrait;

/**
Expand All @@ -48,4 +46,4 @@ public function __construct()
$this->loadAppHelperFunctions();
$this->loadModuleHelperFunctions();
}
}
}
6 changes: 2 additions & 4 deletions src/App/Adapters/ConsoleAppAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 2.9.9
* @since 3.0.0
*/

namespace Quantum\App\Adapters;
Expand All @@ -36,7 +36,6 @@
*/
class ConsoleAppAdapter extends AppAdapter
{

use ConsoleAppTrait;

/**
Expand All @@ -54,7 +53,6 @@ class ConsoleAppAdapter extends AppAdapter
*/
protected $application;


public function __construct()
{
parent::__construct();
Expand Down Expand Up @@ -103,4 +101,4 @@ public function start(): ?int
return $exception->getCode();
}
}
}
}
5 changes: 2 additions & 3 deletions src/App/Adapters/WebAppAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 2.9.9
* @since 3.0.0
*/

namespace Quantum\App\Adapters;
Expand Down Expand Up @@ -44,7 +44,6 @@
*/
class WebAppAdapter extends AppAdapter
{

use WebAppTrait;

/**
Expand Down Expand Up @@ -132,4 +131,4 @@ public function start(): ?int
return $exception->getCode();
}
}
}
}
9 changes: 4 additions & 5 deletions src/App/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 2.9.7
* @since 3.0.0
*/

namespace Quantum\App;
Expand All @@ -24,16 +24,15 @@
*/
class App
{

/**
* Web app adapter
*/
const WEB = 'web';
public const WEB = 'web';

/**
* Console app adapter
*/
const CONSOLE = 'console';
public const CONSOLE = 'console';

/**
* @var string
Expand Down Expand Up @@ -91,4 +90,4 @@ public function __call(string $method, ?array $arguments)

return $this->adapter->$method(...$arguments);
}
}
}
2 changes: 1 addition & 1 deletion src/App/Config/dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
\Quantum\Loader\Loader::class => \Quantum\Loader\Loader::class,
\Quantum\Http\Request::class => \Quantum\Http\Request::class,
\Quantum\Http\Response::class => \Quantum\Http\Response::class,
];
];
5 changes: 2 additions & 3 deletions src/App/Contracts/AppInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 2.9.5
* @since 3.0.0
*/

namespace Quantum\App\Contracts;


/**
* Interface AppInterface
* @package Quantum\App
Expand All @@ -26,4 +25,4 @@ interface AppInterface
* @return int|null
*/
public function start(): ?int;
}
}
26 changes: 13 additions & 13 deletions src/App/Enums/ExceptionMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 2.9.9
* @since 3.0.0
*/

namespace Quantum\App\Enums;
Expand All @@ -20,25 +20,25 @@
*/
class ExceptionMessages
{
const APP_KEY_MISSING = 'APP KEY is missing.';
public const APP_KEY_MISSING = 'APP KEY is missing.';

const EXECUTION_TERMINATED = 'Execution was terminated.';
public const EXECUTION_TERMINATED = 'Execution was terminated.';

const METHOD_NOT_SUPPORTED = 'The method `{%1}` is not supported for `{%2}`.';
public const METHOD_NOT_SUPPORTED = 'The method `{%1}` is not supported for `{%2}`.';

const ADAPTER_NOT_SUPPORTED = 'The adapter `{%1}` is not supported.';
public const ADAPTER_NOT_SUPPORTED = 'The adapter `{%1}` is not supported.';

const DRIVER_NOT_SUPPORTED = 'The driver `{%1}` is not supported.';
public const DRIVER_NOT_SUPPORTED = 'The driver `{%1}` is not supported.';

const FILE_NOT_FOUND = 'The file `{%1}` not found.';
public const FILE_NOT_FOUND = 'The file `{%1}` not found.';

const NOT_FOUND = '{%1} `{%2}` not found.';
public const NOT_FOUND = '{%1} `{%2}` not found.';

const NOT_INSTANCE_OF = 'The `{%1}` is not instance of `{%2}`.';
public const NOT_INSTANCE_OF = 'The `{%1}` is not instance of `{%2}`.';

const CANT_CONNECT = 'Can not connect to `{%1}`.';
public const CANT_CONNECT = 'Can not connect to `{%1}`.';

const MISSING_CONFIG = 'Could not load config `{%1}` properly.';
public const MISSING_CONFIG = 'Could not load config `{%1}` properly.';

const UNAVAILABLE_REQUEST_METHOD = 'Provided request method `{%1}` is not available.';
}
public const UNAVAILABLE_REQUEST_METHOD = 'Provided request method `{%1}` is not available.';
}
5 changes: 2 additions & 3 deletions src/App/Enums/ReservedKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 2.9.9
* @since 3.0.0
*/

namespace Quantum\App\Enums;
Expand All @@ -20,7 +20,6 @@
*/
final class ReservedKeys
{

/**
* Internal response key for rendered view
*/
Expand All @@ -31,4 +30,4 @@ final class ReservedKeys
*/
public const PREV_REQUEST = '_qt_prev_request';

}
}
1 change: 0 additions & 1 deletion src/App/Exceptions/AppException.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
class AppException extends BaseException
{

/**
* @return AppException
*/
Expand Down
5 changes: 2 additions & 3 deletions src/App/Exceptions/BaseException.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
*/
abstract class BaseException extends Exception
{

/**
* @param string $message
* @param int $code
*/
final public function __construct(string $message = "", int $code = 0)
final public function __construct(string $message = '', int $code = 0)
{
parent::__construct($message, $code);
}
Expand Down Expand Up @@ -146,4 +145,4 @@ public static function requestMethodNotAvailable(string $name)
E_WARNING
);
}
}
}
3 changes: 1 addition & 2 deletions src/App/Exceptions/StopExecutionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
class StopExecutionException extends BaseException
{

/**
* @param int|null $code
* @return StopExecutionException
Expand All @@ -36,4 +35,4 @@ public static function executionTerminated(?int $code): self
$code
);
}
}
}
Loading