Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #41 from symfony-cmf/analysis-z9A6v6
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
wouterj authored Jan 26, 2017
2 parents c1ad56d + 4e6e98b commit 001f7a8
Showing 27 changed files with 121 additions and 123 deletions.
2 changes: 1 addition & 1 deletion src/Description/Description.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
2 changes: 1 addition & 1 deletion src/Description/DescriptionEnhancerInterface.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
2 changes: 1 addition & 1 deletion src/Description/DescriptionFactory.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
2 changes: 1 addition & 1 deletion src/Description/Descriptor.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
8 changes: 4 additions & 4 deletions src/Description/Enhancer/Doctrine/PhpcrOdmEnhancer.php
Original file line number Diff line number Diff line change
@@ -3,21 +3,21 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Resource\Description\Enhancer\Doctrine;

use Symfony\Cmf\Component\Resource\Description\DescriptionEnhancerInterface;
use Doctrine\Common\Util\ClassUtils;
use Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory;
use Symfony\Cmf\Component\Resource\Description\Description;
use Symfony\Cmf\Component\Resource\Description\DescriptionEnhancerInterface;
use Symfony\Cmf\Component\Resource\Description\Descriptor;
use Symfony\Cmf\Component\Resource\Puli\Api\PuliResource;
use Symfony\Cmf\Component\Resource\Repository\Resource\CmfResource;
use Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory;
use Doctrine\Common\Util\ClassUtils;

/**
* Add descriptors from the Doctrine PHPCR ODM.
14 changes: 7 additions & 7 deletions src/Description/Enhancer/Sonata/AdminEnhancer.php
Original file line number Diff line number Diff line change
@@ -3,21 +3,21 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Resource\Description\Enhancer\Sonata;

use Sonata\AdminBundle\Admin\Pool;
use Doctrine\Common\Util\ClassUtils;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Cmf\Component\Resource\Description\DescriptionEnhancerInterface;
use Sonata\AdminBundle\Admin\Pool;
use Symfony\Cmf\Component\Resource\Description\Description;
use Symfony\Cmf\Component\Resource\Description\DescriptionEnhancerInterface;
use Symfony\Cmf\Component\Resource\Description\Descriptor;
use Symfony\Cmf\Component\Resource\Puli\Api\PuliResource;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

/**
* Add links and meta-info from Sonata Admin.
@@ -59,15 +59,15 @@ public function enhance(Description $description)
$class = ClassUtils::getClass($object);
$admin = $this->pool->getAdminByClass($class);

$links = array();
$links = [];

$routeCollection = $admin->getRoutes();

foreach ($routeCollection->getElements() as $code => $route) {
$routeName = $route->getDefault('_sonata_name');
$url = $this->urlGenerator->generate($routeName, array(
$url = $this->urlGenerator->generate($routeName, [
$admin->getIdParameter() => $admin->getUrlsafeIdentifier($object),
), true);
], true);

$routeRole = substr($code, strlen($admin->getCode()) + 1);

17 changes: 8 additions & 9 deletions src/Description/Enhancer/Sylius/ResourceEnhancer.php
Original file line number Diff line number Diff line change
@@ -3,26 +3,26 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Resource\Description\Enhancer\Sylius;

use Sylius\Bundle\ResourceBundle\Controller\RequestConfigurationFactory;
use Sylius\Component\Resource\Metadata\Metadata;
use Sylius\Component\Resource\Metadata\RegistryInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Cmf\Component\Resource\Description\DescriptionEnhancerInterface;
use Symfony\Cmf\Component\Resource\Description\Description;
use Symfony\Cmf\Component\Resource\Repository\Resource\CmfResource;
use Symfony\Cmf\Component\Resource\Description\DescriptionEnhancerInterface;
use Symfony\Cmf\Component\Resource\Description\Descriptor;
use Symfony\Cmf\Component\Resource\Puli\Api\PuliResource;
use Sylius\Bundle\ResourceBundle\Controller\RequestConfigurationFactory;
use Symfony\Cmf\Component\Resource\Repository\Resource\CmfResource;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Cmf\Component\Resource\Description\Descriptor;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\HttpFoundation\Request;
use Sylius\Component\Resource\Metadata\Metadata;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

/**
* Add descriptors from the Sylius Resource component.
@@ -86,7 +86,6 @@ public function enhance(Description $description)
];

foreach ($map as $descriptor => $action) {

// note that some resources may not have routes
// registered with sonata (f.e. folder resources)
// so we ignore route-not-found exceptions.
8 changes: 4 additions & 4 deletions src/Repository/AbstractPhpcrRepository.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -12,13 +12,13 @@
namespace Symfony\Cmf\Component\Resource\Repository;

use DTL\Glob\FinderInterface;
use DTL\Glob\GlobHelper;
use Symfony\Cmf\Component\Resource\Puli\AbstractRepository;
use Symfony\Cmf\Component\Resource\Puli\Api\ResourceRepository;
use Symfony\Cmf\Component\Resource\Puli\ArrayResourceCollection;
use Webmozart\PathUtil\Path;
use Symfony\Cmf\Component\Resource\Puli\AbstractRepository;
use Symfony\Cmf\Component\Resource\Repository\Api\EditableRepository;
use DTL\Glob\GlobHelper;
use Webmozart\Assert\Assert;
use Webmozart\PathUtil\Path;

/**
* Abstract repository for both PHPCR and PHPCR-ODM repositories.
18 changes: 9 additions & 9 deletions src/Repository/Api/EditableRepository.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -28,12 +28,12 @@ interface EditableRepository extends ResourceRepository
*
* All resources passed to this method must implement {@link PuliResource}.
*
* @param string $path The path at which to
* add the resource.
* @param PuliResource|ResourceCollection $resource The resource(s) to add
* at that path.
* @param string $path the path at which to
* add the resource
* @param PuliResource|ResourceCollection $resource the resource(s) to add
* at that path
*
* @throws \InvalidArgumentException if the path is invalid. The path must
* @throws \InvalidArgumentException if the path is invalid. The path must
* be a non-empty string starting with "/"
* @throws \RuntimeException if the resource is invalid
*/
@@ -42,11 +42,11 @@ public function add($path, $resource);
/**
* Removes all resources matching the given query.
*
* @param string $query A resource query.
* @param string $query a resource query
* @param string $language The language of the query. All implementations
* must support the language "glob".
*
* @return int The number of resources removed from the repository.
* @return int the number of resources removed from the repository
*
* @throws \InvalidArgumentException if the query is invalid
* @throws \RuntimeException if the language is not supported
@@ -56,7 +56,7 @@ public function remove($query, $language = 'glob');
/**
* Removes all resources from the repository.
*
* @return int The number of resources removed from the repository.
* @return int the number of resources removed from the repository
*/
public function clear();

