1. Go to this page and download the library: Download glpi-project/phpstan-glpi library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
glpi-project / phpstan-glpi example snippets
$class = $_GET['itemtype'];
$object = new $class(); // unsafe
if (is_a($class, CommonDBTM::class, true)) {
$object = new $class(); // safe
}
class MyClass
{
/**
* @var class-string<\CommonDBTM> $class
*/
public function doSomething(string $class): void
{
$object = new $class(); // safe
// ...
}
}
new QueryExpression(new QueryIdentifier('glpi_tickets.id')); // correct
new QueryExpression('COUNT(`glpi_tickets`.`id`)'); // correct
new QueryExpression(sprintf('COUNT(`%s`.`id`)', $table)); // wrong
new QueryExpression('DATE_ADD(`date`, INTERVAL ? DAY)', values: [$delay]); // correct
new QueryIdentifier('glpi_tickets.id'); // correct
new QueryExpression('`glpi_tickets`.`id`'); // wrong
/** @var \Migration $migration */
global migration;
neon
parameters:
level: 0
paths:
- ajax
- front
- inc # or `src` if your PHP class files are in the `src` directory
- hook.php
- setup.php
scanDirectories:
- ../../inc
- ../../src
bootstrapFiles:
- ../../stubs/glpi_constants.php
- ../../vendor/autoload.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.