forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement trait and higher order proxies
- Loading branch information
Showing
10 changed files
with
125 additions
and
68 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
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,28 @@ | ||
<?php | ||
|
||
namespace Illuminate\Support; | ||
|
||
class HigherOrderStrongTypeableProxy | ||
{ | ||
/** | ||
* Create a new strong-typeable proxy instance. | ||
* | ||
* @param mixed $target | ||
* @return void | ||
*/ | ||
public function __construct(protected mixed $target) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Dynamically access properties from the target. | ||
* | ||
* @param string $key | ||
* @return \Illuminate\Support\StrongTypeable | ||
*/ | ||
public function __get(string $key): StrongTypeable | ||
{ | ||
return new StrongTypeable($this->target, $key); | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
namespace Illuminate\Support; | ||
|
||
class HigherOrderTypeableProxy | ||
{ | ||
/** | ||
* Create a new typeable proxy instance. | ||
* | ||
* @param mixed $target | ||
* @return void | ||
*/ | ||
public function __construct(protected mixed $target) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Dynamically access properties from the target. | ||
* | ||
* @param string $key | ||
* @return \Illuminate\Support\Typeable | ||
*/ | ||
public function __get(string $key): Typeable | ||
{ | ||
return new Typeable($this->target, $key); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace Illuminate\Support\Traits; | ||
|
||
use Illuminate\Support\HigherOrderStrongTypeableProxy; | ||
|
||
trait StrongTypeable | ||
{ | ||
/** | ||
* Retrieve a higher order strong-typeable proxy. | ||
* | ||
* @return HigherOrderStrongTypeableProxy | ||
*/ | ||
public function typed(): HigherOrderStrongTypeableProxy | ||
{ | ||
return new HigherOrderStrongTypeableProxy($this); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace Illuminate\Support\Traits; | ||
|
||
use Illuminate\Support\HigherOrderTypeableProxy; | ||
|
||
trait Typeable | ||
{ | ||
/** | ||
* Retrieve a higher order typeable proxy. | ||
* | ||
* @return HigherOrderTypeableProxy | ||
*/ | ||
public function typed(): HigherOrderTypeableProxy | ||
{ | ||
return new HigherOrderTypeableProxy($this); | ||
} | ||
} |
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