Skip to content

Commit

Permalink
Merge pull request #472 from bluzphp/develop
Browse files Browse the repository at this point in the history
Migrated to 7.3
Added support of PHP 7.4
Updated travis email address
  • Loading branch information
Anton committed Jul 2, 2021
2 parents 83cea87 + 8f8f0d2 commit e47c194
Show file tree
Hide file tree
Showing 48 changed files with 300 additions and 251 deletions.
2 changes: 1 addition & 1 deletion .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [ "$TRAVIS_REPO_SLUG" == "bluzphp/framework" ] && [ "$TRAVIS_TAG" != "" ] &&
cp -R docs/html $HOME/docs-latest

cd $HOME
git config --global user.email "travis@travis-ci.org"
git config --global user.email "travis@travis-ci.com"
git config --global user.name "travis-ci"
git config --global push.default simple
git clone --quiet https://${GITHUB_TOKEN}@github.com/bluzphp/bluzphp.github.io > /dev/null
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ matrix:
- php: 8.0
env:
global:
- XDEBUG_MODE=coverage
- secure: "QKyI/QO6H6pFE04Iz/4IcSuttMdY3o85mD2BTNV2Y2SeSPxLfuukqPrxjANrTc4GfI1v7/bZM43uMl3aRa76+HRZ83ZsXR8uv1VZUgNHYuoq7jdZb18BitM36h0LbHzTbYetJLiYg7l3mnbAezTXPXHfpNIWvZcuyZzatyF/lng="
before_install:
# Prefer IPv4 over IPv6
Expand Down
6 changes: 3 additions & 3 deletions src/Acl/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class Acl
/**
* Check user access by pair module-privilege
*
* @param string $module
* @param string $privilege
* @param string $module
* @param string|null $privilege
*
* @return bool
*/
public function isAllowed($module, $privilege): bool
public function isAllowed(string $module, ?string $privilege): bool
{
if ($privilege) {
$user = Auth::getIdentity();
Expand Down
22 changes: 11 additions & 11 deletions src/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ public function isDebug(): bool
/**
* Return/setup Layout Flag
*
* @param bool|null $flag
* @param bool|null $flag
*
* @return bool
*/
public function useLayout($flag = null): bool
public function useLayout(?bool $flag = null): bool
{
if (is_bool($flag)) {
$this->layoutFlag = $flag;
Expand All @@ -134,12 +134,12 @@ public function useLayout($flag = null): bool
/**
* Initialize system packages
*
* @param string $environment
* @param string $environment
*
* @throws ApplicationException
* @return void
* @throws ApplicationException
*/
public function init($environment = 'production'): void
public function init(string $environment = 'production'): void
{
$this->environment = $environment;

Expand Down Expand Up @@ -400,7 +400,7 @@ protected function postProcess(): void
* @throws ControllerException
* @throws ReflectionException
*/
public function dispatch($module, $controller, array $params = []): Controller
public function dispatch(string $module, string $controller, array $params = []): Controller
{
$instance = new Controller($module, $controller, $params);

Expand All @@ -419,11 +419,11 @@ public function dispatch($module, $controller, array $params = []): Controller
/**
* Extension point: pre dispatch
*
* @param Controller $controller
* @param Controller $controller
*
* @return void
*/
protected function preDispatch($controller): void
protected function preDispatch(Controller $controller): void
{
// check HTTP method
$controller->checkHttpMethod();
Expand All @@ -445,7 +445,7 @@ protected function preDispatch($controller): void
* @throws ControllerException
* @throws ReflectionException
*/
protected function doDispatch($controller): void
protected function doDispatch(Controller $controller): void
{
// run controller
$controller->run();
Expand All @@ -454,11 +454,11 @@ protected function doDispatch($controller): void
/**
* Extension point: post dispatch
*
* @param Controller $controller
* @param Controller $controller
*
* @return void
*/
protected function postDispatch($controller): void
protected function postDispatch(Controller $controller): void
{
// nothing by default
}
Expand Down
13 changes: 11 additions & 2 deletions src/Application/Helper/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,28 @@
namespace Bluz\Application\Helper;

use Bluz\Application\Application;
use Bluz\Common\Exception\CommonException;
use Bluz\Common\Exception\ComponentException;
use Bluz\Controller\Controller;
use Bluz\Controller\ControllerException;
use Bluz\Proxy\Response;
use Bluz\Proxy\Router;
use Exception;
use ReflectionException;

/**
* Reload helper can be declared inside Bootstrap
*
* @param \Exception $exception
* @param Exception $exception
*
* @return Controller
* @throws CommonException
* @throws ComponentException
* @throws ControllerException
* @throws ReflectionException
*/
return
function ($exception) {
function (Exception $exception) {
/**
* @var Application $this
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Helper/Forbidden.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @return Controller
*/
return
function ($exception) {
function (ForbiddenException $exception) {
/**
* @var Application $this
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Helper/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @return null
*/
return
function ($exception) {
function (RedirectException $exception) {
/**
* @var Application $this
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Auth/Model/AbstractTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ abstract class AbstractTable extends Table
/**
* Get AuthRow
*
* @param string $provider
* @param string $foreignKey
* @param string $provider
* @param string $foreignKey
*
* @return RowInterface
* @throws InvalidArgumentException
* @throws DbException
* @throws InvalidPrimaryKeyException
*/
public static function getAuthRow($provider, $foreignKey): ?RowInterface
public static function getAuthRow(string $provider, string $foreignKey): ?RowInterface
{
return static::findRow(['provider' => $provider, 'foreignKey' => $foreignKey]);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Common/Container/ArrayAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
* @author Anton Shevchuk
* @see ArrayAccess
*
* @method void doSetContainer($key, $value)
* @method mixed doGetContainer($key)
* @method bool doContainsContainer($key)
* @method void doDeleteContainer($key)
* @method void doSetContainer(string $key, $value)
* @method mixed doGetContainer(string $key)
* @method bool doContainsContainer(string $key)
* @method void doDeleteContainer(string $key)
*/
trait ArrayAccess
{
Expand Down
16 changes: 8 additions & 8 deletions src/Common/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ trait Container
/**
* Set key/value pair
*
* @param string $key
* @param string $key
* @param mixed $value
*
* @return void
*/
protected function doSetContainer($key, $value): void
protected function doSetContainer(string $key, $value): void
{
$this->container[$key] = $value;
}

/**
* Get value by key
*
* @param string $key
* @param string $key
*
* @return mixed
*/
protected function doGetContainer($key)
protected function doGetContainer(string $key)
{
if ($this->doContainsContainer($key)) {
return $this->container[$key];
Expand All @@ -56,23 +56,23 @@ protected function doGetContainer($key)
/**
* Check contains key in container
*
* @param string $key
* @param string $key
*
* @return bool
*/
protected function doContainsContainer($key): bool
protected function doContainsContainer(string $key): bool
{
return array_key_exists($key, $this->container);
}

/**
* Delete value by key
*
* @param string $key
* @param string $key
*
* @return void
*/
protected function doDeleteContainer($key): void
protected function doDeleteContainer(string $key): void
{
unset($this->container[$key]);
}
Expand Down
2 changes: 0 additions & 2 deletions src/Common/Container/JsonSerialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* @package Bluz\Common
* @author Anton Shevchuk
* @see JsonSerializable
*
* @method array toArray()
*/
trait JsonSerialize
{
Expand Down
24 changes: 12 additions & 12 deletions src/Common/Container/MagicAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,58 +17,58 @@
* @package Bluz\Common
* @author Anton Shevchuk
*
* @method void doSetContainer($key, $value)
* @method mixed doGetContainer($key)
* @method bool doContainsContainer($key)
* @method void doDeleteContainer($key)
* @method void doSetContainer(string $key, $value)
* @method mixed doGetContainer(string $key)
* @method bool doContainsContainer(string $key)
* @method void doDeleteContainer(string $key)
*/
trait MagicAccess
{
/**
* Magic alias for set() regular method
*
* @param string $key
* @param string $key
* @param mixed $value
*
* @return void
*/
public function __set($key, $value): void
public function __set(string $key, $value): void
{
$this->doSetContainer($key, $value);
}

/**
* Magic alias for get() regular method
*
* @param string $key
* @param string $key
*
* @return mixed
*/
public function __get($key)
public function __get(string $key)
{
return $this->doGetContainer($key);
}

/**
* Magic alias for contains() regular method
*
* @param string $key
* @param string $key
*
* @return bool
*/
public function __isset($key): bool
public function __isset(string $key): bool
{
return $this->doContainsContainer($key);
}

/**
* Magic alias for delete() regular method
*
* @param string $key
* @param string $key
*
* @return void
*/
public function __unset($key): void
public function __unset(string $key): void
{
$this->doDeleteContainer($key);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Common/Container/RegularAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
* @package Bluz\Common
* @author Anton Shevchuk
*
* @method void doSetContainer($key, $value)
* @method mixed doGetContainer($key)
* @method bool doContainsContainer($key)
* @method void doDeleteContainer($key)
* @method void doSetContainer(string $key, $value)
* @method mixed doGetContainer(string $key)
* @method bool doContainsContainer(string $key)
* @method void doDeleteContainer(string $key)
*/
trait RegularAccess
{
Expand Down
8 changes: 4 additions & 4 deletions src/Common/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ trait Options
*
* @return mixed
*/
public function getOption($key, ...$keys)
public function getOption(string $key, ...$keys)
{
$method = 'get' . Str::toCamelCase($key);
if (method_exists($this, $method)) {
Expand All @@ -70,11 +70,11 @@ public function getOption($key, ...$keys)
* Set option by key over setter
*
* @param string $key
* @param string $value
* @param mixed $value
*
* @return void
*/
public function setOption($key, $value): void
public function setOption(string $key, $value): void
{
$method = 'set' . Str::toCamelCase($key);
if (method_exists($this, $method)) {
Expand All @@ -101,7 +101,7 @@ public function getOptions(): array
* - options must be a array
* - options can be null
*
* @param array $options
* @param array|null $options
*
* @return void
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Common/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class Str
/**
* Convert string to CamelCase
*
* @param string $subject
* @param string $subject
*
* @return string
*/
public static function toCamelCase($subject): string
public static function toCamelCase(string $subject): string
{
$subject = str_replace(['_', '-'], ' ', strtolower($subject));
return str_replace(' ', '', ucwords($subject));
Expand Down

0 comments on commit e47c194

Please sign in to comment.