-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added first idea for in initializers
Signed-off-by: Michael Petri <[email protected]>
- Loading branch information
1 parent
e9e2dcc
commit ac34d26
Showing
4 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Laminas\Code\Generator; | ||
|
||
final class InInitializerGenerator extends ParameterGenerator | ||
{ | ||
public const VISIBILITY_PUBLIC = 'public'; | ||
public const VISIBILITY_PROTECTED = 'protected'; | ||
public const VISIBILITY_PRIVATE = 'private'; | ||
|
||
/** @psalm-var ParameterGenerator::VISIBILITY_* */ | ||
private string $visibility; | ||
|
||
/** | ||
* @psalm-param non-empty-string $name | ||
* @psalm-param ?non-empty-string $type | ||
* @psalm-param ParameterGenerator::VISIBILITY_* $inInitializer | ||
*/ | ||
public function __construct( | ||
string $name, | ||
?string $type = null, | ||
string $visibility = self::VISIBILITY_PUBLIC, | ||
$defaultValue = null, | ||
?int $position = null, | ||
bool $passByReference = false | ||
) { | ||
parent::__construct( | ||
$name, | ||
$type, | ||
$defaultValue, | ||
$position, | ||
$passByReference, | ||
); | ||
|
||
$this->visibility = $visibility; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Laminas\Code\Generator; | ||
|
||
final class ObjectGenerator | ||
{ | ||
/** | ||
* @psalm-param non-empty-string $className | ||
* @psalm-param non-empty-string $constructorName | ||
*/ | ||
public function __construct( | ||
string $className, | ||
array $parameters = [], | ||
string $constructorName = '__construct' | ||
){ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters