Skip to content

Commit

Permalink
Silence invasive deprecation warnings, opt-in for warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
reecefowell committed Jun 8, 2015
1 parent 53d9003 commit 73bbaa6
Show file tree
Hide file tree
Showing 204 changed files with 317 additions and 318 deletions.
2 changes: 1 addition & 1 deletion UPGRADE-2.7.md
Expand Up @@ -5,7 +5,7 @@ Global
------

* `E_USER_DEPRECATED` warnings -
`trigger_error('... is deprecated ...', E_USER_DEPRECATED)` -
`@trigger_error('... is deprecated ...', E_USER_DEPRECATED)` -
are now triggered when using all deprecated functionality.
To avoid filling up error logs, you may need to add
`~E_USER_DEPRECATED` to your `error_reporting` setting in
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bridge\Doctrine\Form\ChoiceList;

trigger_error('The '.__NAMESPACE__.'\EntityChoiceList class is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\EntityChoiceList class is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader instead.', E_USER_DEPRECATED);

use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\ObjectManager;
Expand Down Expand Up @@ -300,12 +300,11 @@ public function getValuesForChoices(array $entities)
* @return array
*
* @see ChoiceListInterface
*
* @deprecated since version 2.4, to be removed in 3.0.
*/
public function getIndicesForChoices(array $entities)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);

// Performance optimization
if (empty($entities)) {
Expand Down Expand Up @@ -344,12 +343,11 @@ public function getIndicesForChoices(array $entities)
* @return array
*
* @see ChoiceListInterface
*
* @deprecated since version 2.4, to be removed in 3.0.
*/
public function getIndicesForValues(array $values)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);

// Performance optimization
if (empty($values)) {
Expand Down
Expand Up @@ -57,14 +57,14 @@ public function __construct($queryBuilder, $manager = null, $class = null)
}

