2017-11-03 193 views
2

我有這個錯誤,當我嘗試承諾推我的工作..我在註釋註釋中寫入參數...在codfe我寫多​​個函數內容參數和資源,也選項和所有類型這個參數是數組而且內容類型參數詮釋

enter image description here

代碼處理:

<?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(); 
    } 
} 

如何解決這個錯誤,請...

回答

0

你正在看到一個PHP代碼嗅探器錯誤,它給你提供了違反你的組織代碼風格指南的錯誤。 Here's the rule你的代碼失敗了。

本質上講,它要你重新安排PHPDoc的意見與你的方法簽名的參數一致:

/** 
* function put. 
* 
* @param array $parameters 
* @param array $options 
* @param array $resource 
*/ 
public function put($resource, array $parameters, array $options) 

應當重新安排爲:

/** 
* function put. 
* 
* @param array $resource 
* @param array $parameters 
* @param array $options 
*/ 
public function put($resource, array $parameters, array $options)