Reputation: 317
I have this error when i try commit to push my work .. I write parameters in comments annotation ... in codfe i write multiple function content parameters and resources and also options and all type this parameters is array and also content type parameters int
code handler:
<?php
namespace AppBundle\Handler;
use AppBundle\Entity\University;
use AppBundle\Form\UniversityType;
use Symfony\Component\HttpFoundation\RequestStack;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\formFactory;
/**
* UniversityHandler.
*/
class UniversityHandler implements HandlerInterface
{
/**
*function construct.
*
* @param EntityManagerInterface $entityManager
* @param formFactory $formFactory
* @param RequestStack $requestStack
*/
public function __construct(EntityManagerInterface $entityManager, formFactory $formFactory, RequestStack $requestStack)
{
$this->em = $entityManager;
$this->formFactory = $formFactory;
$this->requestStack = $requestStack;
}
/**
*function get.
*
* @param int $id
*/
public function get($id)
{
throw new \DomainException('Method UniversitaireHandler::get not implemented');
}
/**
*function all.
*
* @param int $limit
* @param int $offset
*/
public function all($limit = 10, $offset = 0)
{
throw new \DomainException('Method UniversitaireHandler::all not implemented');
}
/**
*function post.
*
* @param array $parameters
* @param array $options
*
* @return \Symfony\Component\Form\Form The form
*/
public function post(array $parameters, array $options = [])
{
$request = $this->requestStack->getCurrentRequest();
$form = $this->formFactory->create(UniversityType::class, new University(), array('csrf_protection' => 'false'));
$form->handleRequest($request);
if ($form->isValid() && $form->isSubmitted()) {
$universitaire = $form->getData();
$this->persistAndFlush($universitaire);
return $universitaire;
}
return $form;
}
/**
*function put.
*
* @param array $parameters
* @param array $options
* @param array $resource
*/
public function put($resource, array $parameters, array $options)
{
throw new \DomainException('Method UniversitaireHandler::put not implemented');
}
/**
*function patch.
*
* @param array $parameters
* @param array $options
* @param array $resource
*/
public function patch($resource, array $parameters, array $options)
{
throw new \DomainException('Method UniversitaireHandler::patch not implemented');
}
/**
*function delete.
*
* @param array $resource
*/
public function delete($resource)
{
throw new \DomainException('Method UniversitaireHandler::delete not implemented');
}
/**
*function persisteAndFlush.
*/
protected function persistAndFlush($object)
{
$this->em->persist($object);
$this->em->flush();
}
}
how to resolve this error please ...
Upvotes: 4
Views: 3542
Reputation: 7409
You're seeing a PHP Code Sniffer error that is giving you errors for violating your organization's code style guidelines. Here's the rule that your code is failing against.
Essentially, it wants you to rearrange your PHPDoc comments to align with the parameters in your method signatures:
/**
* function put.
*
* @param array $parameters
* @param array $options
* @param array $resource
*/
public function put($resource, array $parameters, array $options)
should be rearranged to be:
/**
* function put.
*
* @param array $resource
* @param array $parameters
* @param array $options
*/
public function put($resource, array $parameters, array $options)
Upvotes: 2