Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecations #51

Merged
merged 2 commits into from Aug 4, 2019

Conversation

GwendolenLynch
Copy link
Contributor

  • Add requiresSQLCommentHint() to BaseType

See doctrine/DoctrineBundle#947
Fixes #50

  • Drop null parameter on call to TestCase->setMethods()

The method is type hinted to array so null is throwing a type error

@coveralls
Copy link

coveralls commented Aug 4, 2019

Pull Request Test Coverage Report for Build 241

  • 0 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.3%) to 94.19%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/MartinGeorgiev/Doctrine/DBAL/Types/BaseType.php 0 1 0.0%
Totals Coverage Status
Change from base Build 236: -0.3%
Covered Lines: 308
Relevant Lines: 327

💛 - Coveralls

.gitignore Outdated Show resolved Hide resolved
src/MartinGeorgiev/Doctrine/DBAL/Types/BaseType.php Outdated Show resolved Hide resolved
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseTypeTest.php Outdated Show resolved Hide resolved
Copy link
Owner

@martin-georgiev martin-georgiev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your work :)

@martin-georgiev martin-georgiev merged commit aecd1f8 into martin-georgiev:master Aug 4, 2019
@GwendolenLynch GwendolenLynch deleted the deprecations branch August 4, 2019 09:19
@Gemorroj
Copy link
Contributor

Can you explain why I still have this error?

The type "jsonb" was implicitly marked as commented due to the configurati
on. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the
 "commented" attribute in the configuration to "false" or mark the type as comme
nted in "MartinGeorgiev\Doctrine\DBAL\Types\Jsonb::requiresSQLCommentHint().

@martin-georgiev
Copy link
Owner

Can you explain why I still have this error?

The type "jsonb" was implicitly marked as commented due to the configurati
on. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the
 "commented" attribute in the configuration to "false" or mark the type as comme
nted in "MartinGeorgiev\Doctrine\DBAL\Types\Jsonb::requiresSQLCommentHint().

Can you please share more details about the relevant packages you use?

@Gemorroj
Copy link
Contributor

@martin-georgiev
I use Symfony 4.4 and with tests got noties:

Other deprecation notices (15)

  1x: The type "jsonb" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "MartinGeorgiev\Doctrine\DBAL\Types\Jsonb::requiresSQLCommentHin
t()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "jsonb[]" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "MartinGeorgiev\Doctrine\DBAL\Types\JsonbArray::requiresSQLCom
mentHint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "smallint[]" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "MartinGeorgiev\Doctrine\DBAL\Types\SmallIntArray::requires
SQLCommentHint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "integer[]" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "MartinGeorgiev\Doctrine\DBAL\Types\IntegerArray::requiresSQ
LCommentHint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "bigint[]" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "MartinGeorgiev\Doctrine\DBAL\Types\BigIntArray::requiresSQLC
ommentHint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "text[]" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "MartinGeorgiev\Doctrine\DBAL\Types\TextArray::requiresSQLComme
ntHint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "carrier_service" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "App\DBAL\Types\CarrierServiceType::requiresSQLComment
Hint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "shipping_segment_condition_value" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "App\DBAL\Types\ShippingSegmentCondit
ionValueType::requiresSQLCommentHint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "website_metadata_categories" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "App\DBAL\Types\WebsiteMetadataCategoriesT
ype::requiresSQLCommentHint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "website_metadata_product_attributes" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "App\DBAL\Types\WebsiteMetadataPro
ductAttributesType::requiresSQLCommentHint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "shipping_rule_action" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "App\DBAL\Types\ShippingRuleActionType::requiresS
QLCommentHint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "volumetric_weight_separate_dimensions" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "App\DBAL\Types\VolumetricWeight
SeparateDimensionsType::requiresSQLCommentHint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "volumetric_weight_volume" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "App\DBAL\Types\VolumetricWeightVolumeType::r
equiresSQLCommentHint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The type "volumetric_weight_volumetric_weight" was implicitly marked as commented due to the configuration. This is deprecated and will be removed in DoctrineBundle 2.0. Either set the "commented" attribute in the configuration to "false" or mark the type as commented in "App\DBAL\Types\VolumetricWeightVo
lumetricWeightType::requiresSQLCommentHint()."
    1x in RatesTest::testRates from App\Tests\Api

  1x: The "Doctrine\Bundle\DoctrineBundle\Registry" class implements "Symfony\Bridge\Doctrine\RegistryInterface" that is deprecated since Symfony 4.4, use Doctrine\Common\Persistence\ManagerRegistry instead.

