From ab8c7f7d2d60f6f3f72b24f118460f057e054218 Mon Sep 17 00:00:00 2001 From: Anton Vasiliev <1695147@gmail.com> Date: Sun, 14 Apr 2024 22:44:16 +0100 Subject: [PATCH] #151 - Fix psalm errors --- src/Migration/Action/Generate.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Migration/Action/Generate.php b/src/Migration/Action/Generate.php index a18e069..2891ea9 100644 --- a/src/Migration/Action/Generate.php +++ b/src/Migration/Action/Generate.php @@ -164,7 +164,7 @@ public function __construct( ) { } - public function getEntity(): PhpFile + public function getEntity(): ?PhpFile { $this->checkEntityExists(); @@ -231,7 +231,7 @@ public function addMorph(Snippet $snippet, string $table, bool $skipRefSchema = . $snippet->definitionToString('options', $options) ); - $this->class->addMethod('morph') + $this->class?->addMethod('morph') ->addComment("Define the table structure\n") ->addComment('@return void') ->addComment('@throws Exception') @@ -254,7 +254,7 @@ public function addUp(string $table, $exportData = null, bool $shouldExportDataF $body = "\$this->batchInsert('$table', [{$quoteWrappedColumns}]);"; } - $this->class->addMethod('up') + $this->class?->addMethod('up') ->addComment("Run the migrations\n") ->addComment('@return void') ->setReturnType('void') @@ -272,7 +272,7 @@ public function addDown(string $table, $exportData = null, bool $shouldExportDat $body = "\$this->batchDelete('$table');"; } - $this->class->addMethod('down') + $this->class?->addMethod('down') ->addComment("Reverse the migrations\n") ->addComment('@return void') ->setReturnType('void') @@ -292,7 +292,7 @@ public function addAfterCreateTable(string $table, $exportData = null): self } $body = "\$this->batchInsert('$table', [{$quoteWrappedColumns}]);"; - $this->class->addMethod('afterCreateTable') + $this->class?->addMethod('afterCreateTable') ->addComment("This method is called after the table was created\n") ->addComment('@return void') ->setReturnType('void')