Browse Source

Merge remote-tracking branch 'Moinax/master'

Jordi Boggiano 12 years ago
parent
commit
123be3ca15

+ 2 - 1
.gitignore

@@ -9,4 +9,5 @@ vendor/
 /.settings
 /.buildpath
 /.project
-composer.phar
+/.idea
+composer.phar

+ 4 - 4
src/Packagist/WebBundle/Command/IndexPackagesCommand.php

@@ -114,9 +114,9 @@ class IndexPackagesCommand extends ContainerAwareCommand
 
     private function updateDocumentFromPackage(\Solarium_Document_ReadWrite $document, Package $package)
     {
-        $document->id = $package->getId();
-        $document->name = $package->getName();
-        $document->description = $package->getDescription();
+        $document->setField('id', $package->getId());
+        $document->setField('name', $package->getName());
+        $document->setField('description', $package->getDescription());
 
         $tags = array();
         foreach ($package->getVersions() as $version) {
@@ -124,6 +124,6 @@ class IndexPackagesCommand extends ContainerAwareCommand
                 $tags[mb_strtolower($tag->getName(), 'UTF-8')] = true;
             }
         }
-        $document->tags = array_keys($tags);
+        $document->setField('tags', array_keys($tags));
     }
 }

+ 4 - 2
src/Packagist/WebBundle/Controller/PackageController.php

