[TOOLS][CS-FIXER] Run new PHP CS Fixer config. Notably, adds strict_types
This commit is contained in:
parent
028ea79fff
commit
2694d83ae4
@ -81,6 +81,11 @@ class Security extends Controller
|
||||
* @param Authenticator $authenticator
|
||||
*
|
||||
* @return null|array|Response
|
||||
* @throws EmailTakenException
|
||||
* @throws NicknameTakenException
|
||||
* @throws ServerException
|
||||
* @throws DuplicateFoundException
|
||||
* @throws EmailTakenException
|
||||
* @throws NicknameEmptyException
|
||||
* @throws NicknameInvalidException
|
||||
* @throws NicknameNotAllowedException
|
||||
|
@ -221,7 +221,7 @@ class DB
|
||||
$metadata = self::getClassMetadata(\get_class($owner));
|
||||
$seqName = $metadata->getSequenceName($conn->getDatabasePlatform());
|
||||
self::persist($owner);
|
||||
$id = (int ) $conn->lastInsertId($seqName);
|
||||
$id = (int) $conn->lastInsertId($seqName);
|
||||
F\map(\is_array($others) ? $others : [$others], function ($o) use ($id) { $o->setId($id); self::persist($o); });
|
||||
if (!\is_null($extra)) {
|
||||
$extra($id);
|
||||
|
@ -34,6 +34,7 @@ declare(strict_types = 1);
|
||||
namespace App\DependencyInjection\Compiler;
|
||||
|
||||
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
||||
use Doctrine\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver;
|
||||
use Exception;
|
||||
use Functional as F;
|
||||
@ -91,11 +92,9 @@ class SchemaDefDriver extends StaticPHPDriver implements CompilerPassInterface
|
||||
|
||||
/**
|
||||
* Fill in the database $metadata for $class_name
|
||||
*
|
||||
* @param string $class_name
|
||||
* @param ClassMetadataInfo $metadata
|
||||
* @param ClassMetadataInfo $metadata ClassMetadataInfo is the real type, but we need to override the method
|
||||
*/
|
||||
public function loadMetadataForClass($class_name, $metadata)
|
||||
public function loadMetadataForClass($class_name, ClassMetadata $metadata)
|
||||
{
|
||||
$schema = $class_name::schemaDef();
|
||||
|
||||
@ -211,12 +210,8 @@ class SchemaDefDriver extends StaticPHPDriver implements CompilerPassInterface
|
||||
* Override StaticPHPDriver's method,
|
||||
* we care about classes that have the method `schemaDef`,
|
||||
* instead of `loadMetadata`.
|
||||
*
|
||||
* @param string $class_name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isTransient($class_name)
|
||||
public function isTransient($class_name): bool
|
||||
{
|
||||
return !method_exists($class_name, 'schemaDef');
|
||||
}
|
||||
|
@ -40,27 +40,19 @@ class ActorArrayTransformer extends ArrayTransformer
|
||||
{
|
||||
/**
|
||||
* Transforms array of Actors into string of nicknames
|
||||
*
|
||||
* @param array $a
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function transform($a)
|
||||
{
|
||||
return parent::transform(
|
||||
array_map(
|
||||
fn ($actor) => $actor->getNickname(),
|
||||
$a,
|
||||
),
|
||||
fn ($actor) => $actor->getNickname(),
|
||||
$a,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms string of nicknames into Actors
|
||||
*
|
||||
* @param string $s
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function reverseTransform($s)
|
||||
{
|
||||
|
@ -40,11 +40,6 @@ class ArrayTransformer implements DataTransformerInterface
|
||||
{
|
||||
// Can't use type annotations, to conform to interface
|
||||
|
||||
/**
|
||||
* @param array $a
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function transform($a)
|
||||
{
|
||||
if (!\is_array($a)) {
|
||||
@ -53,11 +48,6 @@ class ArrayTransformer implements DataTransformerInterface
|
||||
return Formatting::toString($a, Formatting::SPLIT_BY_SPACE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $s
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function reverseTransform($s)
|
||||
{
|
||||
if (empty($s)) {
|
||||
|
Loading…
Reference in New Issue
Block a user