Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make mixin method static if there's __callStatic() in the class
- Loading branch information
1 parent
03d8312
commit 114a38f
Showing
4 changed files
with
61 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Bug5536; | ||
|
||
/** | ||
* @mixin Builder<static> | ||
*/ | ||
class Model | ||
{ | ||
/** | ||
* @param array<int, mixed> $args | ||
*/ | ||
public function __call(string $method, array $args) | ||
{ | ||
return $this->$method; | ||
} | ||
|
||
/** | ||
* @param array<int, mixed> $args | ||
*/ | ||
public static function __callStatic(string $method, array $args) | ||
{ | ||
return (new static)->$method(...$args); | ||
} | ||
} | ||
|
||
/** | ||
* @template TModel of Model | ||
*/ | ||
class Builder | ||
{ | ||
/** | ||
* @return array<int, TModel> | ||
*/ | ||
public function all(): array | ||
{ | ||
return []; | ||
} | ||
} | ||
|
||
class User extends Model {} | ||
|
||
function (): void { | ||
User::all(); | ||
$user = new User(); | ||
$user->all(); | ||
}; |