test file:

<?php

namespace App\Tests\Api;

use App\Entity\Origin;
use App\Entity\Website;
use App\Model\Api\Rates\Product;
use App\Model\Api\Rates\Result\Carrier;
use App\Model\Api\Rates\Result\CarrierService;
use App\Model\Api\Rates\Result\Origin as ResultOrigin;
use App\Model\Api\Rates\Shipping;
use App\Service\RatesCalculator;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;

class RatesTest extends KernelTestCase
{
    public function testRates(): void
    {
        self::bootKernel();
        $ratesCalculator = self::$container->get(RatesCalculator::class);
        $entityManager = self::$container->get(EntityManagerInterface::class);

        $shipping = new Shipping();
        $shipping->setWebsite($entityManager->getRepository(Website::class)->findOneBy([]));
        $shipping->setCompanyName('company name');
        $shipping->setCountry('GB');
        $shipping->setPostalCode('NW1 0UR');
        $shipping->setCity('London');
        $shipping->setAddress('32 Guild Street');
        $shipping->setRegionCode('England');
        $shipping->setRegionName('England');
        $shipping->setContactPhone('+4407883307480');
        $shipping->setProducts([
            (new Product())
                ->setQuantity(1.0)
                ->setPriceWithTax(20.0)
                ->setPriceWithoutTax(20.0)
                ->setOrigin($entityManager->getRepository(Origin::class)->findOneBy([]))
                ->setWeight(1.0),
        ]);

        $result = $ratesCalculator->calculate($shipping);

        /** @var ResultOrigin $resultOrigin */
        $resultOrigin = $result->first();
        /** @var Carrier|false $carrier */
        $carrier = $resultOrigin->getCarriers()->first();
        $this->assertNotFalse($carrier);

        $this->assertTrue($carrier->isSuccess());
        /** @var CarrierService|false $service */
        $service = $carrier->getServices()->first();
        $this->assertNotFalse($service);
        $this->assertTrue($service->isSuccess());
    }
}

composer:

    "require": {
        "php": "^7.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "ext-apcu": "*",
        "ext-pdo_pgsql": "*",
        "ext-curl": "*",
        "ext-json": "*",
        "ext-intl": "*",
        "symfony/console": "4.4.*",
        "symfony/dotenv": "4.4.*",
        "symfony/flex": "^1.4.8",
        "symfony/framework-bundle": "4.4.*",
        "symfony/yaml": "4.4.*",
        "symfony/http-client": "4.4.*",
        "symfony/orm-pack": "*",
        "symfony/validator": "4.4.*",
        "symfony/security-bundle": "4.4.*",
        "symfony/intl": "4.4.*",
        "symfony/form": "4.4.*",
        "symfony/serializer-pack": "*",
        "symfony/monolog-bundle": "^3.5",
        "symfony/mercure-bundle": "^0.2",
        "misd/phone-number-bundle": "^2.0@dev",
        "nelmio/api-doc-bundle": "^3.5",
        "nelmio/cors-bundle": "^1.5",
        "lexik/jwt-authentication-bundle": "^2.6",
        "lcobucci/jwt": "^3.3",
        "martin-georgiev/postgresql-for-doctrine": "^1.2",
        "beberlei/doctrineextensions": "^1.2",
        "fresh/doctrine-enum-bundle": "^6.6",
        "barbieswimcrew/zip-code-validator": "^1.3",

        "symfony/mailer": "4.4.*",
        "symfony/twig-pack": "*",

        "shapecode/cron-bundle": "^3.2.3",
        "pagerfanta/pagerfanta": "^2.1"
    },
    "require-dev": {
        "symfony/phpunit-bridge": "4.4.*",
        "doctrine/doctrine-fixtures-bundle": "^3.3",
        "symfony/maker-bundle": "^1.14",
        "symfony/debug-bundle": "4.4.*",
        "easycorp/easy-log-handler": "^1.0.9",
        "phpstan/phpstan-symfony": "^0.10",
        "phpstan/phpstan-phpunit": "^0.10",
        "friendsofphp/php-cs-fixer": "^2.16"
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add requiresSQLCommentHint to custom doctrine types
4 participants