if ($queryBuilder instanceof \Closure) {
trigger_error('Passing a QueryBuilder closure to '.__CLASS__.'::__construct() is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('Passing a QueryBuilder closure to '.__CLASS__.'::__construct() is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);

if (!$manager instanceof EntityManager) {
throw new UnexpectedTypeException($manager, 'Doctrine\ORM\EntityManager');
}

trigger_error('Passing an EntityManager to '.__CLASS__.'::__construct() is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
trigger_error('Passing a class to '.__CLASS__.'::__construct() is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('Passing an EntityManager to '.__CLASS__.'::__construct() is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('Passing a class to '.__CLASS__.'::__construct() is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);

$queryBuilder = $queryBuilder($manager->getRepository($class));

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
Expand Up @@ -248,7 +248,7 @@ public function configureOptions(OptionsResolver $resolver)
// deprecation note
$propertyNormalizer = function (Options $options, $propertyName) {
if ($propertyName) {
trigger_error('The "property" option is deprecated since version 2.7 and will be removed in 3.0. Use "choice_label" instead.', E_USER_DEPRECATED);
@trigger_error('The "property" option is deprecated since version 2.7 and will be removed in 3.0. Use "choice_label" instead.', E_USER_DEPRECATED);
}

return $propertyName;
Expand All @@ -267,7 +267,7 @@ public function configureOptions(OptionsResolver $resolver)
// deprecation note
$loaderNormalizer = function (Options $options, $loader) {
if ($loader) {
trigger_error('The "loader" option is deprecated since version 2.7 and will be removed in 3.0. Override getLoader() instead.', E_USER_DEPRECATED);
@trigger_error('The "loader" option is deprecated since version 2.7 and will be removed in 3.0. Override getLoader() instead.', E_USER_DEPRECATED);
}

return $loader;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Doctrine/Tests/DoctrineOrmTestCase.php
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bridge\Doctrine\Tests;

trigger_error('The '.__NAMESPACE__.'\DoctrineOrmTestCase class is deprecated since version 2.4 and will be removed in 3.0. Use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\DoctrineOrmTestCase class is deprecated since version 2.4 and will be removed in 3.0. Use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper class instead.', E_USER_DEPRECATED);

use Doctrine\ORM\EntityManager;
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Bridge/Monolog/Logger.php
Expand Up @@ -27,7 +27,7 @@ class Logger extends BaseLogger implements LoggerInterface, DebugLoggerInterface
*/
public function emerg($message, array $context = array())
{
trigger_error('The '.__METHOD__.' method inherited from the Symfony\Component\HttpKernel\Log\LoggerInterface interface is deprecated since version 2.2 and will be removed in 3.0. Use the emergency() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method inherited from the Symfony\Component\HttpKernel\Log\LoggerInterface interface is deprecated since version 2.2 and will be removed in 3.0. Use the emergency() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);

return parent::addRecord(BaseLogger::EMERGENCY, $message, $context);
}
Expand All @@ -37,7 +37,7 @@ public function emerg($message, array $context = array())
*/
public function crit($message, array $context = array())
{
trigger_error('The '.__METHOD__.' method inherited from the Symfony\Component\HttpKernel\Log\LoggerInterface interface is deprecated since version 2.2 and will be removed in 3.0. Use the method critical() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method inherited from the Symfony\Component\HttpKernel\Log\LoggerInterface interface is deprecated since version 2.2 and will be removed in 3.0. Use the method critical() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);

return parent::addRecord(BaseLogger::CRITICAL, $message, $context);
}
Expand All @@ -47,7 +47,7 @@ public function crit($message, array $context = array())
*/
public function err($message, array $context = array())
{
trigger_error('The '.__METHOD__.' method inherited from the Symfony\Component\HttpKernel\Log\LoggerInterface interface is deprecated since version 2.2 and will be removed in 3.0. Use the error() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method inherited from the Symfony\Component\HttpKernel\Log\LoggerInterface interface is deprecated since version 2.2 and will be removed in 3.0. Use the error() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);

return parent::addRecord(BaseLogger::ERROR, $message, $context);
}
Expand All @@ -57,7 +57,7 @@ public function err($message, array $context = array())
*/
public function warn($message, array $context = array())
{
trigger_error('The '.__METHOD__.' method inherited from the Symfony\Component\HttpKernel\Log\LoggerInterface interface is deprecated since version 2.2 and will be removed in 3.0. Use the warning() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method inherited from the Symfony\Component\HttpKernel\Log\LoggerInterface interface is deprecated since version 2.2 and will be removed in 3.0. Use the warning() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);

return parent::addRecord(BaseLogger::WARNING, $message, $context);
}
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bridge\Swiftmailer\DataCollector;

trigger_error(__CLASS__.' class is deprecated since version 2.4 and will be removed in 3.0. Use the Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector class from SwiftmailerBundle instead. Require symfony/swiftmailer-bundle package to download SwiftmailerBundle with Composer.', E_USER_DEPRECATED);
@trigger_error(__CLASS__.' class is deprecated since version 2.4 and will be removed in 3.0. Use the Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector class from SwiftmailerBundle instead. Require symfony/swiftmailer-bundle package to download SwiftmailerBundle with Composer.', E_USER_DEPRECATED);

use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\HttpFoundation\Request;
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/AppVariable.php
Expand Up @@ -68,7 +68,7 @@ public function setDebug($debug)
*/
public function getSecurity()
{
trigger_error('The "app.security" variable is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The "app.security" variable is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);

if (null === $this->container) {
throw new \RuntimeException('The "app.security" variable is not available.');
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Bridge/Twig/Extension/AssetExtension.php
Expand Up @@ -61,9 +61,9 @@ public function getAssetUrl($path, $packageName = null, $absolute = false, $vers
{
// BC layer to be removed in 3.0
if (2 < $count = func_num_args()) {
trigger_error('Generating absolute URLs with the Twig asset() function was deprecated in 2.7 and will be removed in 3.0. Please use absolute_url() instead.', E_USER_DEPRECATED);
@trigger_error('Generating absolute URLs with the Twig asset() function was deprecated in 2.7 and will be removed in 3.0. Please use absolute_url() instead.', E_USER_DEPRECATED);
if (4 === $count) {
trigger_error('Forcing a version with the Twig asset() function was deprecated in 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('Forcing a version with the Twig asset() function was deprecated in 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
}

$args = func_get_args();
Expand All @@ -89,7 +89,7 @@ public function getAssetVersion($path, $packageName = null)

public function getAssetsVersion($packageName = null)
{
trigger_error('The Twig assets_version() function was deprecated in 2.7 and will be removed in 3.0. Please use asset_version() instead.', E_USER_DEPRECATED);
@trigger_error('The Twig assets_version() function was deprecated in 2.7 and will be removed in 3.0. Please use asset_version() instead.', E_USER_DEPRECATED);

return $this->packages->getVersion('/', $packageName);
}
Expand Down
7 changes: 4 additions & 3 deletions src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
Expand Up @@ -120,6 +120,7 @@ protected function addFlash($type, $message)
* @param mixed $object The object
*
* @throws \LogicException
*
* @return bool
*/
protected function isGranted($attributes, $object = null)
Expand Down Expand Up @@ -273,7 +274,7 @@ public function createFormBuilder($data = null, array $options = array())
*/
public function getRequest()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The only reliable way to get the "Request" object is to inject it in the action method.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The only reliable way to get the "Request" object is to inject it in the action method.', E_USER_DEPRECATED);

return $this->container->get('request_stack')->getCurrentRequest();
}
Expand Down Expand Up @@ -343,7 +344,7 @@ public function has($id)
public function get($id)
{
if ('request' === $id) {
trigger_error('The "request" service is deprecated and will be removed in 3.0. Add a typehint for Symfony\\Component\\HttpFoundation\\Request to your controller parameters to retrieve the request instead.', E_USER_DEPRECATED);
@trigger_error('The "request" service is deprecated and will be removed in 3.0. Add a typehint for Symfony\\Component\\HttpFoundation\\Request to your controller parameters to retrieve the request instead.', E_USER_DEPRECATED);
}

return $this->container->get($id);
Expand All @@ -362,7 +363,7 @@ protected function getParameter($name)
}

/**
* Checks the validity of a CSRF token
* Checks the validity of a CSRF token.
*
* @param string $id The id used when generating the token
* @param string $token The actual token sent with the request that should be validated
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;

trigger_error('The '.__NAMESPACE__.'\FragmentRendererPass class is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Component\HttpKernel\DependencyInjection\FragmentRendererPass instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\FragmentRendererPass class is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Component\HttpKernel\DependencyInjection\FragmentRendererPass instead.', E_USER_DEPRECATED);

use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down
Expand Up @@ -16,7 +16,7 @@
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

trigger_error('The '.__NAMESPACE__.'\TemplatingAssetHelperPass class is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\TemplatingAssetHelperPass class is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);

/**
* @deprecated since 2.7, will be removed in 3.0
Expand Down
Expand Up @@ -48,7 +48,7 @@ public function getConfigTreeBuilder()
->beforeNormalization()
->ifTrue(function ($v) { return isset($v['csrf_protection']['field_name']); })
->then(function ($v) {
trigger_error('The framework.csrf_protection.field_name configuration key is deprecated since version 2.4 and will be removed in 3.0. Use the framework.form.csrf_protection.field_name configuration key instead', E_USER_DEPRECATED);
@trigger_error('The framework.csrf_protection.field_name configuration key is deprecated since version 2.4 and will be removed in 3.0. Use the framework.form.csrf_protection.field_name configuration key instead', E_USER_DEPRECATED);

return $v;
})
Expand Down Expand Up @@ -82,7 +82,7 @@ public function getConfigTreeBuilder()
|| count($v['templating']['assets_base_urls']['ssl'])
|| count($v['templating']['packages'])
) {
trigger_error('The assets settings under framework.templating are deprecated since version 2.7 and will be removed in 3.0. Use the framework.assets configuration key instead', E_USER_DEPRECATED);
@trigger_error('The assets settings under framework.templating are deprecated since version 2.7 and will be removed in 3.0. Use the framework.assets configuration key instead', E_USER_DEPRECATED);

// convert the old configuration to the new one
if (isset($v['assets'])) {
Expand Down Expand Up @@ -115,7 +115,7 @@ public function getConfigTreeBuilder()
->beforeNormalization()
->ifTrue(function ($v) { return isset($v['validation']['api']); })
->then(function ($v) {
trigger_error('The validation.api configuration key is deprecated since version 2.7 and will be removed in 3.0', E_USER_DEPRECATED);
@trigger_error('The validation.api configuration key is deprecated since version 2.7 and will be removed in 3.0', E_USER_DEPRECATED);

return $v;
})
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bundle\FrameworkBundle\Fragment;

trigger_error('The '.__NAMESPACE__.'\ContainerAwareHIncludeFragmentRenderer class is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Bundle\FrameworkBundle\Fragment\HIncludeFragmentRenderer instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\ContainerAwareHIncludeFragmentRenderer class is deprecated since version 2.7 and will be removed in 3.0. Use Symfony\Bundle\FrameworkBundle\Fragment\HIncludeFragmentRenderer instead.', E_USER_DEPRECATED);

use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php
Expand Up @@ -76,15 +76,15 @@ protected function createSurrogate()
}

/**
* Creates new ESI instance
* Creates new ESI instance.
*
* @return Esi
*
* @deprecated since version 2.6, to be removed in 3.0. Use createSurrogate() instead
*/
protected function createEsi()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use createSurrogate() instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use createSurrogate() instead.', E_USER_DEPRECATED);

return $this->createSurrogate();
}
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bundle\FrameworkBundle\Templating\Asset;

trigger_error('The Symfony\Bundle\FrameworkBundle\Templating\Asset\PackageFactory is deprecated since version 2.7 and will be removed in 3.0. Use the Asset component instead.', E_USER_DEPRECATED);
@trigger_error('The Symfony\Bundle\FrameworkBundle\Templating\Asset\PackageFactory is deprecated since version 2.7 and will be removed in 3.0. Use the Asset component instead.', E_USER_DEPRECATED);

use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
Expand Down
Expand Up @@ -14,7 +14,7 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Templating\Asset\PathPackage as BasePathPackage;

trigger_error('The Symfony\Bundle\FrameworkBundle\Templating\Asset\PathPackage is deprecated since version 2.7 and will be removed in 3.0. Use the Asset component instead.', E_USER_DEPRECATED);
@trigger_error('The Symfony\Bundle\FrameworkBundle\Templating\Asset\PathPackage is deprecated since version 2.7 and will be removed in 3.0. Use the Asset component instead.', E_USER_DEPRECATED);

/**
* The path packages adds a version and a base path to asset URLs.
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/FrameworkBundle/Templating/Debugger.php
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\Bundle\FrameworkBundle\Templating;

trigger_error('The '.__NAMESPACE__.'\Debugger class is deprecated since version 2.4 and will be removed in 3.0. Use the Psr\Log\LoggerInterface interface instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\Debugger class is deprecated since version 2.4 and will be removed in 3.0. Use the Psr\Log\LoggerInterface interface instead.', E_USER_DEPRECATED);

use Symfony\Component\Templating\DebuggerInterface;
use Psr\Log\LoggerInterface;
Expand Down
Expand Up @@ -43,7 +43,7 @@ public function __construct(ContainerInterface $container)
*/
public function getSecurity()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);

if ($this->container->has('security.context')) {
return $this->container->get('security.context');
Expand Down

0 comments on commit 73bbaa6

Please sign in to comment.