Your project should not use dependencies with incompatible licenses
- Read doc
- Legal
- Critical
More information: https://insight.symfony.com/what-we-analyse/composer.incompatible_license
Your project controllers should only contains actions as public methods
- Read doc
- Productivity
- Major
More information: https://insight.symfony.com/what-we-analyse/symfony.controller.non_action_public_method_in_controller_class
- protected EntityManagerInterface $em,
- ) {
- $this->config = $config;
- }
- #[Route('/refresh-cache')]
- public function refreshCache(): Response
- {
- $this->denyAccessUnlessGranted('ROLE_CONFIG_REFRESH_CACHE');
- $configs = $this->em->getRepository(ConfigInterface::class)
Your project must not contain invalid function or method calls 5
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_call
- {
- /** @var AbstractConfigRepository $configRepository */
- $configRepository = $this->em->getRepository(ConfigInterface::class);
- foreach ($this->warmups as $warmup) {
- $warmup->warmup($configRepository);
- }
- $this->em->flush();
- $io = new SymfonyStyle($input, $output);
- public function list(?DatasourceParams $requestParams): iterable
- {
- /** @var ConfigInterface[] $list */
- $list = array_filter(
- [...parent::list($requestParams)],
- fn (ConfigInterface $config): bool => $this->canView($config),
- );
- $resultWithTenant = [];
- foreach ($list as $item) {
- if ($item->getTenantId()) {
- $loader->load("services.yaml");
- $configuration = new Configuration();
- $processedConfig = $this->processConfiguration($configuration, $configs);
- $container->setParameter('lle_config.using_tenant', $processedConfig['using_tenant']);
- $container->setParameter('lle_config.group_roles', $processedConfig['group_roles']);
- if ($processedConfig['tenant_service']) {
- $container->setAlias('lle_config.tenant_service', $processedConfig['tenant_service']);
- }
- $configuration = new Configuration();
- $processedConfig = $this->processConfiguration($configuration, $configs);
- $container->setParameter('lle_config.using_tenant', $processedConfig['using_tenant']);
- $container->setParameter('lle_config.group_roles', $processedConfig['group_roles']);
- if ($processedConfig['tenant_service']) {
- $container->setAlias('lle_config.tenant_service', $processedConfig['tenant_service']);
- }
- // the credential bundle is optional: tagged "credential.warmup" through its autoconfiguration
- $processedConfig = $this->processConfiguration($configuration, $configs);
- $container->setParameter('lle_config.using_tenant', $processedConfig['using_tenant']);
- $container->setParameter('lle_config.group_roles', $processedConfig['group_roles']);
- if ($processedConfig['tenant_service']) {
- $container->setAlias('lle_config.tenant_service', $processedConfig['tenant_service']);
- }
- // the credential bundle is optional: tagged "credential.warmup" through its autoconfiguration
- if (interface_exists(CredentialWarmupInterface::class)) {
- $container->register(ConfigCredentialWarmup::class)
Your project should not use invalid parameter and return typehints
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_typehint
- use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
- #[AsCommand('lle:config:warmup')]
- class WarmupCommand extends Command
- {
- public function __construct(
- protected EntityManagerInterface $em,
- #[AutowireIterator('lle.config.warmup')]
- /** @var iterable<WarmupInterface> */
- protected iterable $warmups,
- ) {
Your project should use return types 4
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.missing_return_typehint
- }
- return $config;
- }
- public function list(?DatasourceParams $requestParams): iterable
- {
- /** @var ConfigInterface[] $list */
- $list = array_filter(
- [...parent::list($requestParams)],
- fn (ConfigInterface $config): bool => $this->canView($config),
- }
- return $eipFields;
- }
- public function getFields(string $key): array
- {
- $group = Field::new('group')->setRuptGroup(1);
- $label = Field::new('label')->setLabel('field.code');
- $transLabel = Field::new('label')
- ->setTemplate('@LleConfig/_trans_label.html.twig')
- public function getNbItems(): int
- {
- return 500;
- }
- public function getListActions(): array
- {
- return [];
- }
- public function getItemActions(): array
- public function getListActions(): array
- {
- return [];
- }
- public function getItemActions(): array
- {
- return [];
- }
- public function getRootRoute(): string
Your project uses non-strict array lookups 3
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.strict_array_lookup
- }
- }
- $result = [];
- foreach ($list as $item) {
- if ($item->getTenantId() || !in_array($item->getLabel() . '-' . $item->getGroup(), $resultWithTenant)) {
- $result[] = $item;
- }
- }
- return $result;
- throw new AccessDeniedException(self::ACCESS_DENIED_MESSAGE);
- }
- // an empty text field arrives as null: store an empty string ("0" is a value, not an empty field)
- if (in_array($resource->getValueType(), [ConfigInterface::PASSWORD, ConfigInterface::STRING]) && $resource->getValueString() === null) {
- $resource->setValueString('');
- }
- if (in_array($resource->getValueType(), [ConfigInterface::TEXT]) && $resource->getValueText() === null) {
- $resource->setValueText('');
- }
- // an empty text field arrives as null: store an empty string ("0" is a value, not an empty field)
- if (in_array($resource->getValueType(), [ConfigInterface::PASSWORD, ConfigInterface::STRING]) && $resource->getValueString() === null) {
- $resource->setValueString('');
- }
- if (in_array($resource->getValueType(), [ConfigInterface::TEXT]) && $resource->getValueText() === null) {
- $resource->setValueText('');
- }
- // an empty number is ignored (0 is a value): reload the entity so that a later flush() cannot write it
- if (
- ($resource->getValueType() === ConfigInterface::INT && $resource->getValueInt() === null)
Your project should not use invalid return types
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_return_typehint
- $tenantId
- );
- $item = $this->cache->getItem($cacheKey);
- if ($item->isHit()) {
- return $item->get();
- }
- return null;
- }
Text files should end with a valid new line character. 3
- Read doc
- Productivity
- Info
More information: https://insight.symfony.com/what-we-analyse/missing_e_o_l
- - name: 'PHPStan Static Analysis'
- uses: php-actions/phpstan@v3
- with:
- configuration: tests/phpstan.neon
- memory_limit: 256M
- with:
- php_version: ${{ matrix.php_version }}
- php_extensions: xdebug
- version: 10.3
- configuration: tests/phpunit/phpunit.xml
- bootstrap: vendor/autoload.php
- php_version: ${{ matrix.php_version }}
- version: 2
- args: --profile --ignore-platform-reqs
- - name: 'PHP CodeSniffer Validations'
- run: vendor/bin/phpcs