Skip to content
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

Bug: Anonymous class extends is parsed instead of class extends #390

Merged
merged 2 commits into from
Aug 22, 2023

Conversation

jdomenechbLendable
Copy link
Contributor

An anonymous class declared inside a normal class makes the parser take the extends from the anonymous class, instead of the correct one.

<?php
namespace Root\Animals;

class Animal
{
}

class Cat extends Animal
{
    public function methodWithAnonymous(): void
    {
        $obj = new class extends \stdClass {};
    }
}

This code above takes stdClass instead of the expected Animal.

@felipefrancisco
Copy link

+1

@AlessandroMinoccheri
Copy link
Member

@jdomenechbLendable can you fix coding standards?

@jdomenechbLendable
Copy link
Contributor Author

@AlessandroMinoccheri Done. Imported main from original repository. Local build tells me no issues to be solved.

@codecov-commenter
Copy link

Codecov Report

Merging #390 (af47660) into main (976c200) will not change coverage.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff            @@
##               main     #390   +/-   ##
=========================================
  Coverage     94.33%   94.33%           
- Complexity      571      572    +1     
=========================================
  Files            67       67           
  Lines          1500     1500           
=========================================
  Hits           1415     1415           
  Misses           85       85           
Files Changed Coverage Δ
src/Analyzer/FileVisitor.php 82.44% <100.00%> (ø)

@micheleorselli micheleorselli self-assigned this Aug 22, 2023
@fain182 fain182 merged commit a9dd2d9 into phparkitect:main Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants