Skip to content

Commit

Permalink
add types, remove unneeded depedency solutosoft/yii2-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
TonisOrmisson committed Oct 12, 2024
1 parent fd69fc8 commit f5ccbdb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
],
"require": {
"php" : ">=8.0",
"yiisoft/yii2": "~2.0.0",
"solutosoft/yii2-plugin": "~1.0.0"
"yiisoft/yii2": "~2.0.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0 || ^9.0 || ^10.0 || ^11.0",
Expand Down
6 changes: 4 additions & 2 deletions src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

namespace leandrogehlen\querybuilder;

use yii\base\Widget;

/**
* QueryBuilder renders a jQuery QueryBuilder component.
*
* @see http://mistic100.github.io/jQuery-QueryBuilder/
* @author Leandro Gehlen <[email protected]>
*/
class QueryBuilder extends \soluto\plugin\Widget {
class QueryBuilder extends Widget {

/**
* @inheridoc
*/
public $pluginName = 'queryBuilder';
public string $pluginName = 'queryBuilder';

/**
* @return string[]
Expand Down
4 changes: 2 additions & 2 deletions src/QueryBuilderAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
*
* @author Leandro Gehlen <[email protected]>
*/
class QueryBuilderAsset extends AssetBundle {
class QueryBuilderAsset extends AssetBundle
{

public $sourcePath = '@npm/jQuery-QueryBuilder/dist';

Expand All @@ -34,5 +35,4 @@ class QueryBuilderAsset extends AssetBundle {
'yii\web\JqueryAsset'
];


}
2 changes: 1 addition & 1 deletion src/QueryBuilderForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function init() : void
$this->options['id'] = $this->getId();
}

echo $this->builder->run();
$this->builder->run();
echo Html::beginForm($this->action, $this->method, $this->options);
echo Html::hiddenInput($this->rulesParam);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Translator
* @param array<mixed> $data Rules configuraion
* @param ?string $paramPrefix prefix added to parameters, to be changed in case of multiple translator params being merged
*/
public function __construct(private array $data, ?string $paramPrefix = null)
public function __construct(private readonly array $data, ?string $paramPrefix = null)
{
$this->init();
if($paramPrefix){
Expand All @@ -69,7 +69,7 @@ public function __construct(private array $data, ?string $paramPrefix = null)
* @param array<string, mixed> $params query parameters
* @return string encoded rule
*/
protected function encodeRule(string $field, string $type, array $params)
protected function encodeRule(string $field, string $type, array $params): string
{
$pattern = $this->_operators[$type];
$keys = array_keys($params);
Expand Down Expand Up @@ -98,7 +98,7 @@ protected function encodeRule(string $field, string $type, array $params)
* @param array<mixed> $data rules configuration
* @return string the WHERE clause
*/
protected function buildWhere($data)
protected function buildWhere(array $data) : string
{
if (!isset($data['rules']) || !$data['rules']) {
return '';
Expand Down Expand Up @@ -137,7 +137,7 @@ protected function buildWhere($data)
* Returns query WHERE condition.
* @return string
*/
public function where()
public function where() : string
{
return $this->_where;
}
Expand All @@ -146,7 +146,7 @@ public function where()
* Returns the parameters to be bound to the query.
* @return array<string,mixed>
*/
public function params()
public function params() : array
{
return $this->_params;
}
Expand Down

0 comments on commit f5ccbdb

Please sign in to comment.