Skip to content

Commit

Permalink
native types
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Nov 7, 2024
1 parent 1313ed2 commit 49c78bf
Show file tree
Hide file tree
Showing 21 changed files with 35 additions and 116 deletions.
7 changes: 2 additions & 5 deletions src/Analyzer/QueryPlanResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ final class QueryPlanResult
/**
* @var array<string, self::*>
*/
private $result = [];
private array $result = [];

/**
* @var string
*/
private $simulatedQuery;
private string $simulatedQuery;

public function __construct(string $simulatedQuery)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Ast/ExpressionFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@

final class ExpressionFinder
{
/**
* @var NodeFinder
*/
private $nodeFinder;
private NodeFinder $nodeFinder;

public function __construct()
{
Expand Down
7 changes: 2 additions & 5 deletions src/Ast/PreviousConnectingVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ final class PreviousConnectingVisitor extends NodeVisitorAbstract
/**
* @var list<Node>
*/
private $stack = [];
private array $stack = [];

/**
* @var ?Node
*/
private $previous;
private ?Node $previous;

public function beforeTraverse(array $nodes)
{
Expand Down
5 changes: 1 addition & 4 deletions src/DbSchema/LazySchemaHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ class LazySchemaHasher implements SchemaHasher
*/
private $schemaHasherFactory;

/**
* @var SchemaHasher|null
*/
private $schemaHasher;
private ?SchemaHasher $schemaHasher;

/**
* @param callable():SchemaHasher $schemaHasherFactory
Expand Down
5 changes: 1 addition & 4 deletions src/DbSchema/SchemaHasherMysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ final class SchemaHasherMysql implements SchemaHasher
*/
private $connection;

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

/**
* @param PDO|mysqli $connection
Expand Down
5 changes: 1 addition & 4 deletions src/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
*/
final class Error
{
/**
* @var string
*/
private $message;
private string $message;

/**
* @var ErrorCodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@

final class MysqliEscapeStringDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension, DynamicFunctionReturnTypeExtension
{
/**
* @var PhpVersion
*/
private $phpVersion;
private PhpVersion $phpVersion;

public function __construct(PhpVersion $phpVersion)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Extensions/MysqliQueryDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@

final class MysqliQueryDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension, DynamicFunctionReturnTypeExtension
{
/**
* @var PhpVersion
*/
private $phpVersion;
private PhpVersion $phpVersion;

public function __construct(PhpVersion $phpVersion)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Extensions/PdoPrepareDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@

final class PdoPrepareDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
{
/**
* @var PhpVersion
*/
private $phpVersion;
private PhpVersion $phpVersion;

public function __construct(PhpVersion $phpVersion)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Extensions/PdoQueryDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@

final class PdoQueryDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
{
/**
* @var PhpVersion
*/
private $phpVersion;
private PhpVersion $phpVersion;

public function __construct(PhpVersion $phpVersion)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Extensions/PdoQuoteDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@

final class PdoQuoteDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
{
/**
* @var PhpVersion
*/
private $phpVersion;
private PhpVersion $phpVersion;

public function __construct(PhpVersion $phpVersion)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@

final class PdoStatementExecuteTypeSpecifyingExtension implements MethodTypeSpecifyingExtension, TypeSpecifierAwareExtension
{
/**
* @var TypeSpecifier
*/
private $typeSpecifier;
private TypeSpecifier $typeSpecifier;

public function getClass(): string
{
Expand Down
12 changes: 3 additions & 9 deletions src/Extensions/PdoStatementFetchDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,9 @@

final class PdoStatementFetchDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
{
/**
* @var PhpVersion
*/
private $phpVersion;

/**
* @var ReflectionProvider
*/
private $reflectionProvider;
private PhpVersion $phpVersion;

private ReflectionProvider $reflectionProvider;

public function __construct(PhpVersion $phpVersion, ReflectionProvider $reflectionProvider)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@

final class PdoStatementFetchObjectDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
{
/**
* @var ReflectionProvider
*/
private $reflectionProvider;
private ReflectionProvider $reflectionProvider;

public function __construct(ReflectionProvider $reflectionProvider)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@

final class PdoStatementSetFetchModeTypeSpecifyingExtension implements MethodTypeSpecifyingExtension, TypeSpecifierAwareExtension
{
/**
* @var TypeSpecifier
*/
private $typeSpecifier;
private TypeSpecifier $typeSpecifier;

public function getClass(): string
{
Expand Down
9 changes: 3 additions & 6 deletions src/QueryReflection/BasePdoQueryReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ abstract class BasePdoQueryReflector implements QueryReflector, RecordingReflect
/**
* @var array<string, PDOException|list<ColumnMeta>|null>
*/
protected $cache = [];
protected array $cache = [];

/**
* @var TypeMapper
Expand All @@ -71,12 +71,9 @@ abstract class BasePdoQueryReflector implements QueryReflector, RecordingReflect
/**
* @var array<string, array<string, list<string>>>
*/
protected $emulatedFlags = [];
protected array $emulatedFlags = [];

/**
* @var PDO
*/
protected $pdo;
protected PDO $pdo;

public function __construct(PDO $pdo)
{
Expand Down
2 changes: 1 addition & 1 deletion src/QueryReflection/ChainedReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class ChainedReflector implements QueryReflector
/**
* @var QueryReflector[]
*/
private $reflectors;
private array $reflectors;

/**
* @param QueryReflector ...$reflectors
Expand Down
10 changes: 2 additions & 8 deletions src/QueryReflection/LazyQueryReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,9 @@ final class LazyQueryReflector implements QueryReflector, RecordingReflector
*/
private $reflectorFactory;

/**
* @var QueryReflector|null
*/
private $reflector;
private ?QueryReflector $reflector;

/**
* @var DbaApi|null
*/
private $dbaApi;
private ?DbaApi $dbaApi;

/**
* @param callable():QueryReflector $reflectorFactory
Expand Down
17 changes: 4 additions & 13 deletions src/QueryReflection/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,13 @@ final class Parameter
/**
* @var non-empty-string|null
*/
public $name;
public ?string $name = null;

/**
* @var Type
*/
public $type;
public Type $type;

/**
* @var ?string
*/
public $simulatedValue;
public ?string $simulatedValue = null;

/**
* @var bool
*/
public $isOptional;
public bool $isOptional;

/**
* @param non-empty-string|null $name
Expand Down
15 changes: 3 additions & 12 deletions src/QueryReflection/QueryReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,11 @@ final class QueryReflection

private const REGEX_NAMED_PLACEHOLDER = '{(["\'])((?:(?!\1)(?s:.))*\1)|(' . self::NAMED_PATTERN . ')}';

/**
* @var QueryReflector|null
*/
private static $reflector;
private static ?QueryReflector $reflector = null;

/**
* @var RuntimeConfiguration|null
*/
private static $runtimeConfiguration;
private static ?RuntimeConfiguration $runtimeConfiguration = null;

/**
* @var SchemaReflection
*/
private $schemaReflection;
private ?SchemaReflection $schemaReflection = null;

public function __construct(?DbaApi $dbaApi = null)
{
Expand Down
12 changes: 3 additions & 9 deletions src/QueryReflection/RecordingQueryReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@

final class RecordingQueryReflector implements QueryReflector, RecordingReflector
{
/**
* @var ReflectionCache
*/
private $reflectionCache;

/**
* @var QueryReflector
*/
private $reflector;
private ReflectionCache $reflectionCache;

private QueryReflector $reflector;

public function __construct(ReflectionCache $cache, QueryReflector $wrappedReflector)
{
Expand Down

0 comments on commit 49c78bf

Please sign in to comment.