Skip to content

Commit

Permalink
Consistence CS 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
VasekPurchart committed May 5, 2017
1 parent f903a80 commit 701537f
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 43 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<property name="path.bin" value="${path.root}/bin"/>
<property name="path.composer.executable" value="composer"/>
<property name="path.phpcs.executable" value="${path.bin}/phpcs"/>
<property name="path.phpcs.ruleset" value="${path.vendor}/consistence/coding-standard/Consistence/ruleset.xml"/>
<property name="path.phpcs.ruleset" value="${path.build}/cs-ruleset.xml"/>
<property name="path.phplint.executable" value="${path.bin}/parallel-lint"/>
<property name="path.phpunit.configuration" value="${path.tests}/phpunit.xml"/>
<property name="path.phpunit.executable" value="${path.bin}/phpunit"/>
Expand Down
20 changes: 20 additions & 0 deletions build/cs-ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<ruleset name="ConsistenceCodingStandard">
<rule ref="../vendor/consistence/coding-standard/Consistence/ruleset.xml">
<exclude name="SlevomatCodingStandard.Classes.ClassConstantVisibility"/><!-- requires 7.1+ -->
<exclude name="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/><!-- requires PHP 7.1+ -->
</rule>
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array" value="
src => Consistence\Doctrine,
tests => Consistence\Doctrine,
"/>
</properties>
<exclude-pattern>*/data/*.php</exclude-pattern>
<exclude-pattern>*/exceptions/*Exception.php</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements">
<exclude-pattern>*/data/*.php</exclude-pattern>
</rule>
</ruleset>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"doctrine/orm": "~2.5.0"
},
"require-dev": {
"consistence/coding-standard": "0.12",
"consistence/coding-standard": "1.0",
"jakub-onderka/php-console-highlighter": "0.3.2",
"jakub-onderka/php-parallel-lint": "0.9.2",
"phing/phing": "2.16",
Expand Down
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ $user = new User(
Sex::get(Sex::FEMALE)
// ...
);
/** @var $entityManager \Doctrine\ORM\EntityManager */
/** @var \Doctrine\ORM\EntityManager $entityManager */
$entityManager->persist($user);

// when persisting User::$sex to database, `female` will be saved
Expand All @@ -107,7 +107,7 @@ And when you retrieve the entity back from database, you will receive the `Sex`

namespace Consistence\Doctrine\Example\User;

/** @var $entityManager \Doctrine\ORM\EntityManager */
/** @var \Doctrine\ORM\EntityManager $entityManager */
$user = $entityManager->find(User::class, 1);
var_dump($user->getSex());

Expand Down Expand Up @@ -174,8 +174,8 @@ use Consistence\Doctrine\Enum\EnumPostLoadEntityListener;

use Doctrine\ORM\Events;

/** @var $entityManager \Doctrine\ORM\EntityManager */
/** @var $annotationDriver \Doctrine\ORM\Mapping\Driver\AnnotationDriver */
/** @var \Doctrine\ORM\EntityManager $entityManager */
/** @var \Doctrine\ORM\Mapping\Driver\AnnotationDriver $annotationDriver */
$annotationDriver = $entityManager->getConfiguration()->getMetadataDriverImpl();
$annotationReader = $annotationDriver->getReader();

Expand Down
2 changes: 0 additions & 2 deletions src/Enum/EnumPostLoadEntityListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
namespace Consistence\Doctrine\Enum;

use Consistence\Enum\Enum;

use Doctrine\Common\Annotations\Reader;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Mapping\ClassMetadata;

use ReflectionClass;
use ReflectionProperty;

Expand Down
4 changes: 2 additions & 2 deletions src/Enum/Type/IntegerEnumType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public function getName(): string
}

