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

phpstan-symfony is no longer compatible with Symfony 4 because InputBag does not exist #195

Closed
zacharylund opened this issue Sep 1, 2021 · 8 comments

Comments

@zacharylund
Copy link

See failures: https://github.com/phpstan/phpstan-symfony/runs/3393866713

Symfony 4.4 does not have the class Symfony\Component\HttpFoundation\InputBag and the additions in 95d9ae7 expect that class to exist in the stub files.

@ondrejmirtes
Copy link
Member

These are build failures in this repo, but in actual use phpstan-symfony is still usable with Symfony 4 projects. Can you verify that?

@zacharylund
Copy link
Author

I added this to a brand new Symfony 4.4 project:

<?php

namespace App\Controller;

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

class TestController extends AbstractController
{
    /**
     * @Route("/test", name="test")
     */
    public function index(Request $request): Response
    {
        $foo = $request->query->get('foo');

        \PHPStan\dumpType($request->query);

        return $this->render('test/index.html.twig', [
            'controller_name' => 'TestController',
        ]);
    }
}

Running phpstan produces this output:

 ------ -------------------------------------------------------------------- 
  Line   Controller/TestController.php                                       
 ------ -------------------------------------------------------------------- 
  17     Call to method get() on an unknown class                            
         Symfony\Component\HttpFoundation\InputBag.                          
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols  
  19     Dumped type: Symfony\Component\HttpFoundation\InputBag<string>      
 ------ -------------------------------------------------------------------- 

@Mick3DIY
Copy link

Mick3DIY commented Sep 1, 2021

I confirm in a Symfony project 4.4.26, phpstan 0.12.97, phpstan-symfony 0.12.43. Works fine before the last update ;)

@codegain
Copy link

codegain commented Sep 2, 2021

Can also confirm: Symfony 4.4.30, phpstan 0.12.97 and phpstan-symfony 0.12.43 produces that output.
phpstan-symfony 0.12.42 works fine.

@jmleroux
Copy link
Contributor

jmleroux commented Sep 2, 2021

Same issue on https://github.com/akeneo/pim-community-dev

@ondrejmirtes
Copy link
Member

Fixed: c1627fc

Will need up-to-date phpstan/phpstan again.

@ondrejmirtes
Copy link
Member

And released: https://github.com/phpstan/phpstan-symfony/releases/tag/0.12.44

@github-actions
Copy link

github-actions bot commented Oct 4, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants