diff --git a/docs/DockBlock.php b/docs/DockBlock.php
index bdd44f7e..862a039e 100644
--- a/docs/DockBlock.php
+++ b/docs/DockBlock.php
@@ -3,6 +3,7 @@
* An complex example of how to write "dockblock", based on PEAR standard
*
* PEAR standard you can find at http://pear.php.net/manual/tr/standards.sample.php
+ * PSR proposal you can find at https://github.com/phpDocumentor/fig-standards/tree/master/proposed
*
* Docblock comments start with "/**" at the top. Notice how the "/"
* lines up with the normal indenting and the asterisks on subsequent rows
@@ -51,9 +52,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz;
/**
diff --git a/src/Acl/Acl.php b/src/Acl/Acl.php
index 6df45283..ca0f8223 100644
--- a/src/Acl/Acl.php
+++ b/src/Acl/Acl.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Acl;
use Bluz\Common\Options;
diff --git a/src/Acl/AclException.php b/src/Acl/AclException.php
index 15a27d3a..ab62bdd9 100644
--- a/src/Acl/AclException.php
+++ b/src/Acl/AclException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Acl;
use Bluz\Application\Exception\ForbiddenException;
diff --git a/src/Application/Application.php b/src/Application/Application.php
index 6d286427..233392c8 100644
--- a/src/Application/Application.php
+++ b/src/Application/Application.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application;
use Bluz\Application\Exception\ApplicationException;
diff --git a/src/Application/Exception/ApplicationException.php b/src/Application/Exception/ApplicationException.php
index bb633893..1329fe62 100644
--- a/src/Application/Exception/ApplicationException.php
+++ b/src/Application/Exception/ApplicationException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application\Exception;
use Bluz\Common\Exception\CommonException;
diff --git a/src/Application/Exception/BadRequestException.php b/src/Application/Exception/BadRequestException.php
index 7d9ae361..ce901774 100644
--- a/src/Application/Exception/BadRequestException.php
+++ b/src/Application/Exception/BadRequestException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application\Exception;
use Bluz\Http\StatusCode;
diff --git a/src/Application/Exception/ForbiddenException.php b/src/Application/Exception/ForbiddenException.php
index 139f016c..b921158e 100644
--- a/src/Application/Exception/ForbiddenException.php
+++ b/src/Application/Exception/ForbiddenException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application\Exception;
use Bluz\Http\StatusCode;
diff --git a/src/Application/Exception/NotAcceptableException.php b/src/Application/Exception/NotAcceptableException.php
index 23064ab8..5afd209c 100644
--- a/src/Application/Exception/NotAcceptableException.php
+++ b/src/Application/Exception/NotAcceptableException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application\Exception;
use Bluz\Http\StatusCode;
diff --git a/src/Application/Exception/NotAllowedException.php b/src/Application/Exception/NotAllowedException.php
index 26d4070a..db0183b1 100644
--- a/src/Application/Exception/NotAllowedException.php
+++ b/src/Application/Exception/NotAllowedException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application\Exception;
use Bluz\Http\StatusCode;
diff --git a/src/Application/Exception/NotFoundException.php b/src/Application/Exception/NotFoundException.php
index 2d697498..ccac8196 100644
--- a/src/Application/Exception/NotFoundException.php
+++ b/src/Application/Exception/NotFoundException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application\Exception;
use Bluz\Http\StatusCode;
diff --git a/src/Application/Exception/NotImplementedException.php b/src/Application/Exception/NotImplementedException.php
index 89e0e87a..138f9d6f 100644
--- a/src/Application/Exception/NotImplementedException.php
+++ b/src/Application/Exception/NotImplementedException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application\Exception;
use Bluz\Http\StatusCode;
diff --git a/src/Application/Exception/RedirectException.php b/src/Application/Exception/RedirectException.php
index 072ef195..1072ccf8 100644
--- a/src/Application/Exception/RedirectException.php
+++ b/src/Application/Exception/RedirectException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application\Exception;
use Bluz\Http\StatusCode;
diff --git a/src/Application/Exception/UnauthorizedException.php b/src/Application/Exception/UnauthorizedException.php
index 27f057b1..c3bb28f3 100644
--- a/src/Application/Exception/UnauthorizedException.php
+++ b/src/Application/Exception/UnauthorizedException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application\Exception;
use Bluz\Http\StatusCode;
diff --git a/src/Application/Helper/Error.php b/src/Application/Helper/Error.php
index aaddec99..5a97ac65 100644
--- a/src/Application/Helper/Error.php
+++ b/src/Application/Helper/Error.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application\Helper;
use Bluz\Application\Application;
diff --git a/src/Application/Helper/Forbidden.php b/src/Application/Helper/Forbidden.php
index 71804dfc..e652bf51 100644
--- a/src/Application/Helper/Forbidden.php
+++ b/src/Application/Helper/Forbidden.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application\Helper;
use Bluz\Application\Application;
diff --git a/src/Application/Helper/Redirect.php b/src/Application/Helper/Redirect.php
index 2a3d3a84..9d5c78f5 100644
--- a/src/Application/Helper/Redirect.php
+++ b/src/Application/Helper/Redirect.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Application\Helper;
use Bluz\Application\Application;
diff --git a/src/Auth/AbstractRow.php b/src/Auth/AbstractRow.php
index 0f0e905a..46fc03d1 100644
--- a/src/Auth/AbstractRow.php
+++ b/src/Auth/AbstractRow.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Auth;
use Bluz\Db\Row;
diff --git a/src/Auth/AbstractRowEntity.php b/src/Auth/AbstractRowEntity.php
index d6fc2460..ca88c6a0 100644
--- a/src/Auth/AbstractRowEntity.php
+++ b/src/Auth/AbstractRowEntity.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Auth;
use Bluz\Db\Row;
@@ -23,17 +22,17 @@ abstract class AbstractRowEntity extends Row implements EntityInterface
/**
* Can entity login
*
- * @return bool
+ * @return void
* @throws AuthException
*/
abstract public function tryLogin();
/**
- * Get privileges
+ * Get user privileges
*
* @return array
*/
- abstract public function getPrivileges();
+ abstract public function getPrivileges() : array;
/**
* Has role a privilege
@@ -42,7 +41,7 @@ abstract public function getPrivileges();
* @param string $privilege
* @return bool
*/
- public function hasPrivilege($module, $privilege)
+ public function hasPrivilege($module, $privilege) : bool
{
$privileges = $this->getPrivileges();
diff --git a/src/Auth/AbstractTable.php b/src/Auth/AbstractTable.php
index 0b4bb1b9..5ea49e47 100644
--- a/src/Auth/AbstractTable.php
+++ b/src/Auth/AbstractTable.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Auth;
use Bluz\Db\Table;
diff --git a/src/Auth/Auth.php b/src/Auth/Auth.php
index 3d2751a1..acc13258 100644
--- a/src/Auth/Auth.php
+++ b/src/Auth/Auth.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Auth;
use Bluz\Common\Options;
diff --git a/src/Auth/AuthException.php b/src/Auth/AuthException.php
index 909cdca0..7108575e 100644
--- a/src/Auth/AuthException.php
+++ b/src/Auth/AuthException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Auth;
use Bluz\Application\Exception\UnauthorizedException;
diff --git a/src/Auth/EntityInterface.php b/src/Auth/EntityInterface.php
index 84f9848b..23c45a3f 100644
--- a/src/Auth/EntityInterface.php
+++ b/src/Auth/EntityInterface.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Auth;
/**
@@ -26,7 +25,7 @@ interface EntityInterface
*
* @return array
*/
- public function getPrivileges();
+ public function getPrivileges() : array;
/**
* Has role a privilege
@@ -35,5 +34,5 @@ public function getPrivileges();
* @param string $privilege
* @return bool
*/
- public function hasPrivilege($module, $privilege);
+ public function hasPrivilege($module, $privilege) : bool;
}
diff --git a/src/Cli/CliResponse.php b/src/Cli/CliResponse.php
index d4dc55fd..6804b11b 100644
--- a/src/Cli/CliResponse.php
+++ b/src/Cli/CliResponse.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Cli;
use Bluz\Http\StatusCode;
diff --git a/src/Cli/Colorize.php b/src/Cli/Colorize.php
index 7bbb6c71..f65fe888 100644
--- a/src/Cli/Colorize.php
+++ b/src/Cli/Colorize.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Cli;
/**
diff --git a/src/Common/Container/ArrayAccess.php b/src/Common/Container/ArrayAccess.php
index e0bcf138..f0ec0d4e 100644
--- a/src/Common/Container/ArrayAccess.php
+++ b/src/Common/Container/ArrayAccess.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Common\Container;
/**
diff --git a/src/Common/Container/Container.php b/src/Common/Container/Container.php
index 5fe26069..6015a46a 100644
--- a/src/Common/Container/Container.php
+++ b/src/Common/Container/Container.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Common\Container;
/**
diff --git a/src/Common/Container/JsonSerialize.php b/src/Common/Container/JsonSerialize.php
index e06d9bde..acfd01c4 100644
--- a/src/Common/Container/JsonSerialize.php
+++ b/src/Common/Container/JsonSerialize.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Common\Container;
/**
diff --git a/src/Common/Container/MagicAccess.php b/src/Common/Container/MagicAccess.php
index ba8111d7..54669868 100644
--- a/src/Common/Container/MagicAccess.php
+++ b/src/Common/Container/MagicAccess.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Common\Container;
/**
diff --git a/src/Common/Container/RegularAccess.php b/src/Common/Container/RegularAccess.php
index e072f9ac..04331650 100644
--- a/src/Common/Container/RegularAccess.php
+++ b/src/Common/Container/RegularAccess.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Common\Container;
/**
diff --git a/src/Common/Exception/CommonException.php b/src/Common/Exception/CommonException.php
index dd7e5381..c08befb4 100644
--- a/src/Common/Exception/CommonException.php
+++ b/src/Common/Exception/CommonException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Common\Exception;
use Bluz\Http\StatusCode;
@@ -25,28 +24,4 @@ class CommonException extends \Exception
* @var integer Used as default HTTP code for exceptions
*/
protected $code = StatusCode::INTERNAL_SERVER_ERROR;
-
- /**
- * (PHP 5 >= 5.1.0)
- * Construct the exception. Note: The message is NOT binary safe.
- * @link http://php.net/manual/en/exception.construct.php
- * Fix for https://github.com/facebook/hhvm/blob/HHVM-3.4.0/hphp/system/php/lang/Exception.php#L55
- *
- * @param string $message [optional] The Exception message to throw.
- * @param integer $code [optional] The Exception code.
- * @param \Exception $previous [optional] The previous exception used for the exception chaining. Since 5.3.0
- */
- public function __construct($message = "", $code = 0, \Exception $previous = null)
- {
- $numAgs = func_num_args();
- if ($numAgs >= 1) {
- $this->message = $message;
- }
-
- if ($numAgs >= 2) {
- $this->code = $code;
- }
-
- parent::__construct($this->message, $this->code, $previous);
- }
}
diff --git a/src/Common/Exception/ComponentException.php b/src/Common/Exception/ComponentException.php
index c55796ab..ae7879b5 100644
--- a/src/Common/Exception/ComponentException.php
+++ b/src/Common/Exception/ComponentException.php
@@ -6,9 +6,9 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+
+declare(strict_types=1);
+
namespace Bluz\Common\Exception;
/**
diff --git a/src/Common/Exception/ConfigurationException.php b/src/Common/Exception/ConfigurationException.php
index 1b630a0b..57750520 100644
--- a/src/Common/Exception/ConfigurationException.php
+++ b/src/Common/Exception/ConfigurationException.php
@@ -6,9 +6,9 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+
+declare(strict_types=1);
+
namespace Bluz\Common\Exception;
/**
diff --git a/src/Common/Nil.php b/src/Common/Nil.php
index 0c1c74c9..26aaf502 100644
--- a/src/Common/Nil.php
+++ b/src/Common/Nil.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Common;
/**
diff --git a/src/Common/Options.php b/src/Common/Options.php
index a384e4a2..3da1c050 100644
--- a/src/Common/Options.php
+++ b/src/Common/Options.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Common;
/**
@@ -88,7 +87,7 @@ public function setOption($key, $value)
*
* @return array
*/
- public function getOptions()
+ public function getOptions() : array
{
return $this->options;
}
@@ -103,7 +102,7 @@ public function getOptions()
* @param array $options
* @return self
*/
- public function setOptions($options)
+ public function setOptions(array $options = null)
{
// store options by default
$this->options = (array) $options;
diff --git a/src/Common/Singleton.php b/src/Common/Singleton.php
index fff837a6..8b5d045c 100644
--- a/src/Common/Singleton.php
+++ b/src/Common/Singleton.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Common;
/**
diff --git a/src/Config/Config.php b/src/Config/Config.php
index 8123cb49..b2b62ac4 100644
--- a/src/Config/Config.php
+++ b/src/Config/Config.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Config;
/**
diff --git a/src/Config/ConfigException.php b/src/Config/ConfigException.php
index 2d3a25ad..c15a248d 100644
--- a/src/Config/ConfigException.php
+++ b/src/Config/ConfigException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Config;
use Bluz\Common\Exception\CommonException;
diff --git a/src/Controller/Controller.php b/src/Controller/Controller.php
index 31be6e01..a5cedcea 100644
--- a/src/Controller/Controller.php
+++ b/src/Controller/Controller.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller;
use Bluz\Application\Application;
diff --git a/src/Controller/ControllerException.php b/src/Controller/ControllerException.php
index b76187be..2b7f7452 100644
--- a/src/Controller/ControllerException.php
+++ b/src/Controller/ControllerException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller;
use Bluz\Application\Exception\ApplicationException;
diff --git a/src/Controller/Data.php b/src/Controller/Data.php
index cc9e8660..cd17b2cd 100644
--- a/src/Controller/Data.php
+++ b/src/Controller/Data.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller;
use Bluz\Common\Container\Container;
diff --git a/src/Controller/Helper/Denied.php b/src/Controller/Helper/Denied.php
index 432231f8..d3341e75 100644
--- a/src/Controller/Helper/Denied.php
+++ b/src/Controller/Helper/Denied.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller\Helper;
use Bluz\Application\Exception\ForbiddenException;
diff --git a/src/Controller/Helper/DisableLayout.php b/src/Controller/Helper/DisableLayout.php
index 61aee1b2..da303346 100644
--- a/src/Controller/Helper/DisableLayout.php
+++ b/src/Controller/Helper/DisableLayout.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller\Helper;
use Bluz\Application\Application;
diff --git a/src/Controller/Helper/DisableView.php b/src/Controller/Helper/DisableView.php
index a6e963e0..256cd05d 100644
--- a/src/Controller/Helper/DisableView.php
+++ b/src/Controller/Helper/DisableView.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller\Helper;
use Bluz\Controller\Controller;
diff --git a/src/Controller/Helper/Dispatch.php b/src/Controller/Helper/Dispatch.php
index 234accc1..9871b79a 100644
--- a/src/Controller/Helper/Dispatch.php
+++ b/src/Controller/Helper/Dispatch.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller\Helper;
use Bluz\Application\Application;
diff --git a/src/Controller/Helper/IsAllowed.php b/src/Controller/Helper/IsAllowed.php
index 64ca369b..fe0b759b 100644
--- a/src/Controller/Helper/IsAllowed.php
+++ b/src/Controller/Helper/IsAllowed.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller\Helper;
use Bluz\Controller\Controller;
diff --git a/src/Controller/Helper/UseJson.php b/src/Controller/Helper/UseJson.php
index 6898ee62..2b8d16dc 100644
--- a/src/Controller/Helper/UseJson.php
+++ b/src/Controller/Helper/UseJson.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller\Helper;
use Bluz\Application\Application;
diff --git a/src/Controller/Helper/UseLayout.php b/src/Controller/Helper/UseLayout.php
index d4b889a6..1de71ff6 100644
--- a/src/Controller/Helper/UseLayout.php
+++ b/src/Controller/Helper/UseLayout.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller\Helper;
use Bluz\Application\Application;
diff --git a/src/Controller/Helper/User.php b/src/Controller/Helper/User.php
index 9032a570..d3243a7f 100644
--- a/src/Controller/Helper/User.php
+++ b/src/Controller/Helper/User.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller\Helper;
use Bluz\Auth\EntityInterface;
diff --git a/src/Controller/Mapper/AbstractMapper.php b/src/Controller/Mapper/AbstractMapper.php
index 5eb3ad6e..b30205ae 100644
--- a/src/Controller/Mapper/AbstractMapper.php
+++ b/src/Controller/Mapper/AbstractMapper.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller\Mapper;
use Bluz\Application\Application;
diff --git a/src/Controller/Mapper/Crud.php b/src/Controller/Mapper/Crud.php
index f4c59bbc..bc2ae23d 100644
--- a/src/Controller/Mapper/Crud.php
+++ b/src/Controller/Mapper/Crud.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller\Mapper;
/**
diff --git a/src/Controller/Mapper/Rest.php b/src/Controller/Mapper/Rest.php
index 1b99f2ad..528281aa 100644
--- a/src/Controller/Mapper/Rest.php
+++ b/src/Controller/Mapper/Rest.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller\Mapper;
use Bluz\Application\Exception\ForbiddenException;
diff --git a/src/Controller/Reflection.php b/src/Controller/Reflection.php
index 2d0bfd56..a5c0ed2f 100644
--- a/src/Controller/Reflection.php
+++ b/src/Controller/Reflection.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Controller;
use Bluz\Common\Exception\ComponentException;
@@ -229,17 +228,23 @@ public function setCache($ttl)
protected function prepareCache($cache)
{
$num = (int)$cache;
- $time = substr($cache, strpos($cache, ' '));
+
+ if ($pos = strpos($cache, ' ')) {
+ $time = substr($cache, $pos);
+ } else {
+ $time = 'min';
+ }
+
switch ($time) {
case 'day':
case 'days':
- return (int)$num * 60 * 60 *24;
+ return $num * 60 * 60 *24;
case 'hour':
case 'hours':
- return (int)$num * 60 * 60;
+ return $num * 60 * 60;
case 'min':
default:
- return (int)$num * 60;
+ return $num * 60;
}
}
diff --git a/src/Crud/AbstractCrud.php b/src/Crud/AbstractCrud.php
index c5c85ee4..3a622793 100644
--- a/src/Crud/AbstractCrud.php
+++ b/src/Crud/AbstractCrud.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Crud;
use Bluz\Application\Exception\NotImplementedException;
diff --git a/src/Crud/CrudException.php b/src/Crud/CrudException.php
index 6121f1a3..ff420a35 100644
--- a/src/Crud/CrudException.php
+++ b/src/Crud/CrudException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Crud;
use Bluz\Common\Exception\CommonException;
diff --git a/src/Crud/Table.php b/src/Crud/Table.php
index 9cbab840..7202ba57 100644
--- a/src/Crud/Table.php
+++ b/src/Crud/Table.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Crud;
use Bluz\Application\Exception\ApplicationException;
diff --git a/src/Db/Db.php b/src/Db/Db.php
index 442cda34..1841b5c8 100644
--- a/src/Db/Db.php
+++ b/src/Db/Db.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db;
use Bluz\Common\Exception\ConfigurationException;
@@ -183,11 +182,12 @@ protected function prepare($sql, $params)
*
*
* @param string $value
+ * @param int $type
* @return string
*/
- public function quote($value)
+ public function quote($value, $type = \PDO::PARAM_STR)
{
- return $this->handler()->quote($value);
+ return $this->handler()->quote($value, $type);
}
/**
diff --git a/src/Db/Exception/DbException.php b/src/Db/Exception/DbException.php
index 7f2cb6c3..2f07aacd 100644
--- a/src/Db/Exception/DbException.php
+++ b/src/Db/Exception/DbException.php
@@ -6,15 +6,14 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Exception;
use Bluz\Common\Exception\CommonException;
/**
- * Exception
+ * Exception for Db package
*
* @package Bluz\Db\Exception
* @author Anton Shevchuk
diff --git a/src/Db/Exception/InvalidPrimaryKeyException.php b/src/Db/Exception/InvalidPrimaryKeyException.php
index 64386f2c..71775ae9 100644
--- a/src/Db/Exception/InvalidPrimaryKeyException.php
+++ b/src/Db/Exception/InvalidPrimaryKeyException.php
@@ -6,13 +6,12 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Exception;
/**
- * WrongPrimaryKeyException
+ * Invalid Primary Key Exception
*
* @package Bluz\Db\Exception
* @author Eugene Zabolotniy
diff --git a/src/Db/Exception/RelationNotFoundException.php b/src/Db/Exception/RelationNotFoundException.php
index 7d339c32..ee3bee0c 100644
--- a/src/Db/Exception/RelationNotFoundException.php
+++ b/src/Db/Exception/RelationNotFoundException.php
@@ -6,17 +6,15 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Exception;
/**
- * RelationNotFoundException class.
+ * Relation Not Found Exception
*
* @package Bluz\Db\Exception
* @author Eugene Zabolotniy
- * @since 1.0
*/
class RelationNotFoundException extends DbException
{
diff --git a/src/Db/Exception/TableNotFoundException.php b/src/Db/Exception/TableNotFoundException.php
index efaa7737..ce4941ab 100644
--- a/src/Db/Exception/TableNotFoundException.php
+++ b/src/Db/Exception/TableNotFoundException.php
@@ -6,17 +6,15 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Exception;
/**
- * TableNotFoundException class.
+ * Table Not Found Exception
*
* @package Bluz\Db\Exception
* @author Eugene Zabolotniy
- * @since 1.0
*/
class TableNotFoundException extends DbException
{
diff --git a/src/Db/Query/AbstractBuilder.php b/src/Db/Query/AbstractBuilder.php
index 0c386c0f..7ac02654 100644
--- a/src/Db/Query/AbstractBuilder.php
+++ b/src/Db/Query/AbstractBuilder.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Query;
use Bluz\Proxy\Db;
diff --git a/src/Db/Query/CompositeBuilder.php b/src/Db/Query/CompositeBuilder.php
index 248601a5..4e9d75a0 100644
--- a/src/Db/Query/CompositeBuilder.php
+++ b/src/Db/Query/CompositeBuilder.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Query;
/**
diff --git a/src/Db/Query/Delete.php b/src/Db/Query/Delete.php
index 73b08e93..ce4bbf08 100644
--- a/src/Db/Query/Delete.php
+++ b/src/Db/Query/Delete.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Query;
/**
diff --git a/src/Db/Query/Insert.php b/src/Db/Query/Insert.php
index a3d978f9..d9e2c7ce 100644
--- a/src/Db/Query/Insert.php
+++ b/src/Db/Query/Insert.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Query;
use Bluz\Proxy\Db;
diff --git a/src/Db/Query/Select.php b/src/Db/Query/Select.php
index e9fe52b6..98548a01 100644
--- a/src/Db/Query/Select.php
+++ b/src/Db/Query/Select.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Query;
use Bluz\Db\Exception\DbException;
diff --git a/src/Db/Query/Traits/From.php b/src/Db/Query/Traits/From.php
index 1cb37bee..19a3a3a5 100644
--- a/src/Db/Query/Traits/From.php
+++ b/src/Db/Query/Traits/From.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Query\Traits;
use Bluz\Db\Query\Delete;
diff --git a/src/Db/Query/Traits/Limit.php b/src/Db/Query/Traits/Limit.php
index 0429d58a..bfcdfbf9 100644
--- a/src/Db/Query/Traits/Limit.php
+++ b/src/Db/Query/Traits/Limit.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Query\Traits;
use Bluz\Db\Query\Delete;
diff --git a/src/Db/Query/Traits/Order.php b/src/Db/Query/Traits/Order.php
index a49291f8..94a7abcc 100644
--- a/src/Db/Query/Traits/Order.php
+++ b/src/Db/Query/Traits/Order.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Query\Traits;
use Bluz\Db\Query\Delete;
diff --git a/src/Db/Query/Traits/Set.php b/src/Db/Query/Traits/Set.php
index 6935ab93..30c6c5f2 100644
--- a/src/Db/Query/Traits/Set.php
+++ b/src/Db/Query/Traits/Set.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Query\Traits;
use Bluz\Db\Query\Insert;
diff --git a/src/Db/Query/Traits/Where.php b/src/Db/Query/Traits/Where.php
index f64f84e3..fb57f801 100644
--- a/src/Db/Query/Traits/Where.php
+++ b/src/Db/Query/Traits/Where.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Query\Traits;
use Bluz\Db\Query\CompositeBuilder;
diff --git a/src/Db/Query/Update.php b/src/Db/Query/Update.php
index 27217434..684df624 100644
--- a/src/Db/Query/Update.php
+++ b/src/Db/Query/Update.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db\Query;
/**
diff --git a/src/Db/Relations.php b/src/Db/Relations.php
index 46d0a37f..e2362f5d 100644
--- a/src/Db/Relations.php
+++ b/src/Db/Relations.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db;
use Bluz\Db\Exception\RelationNotFoundException;
diff --git a/src/Db/Row.php b/src/Db/Row.php
index 6c8aa279..f4c4aa9b 100644
--- a/src/Db/Row.php
+++ b/src/Db/Row.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db;
use Bluz\Common\Container;
diff --git a/src/Db/Table.php b/src/Db/Table.php
index 362eb33c..99cd2068 100755
--- a/src/Db/Table.php
+++ b/src/Db/Table.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Db;
use Bluz\Db\Exception\DbException;
diff --git a/src/EventManager/Event.php b/src/EventManager/Event.php
index f2e705c6..4a4124b4 100644
--- a/src/EventManager/Event.php
+++ b/src/EventManager/Event.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\EventManager;
/**
diff --git a/src/EventManager/EventException.php b/src/EventManager/EventException.php
index 26a73c61..33869a74 100644
--- a/src/EventManager/EventException.php
+++ b/src/EventManager/EventException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\EventManager;
use Bluz\Common\Exception\CommonException;
diff --git a/src/EventManager/EventManager.php b/src/EventManager/EventManager.php
index 449e58d1..0b32a748 100644
--- a/src/EventManager/EventManager.php
+++ b/src/EventManager/EventManager.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\EventManager;
/**
diff --git a/src/Grid/Data.php b/src/Grid/Data.php
index ed426b9d..d1fe7010 100644
--- a/src/Grid/Data.php
+++ b/src/Grid/Data.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid;
/**
@@ -30,9 +29,9 @@ class Data extends \ArrayIterator
* @param integer $total
* @return self
*/
- public function setTotal($total)
+ public function setTotal(int $total)
{
- $this->total = (int)$total;
+ $this->total = $total;
return $this;
}
@@ -41,7 +40,7 @@ public function setTotal($total)
*
* @return integer
*/
- public function getTotal()
+ public function getTotal() : int
{
return $this->total;
}
diff --git a/src/Grid/Grid.php b/src/Grid/Grid.php
index 1b63ac96..7365a226 100644
--- a/src/Grid/Grid.php
+++ b/src/Grid/Grid.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid;
use Bluz\Common\Helper;
@@ -775,7 +774,7 @@ protected function applyAlias($column)
* @return void
* @throws GridException
*/
- public function setPage($page = 1)
+ public function setPage(int $page = 1)
{
if ($page < 1) {
throw new GridException('Wrong page number, should be greater than zero');
@@ -788,7 +787,7 @@ public function setPage($page = 1)
*
* @return integer
*/
- public function getPage()
+ public function getPage() : int
{
return $this->page;
}
@@ -800,7 +799,7 @@ public function getPage()
* @return void
* @throws GridException
*/
- public function setLimit($limit)
+ public function setLimit(int $limit)
{
if ($limit < 1) {
throw new GridException('Wrong limit value, should be greater than zero');
@@ -813,7 +812,7 @@ public function setLimit($limit)
*
* @return integer
*/
- public function getLimit()
+ public function getLimit() : int
{
return $this->limit;
}
@@ -825,7 +824,7 @@ public function getLimit()
* @return void
* @throws GridException
*/
- public function setDefaultLimit($limit)
+ public function setDefaultLimit(int $limit)
{
if ($limit < 1) {
throw new GridException('Wrong default limit value, should be greater than zero');
@@ -840,7 +839,7 @@ public function setDefaultLimit($limit)
*
* @return integer
*/
- public function getDefaultLimit()
+ public function getDefaultLimit() : int
{
return $this->defaultLimit;
}
diff --git a/src/Grid/GridException.php b/src/Grid/GridException.php
index 0463aa96..a109b93d 100644
--- a/src/Grid/GridException.php
+++ b/src/Grid/GridException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid;
use Bluz\Common\Exception\CommonException;
diff --git a/src/Grid/Helper/Filter.php b/src/Grid/Helper/Filter.php
index 10c75839..e817d809 100644
--- a/src/Grid/Helper/Filter.php
+++ b/src/Grid/Helper/Filter.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Helper;
use Bluz\Grid;
diff --git a/src/Grid/Helper/First.php b/src/Grid/Helper/First.php
index c186e780..0f01687c 100644
--- a/src/Grid/Helper/First.php
+++ b/src/Grid/Helper/First.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Helper;
use Bluz\Grid;
diff --git a/src/Grid/Helper/Last.php b/src/Grid/Helper/Last.php
index 51195bf8..7477bac5 100644
--- a/src/Grid/Helper/Last.php
+++ b/src/Grid/Helper/Last.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Helper;
use Bluz\Grid;
diff --git a/src/Grid/Helper/Limit.php b/src/Grid/Helper/Limit.php
index eedce52b..67b355c8 100644
--- a/src/Grid/Helper/Limit.php
+++ b/src/Grid/Helper/Limit.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Helper;
use Bluz\Grid;
diff --git a/src/Grid/Helper/Next.php b/src/Grid/Helper/Next.php
index 66172809..9b8ab1ac 100644
--- a/src/Grid/Helper/Next.php
+++ b/src/Grid/Helper/Next.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Helper;
use Bluz\Grid;
diff --git a/src/Grid/Helper/Order.php b/src/Grid/Helper/Order.php
index d096a963..d5fa7cc5 100644
--- a/src/Grid/Helper/Order.php
+++ b/src/Grid/Helper/Order.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Helper;
use Bluz\Grid;
diff --git a/src/Grid/Helper/Page.php b/src/Grid/Helper/Page.php
index 5eae54b3..d69b5fdd 100644
--- a/src/Grid/Helper/Page.php
+++ b/src/Grid/Helper/Page.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Helper;
use Bluz\Grid;
diff --git a/src/Grid/Helper/Pages.php b/src/Grid/Helper/Pages.php
index 711002ee..2e76aeda 100644
--- a/src/Grid/Helper/Pages.php
+++ b/src/Grid/Helper/Pages.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Helper;
use Bluz\Grid;
@@ -21,5 +20,5 @@ function () {
/**
* @var Grid\Grid $this
*/
- return ceil($this->getData()->getTotal() / $this->getLimit());
+ return (int) ceil($this->getData()->getTotal() / $this->getLimit());
};
diff --git a/src/Grid/Helper/Prev.php b/src/Grid/Helper/Prev.php
index 9fcbb533..788c0a85 100644
--- a/src/Grid/Helper/Prev.php
+++ b/src/Grid/Helper/Prev.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Helper;
use Bluz\Grid;
diff --git a/src/Grid/Helper/Reset.php b/src/Grid/Helper/Reset.php
index a90b70c9..5354d269 100644
--- a/src/Grid/Helper/Reset.php
+++ b/src/Grid/Helper/Reset.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Helper;
use Bluz\Grid;
diff --git a/src/Grid/Helper/Total.php b/src/Grid/Helper/Total.php
index 8117b439..40af1618 100644
--- a/src/Grid/Helper/Total.php
+++ b/src/Grid/Helper/Total.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Helper;
use Bluz\Grid;
diff --git a/src/Grid/Source/AbstractSource.php b/src/Grid/Source/AbstractSource.php
index 017f74e2..bdf171b0 100644
--- a/src/Grid/Source/AbstractSource.php
+++ b/src/Grid/Source/AbstractSource.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Source;
use Bluz\Grid\Grid;
diff --git a/src/Grid/Source/ArraySource.php b/src/Grid/Source/ArraySource.php
index d6ab0c2d..8ed8f900 100644
--- a/src/Grid/Source/ArraySource.php
+++ b/src/Grid/Source/ArraySource.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Source;
use Bluz\Grid;
diff --git a/src/Grid/Source/SelectSource.php b/src/Grid/Source/SelectSource.php
index db2695a5..290ff514 100644
--- a/src/Grid/Source/SelectSource.php
+++ b/src/Grid/Source/SelectSource.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Source;
use Bluz\Db;
@@ -101,7 +100,7 @@ public function process(array $settings = [])
// use transaction to avoid errors
Proxy\Db::transaction(function () use (&$data, &$total, $totalSql) {
$data = $this->source->execute();
- $total = Proxy\Db::fetchOne($totalSql);
+ $total = (int) Proxy\Db::fetchOne($totalSql);
});
$gridData = new Grid\Data($data);
diff --git a/src/Grid/Source/SqlSource.php b/src/Grid/Source/SqlSource.php
index b69dece6..2f90cae3 100644
--- a/src/Grid/Source/SqlSource.php
+++ b/src/Grid/Source/SqlSource.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Grid\Source;
use Bluz\Db;
@@ -63,7 +62,7 @@ public function process(array $settings = [])
}
$where[] = $column .' '.
$this->filters[$filter].' '.
- Proxy\Db::quote($value);
+ Proxy\Db::quote((string)$value);
}
}
}
@@ -109,7 +108,7 @@ public function process(array $settings = [])
// use transaction to avoid errors
Proxy\Db::transaction(function () use (&$data, &$total, $dataSql, $totalSql) {
$data = Proxy\Db::fetchAll($dataSql);
- $total = Proxy\Db::fetchOne($totalSql);
+ $total = (int) Proxy\Db::fetchOne($totalSql);
});
$gridData = new Grid\Data($data);
diff --git a/src/Http/CacheControl.php b/src/Http/CacheControl.php
index 8b6a8964..e16f8489 100644
--- a/src/Http/CacheControl.php
+++ b/src/Http/CacheControl.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Http;
use Bluz\Common\Container\Container;
diff --git a/src/Http/RequestMethod.php b/src/Http/RequestMethod.php
index 848a0f23..2bf6827e 100644
--- a/src/Http/RequestMethod.php
+++ b/src/Http/RequestMethod.php
@@ -1,7 +1,13 @@
initRouters();
+ list($routers, $reverse) = $this->prepareRouterData();
Cache::set('router.routers', $routers, Cache::TTL_NO_EXPIRY, ['system']);
Cache::set('router.reverse', $reverse, Cache::TTL_NO_EXPIRY, ['system']);
}
@@ -107,9 +106,9 @@ public function __construct()
/**
* Initial routers data from controllers
*
- * @return array
+ * @return array[]
*/
- protected function initRouters()
+ private function prepareRouterData()
{
$routers = [];
$reverse = [];
@@ -421,7 +420,7 @@ protected function urlRoute($module, $controller, $params)
$getParams[$key] = $value;
continue;
}
- $url .= '/' . urlencode($key) . '/' . urlencode($value);
+ $url .= '/' . urlencode((string)$key) . '/' . urlencode((string)$value);
}
if (!empty($getParams)) {
$url .= '?' . http_build_query($getParams);
diff --git a/src/Router/RouterException.php b/src/Router/RouterException.php
index 1f066a77..bfeb953e 100644
--- a/src/Router/RouterException.php
+++ b/src/Router/RouterException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Router;
use Bluz\Common\Exception\CommonException;
diff --git a/src/Session/Adapter/AbstractAdapter.php b/src/Session/Adapter/AbstractAdapter.php
index 8a55f894..6d67f23e 100644
--- a/src/Session/Adapter/AbstractAdapter.php
+++ b/src/Session/Adapter/AbstractAdapter.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Session\Adapter;
/**
diff --git a/src/Session/Adapter/Cache.php b/src/Session/Adapter/Cache.php
index e20867ab..46076e33 100644
--- a/src/Session/Adapter/Cache.php
+++ b/src/Session/Adapter/Cache.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Session\Adapter;
use Bluz\Common\Exception\ConfigurationException;
diff --git a/src/Session/Adapter/Redis.php b/src/Session/Adapter/Redis.php
index 59a86bfd..43e60a02 100644
--- a/src/Session/Adapter/Redis.php
+++ b/src/Session/Adapter/Redis.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Session\Adapter;
use Bluz\Common\Exception\ComponentException;
diff --git a/src/Session/Session.php b/src/Session/Session.php
index b43f5918..58105c91 100644
--- a/src/Session/Session.php
+++ b/src/Session/Session.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Session;
use Bluz\Common\Exception\ComponentException;
diff --git a/src/Session/SessionException.php b/src/Session/SessionException.php
index 3a024877..881df6cc 100644
--- a/src/Session/SessionException.php
+++ b/src/Session/SessionException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Session;
use Bluz\Common\Exception\CommonException;
diff --git a/src/Translator/Translator.php b/src/Translator/Translator.php
index c87e24eb..3c495de0 100644
--- a/src/Translator/Translator.php
+++ b/src/Translator/Translator.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Translator;
use Bluz\Common\Exception\ConfigurationException;
diff --git a/src/Validator/Exception/ComponentException.php b/src/Validator/Exception/ComponentException.php
index a873bddc..3ab87c3e 100644
--- a/src/Validator/Exception/ComponentException.php
+++ b/src/Validator/Exception/ComponentException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Exception;
use Bluz\Common\Exception;
diff --git a/src/Validator/Exception/ValidatorException.php b/src/Validator/Exception/ValidatorException.php
index 7fd10f99..01e5458e 100644
--- a/src/Validator/Exception/ValidatorException.php
+++ b/src/Validator/Exception/ValidatorException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Exception;
use Bluz\Application\Exception\BadRequestException;
diff --git a/src/Validator/Rule/AbstractCompareRule.php b/src/Validator/Rule/AbstractCompareRule.php
index 017f8668..5d41cd71 100644
--- a/src/Validator/Rule/AbstractCompareRule.php
+++ b/src/Validator/Rule/AbstractCompareRule.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/AbstractCtypeRule.php b/src/Validator/Rule/AbstractCtypeRule.php
index f4cf821f..3591af66 100644
--- a/src/Validator/Rule/AbstractCtypeRule.php
+++ b/src/Validator/Rule/AbstractCtypeRule.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/AbstractFilterRule.php b/src/Validator/Rule/AbstractFilterRule.php
index bae8211c..e65bcd1e 100644
--- a/src/Validator/Rule/AbstractFilterRule.php
+++ b/src/Validator/Rule/AbstractFilterRule.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
use Bluz\Validator\Exception\ComponentException;
diff --git a/src/Validator/Rule/AbstractRule.php b/src/Validator/Rule/AbstractRule.php
index b8bd1319..414eab1f 100644
--- a/src/Validator/Rule/AbstractRule.php
+++ b/src/Validator/Rule/AbstractRule.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
use Bluz\Translator\Translator;
diff --git a/src/Validator/Rule/Alpha.php b/src/Validator/Rule/Alpha.php
index acbd0558..0b3acba8 100644
--- a/src/Validator/Rule/Alpha.php
+++ b/src/Validator/Rule/Alpha.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/AlphaNumeric.php b/src/Validator/Rule/AlphaNumeric.php
index a64fdc60..a3637730 100644
--- a/src/Validator/Rule/AlphaNumeric.php
+++ b/src/Validator/Rule/AlphaNumeric.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/ArrayInput.php b/src/Validator/Rule/ArrayInput.php
index 56341d9d..31e1ee63 100644
--- a/src/Validator/Rule/ArrayInput.php
+++ b/src/Validator/Rule/ArrayInput.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
use Bluz\Validator\Exception\ComponentException;
diff --git a/src/Validator/Rule/Between.php b/src/Validator/Rule/Between.php
index cabe6144..29484763 100644
--- a/src/Validator/Rule/Between.php
+++ b/src/Validator/Rule/Between.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
use Bluz\Validator\Exception\ComponentException;
diff --git a/src/Validator/Rule/Callback.php b/src/Validator/Rule/Callback.php
index d360394e..e512aa78 100644
--- a/src/Validator/Rule/Callback.php
+++ b/src/Validator/Rule/Callback.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
use Bluz\Validator\Exception\ComponentException;
diff --git a/src/Validator/Rule/Condition.php b/src/Validator/Rule/Condition.php
index 2fb97133..0fecf3ca 100644
--- a/src/Validator/Rule/Condition.php
+++ b/src/Validator/Rule/Condition.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Contains.php b/src/Validator/Rule/Contains.php
index 8de49e24..c6ad6542 100644
--- a/src/Validator/Rule/Contains.php
+++ b/src/Validator/Rule/Contains.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/CountryCode.php b/src/Validator/Rule/CountryCode.php
index 7642a6a3..589937ff 100644
--- a/src/Validator/Rule/CountryCode.php
+++ b/src/Validator/Rule/CountryCode.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/CreditCard.php b/src/Validator/Rule/CreditCard.php
index 921ce0b6..81c2bb8c 100644
--- a/src/Validator/Rule/CreditCard.php
+++ b/src/Validator/Rule/CreditCard.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Date.php b/src/Validator/Rule/Date.php
index 9e4b6964..7c7cfd9d 100644
--- a/src/Validator/Rule/Date.php
+++ b/src/Validator/Rule/Date.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
use DateTime;
diff --git a/src/Validator/Rule/Domain.php b/src/Validator/Rule/Domain.php
index fa8ef9c9..540149f1 100644
--- a/src/Validator/Rule/Domain.php
+++ b/src/Validator/Rule/Domain.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
@@ -46,6 +45,7 @@ public function __construct($checkDns = false)
*/
public function validate($input) : bool
{
+ $input = (string) $input;
// check by regular expression
if (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $input)
&& preg_match("/^.{1,253}$/", $input)
diff --git a/src/Validator/Rule/Email.php b/src/Validator/Rule/Email.php
index 6c9787b1..51281c3f 100644
--- a/src/Validator/Rule/Email.php
+++ b/src/Validator/Rule/Email.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Equals.php b/src/Validator/Rule/Equals.php
index 570719ed..96f2fc6a 100644
--- a/src/Validator/Rule/Equals.php
+++ b/src/Validator/Rule/Equals.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/FloatInput.php b/src/Validator/Rule/FloatInput.php
index a3265ae9..1d39262e 100644
--- a/src/Validator/Rule/FloatInput.php
+++ b/src/Validator/Rule/FloatInput.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/In.php b/src/Validator/Rule/In.php
index 22a299bb..3dc64989 100644
--- a/src/Validator/Rule/In.php
+++ b/src/Validator/Rule/In.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Integer.php b/src/Validator/Rule/Integer.php
index 3fb84d55..fe583d51 100644
--- a/src/Validator/Rule/Integer.php
+++ b/src/Validator/Rule/Integer.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Ip.php b/src/Validator/Rule/Ip.php
index 5e7620ec..244dc1a4 100644
--- a/src/Validator/Rule/Ip.php
+++ b/src/Validator/Rule/Ip.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
use Bluz\Validator\Exception\ComponentException;
@@ -128,7 +127,6 @@ protected function parseRangeUsingCidr($input, &$range)
if ($isAddressMask && $this->verifyAddress($input[1])) {
$range['mask'] = sprintf('%032b', ip2long($input[1]));
-
return ;
}
@@ -136,7 +134,7 @@ protected function parseRangeUsingCidr($input, &$range)
throw new ComponentException('Invalid network mask');
}
- $range['mask'] = sprintf('%032b', ip2long(long2ip(~(pow(2, (32 - $input[1])) - 1))));
+ $range['mask'] = sprintf('%032b', ip2long(long2ip((string)~(pow(2, (32 - $input[1])) - 1))));
}
/**
@@ -218,7 +216,7 @@ public function getTemplate()
if (isset($this->networkRange['max'])) {
$message .= '-' . $this->networkRange['max'];
} else {
- $message .= '/' . long2ip(bindec($this->networkRange['mask']));
+ $message .= '/' . long2ip((string)bindec($this->networkRange['mask']));
}
return __('{{name}} must be an IP address in the "%s" range', $message);
} else {
diff --git a/src/Validator/Rule/Json.php b/src/Validator/Rule/Json.php
index 4d7ceaa0..1417bfdd 100644
--- a/src/Validator/Rule/Json.php
+++ b/src/Validator/Rule/Json.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Latin.php b/src/Validator/Rule/Latin.php
index f8ba930f..8e6b154f 100644
--- a/src/Validator/Rule/Latin.php
+++ b/src/Validator/Rule/Latin.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/LatinNumeric.php b/src/Validator/Rule/LatinNumeric.php
index f6f4a4f1..ca585c3b 100644
--- a/src/Validator/Rule/LatinNumeric.php
+++ b/src/Validator/Rule/LatinNumeric.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Length.php b/src/Validator/Rule/Length.php
index d1e3adf6..9dfe175b 100644
--- a/src/Validator/Rule/Length.php
+++ b/src/Validator/Rule/Length.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
use Bluz\Validator\Exception\ComponentException;
diff --git a/src/Validator/Rule/Max.php b/src/Validator/Rule/Max.php
index 76c3f12f..bf87c2d4 100644
--- a/src/Validator/Rule/Max.php
+++ b/src/Validator/Rule/Max.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Min.php b/src/Validator/Rule/Min.php
index 03f815aa..990f3ea5 100644
--- a/src/Validator/Rule/Min.php
+++ b/src/Validator/Rule/Min.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Negative.php b/src/Validator/Rule/Negative.php
index ff940a02..b4e688eb 100644
--- a/src/Validator/Rule/Negative.php
+++ b/src/Validator/Rule/Negative.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/NoWhitespace.php b/src/Validator/Rule/NoWhitespace.php
index 75892d4a..730603e0 100644
--- a/src/Validator/Rule/NoWhitespace.php
+++ b/src/Validator/Rule/NoWhitespace.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
@@ -31,6 +30,6 @@ class NoWhitespace extends AbstractRule
*/
public function validate($input) : bool
{
- return is_null($input) || !preg_match('/\s/', $input);
+ return is_null($input) || !preg_match('/\s/', (string) $input);
}
}
diff --git a/src/Validator/Rule/NotEmpty.php b/src/Validator/Rule/NotEmpty.php
index ba9cb131..47699873 100644
--- a/src/Validator/Rule/NotEmpty.php
+++ b/src/Validator/Rule/NotEmpty.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Numeric.php b/src/Validator/Rule/Numeric.php
index 4ed53a2e..5a6c7772 100644
--- a/src/Validator/Rule/Numeric.php
+++ b/src/Validator/Rule/Numeric.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Positive.php b/src/Validator/Rule/Positive.php
index aa587e8b..a6f7a9e7 100644
--- a/src/Validator/Rule/Positive.php
+++ b/src/Validator/Rule/Positive.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Regexp.php b/src/Validator/Rule/Regexp.php
index 9138f4c1..367b70ff 100644
--- a/src/Validator/Rule/Regexp.php
+++ b/src/Validator/Rule/Regexp.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Required.php b/src/Validator/Rule/Required.php
index 12a1eff5..c5ca0508 100644
--- a/src/Validator/Rule/Required.php
+++ b/src/Validator/Rule/Required.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Slug.php b/src/Validator/Rule/Slug.php
index 7780a2ec..51ef57a3 100644
--- a/src/Validator/Rule/Slug.php
+++ b/src/Validator/Rule/Slug.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/StringInput.php b/src/Validator/Rule/StringInput.php
index a1a8323e..abc1dc40 100644
--- a/src/Validator/Rule/StringInput.php
+++ b/src/Validator/Rule/StringInput.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Rule/Version.php b/src/Validator/Rule/Version.php
index ecd02ebd..c0df8a4d 100644
--- a/src/Validator/Rule/Version.php
+++ b/src/Validator/Rule/Version.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Rule;
/**
diff --git a/src/Validator/Traits/Validator.php b/src/Validator/Traits/Validator.php
index 4687fcf5..6c882d39 100644
--- a/src/Validator/Traits/Validator.php
+++ b/src/Validator/Traits/Validator.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator\Traits;
use Bluz\Validator\ValidatorBuilder;
diff --git a/src/Validator/Validator.php b/src/Validator/Validator.php
index 37b23394..ef83767b 100644
--- a/src/Validator/Validator.php
+++ b/src/Validator/Validator.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator;
use Bluz\Validator\Exception\ComponentException;
diff --git a/src/Validator/ValidatorBuilder.php b/src/Validator/ValidatorBuilder.php
index 07175833..63f6c5b5 100644
--- a/src/Validator/ValidatorBuilder.php
+++ b/src/Validator/ValidatorBuilder.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\Validator;
use Bluz\Validator\Exception\ValidatorException;
diff --git a/src/View/Helper/Ahref.php b/src/View/Helper/Ahref.php
index 460b689f..4e26b533 100644
--- a/src/View/Helper/Ahref.php
+++ b/src/View/Helper/Ahref.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\Proxy\Request;
diff --git a/src/View/Helper/Attributes.php b/src/View/Helper/Attributes.php
index 839bf892..8f6c35bf 100644
--- a/src/View/Helper/Attributes.php
+++ b/src/View/Helper/Attributes.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\View\View;
diff --git a/src/View/Helper/BaseUrl.php b/src/View/Helper/BaseUrl.php
index f7d74ed3..330c61fc 100644
--- a/src/View/Helper/BaseUrl.php
+++ b/src/View/Helper/BaseUrl.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\Proxy\Router;
diff --git a/src/View/Helper/Checkbox.php b/src/View/Helper/Checkbox.php
index 03a5271e..48022114 100644
--- a/src/View/Helper/Checkbox.php
+++ b/src/View/Helper/Checkbox.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\View\View;
diff --git a/src/View/Helper/Controller.php b/src/View/Helper/Controller.php
index 117ec456..04fcaf07 100644
--- a/src/View/Helper/Controller.php
+++ b/src/View/Helper/Controller.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\Proxy\Request;
diff --git a/src/View/Helper/Dispatch.php b/src/View/Helper/Dispatch.php
index b291e8d0..fd58d033 100644
--- a/src/View/Helper/Dispatch.php
+++ b/src/View/Helper/Dispatch.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\Application\Application;
diff --git a/src/View/Helper/Exception.php b/src/View/Helper/Exception.php
index b3a2f620..0c9ab755 100644
--- a/src/View/Helper/Exception.php
+++ b/src/View/Helper/Exception.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\Application\Application;
diff --git a/src/View/Helper/Gravatar.php b/src/View/Helper/Gravatar.php
index d1f63335..3f82d005 100644
--- a/src/View/Helper/Gravatar.php
+++ b/src/View/Helper/Gravatar.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\Application\Application;
diff --git a/src/View/Helper/HasModule.php b/src/View/Helper/HasModule.php
index 4967888c..6ed09dff 100644
--- a/src/View/Helper/HasModule.php
+++ b/src/View/Helper/HasModule.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
/**
diff --git a/src/View/Helper/HeadScript.php b/src/View/Helper/HeadScript.php
index 737c74d0..8db915e3 100644
--- a/src/View/Helper/HeadScript.php
+++ b/src/View/Helper/HeadScript.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\Application\Application;
diff --git a/src/View/Helper/HeadStyle.php b/src/View/Helper/HeadStyle.php
index a393da5b..6a044a05 100644
--- a/src/View/Helper/HeadStyle.php
+++ b/src/View/Helper/HeadStyle.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\Application\Application;
diff --git a/src/View/Helper/Module.php b/src/View/Helper/Module.php
index 29339f8d..0888458f 100644
--- a/src/View/Helper/Module.php
+++ b/src/View/Helper/Module.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\Proxy\Request;
diff --git a/src/View/Helper/Partial.php b/src/View/Helper/Partial.php
index 77b294a4..e9042c5d 100644
--- a/src/View/Helper/Partial.php
+++ b/src/View/Helper/Partial.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\View\View;
diff --git a/src/View/Helper/PartialLoop.php b/src/View/Helper/PartialLoop.php
index 70faf494..3fcac473 100644
--- a/src/View/Helper/PartialLoop.php
+++ b/src/View/Helper/PartialLoop.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\View\View;
diff --git a/src/View/Helper/Radio.php b/src/View/Helper/Radio.php
index 2e2c75cd..d67cfcc1 100644
--- a/src/View/Helper/Radio.php
+++ b/src/View/Helper/Radio.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\View\View;
diff --git a/src/View/Helper/Redactor.php b/src/View/Helper/Redactor.php
index b8337bcc..29f16ab6 100644
--- a/src/View/Helper/Redactor.php
+++ b/src/View/Helper/Redactor.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\View\View;
diff --git a/src/View/Helper/Script.php b/src/View/Helper/Script.php
index 41552b4f..51daf156 100644
--- a/src/View/Helper/Script.php
+++ b/src/View/Helper/Script.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\View\View;
diff --git a/src/View/Helper/Select.php b/src/View/Helper/Select.php
index a283af8d..02040222 100644
--- a/src/View/Helper/Select.php
+++ b/src/View/Helper/Select.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\View\View;
diff --git a/src/View/Helper/Style.php b/src/View/Helper/Style.php
index 2b53b77b..c0f1366c 100644
--- a/src/View/Helper/Style.php
+++ b/src/View/Helper/Style.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\View\View;
diff --git a/src/View/Helper/Url.php b/src/View/Helper/Url.php
index 956109cf..08fcc453 100644
--- a/src/View/Helper/Url.php
+++ b/src/View/Helper/Url.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\Application\Exception\ForbiddenException;
diff --git a/src/View/Helper/User.php b/src/View/Helper/User.php
index f19dd41f..a934b0a7 100644
--- a/src/View/Helper/User.php
+++ b/src/View/Helper/User.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View\Helper;
use Bluz\Auth\EntityInterface;
diff --git a/src/View/View.php b/src/View/View.php
index 891bb0db..f4c3df1b 100644
--- a/src/View/View.php
+++ b/src/View/View.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View;
use Bluz\Application\Application;
@@ -95,16 +94,6 @@ public function __construct()
$this->addHelperPath(dirname(__FILE__) . '/Helper/');
}
- /**
- * List of packed properties
- *
- * @return string[]
- */
- public function __sleep()
- {
- return ['baseUrl', 'container', 'helpersPath', 'path', 'partialPath', 'template'];
- }
-
/**
* Render like string
*
diff --git a/src/View/ViewException.php b/src/View/ViewException.php
index b41e56c5..28e92122 100644
--- a/src/View/ViewException.php
+++ b/src/View/ViewException.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View;
use Bluz\Common\Exception\CommonException;
diff --git a/src/View/ViewInterface.php b/src/View/ViewInterface.php
index 5ed33597..632cf9bb 100644
--- a/src/View/ViewInterface.php
+++ b/src/View/ViewInterface.php
@@ -6,9 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
-/**
- * @namespace
- */
+declare(strict_types=1);
+
namespace Bluz\View;
/**
diff --git a/src/_functions.php b/src/_functions.php
index ed0dc7c0..13f4504e 100644
--- a/src/_functions.php
+++ b/src/_functions.php
@@ -6,6 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
+declare(strict_types=1);
+
use Bluz\Translator\Translator;
/**
@@ -69,6 +71,9 @@ function debug(...$params)
*/
function esc($variable, int $flags = ENT_HTML5)
{
+ if (!$variable) {
+ return '';
+ }
return htmlentities($variable, $flags, "UTF-8");
}
}
diff --git a/src/_loader.php b/src/_loader.php
index 5b2144d0..29533651 100644
--- a/src/_loader.php
+++ b/src/_loader.php
@@ -6,6 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
+declare(strict_types=1);
+
/**
* Files in this list is core of framework
* use require_once it's really faster than use Loader for it
diff --git a/src/_translator.php b/src/_translator.php
index 04a98e84..5de3e4be 100644
--- a/src/_translator.php
+++ b/src/_translator.php
@@ -6,6 +6,8 @@
* @link https://github.com/bluzphp/framework
*/
+declare(strict_types=1);
+
/**
* This is file required for poedit parser only
* Please, don't use it for anything else
diff --git a/tests/src/Application/ApplicationTest.php b/tests/src/Application/ApplicationTest.php
index 81983d00..662edd89 100644
--- a/tests/src/Application/ApplicationTest.php
+++ b/tests/src/Application/ApplicationTest.php
@@ -83,6 +83,7 @@ public function testErrorController()
// run Application
self::getApp()->process();
+
self::assertEquals(Router::getErrorModule(), self::getApp()->getModule());
self::assertEquals(Router::getErrorController(), self::getApp()->getController());
}
diff --git a/tests/src/Fixtures/Models/UserAdmin.php b/tests/src/Fixtures/Models/UserAdmin.php
index ab513cae..48ed7f30 100644
--- a/tests/src/Fixtures/Models/UserAdmin.php
+++ b/tests/src/Fixtures/Models/UserAdmin.php
@@ -32,7 +32,7 @@ public function tryLogin()
*
* @return array
*/
- public function getPrivileges()
+ public function getPrivileges() : array
{
return [];
}
@@ -55,7 +55,7 @@ public function hasRole($roleId)
* @param string $privilege
* @return boolean
*/
- public function hasPrivilege($module, $privilege)
+ public function hasPrivilege($module, $privilege) : bool
{
return true;
}
diff --git a/tests/src/Fixtures/Models/UserGuest.php b/tests/src/Fixtures/Models/UserGuest.php
index 08ad1845..8b85764a 100644
--- a/tests/src/Fixtures/Models/UserGuest.php
+++ b/tests/src/Fixtures/Models/UserGuest.php
@@ -32,7 +32,7 @@ public function tryLogin()
*
* @return array
*/
- public function getPrivileges()
+ public function getPrivileges() : array
{
return [];
}
@@ -55,7 +55,7 @@ public function hasRole($roleId)
* @param string $privilege
* @return boolean
*/
- public function hasPrivilege($module, $privilege)
+ public function hasPrivilege($module, $privilege) : bool
{
return false;
}
diff --git a/tests/src/View/ViewTest.php b/tests/src/View/ViewTest.php
index 4f57025a..944099ea 100644
--- a/tests/src/View/ViewTest.php
+++ b/tests/src/View/ViewTest.php
@@ -71,22 +71,6 @@ public function testData()
self::assertEqualsArray(['foo' => 'bar', 'baz' => 'qux'], $view->toArray());
}
- /**
- * Test Serialization
- */
- public function testSerialization()
- {
- $view = new View();
-
- $view->foo = 'bar';
- $view->baz = 'qux';
-
- $view = unserialize(serialize($view));
-
- self::assertEquals('bar', $view->foo);
- self::assertEquals('qux', $view->baz);
- }
-
/**
* Test JSON serialization
*/