Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[PropertyInfo] Attempted to load class "ContextFactory" from namespace "phpDocumentor\Reflection\Types" #44299

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
1ed opened this issue Nov 26, 2021 · 0 comments · Fixed by #44300

Comments

@1ed
Copy link
Contributor

1ed commented Nov 26, 2021

Symfony version(s) affected

5.4@dev

Description

Symfony\Component\ErrorHandler\Error\ClassNotFoundError:
Attempted to load class "ContextFactory" from namespace "phpDocumentor\Reflection\Types".
Did you forget a "use" statement for another namespace?

  at vendor/symfony/property-info/PhpStan/NameScopeFactory.php:48
  at Symfony\Component\PropertyInfo\PhpStan\NameScopeFactory->extractFromFullClassName()
     (vendor/symfony/property-info/PhpStan/NameScopeFactory.php:27)
  at Symfony\Component\PropertyInfo\PhpStan\NameScopeFactory->create()
     (vendor/symfony/property-info/Extractor/PhpStanExtractor.php:76)
  at Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor->getTypes()
     (vendor/symfony/property-info/PropertyInfoExtractor.php:112)
  at Symfony\Component\PropertyInfo\PropertyInfoExtractor->extract()
     (vendor/symfony/property-info/PropertyInfoExtractor.php:74)
  at Symfony\Component\PropertyInfo\PropertyInfoExtractor->getTypes()
     (src/Controller/TestController.php:17)
  at App\Controller\TestController->__invoke()
     (vendor/symfony/http-kernel/HttpKernel.php:152)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:74)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:35)

How to reproduce

symfony new --version next test && cd test
composer require symfony/property-info doctrine/annotations jms/serializer
cat <<EOT >> src/Controller/TestController.php
<?php

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Routing\Annotation\Route;

/**
 * @Route()
 */
class TestController extends AbstractController
{
    public function __invoke(PropertyTypeExtractorInterface \$extractor): Response
    {
        \$extractor->getTypes(__CLASS__, 'container');
        die('OK');
    }
}
EOT

Possible Solution

#44300

Additional Context

No response

@1ed 1ed added the Bug label Nov 26, 2021
@fabpot fabpot closed this as completed Nov 29, 2021
nicolas-grekas added a commit that referenced this issue Nov 29, 2021
…overy (1ed)

This PR was merged into the 5.4 branch.

Discussion
----------

[FrameworkBundle] Fix property-info phpstan extractor discovery

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #44299
| License       | MIT
| Doc PR        | -
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - Never break backward compatibility (see https://symfony.com/bc).
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too.)
 - Features and deprecations must be submitted against branch 5.x.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
-->

Commits
-------

396b3f8 [FrameworkBundle] Fix property-info phpstan extractor discovery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants