Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Fixture;

use Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Source\ClassWithGlobalConstants;

final class OnClassConstantGlobalConstants
{
private const ITEMS = ['x', ...ClassWithGlobalConstants::ITEMS];
}

?>
-----
<?php

namespace Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Fixture;

use Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Source\ClassWithGlobalConstants;

final class OnClassConstantGlobalConstants
{
private const ITEMS = ['x', PHP_EOL, \PHP_VERSION, T_STRING, true, null, UNKNOWN_CONSTANT];
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Fixture;

use Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Source\ParentWithRelativeConstant;

final class OnClassConstantNotMovable extends ParentWithRelativeConstant
{
public const A = 'child-a';

private const USES_SELF_INHERITED = [...self::USES_SELF];

private const USES_MAGIC_INHERITED = [...self::USES_MAGIC];

private const USES_NAMESPACED_CONSTANT_INHERITED = [...self::USES_NAMESPACED_CONSTANT];

private const USES_PRIVATE_BY_NAME_INHERITED = [...self::USES_PRIVATE_BY_NAME];
}

?>
-----
<?php

namespace Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Fixture;

use Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Source\ParentWithRelativeConstant;

final class OnClassConstantNotMovable extends ParentWithRelativeConstant
{
public const A = 'child-a';

private const USES_SELF_INHERITED = array_merge(self::USES_SELF);

private const USES_MAGIC_INHERITED = array_merge(self::USES_MAGIC);

private const USES_NAMESPACED_CONSTANT_INHERITED = array_merge(self::USES_NAMESPACED_CONSTANT);

private const USES_PRIVATE_BY_NAME_INHERITED = array_merge(self::USES_PRIVATE_BY_NAME);
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Fixture;

use Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Source\ClassWithArrayConstant;

final class OnClassConstantOtherNamespace extends ClassWithArrayConstant
{
private const FROM_OTHER = ['x', ...ClassWithArrayConstant::ITEMS];

private const FROM_INHERITED = ['y', ...OnClassConstantOtherNamespace::ITEMS];
}

?>
-----
<?php

namespace Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Fixture;

use Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Source\ClassWithArrayConstant;

final class OnClassConstantOtherNamespace extends ClassWithArrayConstant
{
private const FROM_OTHER = ['x', 'a', \Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Source\SomeTokens::TOKEN];

private const FROM_INHERITED = ['y', 'a', \Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Source\SomeTokens::TOKEN];
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace OtherNamespace {
class SomeTokens
{
public const TOKEN = 'token';
}

class ClassWithArrayConstant
{
public const ITEMS = ['a', SomeTokens::TOKEN];
}
}

namespace App {
use OtherNamespace\ClassWithArrayConstant;

final class OnClassConstantOtherNamespace extends ClassWithArrayConstant
{
private const FROM_OTHER = ['x', ...ClassWithArrayConstant::ITEMS];
}
}

?>
-----
<?php

namespace OtherNamespace {
class SomeTokens
{
public const TOKEN = 'token';
}

class ClassWithArrayConstant
{
public const ITEMS = ['a', SomeTokens::TOKEN];
}
}

namespace App {
use OtherNamespace\ClassWithArrayConstant;

final class OnClassConstantOtherNamespace extends ClassWithArrayConstant
{
private const FROM_OTHER = ['x', 'a', \OtherNamespace\SomeTokens::TOKEN];
}
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Source;

class ClassWithArrayConstant
{
public const ITEMS = ['a', SomeTokens::TOKEN];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Source;

class ClassWithGlobalConstants
{
public const ITEMS = [PHP_EOL, \PHP_VERSION, T_STRING, true, null, UNKNOWN_CONSTANT];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Source;

const NAMESPACED_CONSTANT = 'namespaced';

class ParentWithRelativeConstant
{
public const A = 'parent-a';

public const USES_SELF = [self::A];

public const USES_MAGIC = [__CLASS__];

public const USES_NAMESPACED_CONSTANT = [NAMESPACED_CONSTANT];

public const USES_PRIVATE_BY_NAME = [ParentWithRelativeConstant::HIDDEN];

private const HIDDEN = 'hidden';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\DowngradePhp74\Rector\Array_\DowngradeArraySpreadRector\Source;

final class SomeTokens
{
public const TOKEN = 'token';
}
Loading
Loading