Closed icanhazstring closed 5 years ago
@icanhazstring I would go with DeclareStatement
@icanhazstring maybe I missed something but with that implementation is not possible to add declare like:
declare(strict_types=1,ticks=1);
but it's valid. It can have even all three declarations - strict_types
, ticks
and encodning
.
@icanhazstring Ok, nvm. I see, you are doing it on separate statements. It's fine. Maybe even better :)
@webimpress wanted to write this. Yes ;)
The other way around would be also possible, but I guess this is a matter of taste. I would have to change the FileGenerator
to only have a single DeclareStatement
. Maybe then we could remove the logic inside setDeclares
to check if the declare is already given. Maybe some better SoC? Don't know ;)
Thanks, @icanhazstring!
This will add the ability to configure declare() statements at the top of generated files.
I took the implementation suggestion from @GaryJones in #102 and changes it a bit. I changed the behavior to be only able to generate valid
declare
statements at all. Also I added static factories to generate the possible directives.Should solve #102
~One problem tho. Since
declare
is a reserved keyword. The I decided to go withDeclare_
as the class representation. But the codesniffer doesn't like this. Any suggestions?~ Renamed toDeclareStatement
as suggested by @webimpress