partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit bce14b903145791681e6dcdcd5901718a941e49a
parent 46e53452aafe1ce77c8298ef1905d13b06e104e0
Author: Felicia Hummel <felicia@partkeepr.com>
Date:   Mon, 30 Jan 2017 15:56:11 +0100

Make styleci happy

Diffstat:
M.styleci.yml | 1+
Msrc/PartKeepr/CoreBundle/DoctrineMigrations/Version20170108122512.php | 3+--
Msrc/PartKeepr/CoreBundle/DoctrineMigrations/Version20170108143802.php | 1-
Msrc/PartKeepr/CoreBundle/DoctrineMigrations/Version20170113203042.php | 3+--
Msrc/PartKeepr/DoctrineReflectionBundle/Services/FilterService.php | 1+
Msrc/PartKeepr/PartBundle/Action/GetPartsAction.php | 3++-
Msrc/PartKeepr/PartBundle/Controller/PartController.php | 7++++---
Msrc/PartKeepr/PartBundle/DataFixtures/PartDataLoader.php | 1-
Msrc/PartKeepr/PartBundle/Entity/MetaPartParameterCriteria.php | 4+++-
Msrc/PartKeepr/PartBundle/Entity/Part.php | 3++-
Msrc/PartKeepr/PartBundle/Entity/PartParameter.php | 6++++--
Msrc/PartKeepr/PartBundle/Exceptions/NotAMetaPartException.php | 4+---
Msrc/PartKeepr/PartBundle/Services/PartService.php | 1+
Msrc/PartKeepr/ProjectBundle/Entity/ProjectPart.php | 2+-
Msrc/PartKeepr/ProjectBundle/Entity/ProjectRun.php | 6+++---
Msrc/PartKeepr/ProjectBundle/Entity/ProjectRunPart.php | 2+-
Msrc/PartKeepr/ProjectBundle/Tests/ProjectTest.php | 1-
17 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/.styleci.yml b/.styleci.yml @@ -3,3 +3,4 @@ preset: recommended disabled: - phpdoc_to_comment - single_quote + - phpdoc_var_to_type diff --git a/src/PartKeepr/CoreBundle/DoctrineMigrations/Version20170108122512.php b/src/PartKeepr/CoreBundle/DoctrineMigrations/Version20170108122512.php @@ -9,7 +9,7 @@ use Doctrine\DBAL\Schema\Schema; */ class Version20170108122512 extends BaseMigration { -/** + /** * @param Schema $schema */ public function up(Schema $schema) @@ -25,6 +25,5 @@ class Version20170108122512 extends BaseMigration public function down(Schema $schema) { // this down() migration is auto-generated, please modify it to your needs - } } diff --git a/src/PartKeepr/CoreBundle/DoctrineMigrations/Version20170108143802.php b/src/PartKeepr/CoreBundle/DoctrineMigrations/Version20170108143802.php @@ -25,6 +25,5 @@ class Version20170108143802 extends BaseMigration public function down(Schema $schema) { // this down() migration is auto-generated, please modify it to your needs - } } diff --git a/src/PartKeepr/CoreBundle/DoctrineMigrations/Version20170113203042.php b/src/PartKeepr/CoreBundle/DoctrineMigrations/Version20170113203042.php @@ -5,7 +5,7 @@ namespace PartKeepr\CoreBundle\DoctrineMigrations; use Doctrine\DBAL\Schema\Schema; /** - * Sets overageType to a sane default + * Sets overageType to a sane default. */ class Version20170113203042 extends BaseMigration { @@ -25,6 +25,5 @@ class Version20170113203042 extends BaseMigration public function down(Schema $schema) { // this down() migration is auto-generated, please modify it to your needs - } } diff --git a/src/PartKeepr/DoctrineReflectionBundle/Services/FilterService.php b/src/PartKeepr/DoctrineReflectionBundle/Services/FilterService.php @@ -1,4 +1,5 @@ <?php + namespace PartKeepr\DoctrineReflectionBundle\Services; use Doctrine\Bundle\DoctrineBundle\Registry; diff --git a/src/PartKeepr/PartBundle/Action/GetPartsAction.php b/src/PartKeepr/PartBundle/Action/GetPartsAction.php @@ -1,4 +1,5 @@ <?php + namespace PartKeepr\PartBundle\Action; use Doctrine\ORM\EntityManager; @@ -72,9 +73,9 @@ class GetPartsAction } $part->setStockLevel($sum); - } } + return $items; } } diff --git a/src/PartKeepr/PartBundle/Controller/PartController.php b/src/PartKeepr/PartBundle/Controller/PartController.php @@ -57,7 +57,6 @@ class PartController extends FOSRestController $projectRuns[$projectInfo->project] = $projectRun; } - $user = $this->get('partkeepr.userservice')->getUser(); foreach ($removals as $removal) { @@ -93,7 +92,6 @@ class PartController extends FOSRestController } } - foreach ($projectRuns as $projectRun) { $this->get('doctrine.orm.entity_manager')->persist($projectRun); } @@ -122,7 +120,8 @@ class PartController extends FOSRestController * * @return array An array with name and description properties */ - public function getParameterValuesAction (Request $request) { + public function getParameterValuesAction(Request $request) + { if (!$request->query->has("name")) { throw new \InvalidArgumentException("The parameter 'name' must be given"); } @@ -136,6 +135,7 @@ class PartController extends FOSRestController $query = $this->get("doctrine.orm.default_entity_manager")->createQuery($dql); $query->setParameter("name", $request->query->get("name")); $query->setParameter("valueType", $request->query->get("valueType")); + return $query->getArrayResult(); } else { $dql = "SELECT p.value FROM PartKeepr\PartBundle\Entity\PartParameter p WHERE p.name = :name AND p.valueType = :valueType GROUP BY p.value"; @@ -143,6 +143,7 @@ class PartController extends FOSRestController $query = $this->get("doctrine.orm.default_entity_manager")->createQuery($dql); $query->setParameter("name", $request->query->get("name")); $query->setParameter("valueType", $request->query->get("valueType")); + return $query->getArrayResult(); } } diff --git a/src/PartKeepr/PartBundle/DataFixtures/PartDataLoader.php b/src/PartKeepr/PartBundle/DataFixtures/PartDataLoader.php @@ -52,7 +52,6 @@ class PartDataLoader extends AbstractFixture $this->addReference('part.1', $part); $this->addReference('part.2', $part2); - $ohms = new Unit(); $ohms->setName("Ohm"); $ohms->setSymbol("O"); diff --git a/src/PartKeepr/PartBundle/Entity/MetaPartParameterCriteria.php b/src/PartKeepr/PartBundle/Entity/MetaPartParameterCriteria.php @@ -45,6 +45,7 @@ class MetaPartParameterCriteria extends BaseEntity /** * @ORM\Column(type="float",nullable=true) + * * @var float */ private $normalizedValue; @@ -109,7 +110,8 @@ class MetaPartParameterCriteria extends BaseEntity $this->normalizedValue = $normalizedValue; } - protected function recalculateNormalizedValue () { + protected function recalculateNormalizedValue() + { if ($this->getSiPrefix() === null) { $this->setNormalizedValue($this->getValue()); } else { diff --git a/src/PartKeepr/PartBundle/Entity/Part.php b/src/PartKeepr/PartBundle/Entity/Part.php @@ -285,12 +285,13 @@ class Part extends BaseEntity * @ORM\Column(type="boolean") * @Groups({"default"}) * - * @var boolean + * @var bool */ private $metaPart; /** * An array of all matching meta parts. + * * @Groups({"default"}) * * @var array diff --git a/src/PartKeepr/PartBundle/Entity/PartParameter.php b/src/PartKeepr/PartBundle/Entity/PartParameter.php @@ -77,6 +77,7 @@ class PartParameter extends BaseEntity * The normalized value (the product of si prefix + value). * * @ORM\Column(type="float",nullable=true) + * * @var */ private $normalizedValue; @@ -95,6 +96,7 @@ class PartParameter extends BaseEntity * The normalized maximum value (the product of si prefix + value). * * @ORM\Column(type="float",nullable=true) + * * @var */ private $normalizedMaxValue; @@ -439,8 +441,8 @@ class PartParameter extends BaseEntity */ public function setMinValue($minValue) { - $this->minValue = $minValue; - $this->recalculateNormalizedValues(); + $this->minValue = $minValue; + $this->recalculateNormalizedValues(); } /** diff --git a/src/PartKeepr/PartBundle/Exceptions/NotAMetaPartException.php b/src/PartKeepr/PartBundle/Exceptions/NotAMetaPartException.php @@ -1,12 +1,10 @@ <?php - namespace PartKeepr\PartBundle\Exceptions; - class NotAMetaPartException extends \RuntimeException { - public function __construct () + public function __construct() { parent::__construct("Attempted to retrieve parts for a meta part, but the given part is not a meta part!"); } diff --git a/src/PartKeepr/PartBundle/Services/PartService.php b/src/PartKeepr/PartBundle/Services/PartService.php @@ -185,6 +185,7 @@ class PartService $qb->expr()->in("p.id", ":result")); $qb->setParameter(":result", $result); + return $qb->getQuery()->getResult(); } } diff --git a/src/PartKeepr/ProjectBundle/Entity/ProjectPart.php b/src/PartKeepr/ProjectBundle/Entity/ProjectPart.php @@ -87,7 +87,7 @@ class ProjectPart extends BaseEntity */ private $overage; - public function __construct () + public function __construct() { $this->setOverageType(self::OVERAGE_TYPE_ABSOLUTE); $this->setOverage(0); diff --git a/src/PartKeepr/ProjectBundle/Entity/ProjectRun.php b/src/PartKeepr/ProjectBundle/Entity/ProjectRun.php @@ -46,7 +46,7 @@ class ProjectRun extends BaseEntity private $quantity; /** - * Stores the parts + * Stores the parts. * @ORM\OneToMany( * targetEntity="PartKeepr\ProjectBundle\Entity\ProjectRunPart", * mappedBy="projectRun", @@ -59,7 +59,7 @@ class ProjectRun extends BaseEntity */ private $parts; - public function __construct () + public function __construct() { $this->parts = new ArrayCollection(); } @@ -138,7 +138,7 @@ class ProjectRun extends BaseEntity * * @param ProjectRunPart */ - public function removePart ($part) + public function removePart($part) { if ($part instanceof ProjectRunPart) { $part->setProjectRun(null); diff --git a/src/PartKeepr/ProjectBundle/Entity/ProjectRunPart.php b/src/PartKeepr/ProjectBundle/Entity/ProjectRunPart.php @@ -1,4 +1,5 @@ <?php + namespace PartKeepr\ProjectBundle\Entity; use Doctrine\ORM\Mapping as ORM; @@ -13,7 +14,6 @@ use Symfony\Component\Serializer\Annotation\Groups; */ class ProjectRunPart extends BaseEntity { - /** * Stores the project run. * diff --git a/src/PartKeepr/ProjectBundle/Tests/ProjectTest.php b/src/PartKeepr/ProjectBundle/Tests/ProjectTest.php @@ -214,7 +214,6 @@ class ProjectTest extends WebTestCase * Tests that the project part does not contain a reference to the project. This is because we serialize the * project reference as IRI and not as object, which causes problems when reading in the project part in the * frontend and serializing it back. - * */ public function testAbsentProjectReference() {