Skip to content

Commit

Permalink
Merge pull request #32 from bdejacobet/remove-datagrid-bundle
Browse files Browse the repository at this point in the history
chore(dependencies): remove sonata datagrid bundle
  • Loading branch information
mremi authored Oct 24, 2022
2 parents 5aa67a4 + 8e67453 commit fb6b47f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ master

* Add Composer keyword for asking user to add this package to require-dev instead of require
* Fix tests by changing MethodReflection to expected ExtendedMethodRepository
* Remove sonata-project/datagrid-bundle dependency

v1.0.0
------
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"require": {
"php": "^7.3 || ^8.0",
"phpstan/phpstan": "^1.0",
"sonata-project/datagrid-bundle": "^3.0",
"sonata-project/admin-bundle": "^3.107 || ^4.20",
"sonata-project/doctrine-orm-admin-bundle": "^3.6"
},
"require-dev": {
Expand Down
5 changes: 2 additions & 3 deletions src/Type/ProxyQueryDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\MethodsClassReflectionExtension;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface as AdminProxyQueryInterface;
use Sonata\DatagridBundle\ProxyQuery\ProxyQueryInterface as DatagridProxyQueryInterface;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery;

/**
Expand All @@ -46,7 +45,7 @@ public function setBroker(Broker $broker): void
*/
public function hasMethod(ClassReflection $classReflection, string $methodName): bool
{
return (\in_array($classReflection->getName(), [AdminProxyQueryInterface::class, DatagridProxyQueryInterface::class, ProxyQuery::class])
return (\in_array($classReflection->getName(), [ProxyQueryInterface::class, ProxyQuery::class])
&& $this->broker->getClass(QueryBuilder::class)->hasMethod($methodName));
}

Expand Down
9 changes: 3 additions & 6 deletions tests/Type/ProxyQueryDynamicReturnTypeExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
use PHPStan\Reflection\ExtendedMethodReflection;
use PHPStan\Reflection\MethodsClassReflectionExtension;
use PHPUnit\Framework\TestCase;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface as AdminProxyQueryInterface;
use Sonata\DatagridBundle\ProxyQuery\ProxyQueryInterface as DatagridProxyQueryInterface;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQuery;

/**
Expand Down Expand Up @@ -86,10 +85,8 @@ public function hasMethodDataProvider(): \Generator
yield 'wrong class & valid method' => [false, 'Foo\Bar', true, 'leftJoin', 0];
yield 'proxy query & valid method' => [true, ProxyQuery::class, true, 'leftJoin', 1];
yield 'proxy query & wrong method' => [false, ProxyQuery::class, false, 'foo', 1];
yield 'admin proxy query & valid method' => [true, AdminProxyQueryInterface::class, true, 'leftJoin', 1];
yield 'admin proxy query & wrong method' => [false, AdminProxyQueryInterface::class, false, 'foo', 1];
yield 'datagrid proxy query & valid method' => [true, DatagridProxyQueryInterface::class, true, 'leftJoin', 1];
yield 'datagrid proxy query & wrong method' => [false, DatagridProxyQueryInterface::class, false, 'foo', 1];
yield 'admin proxy query & valid method' => [true, ProxyQueryInterface::class, true, 'leftJoin', 1];
yield 'admin proxy query & wrong method' => [false, ProxyQueryInterface::class, false, 'foo', 1];;
}

/**
Expand Down

0 comments on commit fb6b47f

Please sign in to comment.