Skip to content

Commit 0e8050c

Browse files
authored
Merge pull request #103 from mmoreram/feature/version-2
Refactoring for v^2
2 parents 7fa1e8e + 8681541 commit 0e8050c

File tree

97 files changed

+2369
-5342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2369
-5342
lines changed

.formatter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use-sort:
55
group-type: each
66
sort-type: alph
77
sort-direction: asc
8+
strict: true
89
header: |
910
/*
1011
* This file is part of the ControllerExtraBundle for Symfony2.

.travis.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,8 @@ sudo: false
44

55
matrix:
66
include:
7-
- php: 5.6
8-
env: COMPOSER_OPTIONS="--prefer-lowest"
9-
- php: 5.6
10-
env: $SYMFONY_VERSION="^2.8.0"
11-
- php: 7.0
12-
env: $SYMFONY_VERSION="^3.0.0"
137
- php: 7.1
14-
env: $SYMFONY_VERSION="^3.1.0"
15-
- php: 5.6
16-
env: $SYMFONY_VERSION="^3.1.0"
8+
env: $SYMFONY_VERSION="^3.2"
179

1810
before_install:
1911
- 'if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/symfony:${SYMFONY_VERSION}; fi;'
@@ -22,7 +14,7 @@ install:
2214
- composer update --prefer-source --no-interaction ${COMPOSER_OPTIONS}
2315

2416
script:
25-
- phpunit
17+
- php vendor/bin/phpunit
2618

2719
notifications:
2820
email: false

Annotation/Abstracts/Annotation.php renamed to Annotation/Annotation.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111
* @author Marc Morera <yuhu@mmoreram.com>
1212
*/
1313

14-
namespace Mmoreram\ControllerExtraBundle\Annotation\Abstracts;
14+
declare(strict_types=1);
15+
16+
namespace Mmoreram\ControllerExtraBundle\Annotation;
1517

1618
use Doctrine\Common\Annotations\Annotation as DoctrineAnnotation;
1719

1820
/**
1921
* Flush annotation driver.
20-
*
21-
* @Annotation
2222
*/
2323
abstract class Annotation extends DoctrineAnnotation
2424
{
2525
/**
2626
* return value.
2727
*
28-
* @return string Value
28+
* @return null|string Value
2929
*/
30-
public function getValue()
30+
public function getValue() : ? string
3131
{
3232
return $this->value;
3333
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the ControllerExtraBundle for Symfony2.
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*
9+
* Feel free to edit as you please, and have fun.
10+
*
11+
* @author Marc Morera <yuhu@mmoreram.com>
12+
*/
13+
14+
declare(strict_types=1);
15+
16+
namespace Mmoreram\ControllerExtraBundle\Annotation;
17+
18+
/**
19+
* Class AnnotationWithEntityReference.
20+
*/
21+
abstract class AnnotationWithEntityReference extends Annotation
22+
{
23+
/**
24+
* @var string
25+
*
26+
* Entity namespace
27+
*/
28+
protected $namespace;
29+
30+
/**
31+
* @var array
32+
*
33+
* Factory
34+
*/
35+
protected $factory;
36+
37+
/**
38+
* @var string
39+
*
40+
* Repository
41+
*/
42+
protected $repository;
43+
44+
/**
45+
* return namespace.
46+
*
47+
* @return null|string Namespace
48+
*/
49+
public function getNamespace() : ? string
50+
{
51+
return $this->namespace;
52+
}
53+
54+
/**
55+
* Get Factory.
56+
*
57+
* @return null|array
58+
*/
59+
public function getFactory() : ? array
60+
{
61+
return $this->factory;
62+
}
63+
64+
/**
65+
* Get Repository.
66+
*
67+
* @return null|array
68+
*/
69+
public function getRepository() : ? array
70+
{
71+
return $this->repository;
72+
}
73+
}

Annotation/Form.php renamed to Annotation/CreateForm.php

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,99 +11,100 @@
1111
* @author Marc Morera <yuhu@mmoreram.com>
1212
*/
1313

14-
namespace Mmoreram\ControllerExtraBundle\Annotation;
14+
declare(strict_types=1);
1515

16-
use Mmoreram\ControllerExtraBundle\Annotation\Abstracts\Annotation;
16+
namespace Mmoreram\ControllerExtraBundle\Annotation;
1717

1818
/**
19-
* Form annotation driver.
19+
* Class CreateForm.
2020
*
2121
* @Annotation
22+
* @Target({"METHOD"})
2223
*/
23-
class Form extends Annotation
24+
final class CreateForm extends Annotation
2425
{
2526
/**
2627
* @var string
2728
*
2829
* Name of the parameter
2930
*/
30-
public $name;
31+
protected $name;
3132

3233
/**
3334
* @var string
3435
*
3536
* Name of form. This value can refer to a namespace or a service alias
3637
*/
37-
public $class;
38+
protected $class;
3839

3940
/**
40-
* @var entity
41+
* @var string
4142
*
4243
* Entity from Request ParameterBag to use where building form
4344
*/
44-
public $entity;
45+
protected $entity;
4546

4647
/**
4748
* @var bool
4849
*
4950
* Handle request
5051
*/
51-
public $handleRequest = false;
52+
protected $handleRequest = false;
5253

5354
/**
54-
* @var validate
55+
* @var bool
5556
*
5657
* Validates submited form if Request is handled.
5758
* Name of field to set result
5859
*/
59-
public $validate = false;
60+
protected $validate = false;
6061

6162
/**
6263
* return name.
6364
*
64-
* @return string Name
65+
* @return null|string
6566
*/
66-
public function getName()
67+
public function getName() : ? string
6768
{
6869
return $this->name;
6970
}
7071

7172
/**
7273
* return class.
7374
*
74-
* @return string Class
75+
* @return null|string
7576
*/
76-
public function getClass()
77+
public function getClass() : ? string
7778
{
7879
return $this->class;
7980
}
8081

8182
/**
8283
* return entity.
8384
*
84-
* @return string Entity
85+
* @return string
8586
*/
86-
public function getEntity()
87+
public function getEntity() : ? string
8788
{
8889
return $this->entity;
8990
}
9091

9192
/**
9293
* return handle request.
9394
*
94-
* @return string Handle Request
95+
* @return bool
9596
*/
96-
public function getHandleRequest()
97+
public function getHandleRequest() : bool
9798
{
9899
return $this->handleRequest;
99100
}
100101

101102
/**
102103
* return validate value.
103104
*
104-
* @return string Validate param name
105+
* @return bool
105106
*/
106-
public function getValidate()
107+
public function getValidate() : bool
107108
{
108109
return $this->validate;
109110
}

0 commit comments

Comments
 (0)