Git Product home page Git Product logo

Comments (17)

jimigrunge avatar jimigrunge commented on May 29, 2024

Having same issue. Looks like it may have to do with nested Annotations and arrays. If I remove the first nested ORM\AttributeOverride for "email" the warning goes away.

/**
 * @ORM\Table(name="auth.users")
 * @ORM\Entity(repositoryClass="HarmonyBundle\Repository\Auth\UserRepository")
 *
 * @UniqueEntity(fields="usernameCanonical", errorPath="username", message="fos_user.username.already_used")
 * @ORM\AttributeOverrides({
 *      @ORM\AttributeOverride(name="email", column=@ORM\Column(type="string", name="email", length=255, unique=false, nullable=true)),
 *      @ORM\AttributeOverride(name="emailCanonical", column=@ORM\Column(type="string", name="email_canonical", length=255, unique=false, nullable=true))
 * })
 */

from idea-php-annotation-plugin.

martinjeannot avatar martinjeannot commented on May 29, 2024

Same here, it definitely has something to do with nested annotations. Interestingly enough and as noticed by jimigrunge, one nested annotation does not trigger the warning (multiple will).

/**
 * @Entity(repositoryClass="AffranchissementLiberte\Repository\StampRepository")
 * @Table(name="AflStamp", uniqueConstraints={@UniqueConstraint(name="code_idx", columns={"code"})})
 *
 * @XmlRoot("afl-stamp")
 * @Relation("self", href="expr('/api/v1/afl-stamps/' ~ object.getId())")
 * @Relation("operation", href="expr('/api/v1/afl-operations/' ~ object.getOperation().getId())")
 * @Relation("appointment", href="expr('/mobile-rest/appointment/' ~ object.getAppointment().getId())", exclusion=@Exclusion(excludeIf="expr(null === object.getAppointment())"))
 * @Relation("submission", href="expr('/api/v1/afl-stamps/' ~ object.getId() ~ '/submit')", attributes={"method"="POST"}, exclusion=@Exclusion(excludeIf="expr(constant('STAMP_STATUS_CREATED') != object.getStatus())"))
 * @Relation("validation", href="expr('/api/v1/afl-stamps/' ~ object.getId() ~ '/validate')", attributes={"method"="POST"}, exclusion=@Exclusion(excludeIf="expr(constant('STAMP_STATUS_SUBMITTED') != object.getStatus())"))
 * @Relation("invalidation", href="expr('/api/v1/afl-stamps/' ~ object.getId() ~ '/invalidate')", attributes={"method"="POST"}, exclusion=@Exclusion(excludeIf="expr(constant('STAMP_STATUS_SUBMITTED') != object.getStatus())"))
 */
class Stamp
{
...
}

from idea-php-annotation-plugin.

SergSlon avatar SergSlon commented on May 29, 2024

plus 1

from idea-php-annotation-plugin.

thundo avatar thundo commented on May 29, 2024

Same for me with a nested annotation and PhpStorm 9.0.2 with PHP annotations 2.6.1.

The faulty snippet is

/**
 * ...
 * @ORM\AttributeOverrides({
 *      @ORM\AttributeOverride(name="emailCanonical", column=@ORM\Column(type="string", name="email_canonical", length=255, unique=false))
 * })
 */

class User
{
}

from idea-php-annotation-plugin.

cawa87 avatar cawa87 commented on May 29, 2024

Same
/**

  • @Orm\Table(name="users")
  • @Orm\Entity(repositoryClass="AppBundle\Entity\UserRepository")
  • @UniqueEntity("email", groups={"register", "edit"})
  • @loggable()
  • @Orm\AttributeOverrides({
  •  @ORM\AttributeOverride(name="username", column=@ORM\Column()),
    
  •  @ORM\AttributeOverride(name="usernameCanonical", column=@ORM\Column())
    
  • })
    */

from idea-php-annotation-plugin.

johndodev avatar johndodev commented on May 29, 2024

+1

expected

from idea-php-annotation-plugin.

devuo avatar devuo commented on May 29, 2024

+1

from idea-php-annotation-plugin.

devuo avatar devuo commented on May 29, 2024

Actually, never mind, if you wrap the annotation with braces, for example:

/**
 * @Do\Something("else", when={@This("is valid")})
 */

The plugin won't report the DOC_COMMENT_END error and everything will still work as expected.

from idea-php-annotation-plugin.

sh41 avatar sh41 commented on May 29, 2024

