Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock event classes #7491

Merged
merged 2 commits into from Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions UPGRADING.md
Expand Up @@ -122,6 +122,32 @@
- [BC] Method `Psalm\Type\Union::hasFormerStaticObject()` was renamed to `hasStaticObject()`
- [BC] Function assertions (from `@psalm-assert Foo $bar`) have been converted from strings to specific `Assertion` objects.
- [BC] Property `Psalm\Storage\ClassLikeStorage::$invalid_dependencies` changed from `array<string>` to `array<string, true>`.
- [BC] Event classes became final and their constructors were marked `@internal`:
- `Psalm\Plugin\EventHandler\Event\AddRemoveTaintsEvent`
- `Psalm\Plugin\EventHandler\Event\AfterAnalysisEvent`
- `Psalm\Plugin\EventHandler\Event\AfterClassLikeAnalysisEvent`
- `Psalm\Plugin\EventHandler\Event\AfterClassLikeExistenceCheckEvent`
- `Psalm\Plugin\EventHandler\Event\AfterClassLikeVisitEvent`
- `Psalm\Plugin\EventHandler\Event\AfterCodebasePopulatedEvent`
- `Psalm\Plugin\EventHandler\Event\AfterEveryFunctionCallAnalysisEvent`
- `Psalm\Plugin\EventHandler\Event\AfterExpressionAnalysisEvent`
- `Psalm\Plugin\EventHandler\Event\AfterFileAnalysisEvent`
- `Psalm\Plugin\EventHandler\Event\AfterFunctionCallAnalysisEvent`
- `Psalm\Plugin\EventHandler\Event\AfterFunctionLikeAnalysisEvent`
- `Psalm\Plugin\EventHandler\Event\AfterMethodCallAnalysisEvent`
- `Psalm\Plugin\EventHandler\Event\AfterStatementAnalysisEvent`
- `Psalm\Plugin\EventHandler\Event\BeforeFileAnalysisEvent`
- `Psalm\Plugin\EventHandler\Event\FunctionExistenceProviderEvent`
- `Psalm\Plugin\EventHandler\Event\FunctionParamsProviderEvent`
- `Psalm\Plugin\EventHandler\Event\FunctionReturnTypeProviderEvent`
- `Psalm\Plugin\EventHandler\Event\MethodExistenceProviderEvent`
- `Psalm\Plugin\EventHandler\Event\MethodParamsProviderEvent`
- `Psalm\Plugin\EventHandler\Event\MethodReturnTypeProviderEvent`
- `Psalm\Plugin\EventHandler\Event\MethodVisibilityProviderEvent`
- `Psalm\Plugin\EventHandler\Event\PropertyExistenceProviderEvent`
- `Psalm\Plugin\EventHandler\Event\PropertyTypeProviderEvent`
- `Psalm\Plugin\EventHandler\Event\PropertyVisibilityProviderEvent`
- `Psalm\Plugin\EventHandler\Event\StringInterpreterEvent`

## Removed
- [BC] Property `Psalm\Codebase::$php_major_version` was removed, use
Expand Down
3 changes: 2 additions & 1 deletion src/Psalm/Plugin/EventHandler/Event/AddRemoveTaintsEvent.php
Expand Up @@ -7,7 +7,7 @@
use Psalm\Context;
use Psalm\StatementsSource;

