Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 25, 2024 via composer

phpstan/phpstan-doctrine 1.3.55

Doctrine extensions for PHPStan
Package summary
Share
0
issues
1
license
2
MIT
Package created
30 Jan 2017
Version published
15 Jan 2024
Maintainers
1
Total deps
2
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
phpstan/phpstan@1.11.2
phpstan/phpstan-doctrine@1.3.55
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of phpstan/phpstan-doctrine 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
phpstan/phpstan1.11.2-MIT
prod

Visualizations

Frequently Asked Questions

What does phpstan/phpstan-doctrine do?

The phpstan/phpstan-doctrine is an extension for PHPStan that provides various features related to the Doctrine ORM (Object-relational mapping) tool. This includes DQL (Doctrine Query Language) validation for parsing errors, unknown entity classes, and unknown persistent fields, QueryBuilder validation, and recognition of magic methods on EntityRepository, among others. It also provides correct return types for certain Doctrine ORM methods and supports Doctrine ODM (Object Document Mapper). Additionally, it can analyze discrepancies between entity column types and property field types and infer result types of DQL queries if an object manager from the application is provided.

How do you use phpstan/phpstan-doctrine?

To use the phpstan/phpstan-doctrine, install it in Composer with the command composer require --dev phpstan/phpstan-doctrine. If you're using phpstan/extension-installer, it's all you need to do. Otherwise, you have to include 'extension.neon' and optional 'rules.neon' in your project's PHPStan config. Here is a basic usage example:

includes:
    - vendor/phpstan/phpstan-doctrine/extension.neon

Further configuration can be done in your phpstan.neon file to specify your repositories' common base class. More advanced analysis can be enabled by providing the object manager of your application to validate DQL. Here is a brief code example of this:

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

Here is Symfony 4 & 5 examples of object-manager.php:

For Symfony 4:

use App\Kernel;

require __DIR__ . '/../config/bootstrap.php';
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$kernel->boot();
return $kernel->getContainer()->get('doctrine')->getManager();

For Symfony 5:

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();

Where are the phpstan/phpstan-doctrine docs?

The main documentation for phpstan/phpstan-doctrine is found within its GitHub repository (https://github.com/phpstan/phpstan-doctrine.git). It provides comprehensive explanations for the installation process, configuration options, query type inference, and more.