Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[spiral/reactor] Fix Psalm issues and tests in Reactor #1002

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Changes from 1 commit
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
Next Next commit
Fix Psalm issues
  • Loading branch information
msmakouz committed Oct 17, 2023
commit 2dd366f773ab3dc01ac39b271a01b14b2c96aa71
5 changes: 5 additions & 0 deletions src/Reactor/src/AbstractDeclaration.php
Original file line number Diff line number Diff line change
@@ -10,13 +10,18 @@

/**
* Generic element declaration.
*
* @template T of ClassLike
*/
abstract class AbstractDeclaration implements DeclarationInterface, NamedInterface, \Stringable
{
use Traits\CommentAware;
use Traits\NameAware;
use Traits\AttributeAware;

/**
* @var T
*/
protected ClassLike $element;

public function __toString(): string
3 changes: 3 additions & 0 deletions src/Reactor/src/ClassDeclaration.php
Original file line number Diff line number Diff line change
@@ -11,6 +11,9 @@
use Spiral\Reactor\Partial\TraitUse;
use Spiral\Reactor\Traits;

/**
* @extends AbstractDeclaration<ClassType>
*/
class ClassDeclaration extends AbstractDeclaration implements AggregableInterface
{
use Traits\ConstantsAware;
3 changes: 3 additions & 0 deletions src/Reactor/src/EnumDeclaration.php
Original file line number Diff line number Diff line change
@@ -13,6 +13,9 @@
use Spiral\Reactor\Partial\TraitUse;
use Spiral\Reactor\Traits;

/**
* @extends AbstractDeclaration<EnumType>
*/
class EnumDeclaration extends AbstractDeclaration implements AggregableInterface
{
use Traits\ConstantsAware;
3 changes: 3 additions & 0 deletions src/Reactor/src/InterfaceDeclaration.php
Original file line number Diff line number Diff line change
@@ -9,6 +9,9 @@
use Spiral\Reactor\Partial\Method;
use Spiral\Reactor\Traits;

/**
* @extends AbstractDeclaration<InterfaceType>
*/
class InterfaceDeclaration extends AbstractDeclaration implements AggregableInterface
{
use Traits\ConstantsAware;
3 changes: 3 additions & 0 deletions src/Reactor/src/Partial/Parameter.php
Original file line number Diff line number Diff line change
@@ -11,6 +11,9 @@
use Spiral\Reactor\NamedInterface;
use Spiral\Reactor\Traits;

/**
* @property NetteParameter $element
*/
class Parameter implements NamedInterface, AggregableInterface
{
use Traits\AttributeAware;
3 changes: 3 additions & 0 deletions src/Reactor/src/Partial/PromotedParameter.php
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@
use Nette\PhpGenerator\PromotedParameter as NettePromotedParameter;
use Spiral\Reactor\Traits;

/**
* @property NettePromotedParameter $element
*/
final class PromotedParameter extends Parameter
{
use Traits\CommentAware;
3 changes: 3 additions & 0 deletions src/Reactor/src/TraitDeclaration.php
Original file line number Diff line number Diff line change
@@ -11,6 +11,9 @@
use Spiral\Reactor\Partial\TraitUse;
use Spiral\Reactor\Traits;

/**
* @extends AbstractDeclaration<TraitType>
*/
class TraitDeclaration extends AbstractDeclaration implements AggregableInterface
{
use Traits\ConstantsAware;
4 changes: 2 additions & 2 deletions src/Reactor/src/Traits/TraitsAware.php
Original file line number Diff line number Diff line change
@@ -36,9 +36,9 @@ public function getTrait(string $name): TraitUse
return $this->getTraits()->get($name);
}

public function addTrait(string $name, array|bool|null $deprecatedParam = null): TraitUse
public function addTrait(string $name): TraitUse
{
return TraitUse::fromElement($this->element->addTrait($name, $deprecatedParam));
return TraitUse::fromElement($this->element->addTrait($name));
}

public function removeTrait(string $name): static