Skip to content

Commit

Permalink
fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
romalytvynenko committed Mar 9, 2024
1 parent d68f2b4 commit 40e8959
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/Infer/Reflector/ClassReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class ClassReflector

private ?NameContext $nameContext = null;

private array $methods = [];

private function __construct(
private FileParser $parser,
private string $className,
Expand Down
4 changes: 2 additions & 2 deletions src/Support/InferExtensions/ModelExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public function getPropertyType(PropertyFetchEvent $event): ?Type

private function getBaseAttributeType(Model $model, string $key, array $value)
{
$type = explode(' ', $value['type']);
$typeName = explode('(', $type[0])[0];
$type = explode(' ', $value['type'] ?? '');
$typeName = explode('(', $type[0] ?? '')[0];

if (
($model->getCasts()[$key] ?? null) === 'datetime'
Expand Down
4 changes: 2 additions & 2 deletions src/Support/ResponseExtractor/ModelInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public function type()
? Union::wrap([new NullType(), $t])
: $t;

$type = explode(' ', $value['type']);
$typeName = explode('(', $type[0])[0];
$type = explode(' ', $value['type'] ?? '');
$typeName = explode('(', $type[0] ?? '')[0];

if (in_array($key, $model->getDates())) {
return $createType(new ObjectType('\\Carbon\\Carbon'));
Expand Down

0 comments on commit 40e8959

Please sign in to comment.