Skip to content

Commit

Permalink
suppress MissingClassConstType (PHP 8.3 only feature)
Browse files Browse the repository at this point in the history
  • Loading branch information
seferov committed Dec 21, 2024
1 parent d6c93a8 commit cb7aab0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 24 deletions.
1 change: 1 addition & 0 deletions src/Handler/ContainerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

class ContainerHandler implements AfterMethodCallAnalysisInterface, AfterClassLikeVisitInterface, AfterCodebasePopulatedInterface, BeforeAddIssueInterface
{
/** @psalm-suppress MissingClassConstType */

Check failure on line 29 in src/Handler/ContainerHandler.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.1, deps: highest)

UnusedPsalmSuppress

src/Handler/ContainerHandler.php:29:25: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)

Check failure on line 29 in src/Handler/ContainerHandler.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.1, deps: lowest)

UnusedPsalmSuppress

src/Handler/ContainerHandler.php:29:25: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)

Check failure on line 29 in src/Handler/ContainerHandler.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.2, deps: highest)

UnusedPsalmSuppress

src/Handler/ContainerHandler.php:29:25: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)

Check failure on line 29 in src/Handler/ContainerHandler.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.2, deps: lowest)

UnusedPsalmSuppress

src/Handler/ContainerHandler.php:29:25: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)

Check failure on line 29 in src/Handler/ContainerHandler.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.3, deps: lowest)

UnusedPsalmSuppress

src/Handler/ContainerHandler.php:29:25: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)
private const GET_CLASSLIKES = [
'Psr\Container\ContainerInterface',
'Symfony\Component\DependencyInjection\ContainerInterface',
Expand Down
18 changes: 5 additions & 13 deletions src/Test/CodeceptionModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,19 @@
*/
class CodeceptionModule extends BaseModule
{
/** @psalm-suppress MissingClassConstType */

Check failure on line 24 in src/Test/CodeceptionModule.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.1, deps: highest)

UnusedPsalmSuppress

src/Test/CodeceptionModule.php:24:25: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)

Check failure on line 24 in src/Test/CodeceptionModule.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.1, deps: lowest)

UnusedPsalmSuppress

src/Test/CodeceptionModule.php:24:25: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)

Check failure on line 24 in src/Test/CodeceptionModule.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.2, deps: highest)

UnusedPsalmSuppress

src/Test/CodeceptionModule.php:24:25: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)

Check failure on line 24 in src/Test/CodeceptionModule.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.2, deps: lowest)

UnusedPsalmSuppress

src/Test/CodeceptionModule.php:24:25: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)

Check failure on line 24 in src/Test/CodeceptionModule.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.3, deps: lowest)

UnusedPsalmSuppress

src/Test/CodeceptionModule.php:24:25: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)
private const DEFAULT_TWIG_TEMPLATES_DIR = 'templates';

/**
* @var string
*/
private $twigTemplateDir = self::DEFAULT_TWIG_TEMPLATES_DIR;
private string $twigTemplateDir = self::DEFAULT_TWIG_TEMPLATES_DIR;

/**
* @var FilesystemCache|null
*/
private $twigCache;
private ?FilesystemCache $twigCache = null;

/**
* @var string|null
*/
private $lastCachePath;
private ?string $lastCachePath = null;

/**
* @var list<string>
*/
private $suppressedIssueHandlers = [];
private array $suppressedIssueHandlers = [];

public function _initialize(): void
{
Expand Down
13 changes: 4 additions & 9 deletions src/Twig/CachedTemplatesMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,19 @@
class CachedTemplatesMapping implements AfterCodebasePopulatedInterface
{
/**
* @psalm-suppress MissingClassConstType

Check failure on line 16 in src/Twig/CachedTemplatesMapping.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.1, deps: highest)

UnusedPsalmSuppress

src/Twig/CachedTemplatesMapping.php:16:24: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)

Check failure on line 16 in src/Twig/CachedTemplatesMapping.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.1, deps: lowest)

UnusedPsalmSuppress

src/Twig/CachedTemplatesMapping.php:16:24: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)

Check failure on line 16 in src/Twig/CachedTemplatesMapping.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.2, deps: highest)

UnusedPsalmSuppress

src/Twig/CachedTemplatesMapping.php:16:24: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)

Check failure on line 16 in src/Twig/CachedTemplatesMapping.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.2, deps: lowest)

UnusedPsalmSuppress

src/Twig/CachedTemplatesMapping.php:16:24: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)

Check failure on line 16 in src/Twig/CachedTemplatesMapping.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (PHP: 8.3, deps: lowest)

UnusedPsalmSuppress

src/Twig/CachedTemplatesMapping.php:16:24: UnusedPsalmSuppress: This suppression is never used (see https://psalm.dev/207)
* @var string
*/
public const CACHED_TEMPLATE_HEADER_PATTERN =
'use Twig\\\\Template;\n\n'.
'\/\* (?<name>@?.+\.twig) \*\/\n'.
'class (?<class>__TwigTemplate_[a-z0-9]{64}) extends (\\\\Twig\\\\)?Template';

/**
* @var string|null
*/
private static $cachePath;
private static ?string $cachePath = null;

/**
* @var CachedTemplatesRegistry|null
*/
private static $cacheRegistry;
private static ?CachedTemplatesRegistry $cacheRegistry = null;

public static function afterCodebasePopulated(AfterCodebasePopulatedEvent $event)
public static function afterCodebasePopulated(AfterCodebasePopulatedEvent $event): void
{
$codebase = $event->getCodebase();

Expand Down
2 changes: 1 addition & 1 deletion src/Twig/TemplateFileAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function initExtensions(array $extensionClasses): void

public function analyze(
?PsalmContext $file_context = null,
?PsalmContext $global_context = null
?PsalmContext $global_context = null,
): void {
$codebase = $this->project_analyzer->getCodebase();
$taint = $codebase->taint_flow_graph;
Expand Down
3 changes: 2 additions & 1 deletion tests/acceptance/acceptance/console/ConsoleArgument.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Feature: ConsoleArgument

Background:
Given I have Symfony plugin enabled
Given I have issue handler "MissingClassConstType" suppressed
And I have Symfony plugin enabled
And I have the following code preamble
"""
<?php
Expand Down

0 comments on commit cb7aab0

Please sign in to comment.