8000 Fix 'Cannot access parent:: when current class scope has no parent' error by Androbin · Pull Request #40774 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Fix 'Cannot access parent:: when current class scope has no parent' error #40774

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
wants to merge 1 commit into from
Closed

Conversation

Androbin
Copy link
@Androbin Androbin commented Apr 12, 2021
Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception

  [RuntimeException]
  An error occurred when executing the "'cache:clear --no-warmup'" command:

  PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Cannot access parent:: when current class scope has no parent in ./vendor/symfony/symfony/src/Symfony/Component/Config/Resource/ReflectionClassResource.php:167
  Stack trace:
  #0 ./vendor/symfony/symfony/src/Symfony/Component/Config/Resource/ReflectionClassResource.php(167): defined()
  #1 ./vendor/symfony/symfony/src/Symfony/Component/Config/Resource/ReflectionClassResource.php(117): Symfony\Component\Config\Resource\ReflectionClassResource->generateSignature()
  #2 ./vendor/symfony/symfony/src/Symfony/Component/Config/Resource/ReflectionClassResource.php(66): Symfony\Component\Config\Resource\ReflectionClassResource->computeHash()
  #3 [internal function]: Symfony\Component\Config\Resource\ReflectionClassResource->serialize()
  #4 ./vendor/symfony/s in ./vendor/symfony/symfony/src/Symfony/Component/Config/Resource/ReflectionClassResource.php on line 167

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 5.x branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@carsonbot carsonbot added the Bug label Apr 12, 2021
@carsonbot
Copy link

Hey!

But you have made this PR towards a branch that is not maintained anymore. :/
Could you update the PR base branch to target one of these branches instead? 4.4, 5.2.

Cheers!

Carsonbot

@Androbin Androbin changed the base branch from 3.4 to 4.4 April 12, 2021 02:28
@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Apr 12, 2021
@@ -154,13 +154,15 @@ private function generateSignature(\ReflectionClass $class): iterable
continue;
}

if (!$p->isDefaultValueConstant() || \defined($p->getDefaultValueConstantName())) {
$defaultValueConstantName = preg_replace('/^parent::/', 'pimax\Messages\Message::', $p->getDefaultValueConstantName());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Harcoding "pimax" in the source code of Symfony doesn't make sense.
Maybe you can provide us with a reproducer? Or better, a failing test case?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that the name of the type of $m?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry I don't understand, there is no $m on this line.

@Androbin
Copy link
Author
Androbin commented Apr 14, 2021

@nicolas-grekas Minimal reproducing test project: test-project.zip, only need to run composer install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0