Skip to content

Commit

Permalink
[2.7] Fix issues found by PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarlovi authored and nicolas-grekas committed Dec 20, 2017
1 parent 98bfe80 commit 94b797b
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
use Symfony\Component\Form\Forms;
use Symfony\Component\Form\Tests\Extension\Core\Type\BaseTypeTest;
use Symfony\Component\Form\Tests\Extension\Core\Type\FormTypeTest;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleAssociationToIntIdEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity;

Expand Down Expand Up @@ -1103,8 +1102,7 @@ public function testLoaderCaching()
$repo = $this->em->getRepository(self::SINGLE_IDENT_CLASS);

$entityType = new EntityType(
$this->emRegistry,
PropertyAccess::createPropertyAccessor()
$this->emRegistry
);

$entityTypeGuesser = new DoctrineOrmTypeGuesser($this->emRegistry);
Expand Down Expand Up @@ -1166,8 +1164,7 @@ public function testLoaderCachingWithParameters()
$repo = $this->em->getRepository(self::SINGLE_IDENT_CLASS);

$entityType = new EntityType(
$this->emRegistry,
PropertyAccess::createPropertyAccessor()
$this->emRegistry
);

$entityTypeGuesser = new DoctrineOrmTypeGuesser($this->emRegistry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function fileExcerpt($file, $line)
{
if (is_readable($file)) {
if (extension_loaded('fileinfo')) {
$finfo = new \Finfo();
$finfo = new \finfo();

// Check if the file is an application/octet-stream (eg. Phar file) because highlight_file cannot parse these files
if ('application/octet-stream' === $finfo->file($file, FILEINFO_MIME_TYPE)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bundle\TwigBundle\Tests;
namespace Symfony\Bundle\TwigBundle\Tests\Functional;

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
use Symfony\Bundle\TwigBundle\TwigBundle;

class CacheWarmingTest extends TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
* file that was distributed with this source code.
*/

namespace Symfony\Bundle\TwigBundle\Tests;
namespace Symfony\Bundle\TwigBundle\Tests\Functional;

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\TwigBundle\Tests\TestCase;
use Symfony\Bundle\TwigBundle\TwigBundle;

class NoTemplatingEntryTest extends TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@
namespace Symfony\Component\Config\Tests\Definition\Builder;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder as CustomNodeBuilder;
use Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;

require __DIR__.'/../../Fixtures/Builder/NodeBuilder.php';
require __DIR__.'/../../Fixtures/Builder/BarNodeDefinition.php';
require __DIR__.'/../../Fixtures/Builder/VariableNodeDefinition.php';

class TreeBuilderTest extends TestCase
{
public function testUsingACustomNodeBuilder()
Expand All @@ -28,11 +24,11 @@ public function testUsingACustomNodeBuilder()

$nodeBuilder = $root->children();

$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder', $nodeBuilder);
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder', $nodeBuilder);

$nodeBuilder = $nodeBuilder->arrayNode('deeper')->children();

$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder', $nodeBuilder);
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder', $nodeBuilder);
}

public function testOverrideABuiltInNodeType()
Expand All @@ -42,7 +38,7 @@ public function testOverrideABuiltInNodeType()

$definition = $root->children()->variableNode('variable');

$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\VariableNodeDefinition', $definition);
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\Builder\VariableNodeDefinition', $definition);
}

public function testAddANodeType()
Expand All @@ -52,7 +48,7 @@ public function testAddANodeType()

$definition = $root->children()->barNode('variable');

$this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\BarNodeDefinition', $definition);
$this->assertInstanceOf('Symfony\Component\Config\Tests\Fixtures\Builder\BarNodeDefinition', $definition);
}

public function testCreateABuiltInNodeTypeWithACustomNodeBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\Config\Tests\Definition\Builder;
namespace Symfony\Component\Config\Tests\Fixtures\Builder;

use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\Config\Tests\Fixtures\BarNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\Config\Tests\Definition\Builder;
namespace Symfony\Component\Config\Tests\Fixtures\Builder;

use Symfony\Component\Config\Definition\Builder\NodeBuilder as BaseNodeBuilder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Component\Config\Tests\Definition\Builder;
namespace Symfony\Component\Config\Tests\Fixtures\Builder;

use Symfony\Component\Config\Definition\Builder\VariableNodeDefinition as BaseVariableNodeDefinition;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public function flattenDataProvider()

public function testRecursionInArguments()
{
$a = null;
$a = array('foo', array(2, &$a));
$exception = $this->createException($a);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ public function ianaCodesReasonPhrasesProvider()

$ianaCodesReasonPhrases = array();

$xpath = new \DomXPath($ianaHttpStatusCodes);
$xpath = new \DOMXPath($ianaHttpStatusCodes);
$xpath->registerNamespace('ns', 'http://www.iana.org/assignments');

$records = $xpath->query('//ns:record');
Expand Down

0 comments on commit 94b797b

Please sign in to comment.