class AddRemoveTaintsEvent
final class AddRemoveTaintsEvent
{
/**
* @var Expr
Expand All @@ -28,6 +28,7 @@ class AddRemoveTaintsEvent

/**
* Called after an expression has been checked
* @internal
*/
public function __construct(
Expr $expr,
Expand Down
3 changes: 2 additions & 1 deletion src/Psalm/Plugin/EventHandler/Event/AfterAnalysisEvent.php
Expand Up @@ -6,7 +6,7 @@
use Psalm\Internal\Analyzer\IssueData;
use Psalm\SourceControl\SourceControlInfo;

class AfterAnalysisEvent
final class AfterAnalysisEvent
{
/**
* @var Codebase
Expand All @@ -29,6 +29,7 @@ class AfterAnalysisEvent
* Called after analysis is complete
*
* @param array<string, list<IssueData>> $issues
* @internal
*/
public function __construct(
Codebase $codebase,
Expand Down
Expand Up @@ -8,7 +8,7 @@
use Psalm\StatementsSource;
use Psalm\Storage\ClassLikeStorage;

class AfterClassLikeAnalysisEvent
final class AfterClassLikeAnalysisEvent
{
/**
* @var Node\Stmt\ClassLike
Expand All @@ -35,6 +35,7 @@ class AfterClassLikeAnalysisEvent
* Called after a statement has been checked
*
* @param FileManipulation[] $file_replacements
* @internal
*/
public function __construct(
Node\Stmt\ClassLike $stmt,
Expand Down
Expand Up @@ -7,7 +7,7 @@
use Psalm\FileManipulation;
use Psalm\StatementsSource;

class AfterClassLikeExistenceCheckEvent
final class AfterClassLikeExistenceCheckEvent
{
/**
* @var string
Expand All @@ -32,6 +32,7 @@ class AfterClassLikeExistenceCheckEvent

/**
* @param FileManipulation[] $file_replacements
* @internal
*/
public function __construct(
string $fq_class_name,
Expand Down
Expand Up @@ -8,7 +8,7 @@
use Psalm\FileSource;
use Psalm\Storage\ClassLikeStorage;

class AfterClassLikeVisitEvent
final class AfterClassLikeVisitEvent
{
/**
* @var ClassLike
Expand All @@ -33,6 +33,7 @@ class AfterClassLikeVisitEvent

/**
* @param FileManipulation[] $file_replacements
* @internal
*/
public function __construct(
ClassLike $stmt,
Expand Down
Expand Up @@ -4,7 +4,7 @@

use Psalm\Codebase;

class AfterCodebasePopulatedEvent
final class AfterCodebasePopulatedEvent
{
/**
* @var Codebase
Expand All @@ -13,6 +13,7 @@ class AfterCodebasePopulatedEvent

/**
* Called after codebase has been populated
* @internal
*/
public function __construct(Codebase $codebase)
{
Expand Down
Expand Up @@ -7,7 +7,7 @@
use Psalm\Context;
use Psalm\StatementsSource;

class AfterEveryFunctionCallAnalysisEvent
final class AfterEveryFunctionCallAnalysisEvent
{
/**
* @var FuncCall
Expand All @@ -30,6 +30,7 @@ class AfterEveryFunctionCallAnalysisEvent
*/
private $codebase;

/** @internal */
public function __construct(
FuncCall $expr,
string $function_id,
Expand Down
Expand Up @@ -8,7 +8,7 @@
use Psalm\FileManipulation;
use Psalm\StatementsSource;

class AfterExpressionAnalysisEvent
final class AfterExpressionAnalysisEvent
{
/**
* @var Expr
Expand All @@ -35,6 +35,7 @@ class AfterExpressionAnalysisEvent
* Called after an expression has been checked
*
* @param FileManipulation[] $file_replacements
* @internal
*/
public function __construct(
Expr $expr,
Expand Down
Expand Up @@ -8,7 +8,7 @@
use Psalm\StatementsSource;
use Psalm\Storage\FileStorage;

class AfterFileAnalysisEvent
final class AfterFileAnalysisEvent
{
/**
* @var StatementsSource
Expand All @@ -35,6 +35,7 @@ class AfterFileAnalysisEvent
* Called after a file has been checked
*
* @param array<Stmt> $stmts
* @internal
*/
public function __construct(
StatementsSource $statements_source,
Expand Down
Expand Up @@ -9,7 +9,7 @@
use Psalm\StatementsSource;
use Psalm\Type\Union;

class AfterFunctionCallAnalysisEvent
final class AfterFunctionCallAnalysisEvent
{
/**
* @var FuncCall
Expand Down Expand Up @@ -43,6 +43,7 @@ class AfterFunctionCallAnalysisEvent
/**
* @param non-empty-string $function_id
* @param FileManipulation[] $file_replacements
* @internal
*/
public function __construct(
FuncCall $expr,
Expand Down
Expand Up @@ -10,7 +10,7 @@
use Psalm\StatementsSource;
use Psalm\Storage\FunctionLikeStorage;

class AfterFunctionLikeAnalysisEvent
final class AfterFunctionLikeAnalysisEvent
{
/**
* @var Node\FunctionLike
Expand Down Expand Up @@ -45,6 +45,7 @@ class AfterFunctionLikeAnalysisEvent
* Called after a statement has been checked
*
* @param FileManipulation[] $file_replacements
* @internal
*/
public function __construct(
Node\FunctionLike $stmt,
Expand Down
Expand Up @@ -11,7 +11,7 @@
use Psalm\StatementsSource;
use Psalm\Type\Union;

class AfterMethodCallAnalysisEvent
final class AfterMethodCallAnalysisEvent
{
/**
* @var MethodCall|StaticCall
Expand Down Expand Up @@ -53,6 +53,7 @@ class AfterMethodCallAnalysisEvent
/**
* @param MethodCall|StaticCall $expr
* @param FileManipulation[] $file_replacements
* @internal
*/
public function __construct(
Expr $expr,
Expand Down
Expand Up @@ -8,7 +8,7 @@
use Psalm\FileManipulation;
use Psalm\StatementsSource;

class AfterStatementAnalysisEvent
final class AfterStatementAnalysisEvent
{
/**
* @var Stmt
Expand All @@ -35,6 +35,7 @@ class AfterStatementAnalysisEvent
* Called after a statement has been checked
*
* @param FileManipulation[] $file_replacements
* @internal
*/
public function __construct(
Stmt $stmt,
Expand Down
Expand Up @@ -7,7 +7,7 @@
use Psalm\StatementsSource;
use Psalm\Storage\FileStorage;

class BeforeFileAnalysisEvent
final class BeforeFileAnalysisEvent
{
/**
* @var StatementsSource
Expand All @@ -28,6 +28,7 @@ class BeforeFileAnalysisEvent

/**
* Called before a file has been checked
* @internal
*/
public function __construct(
StatementsSource $statements_source,
Expand Down
Expand Up @@ -4,7 +4,7 @@

use Psalm\StatementsSource;

class FunctionExistenceProviderEvent
final class FunctionExistenceProviderEvent
{
/**
* @var StatementsSource
Expand All @@ -19,6 +19,8 @@ class FunctionExistenceProviderEvent
* Use this hook for informing whether or not a global function exists. If you know the function does
* not exist, return false. If you aren't sure if it exists or not, return null and the default analysis
* will continue to determine if the function actually exists.
*
* @internal
*/
public function __construct(
StatementsSource $statements_source,
Expand Down
Expand Up @@ -7,7 +7,7 @@
use Psalm\Context;
use Psalm\StatementsSource;

class FunctionParamsProviderEvent
final class FunctionParamsProviderEvent
{
/**
* @var StatementsSource
Expand All @@ -32,6 +32,7 @@ class FunctionParamsProviderEvent

/**
* @param list<PhpParser\Node\Arg> $call_args
* @internal
*/
public function __construct(
StatementsSource $statements_source,
Expand Down
Expand Up @@ -7,7 +7,7 @@
use Psalm\Context;
use Psalm\StatementsSource;

class FunctionReturnTypeProviderEvent
final class FunctionReturnTypeProviderEvent
{
/**
* @var StatementsSource
Expand Down Expand Up @@ -36,6 +36,7 @@ class FunctionReturnTypeProviderEvent
* if something should be returned, but can't be more specific.
*
* @param non-empty-string $function_id
* @internal
*/
public function __construct(
StatementsSource $statements_source,
Expand Down
Expand Up @@ -5,7 +5,7 @@
use Psalm\CodeLocation;
use Psalm\StatementsSource;

class MethodExistenceProviderEvent
final class MethodExistenceProviderEvent
{
/**
* @var string
Expand All @@ -28,6 +28,8 @@ class MethodExistenceProviderEvent
* Use this hook for informing whether or not a method exists on a given object. If you know the method does
* not exist, return false. If you aren't sure if it exists or not, return null and the default analysis will
* continue to determine if the method actually exists.
*
* @internal
*/
public function __construct(
string $fq_classlike_name,
Expand Down
Expand Up @@ -7,7 +7,7 @@
use Psalm\Context;
use Psalm\StatementsSource;

class MethodParamsProviderEvent
final class MethodParamsProviderEvent
{
/**
* @var string
Expand Down Expand Up @@ -36,6 +36,7 @@ class MethodParamsProviderEvent

/**
* @param list<PhpParser\Node\Arg> $call_args
* @internal
*/
public function __construct(
string $fq_classlike_name,
Expand Down
Expand Up @@ -8,7 +8,7 @@
use Psalm\StatementsSource;
use Psalm\Type\Union;

class MethodReturnTypeProviderEvent
final class MethodReturnTypeProviderEvent
{
/**
* @var StatementsSource
Expand Down Expand Up @@ -56,6 +56,8 @@ class MethodReturnTypeProviderEvent
* @param ?array<Union> $template_type_parameters
* @param lowercase-string $method_name_lowercase
* @param lowercase-string $called_method_name_lowercase
*
* @internal
*/
public function __construct(
StatementsSource $source,
Expand Down
Expand Up @@ -6,7 +6,7 @@
use Psalm\Context;
use Psalm\StatementsSource;

class MethodVisibilityProviderEvent
final class MethodVisibilityProviderEvent
{
/**
* @var StatementsSource
Expand All @@ -29,6 +29,7 @@ class MethodVisibilityProviderEvent
*/
private $code_location;

/** @internal */
public function __construct(
StatementsSource $source,
string $fq_classlike_name,
Expand Down