Skip to content

Commit

Permalink
Merge pull request #1007 from spiral/bugfix/php-generator
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralbot committed Oct 23, 2023
1 parent 34c7348 commit 43b4d19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -30,7 +30,7 @@
"php": ">=8.1",
"spiral/files": "^3.10",
"doctrine/inflector": "^1.4|^2.0",
"nette/php-generator": "^4.0.1"
"nette/php-generator": "4.0.9"
},
"require-dev": {
"phpunit/phpunit": "^10.1",
Expand Down
12 changes: 11 additions & 1 deletion tests/FileDeclarationTest.php
Expand Up @@ -4,6 +4,7 @@

namespace Spiral\Tests\Reactor;

use Nette\PhpGenerator\Literal;
use Nette\PhpGenerator\PhpFile;
use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Reactor\Aggregator\Classes;
Expand All @@ -19,8 +20,16 @@ final class FileDeclarationTest extends BaseWithElementsTestCase
public function testFromCode(): void
{
$file = FileDeclaration::fromCode('<?php
final class MyClass implements Countable
namespace Foo\Bar;
use Baz\Bar\ClassA;
use Baz\Bar\ClassB;
final class MyClass implements \Countable
{
public const TEST = [
ClassA::class => ClassB::class,
];
}'
);

Expand All @@ -31,6 +40,7 @@ final class MyClass implements Countable

$this->assertSame('MyClass', $class->getName());
$this->assertTrue($class->isFinal());
$this->assertInstanceOf(Literal::class, $class->getConstant('TEST')->getValue());
$this->assertSame([\Countable::class], $class->getImplements());
}

Expand Down

0 comments on commit 43b4d19

Please sign in to comment.