Skip to content

Commit

Permalink
Merge branch 'master' into fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Jan 17, 2024
2 parents e7c9bcc + 823c918 commit 2011145
Show file tree
Hide file tree
Showing 75 changed files with 140 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/Psalm/Aliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ final class Aliases
{
use UnserializeMemoryUsageSuppressionTrait;

public ?int $namespace_first_stmt_start = null;

public ?int $uses_start = null;

public ?int $uses_end = null;
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Internal/Analyzer/ClosureAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Psalm\Issue\PossiblyUndefinedVariable;
use Psalm\Issue\UndefinedVariable;
use Psalm\IssueBuffer;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;
use Psalm\Type;
use Psalm\Type\Atomic\TNamedObject;
use Psalm\Type\Union;
Expand All @@ -30,6 +31,7 @@
*/
final class ClosureAnalyzer extends FunctionLikeAnalyzer
{
use UnserializeMemoryUsageSuppressionTrait;
/**
* @param PhpParser\Node\Expr\Closure|PhpParser\Node\Expr\ArrowFunction $function
*/
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Internal/Analyzer/FunctionAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use PhpParser;
use Psalm\Config;
use Psalm\Context;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;
use UnexpectedValueException;

use function is_string;
Expand All @@ -18,6 +19,7 @@
*/
final class FunctionAnalyzer extends FunctionLikeAnalyzer
{
use UnserializeMemoryUsageSuppressionTrait;
public function __construct(PhpParser\Node\Stmt\Function_ $function, SourceAnalyzer $source)
{
$codebase = $source->getCodebase();
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Internal/Analyzer/MethodAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Psalm\StatementsSource;
use Psalm\Storage\ClassLikeStorage;
use Psalm\Storage\MethodStorage;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;
use UnexpectedValueException;

use function in_array;
Expand All @@ -31,6 +32,7 @@
*/
final class MethodAnalyzer extends FunctionLikeAnalyzer
{
use UnserializeMemoryUsageSuppressionTrait;
// https://github.com/php/php-src/blob/a83923044c48982c80804ae1b45e761c271966d3/Zend/zend_enum.c#L77-L95
private const FORBIDDEN_ENUM_METHODS = [
'__construct',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
use function explode;
use function in_array;
use function str_contains;
use function str_ends_with;
use function strlen;
use function strtolower;
use function substr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
use function in_array;
use function is_numeric;
use function is_string;
use function str_starts_with;
use function preg_match;
use function str_starts_with;
use function strpos;
use function strtolower;

Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/MethodIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use InvalidArgumentException;
use Psalm\Storage\ImmutableNonCloneableTrait;
use Stringable;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;
use Stringable;

use function explode;
use function is_string;
Expand Down
2 changes: 0 additions & 2 deletions src/Psalm/Internal/PhpVisitor/Reflector/ExpressionScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
use function dirname;
use function explode;
use function in_array;
use function preg_match;
use function str_contains;
use function strpos;
use function strtolower;
use function substr;

Expand Down
1 change: 0 additions & 1 deletion src/Psalm/Internal/Type/TypeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
use function end;
use function explode;
use function filter_var;
use function get_class;
use function in_array;
use function is_int;
use function is_numeric;
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/Any.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class Any extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function getNegation(): Assertion
{
return $this;
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/ArrayKeyDoesNotExist.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class ArrayKeyDoesNotExist extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function getNegation(): Assertion
{
return new ArrayKeyExists();
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/ArrayKeyExists.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class ArrayKeyExists extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function getNegation(): Assertion
{
return new ArrayKeyDoesNotExist();
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/DoesNotHaveAtLeastCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class DoesNotHaveAtLeastCount extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
/** @param positive-int $count */
public function __construct(public readonly int $count)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/DoesNotHaveExactCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class DoesNotHaveExactCount extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
/** @param positive-int $count */
public function __construct(public readonly int $count)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/DoesNotHaveMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class DoesNotHaveMethod extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function __construct(public readonly string $method)
{
}
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/Empty_.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class Empty_ extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function getNegation(): Assertion
{
return new NonEmpty();
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/Falsy.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class Falsy extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function getNegation(): Assertion
{
return new Truthy();
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/HasArrayKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;
use UnexpectedValueException;

/**
* @psalm-immutable
*/
final class HasArrayKey extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function __construct(public readonly string $key)
{
}
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/HasAtLeastCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class HasAtLeastCount extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
/** @param positive-int $count */
public function __construct(public readonly int $count)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/HasExactCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class HasExactCount extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
/** @param positive-int $count */
public function __construct(public readonly int $count)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/HasIntOrStringArrayAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;
use UnexpectedValueException;

/**
* @psalm-immutable
*/
final class HasIntOrStringArrayAccess extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function getNegation(): Assertion
{
throw new UnexpectedValueException('This should never be called');
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/HasMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class HasMethod extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function __construct(public readonly string $method)
{
}
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/HasStringArrayAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;
use UnexpectedValueException;

/**
* @psalm-immutable
*/
final class HasStringArrayAccess extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function getNegation(): Assertion
{
throw new UnexpectedValueException('This should never be called');
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/InArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;
use Psalm\Type\Union;

/**
* @psalm-immutable
*/
final class InArray extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function __construct(public readonly Union $type)
{
}
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/IsAClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;
use Psalm\Type\Atomic;

/**
* @psalm-immutable
*/
final class IsAClass extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
/** @param Atomic\TTemplateParamClass|Atomic\TNamedObject $type */
public function __construct(public readonly Atomic $type, public readonly bool $allow_string)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/IsClassEqual.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class IsClassEqual extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function __construct(public readonly string $type)
{
}
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/IsClassNotEqual.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class IsClassNotEqual extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function __construct(public readonly string $type)
{
}
Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Storage/Assertion/IsCountable.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
namespace Psalm\Storage\Assertion;

use Psalm\Storage\Assertion;
use Psalm\Storage\UnserializeMemoryUsageSuppressionTrait;

/**
* @psalm-immutable
*/
final class IsCountable extends Assertion
{
use UnserializeMemoryUsageSuppressionTrait;
public function getNegation(): Assertion
{
return new IsNotCountable(true);
Expand Down
Loading

0 comments on commit 2011145

Please sign in to comment.