Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Type/InputFilter/CreateResourceInputFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Dot\Maker\Component;
use Dot\Maker\Component\ClassFile;
use Dot\Maker\Component\Method;
use Dot\Maker\Component\Method\Constructor;
use Dot\Maker\Exception\BadRequestException;
use Dot\Maker\Exception\DuplicateFileException;
Expand Down Expand Up @@ -57,7 +58,8 @@ public function render(string $name, Component $inputFilter): string
*/
COMM);

$init = (new Constructor())
$init = (new Method('init'))
->setReturnType('self')
->setBody(<<<BODY
// chain inputs below

Expand All @@ -81,11 +83,11 @@ public function renderApi(string $name, Component $inputFilter): string
*/
COMM);

$init = (new Constructor())
$constructor = (new Constructor())
->setBody(<<<BODY
// chain inputs here
BODY);
$class->addMethod($init);
$class->addMethod($constructor);

return $class->render();
}
Expand Down
5 changes: 3 additions & 2 deletions src/Type/InputFilter/DeleteResourceInputFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Dot\Maker\Component;
use Dot\Maker\Component\ClassFile;
use Dot\Maker\Component\Method\Constructor;
use Dot\Maker\Component\Method;
use Dot\Maker\Exception\BadRequestException;
use Dot\Maker\Exception\DuplicateFileException;
use Dot\Maker\Exception\RuntimeException;
Expand Down Expand Up @@ -58,7 +58,8 @@ public function render(string $name, Component $inputFilter, Component $input):
*/
COMM);

$init = (new Constructor())
$init = (new Method('init'))
->setReturnType('self')
->setBody(<<<BODY
// chain inputs below

Expand Down
8 changes: 5 additions & 3 deletions src/Type/InputFilter/EditResourceInputFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Dot\Maker\Component;
use Dot\Maker\Component\ClassFile;
use Dot\Maker\Component\Method;
use Dot\Maker\Component\Method\Constructor;
use Dot\Maker\Exception\BadRequestException;
use Dot\Maker\Exception\DuplicateFileException;
Expand Down Expand Up @@ -57,7 +58,8 @@ public function render(string $name, Component $inputFilter): string
*/
COMM);

$init = (new Constructor())
$init = (new Method('init'))
->setReturnType('self')
->setBody(<<<BODY
// chain inputs below

Expand All @@ -81,11 +83,11 @@ public function renderApi(string $name, Component $inputFilter): string
*/
COMM);

$init = (new Constructor())
$constructor = (new Constructor())
->setBody(<<<BODY
// chain inputs here
BODY);
$class->addMethod($init);
$class->addMethod($constructor);

return $class->render();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Type/InputFilter/ReplaceResourceInputFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ public function render(string $name, Component $inputFilter): string
*/
COMM);

$init = (new Constructor())
$constructor = (new Constructor())
->setBody(<<<BODY
// chain inputs here
BODY);
$class->addMethod($init);
$class->addMethod($constructor);

return $class->render();
}
Expand Down
6 changes: 3 additions & 3 deletions test/Type/InputFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ private function dataProviderCreateResourceInputFilter(): string
*/
class CreateBookStoreInputFilter extends AbstractInputFilter
{
public function __construct()
public function init(): self
{
// chain inputs below

Expand Down Expand Up @@ -510,7 +510,7 @@ private function dataProviderDeleteResourceInputFilter(): string
*/
class DeleteBookStoreInputFilter extends AbstractInputFilter
{
public function __construct()
public function init(): self
{
// chain inputs below

Expand Down Expand Up @@ -541,7 +541,7 @@ private function dataProviderEditResourceInputFilter(): string
*/
class EditBookStoreInputFilter extends AbstractInputFilter
{
public function __construct()
public function init(): self
{
// chain inputs below

Expand Down