@@ -29,7 +29,9 @@ class PackageController extends Controller
      */
     public function editAction(Request $req, $name)
     {
+        /** @var $packageRepo \Packagist\WebBundle\Entity\PackageRepository */
         $packageRepo = $this->getDoctrine()->getRepository('PackagistWebBundle:Package');
+        /** @var $package Package */
         $package = $packageRepo->findOneByName($name);
 
         if (!$package) {
@@ -47,13 +49,13 @@ class PackageController extends Controller
         if ($req->isMethod("POST")) {
             $package->setEntityRepository($packageRepo);
 
-            $form->bindRequest($req);
+            $form->bind($req);
 
             if ($form->isValid()) {
                 // Force updating of packages once the package is viewed after the redirect.
                 $package->setCrawledAt(null);
 
-                $em = $this->getDoctrine()->getEntityManager();
+                $em = $this->getDoctrine()->getManager();
                 $em->persist($package);
                 $em->flush();
 

+ 16 - 14
src/Packagist/WebBundle/Controller/WebController.php

@@ -58,8 +58,6 @@ class WebController extends Controller
      */
     public function browseAction(Request $req)
     {
-        $repository = $this->getDoctrine()->getRepository('PackagistWebBundle:Package');
-
         $filters = array(
             'type' => $req->query->get('type'),
             'tag' => $req->query->get('tag'),
@@ -110,8 +108,9 @@ class WebController extends Controller
         }
 
         if ($req->query->has('search_query')) {
-            $form->bindRequest($req);
+            $form->bind($req);
             if ($form->isValid()) {
+                /** @var $solarium \Solarium_Client */
                 $solarium = $this->get('solarium.client');
 
                 $select = $solarium->createSelect();
@@ -178,12 +177,12 @@ class WebController extends Controller
         $form = $this->createForm(new PackageType, $package);
 
         if ('POST' === $req->getMethod()) {
-            $form->bindRequest($req);
+            $form->bind($req);
             if ($form->isValid()) {
                 try {
                     $user = $this->getUser();
                     $package->addMaintainer($user);
-                    $em = $this->getDoctrine()->getEntityManager();
+                    $em = $this->getDoctrine()->getManager();
                     $em->persist($package);
                     $em->flush();
 
@@ -212,12 +211,12 @@ class WebController extends Controller
         $response = array('status' => 'error', 'reason' => 'No data posted.');
         $req = $this->getRequest();
         if ('POST' === $req->getMethod()) {
-            $form->bindRequest($req);
+            $form->bind($req);
             if ($form->isValid()) {
                 $response = array('status' => 'success', 'name' => $package->getName());
             } else {
                 $errors = array();
-                foreach ($form->getChildren() as $child) {
+                foreach ($form->all() as $child) {
                     if ($child->hasErrors()) {
                         foreach ($child->getErrors() as $error) {
                             $errors[] = $error->getMessageTemplate();
@@ -265,6 +264,7 @@ class WebController extends Controller
     public function viewPackageAction(Request $req, $name)
     {
         try {
+            /** @var $package Package */
             $package = $this->getDoctrine()
                 ->getRepository('PackagistWebBundle:Package')
                 ->getFullPackageByName($name);
@@ -281,6 +281,7 @@ class WebController extends Controller
         $id = $package->getId();
 
         try {
+            /** @var $redis \Snc\RedisBundle\Client\Phpredis\Client */
             $redis = $this->get('snc_redis.default');
             $counts = $redis->mget('dl:'.$id, 'dl:'.$id.':'.date('Ym'), 'dl:'.$id.':'.date('Ymd'));
             $data['downloads'] = array(
@@ -314,7 +315,7 @@ class WebController extends Controller
      * @Route("/packages/{name}", name="update_package", requirements={"name"="[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+"}, defaults={"_format" = "json"})
      * @Method({"PUT"})
      */
-    public function updatePackageAction(Request $req, $name)
+    public function updatePackageAction($name)
     {
         $doctrine = $this->getDoctrine();
 
@@ -350,7 +351,7 @@ class WebController extends Controller
         if ($package->getMaintainers()->contains($user) || $this->get('security.context')->isGranted('ROLE_UPDATE_PACKAGES')) {
             if (null !== $autoUpdated) {
                 $package->setAutoUpdated((Boolean) $autoUpdated);
-                $doctrine->getEntityManager()->flush();
+                $doctrine->getManager()->flush();
             }
 
             if ($update) {
@@ -397,7 +398,7 @@ class WebController extends Controller
                 $versionRepo->remove($version);
             }
 
-            $em = $doctrine->getEntityManager();
+            $em = $doctrine->getManager();
             $em->remove($package);
             $em->flush();
 
@@ -420,6 +421,7 @@ class WebController extends Controller
      */
     public function createMaintainerAction(Request $req, $name)
     {
+        /** @var $package Package */
         $package = $this->getDoctrine()
             ->getRepository('PackagistWebBundle:Package')
             ->findOneByName($name);
@@ -440,10 +442,10 @@ class WebController extends Controller
         );
 
         if ('POST' === $req->getMethod()) {
-            $form->bindRequest($req);
+            $form->bind($req);
             if ($form->isValid()) {
                 try {
-                    $em = $this->getDoctrine()->getEntityManager();
+                    $em = $this->getDoctrine()->getManager();
                     $user = $form->getData()->getUser();
 
                     if (!empty($user)) {
@@ -496,13 +498,13 @@ class WebController extends Controller
 
         // prepare data
         $count = 0;
-        foreach ($packages as $key => $dataPoint) {
+        foreach ($packages as $dataPoint) {
             $count += $dataPoint['count'];
             $chart['packages'][$dataPoint['month']] = $count;
         }
 
         $count = 0;
-        foreach ($versions as $key => $dataPoint) {
+        foreach ($versions as $dataPoint) {
             $count += $dataPoint['count'];
             if (in_array($dataPoint['month'], $chart['months'])) {
                 $chart['versions'][$dataPoint['month']] = $count;

+ 10 - 10
src/Packagist/WebBundle/Entity/Author.php

@@ -122,7 +122,7 @@ class Author
     /**
      * Set createdAt
      *
-     * @param datetime $createdAt
+     * @param \DateTime $createdAt
      */
     public function setCreatedAt($createdAt)
     {
@@ -132,7 +132,7 @@ class Author
     /**
      * Get createdAt
      *
-     * @return datetime $createdAt
+     * @return \DateTime $createdAt
      */
     public function getCreatedAt()
     {
@@ -142,7 +142,7 @@ class Author
     /**
      * Add versions
      *
-     * @param Packagist\WebBundle\Entity\Version $version
+     * @param \Packagist\WebBundle\Entity\Version $version
      */
     public function addVersion(Version $version)
     {
@@ -162,9 +162,9 @@ class Author
     /**
      * Set updatedAt
      *
-     * @param datetime $updatedAt
+     * @param \DateTime $updatedAt
      */
-    public function setUpdatedAt($updatedAt)
+    public function setUpdatedAt(\DateTime $updatedAt)
     {
         $this->updatedAt = $updatedAt;
     }
@@ -172,7 +172,7 @@ class Author
     /**
      * Get updatedAt
      *
-     * @return datetime $updatedAt
+     * @return \DateTime $updatedAt
      */
     public function getUpdatedAt()
     {
@@ -192,7 +192,7 @@ class Author
     /**
      * Get email
      *
-     * @return text
+     * @return string
      */
     public function getEmail()
     {
@@ -212,7 +212,7 @@ class Author
     /**
      * Get homepage
      *
-     * @return text
+     * @return string
      */
     public function getHomepage()
     {
@@ -242,7 +242,7 @@ class Author
     /**
      * Set owner
      *
-     * @param Packagist\WebBundle\Entity\User $owner
+     * @param \Packagist\WebBundle\Entity\User $owner
      */
     public function setOwner(User $owner)
     {
@@ -252,7 +252,7 @@ class Author
     /**
      * Get owner
      *
-     * @return Packagist\WebBundle\Entity\User
+     * @return \Packagist\WebBundle\Entity\User
      */
     public function getOwner()
     {

+ 6 - 1
src/Packagist/WebBundle/Entity/Package.php

@@ -111,6 +111,9 @@ class Package
     private $autoUpdated = false;
 
     private $entityRepository;
+    /**
+     * @var \Composer\Repository\RepositoryInterface
+     */
     private $repositoryClass;
 
     public function __construct()
@@ -123,10 +126,12 @@ class Package
     {
         $versions = array();
         foreach ($this->getVersions() as $version) {
+            /** @var $version Version */
             $versions[$version->getVersion()] = $version->toArray();
         }
         $maintainers = array();
         foreach ($this->getMaintainers() as $maintainer) {
+            /** @var $maintainer Maintainer */
             $maintainers[] = $maintainer->toArray();
         }
         $data = array(
@@ -367,7 +372,7 @@ class Package
     /**
      * Set crawledAt
      *
-     * @param \DateTime $crawledAt
+     * @param \DateTime|null $crawledAt
      */
     public function setCrawledAt($crawledAt)
     {

+ 5 - 3
src/Packagist/WebBundle/Entity/PackageLink.php

@@ -38,6 +38,8 @@ abstract class PackageLink
      */
     private $packageVersion;
 
+    private $version;
+
     public function toArray()
     {
         return array($this->getPackageName() => $this->getPackageVersion());
@@ -96,9 +98,9 @@ abstract class PackageLink
     /**
      * Set version
      *
-     * @param Packagist\WebBundle\Entity\Version $version
+     * @param \Packagist\WebBundle\Entity\Version $version
      */
-    public function setVersion(\Packagist\WebBundle\Entity\Version $version)
+    public function setVersion(Version $version)
     {
         $this->version = $version;
     }
@@ -106,7 +108,7 @@ abstract class PackageLink
     /**
      * Get version
      *
-     * @return Packagist\WebBundle\Entity\Version
+     * @return \Packagist\WebBundle\Entity\Version
      */
     public function getVersion()
     {

+ 2 - 1
src/Packagist/WebBundle/Entity/PackageRepository.php

@@ -13,6 +13,7 @@
 namespace Packagist\WebBundle\Entity;
 
 use Doctrine\ORM\EntityRepository;
+use Doctrine\ORM\QueryBuilder;
 
 /**
  * @author Jordi Boggiano <j.boggiano@seld.be>
@@ -156,7 +157,7 @@ class PackageRepository extends EntityRepository
         return $qb;
     }
 
-    private function addFilters($qb, array $filters)
+    private function addFilters(QueryBuilder $qb, array $filters)
     {
         foreach ($filters as $name => $value) {
             if (null === $value) {

+ 22 - 7
src/Packagist/WebBundle/Entity/Tag.php

@@ -14,6 +14,8 @@ namespace Packagist\WebBundle\Entity;
 
 use Doctrine\ORM\Mapping as ORM;
 use Symfony\Component\Validator\Constraints as Assert;
+use Doctrine\Common\Collections\Collection;
+use Doctrine\ORM\EntityManager;
 
 /**
  * @ORM\Entity
@@ -45,7 +47,15 @@ class Tag
         $this->name = $name;
     }
 
-    public static function getByName($em, $name, $create = false)
+    /**
+     * @param \Doctrine\ORM\EntityManager $em
+     * @param                             $name
+     * @param bool                        $create
+     *
+     * @return mixed|Tag
+     * @throws \Doctrine\ORM\NoResultException
+     */
+    public static function getByName(EntityManager $em, $name, $create = false)
     {
         try {
             $qb = $em->createQueryBuilder();
@@ -54,12 +64,17 @@ class Tag
                 ->where('t.name = ?1')
                 ->setMaxResults(1)
                 ->setParameter(1, $name);
+
             return $qb->getQuery()->getSingleResult();
         } catch (\Doctrine\ORM\NoResultException $e) {
+            if ($create) {
+                $tag = new self($name);
+                $em->persist($tag);
+
+                return $tag;
+            }
+            throw $e;
         }
-        $tag = new self($name);
-        $em->persist($tag);
-        return $tag;
     }
 
     public function setId($id)
@@ -85,9 +100,9 @@ class Tag
     /**
      * Add versions
      *
-     * @param Packagist\WebBundle\Entity\Version $versions
+     * @param \Packagist\WebBundle\Entity\Version $versions
      */
-    public function addVersions(\Packagist\WebBundle\Entity\Version $versions)
+    public function addVersions(Version $versions)
     {
         $this->versions[] = $versions;
     }
@@ -95,7 +110,7 @@ class Tag
     /**
      * Get versions
      *
-     * @return Doctrine\Common\Collections\Collection $versions
+     * @return \Doctrine\Common\Collections\Collection $versions
      */
     public function getVersions()
     {

+ 6 - 6
src/Packagist/WebBundle/Entity/User.php

@@ -69,7 +69,7 @@ class User extends BaseUser
     /**
      * Add packages
      *
-     * @param Packagist\WebBundle\Entity\Package $packages
+     * @param \Packagist\WebBundle\Entity\Package $packages
      */
     public function addPackages(Package $packages)
     {
@@ -79,7 +79,7 @@ class User extends BaseUser
     /**
      * Get packages
      *
-     * @return Doctrine\Common\Collections\Collection $packages
+     * @return \Doctrine\Common\Collections\Collection $packages
      */
     public function getPackages()
     {
@@ -89,7 +89,7 @@ class User extends BaseUser
     /**
      * Add authors
      *
-     * @param Packagist\WebBundle\Entity\Author $authors
+     * @param \Packagist\WebBundle\Entity\Author $authors
      */
     public function addAuthors(\Packagist\WebBundle\Entity\Author $authors)
     {
@@ -99,7 +99,7 @@ class User extends BaseUser
     /**
      * Get authors
      *
-     * @return Doctrine\Common\Collections\Collection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getAuthors()
     {
@@ -109,7 +109,7 @@ class User extends BaseUser
     /**
      * Set createdAt
      *
-     * @param datetime $createdAt
+     * @param \DateTime $createdAt
      */
     public function setCreatedAt($createdAt)
     {
@@ -119,7 +119,7 @@ class User extends BaseUser
     /**
      * Get createdAt
      *
-     * @return datetime
+     * @return \DateTime
      */
     public function getCreatedAt()
     {

+ 49 - 44
src/Packagist/WebBundle/Entity/Version.php

@@ -13,8 +13,9 @@
 namespace Packagist\WebBundle\Entity;
 
 use Doctrine\ORM\Mapping as ORM;
-use Composer\Package\Version\VersionParser;
 use Symfony\Component\Validator\Constraints as Assert;
+use Doctrine\Common\Collections\ArrayCollection;
+use Composer\Package\Version\VersionParser;
 
 /**
  * @ORM\Entity(repositoryClass="Packagist\WebBundle\Entity\VersionRepository")
@@ -193,14 +194,14 @@ class Version
 
     public function __construct()
     {
-        $this->tags = new \Doctrine\Common\Collections\ArrayCollection();
-        $this->require = new \Doctrine\Common\Collections\ArrayCollection();
-        $this->replace = new \Doctrine\Common\Collections\ArrayCollection();
-        $this->conflict = new \Doctrine\Common\Collections\ArrayCollection();
-        $this->provide = new \Doctrine\Common\Collections\ArrayCollection();
-        $this->devRequire = new \Doctrine\Common\Collections\ArrayCollection();
-        $this->suggest = new \Doctrine\Common\Collections\ArrayCollection();
-        $this->authors = new \Doctrine\Common\Collections\ArrayCollection();
+        $this->tags = new ArrayCollection();
+        $this->require = new ArrayCollection();
+        $this->replace = new ArrayCollection();
+        $this->conflict = new ArrayCollection();
+        $this->provide = new ArrayCollection();
+        $this->devRequire = new ArrayCollection();
+        $this->suggest = new ArrayCollection();
+        $this->authors = new ArrayCollection();
         $this->createdAt = new \DateTime;
         $this->updatedAt = new \DateTime;
     }
@@ -209,10 +210,12 @@ class Version
     {
         $tags = array();
         foreach ($this->getTags() as $tag) {
+            /** @var $tag Tag */
             $tags[] = $tag->getName();
         }
         $authors = array();
         foreach ($this->getAuthors() as $author) {
+            /** @var $author Author */
             $authors[] = $author->toArray();
         }
 
@@ -307,7 +310,7 @@ class Version
     /**
      * Get description
      *
-     * @return text $description
+     * @return string $description
      */
     public function getDescription()
     {
@@ -377,7 +380,7 @@ class Version
     /**
      * Set license
      *
-     * @param string $license
+     * @param array $license
      */
     public function setLicense(array $license)
     {
@@ -407,7 +410,7 @@ class Version
     /**
      * Get source
      *
-     * @return text $source
+     * @return array $source
      */
     public function getSource()
     {
@@ -427,7 +430,7 @@ class Version
     /**
      * Get dist
      *
-     * @return text
+     * @return array
      */
     public function getDist()
     {
@@ -447,7 +450,7 @@ class Version
     /**
      * Get autoload
      *
-     * @return text
+     * @return array
      */
     public function getAutoload()
     {
@@ -467,7 +470,7 @@ class Version
     /**
      * Get binaries
      *
-     * @return text
+     * @return array
      */
     public function getBinaries()
     {
@@ -517,7 +520,7 @@ class Version
     /**
      * Set createdAt
      *
-     * @param datetime $createdAt
+     * @param \DateTime $createdAt
      */
     public function setCreatedAt($createdAt)
     {
@@ -527,7 +530,7 @@ class Version
     /**
      * Get createdAt
      *
-     * @return datetime $createdAt
+     * @return \DateTime $createdAt
      */
     public function getCreatedAt()
     {
@@ -537,7 +540,7 @@ class Version
     /**
      * Set releasedAt
      *
-     * @param datetime $releasedAt
+     * @param \DateTime $releasedAt
      */
     public function setReleasedAt($releasedAt)
     {
@@ -547,7 +550,7 @@ class Version
     /**
      * Get releasedAt
      *
-     * @return datetime $releasedAt
+     * @return \DateTime $releasedAt
      */
     public function getReleasedAt()
     {
@@ -557,7 +560,7 @@ class Version
     /**
      * Set package
      *
-     * @param Packagist\WebBundle\Entity\Package $package
+     * @param \Packagist\WebBundle\Entity\Package $package
      */
     public function setPackage(Package $package)
     {
@@ -567,7 +570,7 @@ class Version
     /**
      * Get package
      *
-     * @return Packagist\WebBundle\Entity\Package $package
+     * @return \Packagist\WebBundle\Entity\Package $package
      */
     public function getPackage()
     {
@@ -577,7 +580,7 @@ class Version
     /**
      * Get tags
      *
-     * @return Doctrine\Common\Collections\Collection $tags
+     * @return \Doctrine\Common\Collections\Collection $tags
      */
     public function getTags()
     {
@@ -587,7 +590,7 @@ class Version
     /**
      * Set updatedAt
      *
-     * @param datetime $updatedAt
+     * @param \DateTime $updatedAt
      */
     public function setUpdatedAt($updatedAt)
     {
@@ -597,7 +600,7 @@ class Version
     /**
      * Get updatedAt
      *
-     * @return datetime $updatedAt
+     * @return \DateTime $updatedAt
      */
     public function getUpdatedAt()
     {
@@ -607,7 +610,7 @@ class Version
     /**
      * Get authors
      *
-     * @return Doctrine\Common\Collections\Collection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getAuthors()
     {
@@ -703,29 +706,29 @@ class Version
     }
 
     /**
-     * Add tags
+     * Add tag
      *
-     * @param Packagist\WebBundle\Entity\Tag $tags
+     * @param \Packagist\WebBundle\Entity\Tag $tag
      */
-    public function addTag(\Packagist\WebBundle\Entity\Tag $tags)
+    public function addTag(Tag $tag)
     {
-        $this->tags[] = $tags;
+        $this->tags[] = $tag;
     }
 
     /**
      * Add authors
      *
-     * @param Packagist\WebBundle\Entity\Author $authors
+     * @param \Packagist\WebBundle\Entity\Author $author
      */
-    public function addAuthor(\Packagist\WebBundle\Entity\Author $authors)
+    public function addAuthor(Author $author)
     {
-        $this->authors[] = $authors;
+        $this->authors[] = $author;
     }
 
     /**
      * Add require
      *
-     * @param Packagist\WebBundle\Entity\RequireLink $require
+     * @param \Packagist\WebBundle\Entity\RequireLink $require
      */
     public function addRequireLink(RequireLink $require)
     {
@@ -735,7 +738,7 @@ class Version
     /**
      * Get require
      *
-     * @return Doctrine\Common\Collections\Collection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getRequire()
     {
@@ -745,7 +748,7 @@ class Version
     /**
      * Add replace
      *
-     * @param Packagist\WebBundle\Entity\ReplaceLink $replace
+     * @param \Packagist\WebBundle\Entity\ReplaceLink $replace
      */
     public function addReplaceLink(ReplaceLink $replace)
     {
@@ -755,7 +758,7 @@ class Version
     /**
      * Get replace
      *
-     * @return Doctrine\Common\Collections\Collection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getReplace()
     {
@@ -765,7 +768,7 @@ class Version
     /**
      * Add conflict
      *
-     * @param Packagist\WebBundle\Entity\ConflictLink $conflict
+     * @param \Packagist\WebBundle\Entity\ConflictLink $conflict
      */
     public function addConflictLink(ConflictLink $conflict)
     {
@@ -775,7 +778,7 @@ class Version
     /**
      * Get conflict
      *
-     * @return Doctrine\Common\Collections\Collection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getConflict()
     {
@@ -785,7 +788,7 @@ class Version
     /**
      * Add provide
      *
-     * @param Packagist\WebBundle\Entity\ProvideLink $provide
+     * @param \Packagist\WebBundle\Entity\ProvideLink $provide
      */
     public function addProvideLink(ProvideLink $provide)
     {
@@ -795,7 +798,7 @@ class Version
     /**
      * Get provide
      *
-     * @return Doctrine\Common\Collections\Collection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getProvide()
     {
@@ -805,7 +808,7 @@ class Version
     /**
      * Add devRequire
      *
-     * @param Packagist\WebBundle\Entity\DevRequireLink $devRequire
+     * @param \Packagist\WebBundle\Entity\DevRequireLink $devRequire
      */
     public function addDevRequireLink(DevRequireLink $devRequire)
     {
@@ -815,7 +818,7 @@ class Version
     /**
      * Get devRequire
      *
-     * @return Doctrine\Common\Collections\Collection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getDevRequire()
     {
@@ -825,7 +828,7 @@ class Version
     /**
      * Add suggest
      *
-     * @param Packagist\WebBundle\Entity\SuggestLink $suggest
+     * @param \Packagist\WebBundle\Entity\SuggestLink $suggest
      */
     public function addSuggestLink(SuggestLink $suggest)
     {
@@ -835,7 +838,7 @@ class Version
     /**
      * Get suggest
      *
-     * @return Doctrine\Common\Collections\Collection
+     * @return \Doctrine\Common\Collections\Collection
      */
     public function getSuggest()
     {
@@ -862,6 +865,8 @@ class Version
             $version = $parser->normalizeBranch(str_replace('-dev', '', $extra['branch-alias'][$this->getVersion()]));
             return preg_replace('{(\.9{7})+}', '.x', $version);
         }
+
+        return '';
     }
 
     public function __toString()

+ 2 - 0
src/Packagist/WebBundle/Entity/VersionRepository.php

@@ -34,11 +34,13 @@ class VersionRepository extends EntityRepository
         $version->getPackage()->getVersions()->removeElement($version);
 
         foreach ($version->getAuthors() as $author) {
+            /** @var $author Author */
             $author->getVersions()->removeElement($version);
         }
         $version->getAuthors()->clear();
 
         foreach ($version->getTags() as $tag) {
+            /** @var $tag Tag */
             $tag->getVersions()->removeElement($version);
         }
         $version->getTags()->clear();

+ 3 - 0
src/Packagist/WebBundle/Package/Dumper.php

@@ -58,6 +58,8 @@ class Dumper
      * Constructor
      *
      * @param RegistryInterface $doctrine
+     * @param Filesystem $filesystem
+     * @param UrlGeneratorInterface $router
      * @param string $webDir web root
      * @param string $cacheDir cache dir
      */
@@ -75,6 +77,7 @@ class Dumper
      *
      * @param array $packageIds
      * @param Boolean $force
+     * @param Boolean $verbose
      */
     public function dump(array $packageIds, $force = false, $verbose = false)
     {

+ 2 - 2
src/Packagist/WebBundle/Package/Updater.php

@@ -79,10 +79,10 @@ class Updater
     /**
      * Update a project
      *
-     * @param PackageInterface $package
+     * @param \Packagist\WebBundle\Entity\Package $package
      * @param RepositoryInterface $repository the repository instance used to update from
      * @param int $flags a few of the constants of this class
-     * @param DateTime $start
+     * @param \DateTime $start
      */
     public function update(Package $package, RepositoryInterface $repository, $flags = 0, \DateTime $start = null)
     {

+ 1 - 1
src/Packagist/WebBundle/Resources/public/js/layout.js

@@ -7,4 +7,4 @@ $.ajaxSetup({
     error: function (xhr) {
         humane.info("We're so sorry, something is wrong on our end.");
     }
-})
+});

+ 35 - 35
src/Packagist/WebBundle/Resources/public/js/submitPackage.js

@@ -1,35 +1,35 @@
-(function ($) {
-    var onSubmit = function(e) {
-        var success;
-        $('div > ul, div.confirmation', this).remove();
-        success = function (data) {
-            var html = '';
-            $('#submit').removeClass('loading');
-            if (data.status === 'error') {
-                $.each(data.reason, function (k, v) {
-                    html += '<li>'+v+'</li>';
-                });
-                $('#submit-package-form div').prepend('<ul>'+html+'</ul>');
-            } else {
-                $('#submit-package-form input[type="submit"]').before(
-                    '<div class="confirmation">The package name found for your repository is: '+data.name+', press Submit to confirm.</div>'
-                );
-                $('#submit').val('Submit');
-                $('#submit-package-form').unbind('submit');
-            }
-        };
-        $.post($(this).data('check-url'), $(this).serializeArray(), success);
-        $('#submit').addClass('loading');
-        // TODO display loader icon
-        e.preventDefault();
-    }
-
-    $('#package_repository').change(function() {
-        $('#submit-package-form').unbind('submit');
-        $('#submit-package-form').submit(onSubmit);
-        $('#submit').val('Check');
-    });
-
-    $('#package_repository').triggerHandler('change');
-})(jQuery);
-
+(function ($) {
+    var onSubmit = function(e) {
+        var success;
+        $('div > ul, div.confirmation', this).remove();
+        success = function (data) {
+            var html = '';
+            $('#submit').removeClass('loading');
+            if (data.status === 'error') {
+                $.each(data.reason, function (k, v) {
+                    html += '<li>'+v+'</li>';
+                });
+                $('#submit-package-form div').prepend('<ul>'+html+'</ul>');
+            } else {
+                $('#submit-package-form input[type="submit"]').before(
+                    '<div class="confirmation">The package name found for your repository is: '+data.name+', press Submit to confirm.</div>'
+                );
+                $('#submit').val('Submit');
+                $('#submit-package-form').unbind('submit');
+            }
+        };
+        $.post($(this).data('check-url'), $(this).serializeArray(), success);
+        $('#submit').addClass('loading');
+        // TODO display loader icon
+        e.preventDefault();
+    };
+
+    $('#package_repository').change(function() {
+        $('#submit-package-form').unbind('submit');
+        $('#submit-package-form').submit(onSubmit);
+        $('#submit').val('Check');
+    });
+
+    $('#package_repository').triggerHandler('change');
+})(jQuery);
+