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
7 changes: 7 additions & 0 deletions src/Builder/DatagridBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@

/**
* @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* @phpstan-template T of \Sonata\AdminBundle\Datagrid\ProxyQueryInterface
*/
interface DatagridBuilderInterface extends BuilderInterface
{
/**
* @param string|null $type
* @param AdminInterface<object> $admin
*
* @phpstan-param DatagridInterface<T> $datagrid
* @phpstan-param class-string $type
*/
public function addFilter(
DatagridInterface $datagrid,
Expand All @@ -38,6 +43,8 @@ public function addFilter(
* @param array<string, mixed> $values
*
* @return DatagridInterface
*
* @phpstan-return DatagridInterface<T>
*/
public function getBaseDatagrid(AdminInterface $admin, array $values = []);
}
Expand Down
3 changes: 3 additions & 0 deletions src/Builder/FormContractorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
*/
interface FormContractorInterface extends BuilderInterface
{
/**
* NEXT_MAJOR: Remove the `__construct()` method from the interface.
*/
public function __construct(FormFactoryInterface $formFactory);

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Datagrid/DatagridMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public function getAdmin()
* @throws \LogicException
*
* @return DatagridMapper
*
* @phpstan-param class-string|null $type
*/
public function add(
$name,
Expand Down
6 changes: 6 additions & 0 deletions src/Model/LockInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@

/**
* @author Emmanuel Vella <vella.emmanuel@gmail.com>
*
* @phpstan-template T of object
*/
interface LockInterface
{
/**
* @param object $object
*
* @return mixed|null
*
* @phpstan-param T $object
*/
public function getLockVersion($object);

Expand All @@ -32,6 +36,8 @@ public function getLockVersion($object);
* @param mixed $expectedVersion
*
* @throws LockException
*
* @phpstan-param T $object
*/
public function lock($object, $expectedVersion);
}
21 changes: 18 additions & 3 deletions src/Model/ModelManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,26 @@ public function getNewFieldDescriptionInstance($class, $name, array $options = [
* @param object $object
*
* @throws ModelManagerException
*
* @phpstan-param T $object
*/
public function create($object);

/**
* @param object $object
*
* @throws ModelManagerException
*
* @phpstan-param T $object
*/
public function update($object);

/**
* @param object $object
*
* @throws ModelManagerException
*
* @phpstan-param T $object
*/
public function delete($object);

Expand Down Expand Up @@ -106,7 +112,7 @@ public function find($class, $id);
*
* @throws ModelManagerException
*
* @phpstan-param class-string $class
* @phpstan-param class-string<T> $class
*/
public function batchDelete($class, ProxyQueryInterface $query);

Expand All @@ -128,7 +134,7 @@ public function getParentFieldDescription($parentAssociationMapping, $class);
*
* @return ProxyQueryInterface
*
* @phpstan-param class-string $class
* @phpstan-param class-string<T> $class
*/
public function createQuery($class);

Expand Down Expand Up @@ -157,6 +163,8 @@ public function getModelIdentifier($class);
* @param object $model
*
* @return array<int|string> list of all identifiers of this model
*
* @phpstan-param T $model
*/
public function getIdentifierValues($model);

Expand All @@ -168,7 +176,7 @@ public function getIdentifierValues($model);
*
* @return string[]
*
* @phpstan-param class-string $class
* @phpstan-param class-string<T> $class
*/
public function getIdentifierFieldNames($class);

Expand All @@ -179,6 +187,8 @@ public function getIdentifierFieldNames($class);
*
* @return string|null a string representation of the identifiers for this
* instance
*
* @phpstan-param T $model
*/
public function getNormalizedIdentifier($model);

Expand All @@ -191,6 +201,8 @@ public function getNormalizedIdentifier($model);
* @param object $model
*
* @return string|null string representation of the id that is safe to use in a url
*
* @phpstan-param T $model
*/
public function getUrlSafeIdentifier($model);

Expand Down Expand Up @@ -295,6 +307,9 @@ public function getSortParameters(FieldDescriptionInterface $fieldDescription, D
public function modelReverseTransform($class, array $array = []);

// NEXT_MAJOR: Uncomment this.
/**
* @phpstan-param T $object
*/
// public function reverseTransform(object $object, array $array = []): void;

/**
Expand Down