for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace LeKoala\Tabulator\BulkActions;
use SilverStripe\Control\HTTPRequest;
use LeKoala\Tabulator\AbstractBulkAction;
/**
* Bulk action handler for unpublishing records.
*/
class BulkUnpublishAction extends AbstractBulkAction
{
protected string $name = 'unpublish';
protected string $label = 'Unpublish';
protected bool $xhr = true;
public function getI18nLabel(): string
return _t(__CLASS__ . '.UNPUBLISH_SELECT_LABEL', $this->getLabel());
}
public function process(HTTPRequest $request): string
$records = $this->getRecords() ?? [];
$this->getRecords()
LeKoala\Tabulator\AbstractBulkAction::getRecords()
This check looks for function or method calls that always return null and whose return value is used.
class A { function getObject() { return null; } } $a = new A(); if ($a->getObject()) {
The method getObject() can return nothing but null, so it makes no sense to use the return value.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
$i = 0;
foreach ($records as $record) {
$record->doUnpublish();
$i++;
$result = _t(__CLASS__ . ".RECORDSUNPUBLISHED", "{count} records unpublished", ["count" => $i]);
return $result;
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.