Skip to content

Commit

Permalink
Uses @return $this in PHPDoc for fluent interface
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Jul 19, 2023
1 parent 6461f3c commit d3f0fdc
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 39 deletions.
8 changes: 4 additions & 4 deletions src/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function getUrl($row)

/**
* @param string|NULL $icon
* @return self
* @return $this
*/
public function setIcon($icon)
{
Expand All @@ -105,7 +105,7 @@ public function getIcon()

/**
* @param string $primaryKey
* @return self
* @return $this
*/
public function setPrimaryKey($primaryKey)
{
Expand All @@ -125,7 +125,7 @@ public function getPrimaryKey()


/**
* @return self
* @return $this
*/
public function setDisabled(callable $callback)
{
Expand All @@ -150,7 +150,7 @@ public function isDisabled($row)

/**
* @param string $type
* @return self
* @return $this
*/
public function setType($type)
{
Expand Down
2 changes: 1 addition & 1 deletion src/BulkAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function getEmptySelection()
/**
* @param string $name
* @param mixed $value
* @return self
* @return $this
*/
public function setOption($name, $value)
{
Expand Down
14 changes: 7 additions & 7 deletions src/Columns/AbstractColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function getLabel()

/**
* @param string $rowField
* @return self
* @return $this
*/
public function setRowField($rowField)
{
Expand Down Expand Up @@ -118,7 +118,7 @@ public function formatValue($row)

/**
* @param callable|NULL $customRender
* @return self
* @return $this
*/
public function setCustomRender($customRender)
{
Expand All @@ -129,7 +129,7 @@ public function setCustomRender($customRender)

/**
* @param callable|NULL $valueProvider
* @return self
* @return $this
*/
public function setValueProvider(callable $valueProvider = NULL)
{
Expand All @@ -150,7 +150,7 @@ public function getSort()

/**
* @param string $sorting
* @return self
* @return $this
*/
public function setSort($sorting)
{
Expand All @@ -167,7 +167,7 @@ public function setSort($sorting)

/**
* @param bool|string|string[] $sortable
* @return self
* @return $this
*/
public function setSortable($sortable = TRUE)
{
Expand Down Expand Up @@ -223,7 +223,7 @@ public function getAttributes(array $defaultAttributes = NULL)
/**
* @param string $attr
* @param scalar|NULL $value
* @return self
* @return $this
*/
public function setAttribute($attr, $value)
{
Expand All @@ -245,7 +245,7 @@ public function setAttribute($attr, $value)
/**
* @param string $property
* @param scalar|NULL $value
* @return self
* @return $this
*/
public function setStyle($property, $value)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Columns/NumberColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class NumberColumn extends AbstractColumn

/**
* @param string|NULL $prefix
* @return static
* @return $this
*/
public function setPrefix($prefix)
{
Expand All @@ -30,7 +30,7 @@ public function setPrefix($prefix)

/**
* @param string|NULL $suffix
* @return static
* @return $this
*/
public function setSuffix($suffix)
{
Expand All @@ -41,7 +41,7 @@ public function setSuffix($suffix)

/**
* @param int $decimals
* @return static
* @return $this
*/
public function setDecimals($decimals)
{
Expand Down
8 changes: 4 additions & 4 deletions src/DataGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __construct(IDataSource $dataSource)
/**
* @param string $file file path or template name
* @param array<string, mixed> $parameters
* @return self
* @return $this
*/
public function setTemplateFile($file, array $parameters = [])
{
Expand All @@ -91,7 +91,7 @@ public function setTemplateFile($file, array $parameters = [])
/**
* @param int|NULL $itemsOnPage
* @param bool|int[] $changeable
* @return self
* @return $this
*/
public function setItemsOnPage($itemsOnPage = NULL, $changeable = FALSE)
{
Expand Down Expand Up @@ -124,7 +124,7 @@ public function setItemsOnPage($itemsOnPage = NULL, $changeable = FALSE)

/**
* @param array<string, string> $sorts [column => (string) ASC|DESC]
* @return self
* @return $this
*/
public function setDefaultSort(array $sorts)
{
Expand All @@ -147,7 +147,7 @@ public function setDefaultSort(array $sorts)


/**
* @return self
* @return $this
*/
public function setRowAttributes(callable $callback)
{
Expand Down
2 changes: 1 addition & 1 deletion src/FilterCondition.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getValue()
/**
* @param string $modifier
* @param array<string, mixed> $arguments
* @return self
* @return $this
*/
public function addModifier($modifier, array $arguments = [])
{
Expand Down
6 changes: 3 additions & 3 deletions src/Filters/AbstractFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function isActive()

/**
* @param string $rowField
* @return self
* @return $this
*/
public function setRowField($rowField)
{
Expand All @@ -98,7 +98,7 @@ public function getRowField()

/**
* @param string $value
* @return self
* @return $this
*/
public function setValue($value)
{
Expand All @@ -120,7 +120,7 @@ public function getValue()

/**
* @param callable|int $condition
* @return static
* @return $this
*/
public function setCondition($condition)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Filters/MultiSelectFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct($name, $label, array $items, $rowField = NULL)

/**
* @param string $value
* @return self
* @return $this
*/
public function setValue($value)
{
Expand Down Expand Up @@ -69,7 +69,7 @@ public function getValue()

/**
* @param string|string[] $value
* @return self
* @return $this
*/
public function setFormValue($value)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Filters/SelectFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct($name, $label, array $items, $rowField = NULL)

/**
* @param string $value
* @return self
* @return $this
*/
public function setFormValue($value)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Filters/TextFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TextFilter extends AbstractFilter

/**
* @param string|NULL $placeholder
* @return static
* @return $this
*/
public function setPlaceholder($placeholder)
{
Expand All @@ -27,7 +27,7 @@ public function setPlaceholder($placeholder)

/**
* @param string $value
* @return static
* @return $this
*/
public function setFormValue($value)
{
Expand Down
14 changes: 7 additions & 7 deletions src/IColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function getLabel();

/**
* @param string $rowField
* @return self
* @return $this
*/
function setRowField($rowField);

Expand All @@ -45,13 +45,13 @@ function formatValue($row);

/**
* @param callable|NULL $customRender
* @return self
* @return $this
*/
function setCustomRender($customRender);


/**
* @return self
* @return $this
*/
function setValueProvider(callable $customRender = NULL);

Expand All @@ -64,14 +64,14 @@ function getSort();

/**
* @param string $sorting
* @return self
* @return $this
*/
function setSort($sorting);


/**
* @param bool|string|string[] $sortable
* @return self
* @return $this
*/
function setSortable($sortable = TRUE);

Expand All @@ -97,14 +97,14 @@ function getAttributes();
/**
* @param string $attr
* @param scalar|NULL $value
* @return self
* @return $this
*/
function setAttribute($attr, $value);

/**
* @param string $property
* @param scalar|NULL $value
* @return self
* @return $this
*/
function setStyle($property, $value);
}
8 changes: 4 additions & 4 deletions src/IFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function isActive();

/**
* @param string $rowField
* @return self
* @return $this
*/
function setRowField($rowField);

Expand All @@ -46,7 +46,7 @@ function getRowField();

/**
* @param string $value
* @return self
* @return $this
*/
function setValue($value);

Expand All @@ -59,14 +59,14 @@ function getValue();

/**
* @param callable|int $condition
* @return self
* @return $this
*/
function setCondition($condition);


/**
* @param mixed $value
* @return self
* @return $this
*/
function setFormValue($value);

Expand Down

0 comments on commit d3f0fdc

Please sign in to comment.