chamilo/chamilo-lms

View on GitHub
src/CourseBundle/Entity/CForumPost.php

Summary

Maintainability
A
0 mins
Test Coverage

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\OneToMany(targetEntity: CForumAttachment::class, mappedBy: 'post', cascade: ['persist', 'remove'], orphanRemoval: true)]

Add a single space around assignment operators
Open

declare(strict_types=1);

You must use "/**" style comments for a class comment
Open

class CForumPost extends AbstractResource implements ResourceInterface, Stringable

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Assert\NotBlank]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Assert\NotBlank]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\Column(name: 'post_text', type: 'text', nullable: true)]

Missing function doc comment
Open

    public function setTitle(string $title): self

Missing function doc comment
Open

    public function getPostParent(): ?self

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Assert\NotBlank]

Missing function doc comment
Open

    public function getTitle(): string

Missing function doc comment
Open

    public function setThread(?CForumThread $thread = null): self

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

#[ORM\Table(name: 'c_forum_post')]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\Id]

Missing function doc comment
Open

    public function setStatus(int $status): self

Missing function doc comment
Open

    public function getResourceIdentifier(): int|Uuid

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\Column(name: 'iid', type: 'integer')]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\Column(name: 'title', type: 'string', length: 250, nullable: false)]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\ManyToOne(targetEntity: User::class)]

Missing function doc comment
Open

    public function __construct()

Missing function doc comment
Open

    public function setPostNotification(bool $postNotification): self

Missing function doc comment
Open

    public function getUser(): User

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\ManyToOne(targetEntity: CForumThread::class, inversedBy: 'posts')]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\JoinColumn(name: 'poster_id', referencedColumnName: 'id', onDelete: 'CASCADE')]

Missing function doc comment
Open

    public function getPostText(): ?string

Missing function doc comment
Open

    public function removeAttachment(CForumAttachment $attachment): void

Missing function doc comment
Open

    public function getForum(): ?CForum

Missing function doc comment
Open

    public function setPostParent(?self $postParent): self

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\Column(name: 'post_notification', type: 'boolean', nullable: true)]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\JoinColumn(name: 'thread_id', referencedColumnName: 'iid', nullable: true, onDelete: 'SET NULL')]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\JoinColumn(name: 'forum_id', referencedColumnName: 'iid', nullable: true, onDelete: 'SET NULL')]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\Column(name: 'post_date', type: 'datetime', nullable: false)]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\ManyToOne(targetEntity: CForum::class, inversedBy: 'posts')]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\JoinColumn(name: 'post_parent_id', referencedColumnName: 'iid', onDelete: 'SET NULL')]

Missing function doc comment
Open

    public function setVisible(bool $visible): self

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

#[ORM\Index(name: 'idx_forum_post_visible', columns: ['visible'])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

#[ORM\Entity(repositoryClass: CForumPostRepository::class)]

Missing function doc comment
Open

    public function __toString(): string

Missing function doc comment
Open

    public function setPostDate(DateTime $postDate): self

Missing function doc comment
Open

    public function setUser(User $user): self

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\GeneratedValue]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[Assert\NotNull]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\Column(name: 'status', type: 'integer', nullable: true)]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\OneToMany(targetEntity: self::class, mappedBy: 'postParent')]

Missing function doc comment
Open

    public function getThread(): ?CForumThread

Missing function doc comment
Open

    public function getAttachments(): Collection

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]

Missing function doc comment
Open

    public function getResourceName(): string

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

#[ORM\Index(name: 'forum_id', columns: ['forum_id'])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

#[ORM\Index(name: 'idx_forum_post_thread_id', columns: ['thread_id'])]

Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead.
Open

    #[ORM\Column(name: 'visible', type: 'boolean', nullable: false)]

Missing function doc comment
Open

    public function setResourceName(string $name): self

Missing function doc comment
Open

    public function setPostText(string $postText): self

Missing function doc comment
Open

    public function setForum(?CForum $forum): self

The 'getVisible()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function getVisible()
    {
        return $this->visible;
    }

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

Source https://phpmd.org/rules/naming.html#booleangetmethodname

The 'getPostNotification()' method which returns a boolean should be named 'is...()' or 'has...()'
Open

    public function getPostNotification()
    {
        return $this->postNotification;
    }

BooleanGetMethodName

Since: 0.2

Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

Example

class Foo {
    /**
     * @return boolean
     */
    public function getFoo() {} // bad
    /**
     * @return bool
     */
    public function isFoo(); // ok
    /**
     * @return boolean
     */
    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
}

Source https://phpmd.org/rules/naming.html#booleangetmethodname

There are no issues that match your filters.

Category
Status