Skip to content

Commit

Permalink
More finalization
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Oct 19, 2023
1 parent 19a5c01 commit 4d4b6ca
Show file tree
Hide file tree
Showing 48 changed files with 120 additions and 119 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"amphp/phpunit-util": "^3",
"bamarni/composer-bin-plugin": "^1.4",
"brianium/paratest": "^6.9",
"dg/bypass-finals": "^1.5",
"mockery/mockery": "^1.5",
"nunomaduro/mock-final-classes": "^1.1",
"php-parallel-lint/php-parallel-lint": "^1.2",
Expand Down
4 changes: 2 additions & 2 deletions examples/TemplateChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use function strtolower;
use function trim;

class TemplateAnalyzer extends Psalm\Internal\Analyzer\FileAnalyzer
final class TemplateAnalyzer extends Psalm\Internal\Analyzer\FileAnalyzer
{
final public const VIEW_CLASS = 'Your\\View\\Class';

Expand Down Expand Up @@ -148,7 +148,7 @@ private function checkMethod(MethodIdentifier $method_id, PhpParser\Node $stmt,
/**
* @param array<PhpParser\Node\Stmt> $stmts
*/
protected function checkWithViewClass(Context $context, array $stmts): void
private function checkWithViewClass(Context $context, array $stmts): void
{
$pseudo_method_stmts = [];

Expand Down
2 changes: 1 addition & 1 deletion examples/TemplateScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use function preg_match;
use function trim;

class TemplateScanner extends Psalm\Internal\Scanner\FileScanner
final class TemplateScanner extends Psalm\Internal\Scanner\FileScanner
{
final public const VIEW_CLASS = 'Your\\View\\Class';

Expand Down
2 changes: 1 addition & 1 deletion examples/plugins/ClassUnqualifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use function strpos;
use function strtolower;

class ClassUnqualifier implements AfterClassLikeExistenceCheckInterface
final class ClassUnqualifier implements AfterClassLikeExistenceCheckInterface
{
public static function afterClassLikeExistenceCheck(
AfterClassLikeExistenceCheckEvent $event
Expand Down
4 changes: 2 additions & 2 deletions examples/plugins/FunctionCasingChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* Checks that functions and methods are correctly-cased
*/
class FunctionCasingChecker implements AfterFunctionCallAnalysisInterface, AfterMethodCallAnalysisInterface
final class FunctionCasingChecker implements AfterFunctionCallAnalysisInterface, AfterMethodCallAnalysisInterface
{
public static function afterMethodCallAnalysis(AfterMethodCallAnalysisEvent $event): void
{
Expand Down Expand Up @@ -99,6 +99,6 @@ public static function afterFunctionCallAnalysis(AfterFunctionCallAnalysisEvent
}
}

class IncorrectFunctionCasing extends PluginIssue
final class IncorrectFunctionCasing extends PluginIssue
{
}
2 changes: 1 addition & 1 deletion examples/plugins/InternalChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use function strpos;

class InternalChecker implements AfterClassLikeAnalysisInterface
final class InternalChecker implements AfterClassLikeAnalysisInterface
{
/** @return null|false */
public static function afterStatementAnalysis(AfterClassLikeAnalysisEvent $event): ?bool
Expand Down
4 changes: 2 additions & 2 deletions examples/plugins/PreventFloatAssignmentChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Prevents any assignment to a float value
*/
class PreventFloatAssignmentChecker implements AfterExpressionAnalysisInterface
final class PreventFloatAssignmentChecker implements AfterExpressionAnalysisInterface
{
/**
* Called after an expression has been checked
Expand Down Expand Up @@ -40,6 +40,6 @@ public static function afterExpressionAnalysis(AfterExpressionAnalysisEvent $eve
}
}

class NoFloatAssignment extends PluginIssue
final class NoFloatAssignment extends PluginIssue
{
}
2 changes: 1 addition & 1 deletion examples/plugins/SafeArrayKeyChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Psalm\Plugin\EventHandler\Event\AddRemoveTaintsEvent;
use Psalm\Plugin\EventHandler\RemoveTaintsInterface;

class SafeArrayKeyChecker implements RemoveTaintsInterface
final class SafeArrayKeyChecker implements RemoveTaintsInterface
{
/**
* Called to see what taints should be removed
Expand Down
2 changes: 1 addition & 1 deletion examples/plugins/StringChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use function strpos;
use function strtolower;

class StringChecker implements AfterExpressionAnalysisInterface
final class StringChecker implements AfterExpressionAnalysisInterface
{
/**
* Called after an expression has been checked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Psalm\Type\Atomic\TLiteralString;
use Psalm\Type\Atomic\TString;

class EchoChecker implements AfterStatementAnalysisInterface
final class EchoChecker implements AfterStatementAnalysisInterface
{
/**
* Called after a statement has been checked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Psalm\Plugin\RegistrationInterface;
use SimpleXMLElement;

class PluginEntryPoint implements PluginEntryPointInterface
final class PluginEntryPoint implements PluginEntryPointInterface
{
public function __invoke(RegistrationInterface $registration, ?SimpleXMLElement $config = null): void
{
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
bootstrap="tests/autoload.php"
backupGlobals="false"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
Expand Down
10 changes: 5 additions & 5 deletions src/Psalm/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
* @psalm-suppress PropertyNotSetInConstructor
* @psalm-consistent-constructor
*/
class Config
final class Config
{
private const DEFAULT_FILE_NAME = 'psalm.xml';
final public const CONFIG_NAMESPACE = 'https://getpsalm.org/schema/config';
Expand Down Expand Up @@ -173,7 +173,7 @@ class Config
*
* @var array<int, lowercase-string>
*/
protected array $universal_object_crates;
private array $universal_object_crates;

/**
* @var static|null
Expand Down Expand Up @@ -223,7 +223,7 @@ class Config

protected ?ProjectFileFilter $project_files = null;

protected ?ProjectFileFilter $extra_files = null;
private ?ProjectFileFilter $extra_files = null;

/**
* The base directory of this config file
Expand Down Expand Up @@ -427,7 +427,7 @@ class Config

private ?IncludeCollector $include_collector = null;

protected ?TaintAnalysisFileFilter $taint_analysis_ignored_files = null;
private ?TaintAnalysisFileFilter $taint_analysis_ignored_files = null;

/**
* @var bool whether to emit a backtrace of emitted issues to stderr
Expand Down Expand Up @@ -567,7 +567,7 @@ class Config
public array $config_warnings = [];

/** @internal */
protected function __construct()
private function __construct()
{
self::$instance = $this;
$this->eventDispatcher = new EventDispatcher();
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Exception/DocblockParseException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

use Exception;

class DocblockParseException extends Exception
final class DocblockParseException extends Exception
{
}
6 changes: 3 additions & 3 deletions src/Psalm/Internal/Analyzer/FileAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
* @internal
* @psalm-consistent-constructor
*/
class FileAnalyzer extends SourceAnalyzer
final class FileAnalyzer extends SourceAnalyzer
{
use CanAlias;

protected ?string $root_file_path = null;
private ?string $root_file_path = null;

protected ?string $root_file_name = null;
private ?string $root_file_name = null;

/**
* @var array<string, bool>
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class NamespaceAnalyzer extends SourceAnalyzer
*
* @var array<string, array<string, Union>>
*/
protected static array $public_namespace_constants = [];
private static array $public_namespace_constants = [];

public function __construct(
private readonly Namespace_ $namespace, /**
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Analyzer/ProjectAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ public function addExtraFile(string $file_path): void
/**
* @return list<string>
*/
protected function getDiffFiles(): array
private function getDiffFiles(): array
{
if (!$this->parser_cache_provider || !$this->project_cache_provider) {
throw new UnexpectedValueException('Parser cache provider cannot be null here');
Expand Down
Loading

0 comments on commit 4d4b6ca

Please sign in to comment.