Skip to content

Throws Missing PHP DocBlock for class property warning if readonly used in class property | PHP 8.1 #446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sandipklevu opened this issue May 24, 2023 · 1 comment · Fixed by #447
Assignees
Labels
bug Something isn't working Progress: done

Comments

@sandipklevu
Copy link
Contributor

Preconditions

  1. Magento 2.4.6 EE/CE
  2. Magento Coding Standard v31 i.e magento/magento-coding-standard: 31
  3. PHP 8.1|8.2

Steps to reproduce

  1. Create a class
<?php
declare(strict_types=1);

namespace Vendor\Module\Handler;

use Vendor\Module\Service\IsLoggingServiceInterface;
use Magento\Framework\Filesystem\DriverInterface;
use Magento\Framework\Logger\Handler\Base as BaseHandler;
use Monolog\Logger;


class IfConfigured extends BaseHandler
{
    /**
     * @var IsLoggingServiceInterface
     */
    private readonly IsLoggingServiceInterface $loggingEnabledService;
    
}
  1. vendor/bin/phpcs --standard=Magento2 . -s

Expected result

  1. It should not throw a warning

Actual result

  1. Throws warning
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------
 17 | WARNING | Missing PHP DocBlock for class property.
    |         | (Magento2.Commenting.ClassPropertyPHPDocFormatting.Missing)

@sandipklevu sandipklevu added the bug Something isn't working label May 24, 2023
@m2-assistant
Copy link

m2-assistant bot commented May 24, 2023

Hi @sandipklevu. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Progress: done
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant