В настоящее время работает на уровне 7. Вот ошибка, которую я получаю при запуске:
Код: Выделить всё
vendor/bin/phpstan analyseКод: Выделить всё
------ --------------------------------------------------------------------------------------------------------------
Line src/AppBundle/Controller/MapController.php
------ --------------------------------------------------------------------------------------------------------------
94 Parameter #1 $user of static method AppBundle\Entity\MapMarker::createMapMarker() expects
Symfony\Component\Security\Core\User\UserInterface, object given.
Код: Выделить всё
$user = $this->getUser();
$mapMarker = MapMarker::createMapMarker(
$user,
$latitude,
$longitude
);
Код: Выделить всё
/**
* Get a user from the Security Token Storage.
*
* @return UserInterface|object|null
*
* @throws \LogicException If SecurityBundle is not available
*
* @see TokenInterface::getUser()
*
* @final since version 3.4
*/
protected function getUser()
{
if (!$this->container->has('security.token_storage')) {
throw new \LogicException('The SecurityBundle is not registered in your application. Try running "composer require symfony/security-bundle".');
}
if (null === $token = $this->container->get('security.token_storage')->getToken()) {
return null;
}
if (!\is_object($user = $token->getUser())) {
// e.g. anonymous authentication
return null;
}
return $user;
}
Код: Выделить всё
/**
* @param UserInterface $user
* @param double $latitude
* @param double $longitude
*/
private function __construct(UserInterface $user, $latitude, $longitude) {
$this->createdBy = $user;
$this->latitude = $latitude;
$this->longitude = $longitude;
}
/**
* @param UserInterface $user
* @param double $latitude
* @param double $longitude
* @return MapMarker
*/
public static function createMapMarker(UserInterface $user, $latitude, $longitude): MapMarker
{
return new self($user, $latitude, $longitude);
}
И, наконец, вот мой файл конфигурации phpstan.neon:
Код: Выделить всё
parameters:
level: 7
paths:
- src
- tests
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false
Подробнее здесь: https://stackoverflow.com/questions/614 ... ny-project
Мобильная версия