cakephp / cakephp/cakephp-codesniffer

Problems with Property Hooks

Open
#408 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
232
Forks
85
PR merge metrics
No merged PRs in 30d

Description

Doing a simple

class ConfigChecker
{
    public FTPInterface $ftpCheckObject {
        get {
            return $this->ftpCheckObject;
        }
        set(FTPInterface $value) {
            $this->ftpCheckObject = $value;
        }
    }
}

causes the following errors:

--------------------------------------------------------------------------------
FOUND 10 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
 10 | ERROR   | There must not be more than one property declared per statement
 12 | ERROR   | Visibility must be declared on property "$this"
 12 | ERROR   | Scope modifier not specified for member variable "$this"
 14 | WARNING | Code after the RETURN statement on line 12 cannot be executed
 14 | ERROR   | There must not be more than one property declared per statement
 14 | ERROR   | Visibility must be declared on property "$value"
 14 | ERROR   | Scope modifier not specified for member variable "$value"
 15 | WARNING | Code after the RETURN statement on line 12 cannot be executed
 15 | ERROR   | There must not be more than one property declared per statement
 15 | ERROR   | Visibility must be declared on property "$this"
 15 | ERROR   | Scope modifier not specified for member variable "$this"
 15 | ERROR   | Scope modifier not specified for member variable "$value"
--------------------------------------------------------------------------------

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the PHP code sample through the repository's checker and compare the reported diagnostics with the expected handling of property hooks. Trace the parsing and property-validation entry points responsible for the listed errors. Done means the sample no longer produces false property and unreachable-code errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.