From 441e6e1d310008f6d6af23a4bf83cb0c05cd61ba Mon Sep 17 00:00:00 2001 From: Ilia Smirnov <php1602agregator@gmail.com> Date: Wed, 19 Jul 2017 17:55:00 +0300 Subject: [PATCH] Fixed incorrect class inheritance (#394) Generated example was incorrect - you cannot define import alias: use Some\Other\Thingy as SomeClass; and then define a class with the same name: abstract class SomeClass ... Class names changed to avoid conflict between import alias and abstract class name. --- doc/4_Code_generation.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/4_Code_generation.markdown b/doc/4_Code_generation.markdown index 2c0aa0ed..ac9e4980 100644 --- a/doc/4_Code_generation.markdown +++ b/doc/4_Code_generation.markdown @@ -21,8 +21,8 @@ use PhpParser\Node; $factory = new BuilderFactory; $node = $factory->namespace('Name\Space') ->addStmt($factory->use('Some\Other\Thingy')->as('SomeOtherClass')) - ->addStmt($factory->class('SomeClass') - ->extend('SomeOtherClass') + ->addStmt($factory->class('SomeOtherClass') + ->extend('SomeClass') ->implement('A\Few', '\Interfaces') ->makeAbstract() // ->makeFinal() @@ -66,7 +66,7 @@ This will produce the following output with the standard pretty printer: namespace Name\Space; use Some\Other\Thingy as SomeClass; -abstract class SomeClass extends SomeOtherClass implements A\Few, \Interfaces +abstract class SomeOtherClass extends SomeClass implements A\Few, \Interfaces { protected $someProperty; private $anotherProperty = array(1, 2, 3);