Comments (17)
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.
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.
plus 1
from idea-php-annotation-plugin.
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.
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.
+1
from idea-php-annotation-plugin.
+1
from idea-php-annotation-plugin.
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.
@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.
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.
Thanks Daniel, your work on the plugin is much appreciated!
from idea-php-annotation-plugin.
+1
from idea-php-annotation-plugin.
+1
from idea-php-annotation-plugin.
+1
from idea-php-annotation-plugin.
+1
from idea-php-annotation-plugin.
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.
fixed by #55 and PhpStorm 2016.1.2
from idea-php-annotation-plugin.
Related Issues (20)
- Сollapse the code of nested annotations
- Unused imports detected for classes with generic type annotations HOT 1
- Stub index points to a file without PSI HOT 1
- Error in PhpStorm HOT 1
- JavascriptParserDefinition error in PhpStorm HOT 1
- Embedded classes => @ORM\Embeddable instead of @ORM\Embedded.
- [attributes] Incorrect Doctrine autocomplete HOT 1
- Argument autocompletion based on .phpstorm.meta.php
- Add PHP 8 Attribute generator for supported classes HOT 3
- Tests are not running due toolbox.xml conflict
- Incorrect Doctrine deprecation flagged on OpenApi attributes
- Symfony Doctrine - Decision between Annotation and Attribute could be better HOT 1
- Error with PHPStorm 2023.1 EAP HOT 9
- Support "Use Alias" feature for PHP 8 attributes HOT 1
- Remove / Fix inspection preview feature for "Add Doctrine repository"
- Annotations marked as unused in PHPStorm 2023.2 EAP HOT 7
- Import is considered "used" if FQCN + ::foo() in doc comment.
- Renaming class is not working HOT 2
- Unused import: "Unused statement use" reported when using Doctrine annotations HOT 4
- Prepare icons for generator actions and rename them for "Floating Code Toolbar"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from idea-php-annotation-plugin.