Skip to content

Commit

Permalink
fix: Fix PHP 8.2 dynamic property deprecation (#1136)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Sep 18, 2023
1 parent 692846a commit 7303043
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

namespace Nelmio\Alice\Entity\Instantiator;

use AllowDynamicProperties;

#[AllowDynamicProperties]
class DummyWithExplicitDefaultConstructor
{
public function __construct()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

namespace Nelmio\Alice\Entity\Instantiator;

use AllowDynamicProperties;

#[AllowDynamicProperties]
class DummyWithFakeNamedConstructor
{
public static function namedConstruct()
Expand Down
3 changes: 3 additions & 0 deletions fixtures/Entity/Instantiator/DummyWithNamedConstructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

namespace Nelmio\Alice\Entity\Instantiator;

use AllowDynamicProperties;

#[AllowDynamicProperties]
class DummyWithNamedConstructor
{
public static function namedConstruct()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

namespace Nelmio\Alice\Entity\Instantiator;

use AllowDynamicProperties;

#[AllowDynamicProperties]
class DummyWithNamedConstructorAndOptionalParameters
{
public static function namedConstruct(int $param = 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

namespace Nelmio\Alice\Entity\Instantiator;

use AllowDynamicProperties;

#[AllowDynamicProperties]
class DummyWithNamedConstructorAndRequiredParameters
{
public static function namedConstruct(int $param)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

namespace Nelmio\Alice\Entity\Instantiator;

use AllowDynamicProperties;

#[AllowDynamicProperties]
class DummyWithOptionalParameterInConstructor
{
public function __construct(int $optionalParam = 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

namespace Nelmio\Alice\Entity\Instantiator;

use AllowDynamicProperties;

#[AllowDynamicProperties]
class DummyWithRequiredParameterInConstructor
{
public function __construct(int $requiredParam)
Expand Down
6 changes: 4 additions & 2 deletions fixtures/Generator/Instantiator/FakeChainableInstantiator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,22 @@

namespace Nelmio\Alice\Generator\Instantiator;

use AllowDynamicProperties;
use Nelmio\Alice\FixtureInterface;
use Nelmio\Alice\Generator\GenerationContext;
use Nelmio\Alice\Generator\ResolvedFixtureSet;
use Nelmio\Alice\NotCallableTrait;

#[AllowDynamicProperties]
class FakeChainableInstantiator implements ChainableInstantiatorInterface
{
use NotCallableTrait;

public function canInstantiate(FixtureInterface $fixture): bool
{
$this->__call(__METHOD__, func_get_args());
}

public function instantiate(FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, GenerationContext $context): ResolvedFixtureSet
{
$this->__call(__METHOD__, func_get_args());
Expand Down
4 changes: 3 additions & 1 deletion fixtures/Generator/Resolver/Value/FakeValueResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Nelmio\Alice\Generator\Resolver\Value;

use AllowDynamicProperties;
use Nelmio\Alice\Definition\ValueInterface;
use Nelmio\Alice\FixtureInterface;
use Nelmio\Alice\Generator\GenerationContext;
Expand All @@ -21,10 +22,11 @@
use Nelmio\Alice\Generator\ValueResolverInterface;
use Nelmio\Alice\NotCallableTrait;

#[AllowDynamicProperties]
class FakeValueResolver implements ValueResolverInterface
{
use NotCallableTrait;

public function resolve(
ValueInterface $value,
FixtureInterface $fixture,
Expand Down

0 comments on commit 7303043

Please sign in to comment.