CS: Autofix.

This commit is contained in:
Pol Dellaiera 2022-01-25 13:44:53 +01:00
parent a18ea30c8f
commit bddb6e615e
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
5 changed files with 48 additions and 33 deletions

View File

@ -1,6 +1,8 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

View File

@ -15,7 +15,6 @@ use Chill\MainBundle\Phonenumber\PhonenumberHelper;
use Chill\PersonBundle\Entity\PersonPhone;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TelType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;

View File

@ -1,6 +1,8 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/

View File

@ -1,6 +1,8 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
@ -15,6 +17,10 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\PreloadedExtension;
use Symfony\Component\Form\Test\TypeTestCase;
/**
* @internal
* @coversNothing
*/
final class PhoneNumberTypeTest extends TypeTestCase
{
private ParameterBagInterface $parameterBag;
@ -30,16 +36,6 @@ final class PhoneNumberTypeTest extends TypeTestCase
parent::setUp();
}
protected function getExtensions()
{
// create a type instance with the mocked dependencies
$type = new PhoneNumberType($this->parameterBag);
return [
new PreloadedExtension([$type], []),
];
}
public function singleFieldProvider()
{
yield ['abc', [], ''];
@ -61,7 +57,6 @@ final class PhoneNumberTypeTest extends TypeTestCase
yield ['0486/540.660', ['default_country_prefix' => '+36'], '+36486540660'];
}
/**
* @dataProvider singleFieldProvider
*/
@ -81,4 +76,14 @@ final class PhoneNumberTypeTest extends TypeTestCase
self::assertSame($output, $view->vars['value']);
}
protected function getExtensions()
{
// create a type instance with the mocked dependencies
$type = new PhoneNumberType($this->parameterBag);
return [
new PreloadedExtension([$type], []),
];
}
}

View File

@ -1,5 +1,12 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\Person;
@ -12,6 +19,25 @@ use Doctrine\Migrations\AbstractMigration;
*/
final class Version20210518135515 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('UPDATE chill_person_person SET phonenumber = :pn WHERE phonenumber IS NULL', ['pn' => '']);
$this->addSql('UPDATE chill_person_person SET mobilenumber = :pn WHERE mobilenumber IS NULL', ['pn' => '']);
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber TYPE TEXT');
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber DROP DEFAULT');
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber SET NOT NULL');
$this->addSql('COMMENT ON COLUMN chill_person_person.phonenumber IS NULL');
$this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber TYPE TEXT');
$this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN chill_person_phone.phonenumber IS NULL');
$this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber TYPE TEXT');
$this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN chill_person_person.mobilenumber IS NULL');
}
public function getDescription(): string
{
return '';
@ -32,26 +58,7 @@ final class Version20210518135515 extends AbstractMigration
$this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN chill_person_person.mobilenumber IS \'(DC2Type:phone_number)\'');
$this->addSql('UPDATE chill_person_person SET phonenumber = NULL WHERE phonenumber=:pn', array('pn' => ''));
$this->addSql('UPDATE chill_person_person SET mobilenumber = NULL WHERE mobilenumber=:pn', array('pn' => ''));
}
public function down(Schema $schema): void
{
$this->addSql('UPDATE chill_person_person SET phonenumber = :pn WHERE phonenumber IS NULL', array('pn' => ''));
$this->addSql('UPDATE chill_person_person SET mobilenumber = :pn WHERE mobilenumber IS NULL', array('pn' => ''));
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber TYPE TEXT');
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber DROP DEFAULT');
$this->addSql('ALTER TABLE chill_person_person ALTER phonenumber SET NOT NULL');
$this->addSql('COMMENT ON COLUMN chill_person_person.phonenumber IS NULL');
$this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber TYPE TEXT');
$this->addSql('ALTER TABLE chill_person_phone ALTER phonenumber DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN chill_person_phone.phonenumber IS NULL');
$this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber TYPE TEXT');
$this->addSql('ALTER TABLE chill_person_person ALTER mobilenumber DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN chill_person_person.mobilenumber IS NULL');
$this->addSql('UPDATE chill_person_person SET phonenumber = NULL WHERE phonenumber=:pn', ['pn' => '']);
$this->addSql('UPDATE chill_person_person SET mobilenumber = NULL WHERE mobilenumber=:pn', ['pn' => '']);
}
}