for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Leonidas\Framework\Module\Abstracts;
use Leonidas\Contracts\Extension\ModuleInterface;
use Leonidas\Contracts\System\Model\PostType\PostTypeInterface;
use Leonidas\Contracts\System\Model\PostType\PostTypeOptionHandlerCollectionInterface;
use Leonidas\Contracts\System\Model\PostType\PostTypeRegistrarInterface;
use Leonidas\Hooks\TargetsInitHook;
use Leonidas\Library\System\Model\PostType\PostTypeRegistrar;
abstract class PostTypeRegistrationModule extends Module implements ModuleInterface
{
use TargetsInitHook;
public function hook(): void
$this->targetInitHook();
}
protected function doInitAction(): void
$this->registerPostTypes();
protected function registerPostTypes(): void
$this->postTypeRegistrar()->registerMany(...$this->postTypes());
protected function postTypeRegistrar(): PostTypeRegistrarInterface
return new PostTypeRegistrar($this->optionHandlers());
$this->optionHandlers()
Leonidas\Framework\Modul...odule::optionHandlers()
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.
protected function optionHandlers(): ?PostTypeOptionHandlerCollectionInterface
return null;
/**
* @return PostTypeInterface[]
*/
abstract protected function postTypes(): array;
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.