4 changes: 2 additions & 2 deletions src/Repository/PhpcrOdmRepository.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -87,7 +87,7 @@ public function findByTag($tag)
*/
public function getTags()
{
return array();
return [];
}

/**
4 changes: 2 additions & 2 deletions src/Repository/PhpcrRepository.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -87,7 +87,7 @@ public function findByTag($tag)
*/
public function getTags()
{
return array();
return [];
}

/**
2 changes: 1 addition & 1 deletion src/Repository/Resource/CmfResource.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
4 changes: 2 additions & 2 deletions src/Repository/Resource/Metadata/PhpcrMetadata.php
Original file line number Diff line number Diff line change
@@ -3,16 +3,16 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Resource\Repository\Resource\Metadata;

use Symfony\Cmf\Component\Resource\Puli\Api\ResourceMetadata;
use PHPCR\NodeInterface;
use Symfony\Cmf\Component\Resource\Puli\Api\ResourceMetadata;

/**
* Metadata for PHPCR node.
6 changes: 3 additions & 3 deletions src/Repository/Resource/PhpcrOdmResource.php
Original file line number Diff line number Diff line change
@@ -3,18 +3,18 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Resource\Repository\Resource;

use Puli\Repository\Api\Resource\Resource;
use Doctrine\Common\Util\ClassUtils;
use PHPCR\DocumentInterface;
use PHPCR\Util\PathHelper;
use Doctrine\Common\Util\ClassUtils;
use Puli\Repository\Api\Resource\Resource;

/**
* Resource representing a PHPCR document.
4 changes: 2 additions & 2 deletions src/Repository/Resource/PhpcrResource.php
Original file line number Diff line number Diff line change
@@ -3,16 +3,16 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Resource\Repository\Resource;

use Puli\Repository\Api\Resource\Resource;
use PHPCR\NodeInterface;
use Puli\Repository\Api\Resource\Resource;
use Symfony\Cmf\Component\Resource\Repository\Resource\Metadata\PhpcrMetadata;

/**
2 changes: 1 addition & 1 deletion src/RepositoryRegistryInterface.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
4 changes: 2 additions & 2 deletions tests/Unit/Description/DescriptionFactoryTest.php
Original file line number Diff line number Diff line change
@@ -3,17 +3,17 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Resource\Tests\Unit\Repository;

use Prophecy\Argument;
use Symfony\Cmf\Component\Resource\Description\Description;
use Symfony\Cmf\Component\Resource\Description\DescriptionEnhancerInterface;
use Prophecy\Argument;
use Symfony\Cmf\Component\Resource\Description\DescriptionFactory;
use Symfony\Cmf\Component\Resource\Puli\Api\PuliResource;

5 changes: 2 additions & 3 deletions tests/Unit/Description/DescriptionTest.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2015 Symfony CMF
* (c) 2011-2017 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -50,14 +50,13 @@ public function testGetSet()
Descriptor::TYPE_ALIAS => 'page',
Descriptor::LINK_EDIT_HTML => '/path/to/edit',
'custom.key' => 'Hello',

], $this->description->all());
}

/**
* It should throw an exception if a non-scalar value is set.
*
* @expectedException InvalidArgumentException
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Only scalar and array values are allowed as descriptor values, got "object" when setting descriptor "hello"
*/
public function testSetNonScalar()
Loading

0 comments on commit 001f7a8

Please sign in to comment.