@CawaKharkov A work around for this is to change where the { is in the annotation. Similar to your example this gives DOC_COMMENT_END error in PHPStorm

/**
 * Class User
 * @package AppBundle\Entity
 * @ORM\Entity()
 * @UniqueEntity(fields="usernameCanonical", errorPath="email", message="fos_user.email.already_used")
 * @ORM\AttributeOverrides({
 * @ORM\AttributeOverride(name="email", column=@ORM\Column(type="string", name="email", length=255, unique=false, nullable=false)),
 * @ORM\AttributeOverride(name="emailCanonical", column=@ORM\Column(type="string", name="email_canonical", length=255, unique=false, nullable=false))
 * })
 *
 * @ExclusionPolicy("none")
 *
 */
class User extends BaseUser

This does not:

/**
 * Class User
 * @package AppBundle\Entity
 * @ORM\Entity()
 * @UniqueEntity(fields="usernameCanonical", errorPath="email", message="fos_user.email.already_used")
 * @ORM\AttributeOverrides(
 * {@ORM\AttributeOverride(name="email", column=@ORM\Column(type="string", name="email", length=255, unique=false, nullable=false)),
 * @ORM\AttributeOverride(name="emailCanonical", column=@ORM\Column(type="string", name="email_canonical", length=255, unique=false, nullable=false))
 * })
 *
 * @ExclusionPolicy("none")
 *
 */
class User extends BaseUser

The only change is moving { from the end of the @ORM\AttributeOverrides( line to the start of the @ORM\AttributeOverride(name="email"... line.

Hope that helps.

from idea-php-annotation-plugin.

Haehnchen avatar Haehnchen commented on May 29, 2024

that's not an issue here, document structure is delieverd by phpstorm. will open an external issue on jetbrains side

from idea-php-annotation-plugin.

sh41 avatar sh41 commented on May 29, 2024

Thanks Daniel, your work on the plugin is much appreciated!

from idea-php-annotation-plugin.

Alumbrados avatar Alumbrados commented on May 29, 2024

+1

from idea-php-annotation-plugin.

grachevko avatar grachevko commented on May 29, 2024

+1

from idea-php-annotation-plugin.

githoober avatar githoober commented on May 29, 2024

+1

from idea-php-annotation-plugin.

zazoomauro avatar zazoomauro commented on May 29, 2024

+1

from idea-php-annotation-plugin.

enekochan avatar enekochan commented on May 29, 2024

I was having this issue too. I had a QueryParam annotation and inside of it a Date constraint annotation. Only when 2 or more of those were used in the same PHPDoc section gave the error.

So as @sh41 suggested I changed this:

use Symfony\Component\Validator\Constraints as Assert;

    /**
     * Collection get action
     *
     * @ParamConverter("business", class="AppBundle:Business")
     * @Security("is_granted('VIEW', business)")
     * @Rest\QueryParam(name="date", strict=true, nullable=true, allowBlank=true, description="Specific date for appointments list", requirements=@Assert\Date())
     * @Rest\QueryParam(name="dateFrom", strict=true, nullable=true, allowBlank=true, description="Specific date for appointments list", requirements=@Assert\Date())
     * @Rest\QueryParam(name="dateTo", strict=true, nullable=true, allowBlank=true, description="Specific date for appointments list", requirements=@Assert\Date())
     * @Rest\QueryParam(name="pending", strict=true, nullable=true, allowBlank=true, description="Show only pending appointments", requirements="(false|true)")
     * @Rest\View()
     * @ApiDoc(
     *  authentication=true,
     *  section="Business Appointments",
     *  description="Get all appointments for a business",
     *  statusCodes={
     *      200="Returned when successful"
     *  }
     * )
     *
     * @param \AppBundle\Entity\Business $business Business
     * @param \FOS\RestBundle\Request\ParamFetcher $paramFetcher ParamFetcher
     *
     * @return \FOS\RestBundle\View\View
     */

To this and the error was gone:

use Symfony\Component\Validator\Constraints as Assert;

    /**
     * Collection get action
     *
     * @ParamConverter("business", class="AppBundle:Business")
     * @Security("is_granted('VIEW', business)")
     * @Rest\QueryParam(
     *     name="date",
     *     strict=true,
     *     nullable=true,
     *     allowBlank=true,
     *     description="Specific date for appointments list",
     *     requirements=@Assert\Date()
     * )
     * @Rest\QueryParam(
     *     name="dateFrom",
     *     strict=true,
     *     nullable=true,
     *     allowBlank=true,
     *     description="Specific date from for appointments list",
     *     requirements=@Assert\Date()
     * )
     * @Rest\QueryParam(
     *     name="dateTo",
     *     strict=true,
     *     nullable=true,
     *     allowBlank=true,
     *     description="Specific date to for appointments list",
     *     requirements=@Assert\Date()
     * )
     * @Rest\QueryParam(name="pending",
     *     strict=true, nullable=true,
     *     allowBlank=true,
     *     description="Show only pending appointments",
     *     requirements="(false|true)"
     * )
     * @Rest\View()
     * @ApiDoc(
     *  authentication=true,
     *  section="Business Appointments",
     *  description="Get all appointments for a business",
     *  requirements={
     *      {
     *          "name"="business",
     *          "dataType"="integer",
     *          "requirement"="\d+",
     *          "description"="Business id"
     *      }
     *  },
     *  statusCodes={
     *      200="Returned when successful"
     *  }
     * )
     *
     * @param \AppBundle\Entity\Business $business Business
     * @param \FOS\RestBundle\Request\ParamFetcher $paramFetcher ParamFetcher
     *
     * @return \FOS\RestBundle\View\View
     */
    public function getAppointmentsAction(Business $business, ParamFetcher $paramFetcher) {
        ....
    }

So only adding some carrier returns fixed it. Hope it helps

from idea-php-annotation-plugin.

Haehnchen avatar Haehnchen commented on May 29, 2024

fixed by #55 and PhpStorm 2016.1.2

from idea-php-annotation-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.