File tree Expand file tree Collapse file tree 4 files changed +27
-0
lines changed
Expand file tree Collapse file tree 4 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 11# CHANGELOG
22
3+ ## 4.0.1 - 2021/02/04
4+ - Add back ` getMainElement ` method to ` AbstractComponent `
5+
36## 4.0.0 - 2021/02/04
47- issue #11 - Allow class property to be typed
58- Clear, refactor and review code
Original file line number Diff line number Diff line change @@ -39,6 +39,14 @@ public function setMainElement(AbstractElement $element): self
3939 return $ this ;
4040 }
4141
42+ /**
43+ * @return PhpClassElement|PhpFileElement
44+ */
45+ public function getMainElement ()
46+ {
47+ return $ this ->mainElement ;
48+ }
49+
4250 public function addConstantElement (PhpConstantElement $ constant ): self
4351 {
4452 if (!$ constant ->getClass () instanceof PhpClassElement && $ this ->mainElement instanceof PhpClassElement) {
Original file line number Diff line number Diff line change 66
77use WsdlToPhp \PhpGenerator \Component \PhpClass as PhpClassComponent ;
88use WsdlToPhp \PhpGenerator \Element \PhpAnnotation as PhpAnnotationElement ;
9+ use WsdlToPhp \PhpGenerator \Element \PhpClass ;
910use WsdlToPhp \PhpGenerator \Element \PhpFunctionParameter as PhpFunctionParameterElement ;
1011use WsdlToPhp \PhpGenerator \Element \PhpProperty ;
1112use WsdlToPhp \PhpGenerator \Element \PhpProperty as PhpPropertyElement ;
1617 */
1718class PhpClassTest extends AbstractComponent
1819{
20+ public function testGetMainElementMustBeOfPhpClassElement ()
21+ {
22+ $ class = new PhpClassComponent ('Foo ' , true , 'stdClass ' );
23+
24+ $ this ->assertInstanceOf (PhpClass::class, $ class ->getMainElement ());
25+ }
26+
1927 public function testSimpleToString ()
2028 {
2129 $ class = new PhpClassComponent ('Foo ' , true , 'stdClass ' );
Original file line number Diff line number Diff line change 1010use WsdlToPhp \PhpGenerator \Component \PhpInterface as PhpInterfaceComponent ;
1111use WsdlToPhp \PhpGenerator \Element \PhpAnnotation as PhpAnnotationElement ;
1212use WsdlToPhp \PhpGenerator \Element \PhpDeclare ;
13+ use WsdlToPhp \PhpGenerator \Element \PhpFile ;
1314use WsdlToPhp \PhpGenerator \Element \PhpFunctionParameter as PhpFunctionParameterElement ;
1415use WsdlToPhp \PhpGenerator \Element \PhpProperty ;
1516use WsdlToPhp \PhpGenerator \Element \PhpProperty as PhpPropertyElement ;
2021 */
2122class PhpFileTest extends AbstractComponent
2223{
24+ public function testGetMainElementMustBeOfPhpFileElement ()
25+ {
26+ $ class = new PhpFileComponent ('Foo ' , true , 'stdClass ' );
27+
28+ $ this ->assertInstanceOf (PhpFile::class, $ class ->getMainElement ());
29+ }
30+
2331 public function testSimpleClassToString ()
2432 {
2533 $ file = new PhpFileComponent ('Foo ' );
You can’t perform that action at this time.
0 commit comments