Skip to content

Add Symfony and Doctrine PHPStan extensions #1391

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

Merged
merged 1 commit into from
Jan 13, 2023

Conversation

ker0x
Copy link
Contributor

@ker0x ker0x commented Jan 9, 2023

Fix #1379

@seb-jean
Copy link
Contributor

Should the phpstan-baseline.neon file be regenerated with the new errors?

@ker0x ker0x force-pushed the feature/issue-1379 branch from 9a512a8 to 9adc4fb Compare January 11, 2023 10:35
@ker0x
Copy link
Contributor Author

ker0x commented Jan 11, 2023

Should the phpstan-baseline.neon file be regenerated with the new errors?

I regenerated it, but nothing has changed with these new modifications

@seb-jean
Copy link
Contributor

seb-jean commented Jan 11, 2023

Sorry ;).

I think it should be added to the phpstan.neon.dist file:

parameters:
    doctrine:
        objectManagerLoader: tests/object-manager.php

And a new file tests/object-manager.php

<?php

use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;

require __DIR__.'/../vendor/autoload.php';

(new Dotenv())->bootEnv(__DIR__.'/../.env');

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$kernel->boot();

return $kernel->getContainer()->get('doctrine')->getManager();

https://github.com/phpstan/phpstan-doctrine#configuration

@javiereguiluz
Copy link
Member

I love it! Thanks for contributing this Romain!

@javiereguiluz javiereguiluz merged commit b0526f4 into symfony:main Jan 13, 2023
@ker0x ker0x deleted the feature/issue-1379 branch January 15, 2023 09:46
@BafS BafS mentioned this pull request Sep 28, 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.

PHPStan - Symfony + Doctrine
3 participants