/**
* @param \Consistence\Enum\Enum|integer|null $value
* @param \Consistence\Enum\Enum|int|null $value
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
* @return integer|null
* @return int|null
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
Expand Down
10 changes: 0 additions & 10 deletions src/Enum/exceptions/Exception.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Enum/exceptions/NotEnumException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Consistence\Doctrine\Enum;

class NotEnumException extends \Consistence\PhpException implements \Consistence\Doctrine\Enum\Exception
class NotEnumException extends \Consistence\PhpException
{

/** @var string */
Expand Down
2 changes: 1 addition & 1 deletion src/Enum/exceptions/UnsupportedClassMetadataException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Doctrine\ORM\Mapping\ClassMetadata;

class UnsupportedClassMetadataException extends \Consistence\PhpException implements \Consistence\Doctrine\Enum\Exception
class UnsupportedClassMetadataException extends \Consistence\PhpException
{

/** @var string */
Expand Down
10 changes: 0 additions & 10 deletions src/exceptions/Exception.php

This file was deleted.

1 change: 0 additions & 1 deletion tests/Enum/EnumPostLoadEntityListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Mapping\ClassMetadata;

use ReflectionClass;

class EnumPostLoadEntityListenerTest extends \PHPUnit\Framework\TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Enum/LoadEnumToEntityIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private function callPostLoadEventOnEntity($entity)
];
$config = Setup::createAnnotationMetadataConfiguration([__DIR__ . '/data'], true, null, null, false);
$entityManager = EntityManager::create($connectionParameters, $config);
/** @var $annotationDriver \Doctrine\ORM\Mapping\Driver\AnnotationDriver */
/** @var \Doctrine\ORM\Mapping\Driver\AnnotationDriver $annotationDriver */
$annotationDriver = $entityManager->getConfiguration()->getMetadataDriverImpl();

$postLoadListener = new EnumPostLoadEntityListener($annotationDriver->getReader());
Expand Down
1 change: 0 additions & 1 deletion tests/Enum/Type/EnumTypeIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Consistence\Doctrine\Enum\Type;

use Consistence\Enum\Enum;

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type as DoctrineType;

Expand Down
1 change: 0 additions & 1 deletion tests/Enum/data/BarEmbeddable.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Consistence\Doctrine\Enum;

use Consistence\Doctrine\Enum\EnumAnnotation as Enum;

use Doctrine\ORM\Mapping as ORM;

/**
Expand Down
1 change: 0 additions & 1 deletion tests/Enum/data/BarEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Consistence\Doctrine\Enum;

use Consistence\Doctrine\Enum\EnumAnnotation as Enum;

use Doctrine\ORM\Mapping as ORM;

/**
Expand Down
1 change: 0 additions & 1 deletion tests/Enum/data/BaxEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Consistence\Doctrine\Enum;

use Consistence\Doctrine\Enum\EnumAnnotation as Enum;

use Doctrine\ORM\Mapping as ORM;

/**
Expand Down
1 change: 0 additions & 1 deletion tests/Enum/data/BazEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Consistence\Doctrine\Enum;

use Consistence\Doctrine\Enum\EnumAnnotation as Enum;

use Doctrine\ORM\Mapping as ORM;

/**
Expand Down
1 change: 0 additions & 1 deletion tests/Enum/data/FooEmbeddable.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Consistence\Doctrine\Enum;

use Consistence\Doctrine\Enum\EnumAnnotation as Enum;

use Doctrine\ORM\Mapping as ORM;

/**
Expand Down
1 change: 0 additions & 1 deletion tests/Enum/data/FooEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Consistence\Doctrine\Enum;

use Consistence\Doctrine\Enum\EnumAnnotation as Enum;

use Doctrine\ORM\Mapping as ORM;

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Enum/data/FooParentEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FooParentEntity
/**
* @ORM\Id()
* @ORM\Column(type="integer")
* @var integer
* @var int
*/
private $id;

Expand Down
1 change: 0 additions & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Consistence\Doctrine\Enum\Type\FloatEnumType;
use Consistence\Doctrine\Enum\Type\IntegerEnumType;
use Consistence\Doctrine\Enum\Type\StringEnumType;

use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\DBAL\Types\Type as DoctrineType;

Expand Down

0 comments on commit 701537f

Please sign in to comment.