-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Valentin Wotschel
committed
Apr 25, 2024
1 parent
f9e07be
commit d909e7e
Showing
9 changed files
with
205 additions
and
33 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
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
22 changes: 22 additions & 0 deletions
22
src/Prophecy/Doubler/ClassPatch/ProphecySubjectPatch/ObjectProphecyClosureContainer.php
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,22 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Prophecy. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* Marcello Duarte <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Prophecy\Doubler\ClassPatch\ProphecySubjectPatch; | ||
|
||
/** | ||
* Container for the closure that can be used and modified in a read-only class. | ||
* | ||
* @noinspection PhpUnused | ||
*/ | ||
class ObjectProphecyClosureContainer | ||
{ | ||
public $closure = null; | ||
} |
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
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,94 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Prophecy. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* Marcello Duarte <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Prophecy\Doubler\Generator\Node; | ||
|
||
use Prophecy\Exception\InvalidArgumentException; | ||
|
||
/** | ||
* Property node. | ||
*/ | ||
class PropertyNode | ||
{ | ||
private $name; | ||
|
||
/** | ||
* @var string | ||
* | ||
* @phpstan-var 'public'|'private'|'protected' | ||
*/ | ||
private $visibility = 'public'; | ||
|
||
/** | ||
* @var PropertyTypeNode | ||
*/ | ||
private $typeNode; | ||
|
||
/** | ||
* @param string $name | ||
*/ | ||
public function __construct(string $name) | ||
{ | ||
$this->name = $name; | ||
$this->typeNode = new PropertyTypeNode(); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* @return PropertyTypeNode | ||
*/ | ||
public function getTypeNode(): PropertyTypeNode | ||
{ | ||
return $this->typeNode; | ||
} | ||
|
||
public function setTypeNode(PropertyTypeNode $typeNode) | ||
{ | ||
$this->typeNode = $typeNode; | ||
} | ||
|
||
/** | ||
* @return string | ||
* | ||
* @phpstan-return 'public'|'private'|'protected' | ||
*/ | ||
public function getVisibility(): string | ||
{ | ||
return $this->visibility; | ||
} | ||
|
||
/** | ||
* @param string $visibility | ||
* | ||
* @return void | ||
* | ||
* @phpstan-param 'public'|'private'|'protected' $visibility | ||
*/ | ||
public function setVisibility(string $visibility) | ||
{ | ||
$visibility = strtolower($visibility); | ||
|
||
if (!\in_array($visibility, array('public', 'private', 'protected'), true)) { | ||
throw new InvalidArgumentException(sprintf( | ||
'`%s` method visibility is not supported.', $visibility | ||
)); | ||
} | ||
|
||
$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,17 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Prophecy. | ||
* (c) Konstantin Kudryashov <[email protected]> | ||
* Marcello Duarte <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Prophecy\Doubler\Generator\Node; | ||
|
||
class PropertyTypeNode extends TypeNodeAbstract | ||
{ | ||
|
||
} |