Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Nov 10, 2023
1 parent e8fa78d commit 68a54a4
Show file tree
Hide file tree
Showing 16 changed files with 205 additions and 197 deletions.
8 changes: 4 additions & 4 deletions src/ActiveDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public function getAggregations(): array
*
* @param string $name aggregation name.
*
* @return array aggregation results.
*
* @throws InvalidCallException if query results do not contain the requested aggregation.
*
* @return array aggregation results.
*/
public function getAggregation(string $name): array

Check warning on line 84 in src/ActiveDataProvider.php

View check run for this annotation

Codecov / codecov/patch

src/ActiveDataProvider.php#L84

Added line #L84 was not covered by tests
{
Expand Down Expand Up @@ -107,9 +107,9 @@ public function getSuggestions(): array
*
* @param string $name suggestion name.
*
* @return array suggestion results.
*
* @throws InvalidCallException if query results do not contain the requested suggestion.
*
* @return array suggestion results.
*/
public function getSuggestion(string $name): array

Check warning on line 114 in src/ActiveDataProvider.php

View check run for this annotation

Codecov / codecov/patch

src/ActiveDataProvider.php#L114

Added line #L114 was not covered by tests
{
Expand Down
4 changes: 2 additions & 2 deletions src/ActiveFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ public function load(): void
*
* If the data file does not exist, an empty array will be returned.
*
* @return array the data rows to be inserted into the database index.
*
* @throws InvalidConfigException
*
* @return array the data rows to be inserted into the database index.
*/
protected function getData(): array

Check warning on line 156 in src/ActiveFixture.php

View check run for this annotation

Codecov / codecov/patch

src/ActiveFixture.php#L156

Added line #L156 was not covered by tests
{
Expand Down
12 changes: 6 additions & 6 deletions src/ActiveQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ public function init(): void
* @param Connection|null $db the DB connection used to create the DB command.
* If null, the DB connection returned by [[modelClass]] will be used.
*
* @return Command the created DB command instance.
*
* @throws Exception
*
* @return Command the created DB command instance.
*/
public function createCommand(Connection $db = null): Command
{
Expand Down Expand Up @@ -169,9 +169,9 @@ public function createCommand(Connection $db = null): Command
* @param Connection|null $db the DB connection used to create the DB command.
* If null, the DB connection returned by [[modelClass]] will be used.
*
* @return array the query results. If the query results in nothing, an empty array will be returned.
*
* @throws Exception
*
* @return array the query results. If the query results in nothing, an empty array will be returned.
*/
public function all($db = null): array
{
Expand Down Expand Up @@ -258,11 +258,11 @@ public function populate(array $rows): array
* @param Connection|null $db the DB connection used to create the DB command.
* If null, the DB connection returned by [[modelClass]] will be used.
*
* @throws Exception
*
* @return ActiveRecord|array|null a single row of a query result. Depending on the setting of [[asArray]],
* the query result may be either an array or an ActiveRecord object. Null will be returned
* if the query results in nothing.
*
* @throws Exception
*/
public function one($db = null): ActiveRecord|array|null
{
Expand Down
55 changes: 27 additions & 28 deletions src/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ class ActiveRecord extends BaseActiveRecord
* By default, the "elasticsearch" application component is used as the database connection.
* You may override this method if you want to use a different database connection.
*
* @return Connection the database connection used by this AR class.
*
* @throws InvalidConfigException
*
* @return Connection the database connection used by this AR class.
*/
public static function getDb()

Check warning on line 90 in src/ActiveRecord.php

View check run for this annotation

Codecov / codecov/patch

src/ActiveRecord.php#L90

Added line #L90 was not covered by tests
{
Expand All @@ -95,9 +95,9 @@ public static function getDb()
/**
* @inheritdoc
*
* @return ActiveQuery the newly created [[ActiveQuery]] instance.
*
* @throws InvalidConfigException
*
* @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/
public static function find()
{
Expand Down Expand Up @@ -174,10 +174,10 @@ private static function filterCondition(array $condition): array
* Please refer to the [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html)
* for more details on these options.
*
* @return static|null The record instance or null if it was not found.
*
* @throws InvalidConfigException
* @throws \yii\elasticsearch\Exception
*
* @return static|null The record instance or null if it was not found.
*/
public static function get(mixed $primaryKey, array $options = []): static|null
{
Expand Down Expand Up @@ -209,10 +209,10 @@ public static function get(mixed $primaryKey, array $options = []): static|null
* Please refer to the [Elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html)
* for more details on these options.
*
* @return array The record instances, or empty array if nothing was found
*
* @throws InvalidConfigException
* @throws \yii\elasticsearch\Exception
*
* @return array The record instances, or empty array if nothing was found
*/
public static function mget(array $primaryKeys, array $options = []): array
{
Expand Down Expand Up @@ -455,9 +455,9 @@ public static function populateRecord($record, $row): void
* - `_type`: the type this record is stored in.
* - `_Index`: the index this record is stored in.
*
* @return static the newly created active record
*
* @throws InvalidConfigException
*
* @return static the newly created active record
*/
public static function instantiate($row): static
{
Expand Down Expand Up @@ -510,10 +510,10 @@ public static function instantiate($row): static
*
* By default, the `op_type` is set to `create` if a model primary key is present.
*
* @return bool whether the attributes are valid and the record is inserted successfully.
*
* @throws InvalidConfigException
* @throws \yii\elasticsearch\Exception
*
* @return bool whether the attributes are valid and the record is inserted successfully.
*/
public function insert($runValidation = true, $attributes = null, array $options = [ ]): bool
{
Expand Down Expand Up @@ -590,13 +590,13 @@ public function insert($runValidation = true, $attributes = null, array $options
* Make sure the record has been fetched with a [[version]] before. This is only the case
* for records fetched via [[get()]] and [[mget()]] by default. For normal queries, the `_version` field has to be fetched explicitly.
*
* @return bool|int the number of rows affected, or false if validation fails
* or [[beforeSave()]] stops the updating process.
*
* @throws InvalidArgumentException if no [[version]] is available and optimistic locking is enabled.
* @throws Exception
* @throws InvalidConfigException in case update failed.
* @throws StaleObjectException if optimistic, locking is enabled and the data being updated is outdated.
*
* @return bool|int the number of rows affected, or false if validation fails
* or [[beforeSave()]] stops the updating process.
*/
public function update($runValidation = true, $attributeNames = null, array $options = []): bool|int
{
Expand All @@ -611,12 +611,12 @@ public function update($runValidation = true, $attributeNames = null, array $opt
* @param array $options options given in this parameter are passed to Elasticsearch
* as request URI parameters. See [[update()]] for details.
*
* @return false|int the number of rows affected, or false if [[beforeSave()]] stops the updating process.
*
* @throws Exception in case update failed.
* @throws InvalidConfigException
* @throws StaleObjectException if optimistic, locking is enabled and the data being updated is outdated.
*
* @return false|int the number of rows affected, or false if [[beforeSave()]] stops the updating process.
*
* @see update()
*/
protected function updateInternal($attributes = null, array $options = []): bool|int
Expand Down Expand Up @@ -684,10 +684,10 @@ protected function updateInternal($attributes = null, array $options = []): bool
*
* @param array $condition please refer to [[ActiveQuery::where()]] on how to specify this parameter
*
* @return array primary keys that correspond to given conditions
*
* @throws InvalidConfigException
*
* @return array primary keys that correspond to given conditions
*
* @see updateAllCounters()
* @see deleteAll()
* @see updateAll()
Expand Down Expand Up @@ -721,11 +721,10 @@ protected static function primaryKeysByCondition(array $condition): array
* @param array $condition the conditions that will be passed to the `where()` method when building the query.
* Please refer to [[ActiveQuery::where()]] on how to specify this parameter.
*
* @return int the number of rows updated
*
* @throws InvalidConfigException
*
* @throws Exception on error.*@see [[ActiveRecord::primaryKeysByCondition()]]
*
* @return int the number of rows updated
*/
public static function updateAll($attributes, $condition = []): int
{
Expand Down Expand Up @@ -774,11 +773,11 @@ public static function updateAll($attributes, $condition = []): int
* @param array $condition the conditions that will be passed to the `where()` method when building the query.
* Please refer to [[ActiveQuery::where()]] on how to specify this parameter.
*
* @return int the number of rows updated
*
* @throws InvalidConfigException
* @throws Exception on error.
*
* @return int the number of rows updated
*
* @see [[ActiveRecord::primaryKeysByCondition()]]
*/
public static function updateAllCounters($counters, $condition = []): int
Expand Down Expand Up @@ -854,13 +853,13 @@ public static function updateAllCounters($counters, $condition = []): int
* for records fetched via [[get()]] and [[mget()]] by default.
* For normal queries, the `_version` field has to be fetched explicitly.
*
* @return bool|int the number of rows deleted, or false if the deletion is unsuccessful for some reason.
*
* @throws StaleObjectException if optimistic, locking is enabled and the data being deleted is outdated.
* @throws Exception
* @throws InvalidConfigException in case delete failed.
*
* Note that it is possible the number of rows deleted is 0, even though the deletion execution is successful.
*
* @return bool|int the number of rows deleted, or false if the deletion is unsuccessful for some reason.
*/
public function delete(array $options = []): bool|int
{
Expand Down Expand Up @@ -914,11 +913,11 @@ public function delete(array $options = []): bool|int
* @param array $condition the conditions that will be passed to the `where()` method when building the query.
* Please refer to [[ActiveQuery::where()]] on how to specify this parameter.
*
* @return int the number of rows deleted
*
* @throws InvalidConfigException
* @throws Exception on error.
*
* @return int the number of rows deleted
*
* @see [[ActiveRecord::primaryKeysByCondition()]]
*/
public static function deleteAll($condition = []): int
Expand Down
4 changes: 2 additions & 2 deletions src/BatchQueryResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ public function next(): void
/**
* Fetches the next batch of data.
*
* @return array the data fetched
*
* @throws Exception
* @throws InvalidConfigException
*
* @return array the data fetched
*/
protected function fetchData(): array
{
Expand Down
3 changes: 2 additions & 1 deletion src/BulkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ class BulkCommand extends Component
/**
* Executes the bulk command.
*
* @return mixed
* @throws Exception
* @throws InvalidConfigException
*
* @return mixed
*/
public function execute(): mixed
{
Expand Down
Loading

0 comments on commit 68a54a4

Please sign in to comment.