Releases: ajthinking/archetype
Support php-parser 5
- Add support for php-parser 5, Drops support for php parser 4.
Thanks to @jasonvarga ✨
Preliminary support for trait usage in a class
Please see #77 for details.
Allow passing a closure to insertStmt
This feature provides a BuilderFactory instance when passing a closure to insertStmt.
PHPFile::make()->class(\App\Dummy::class)
->astQuery()
->class()
->insertStmt(function(BuilderFactory $builder) {
return $builder->property('someProperty')->getNode();
})
->commit()
->end()
->preview();
Fix insertStmt bug
When astQuery()->insertStmt(.....)
had no matches to operate on, it added the node to the end of the file. This was fixed by adding a guard clause.
Refactoring and bug fixes
- Improve pretty printing when creating new classes
- Adds missing types
- Remove unused dev dependency
- new ASTQueryBuilder
withEach
method - No more magic for phpparser classmap, use explicit methods instead
- Fix an issue where weak comparison caused flakiness
Refactoring
- Use dependency injection for maker
- Fix most phpstan level 0 errors
Dynamic Makers
Makers
PHPFile::make()
now return a Maker instance. Makers allows creating files from a template, for instance:
PHPFile::make()->file('scripts.php')
PHPFile::make()->class(\App\Car::class)
We can implement a custom maker and attaching it to the property "maker" on the File instance.
Internal changes
File methods no longer rely on obscure __call
magic, instead minimal stubs are implemented to explicitly forward calls to the corresponding endpoint class.
Bugfix - Str::macro
Avoid Str
macros which may cause segmentation fault in statamic/cms
Laravel 9 support
Merge pull request #60 from ajthinking/laravel-9-support Allow laravel 9
v1.0.1
Fixes bug when creating classes.
Now we can create classes like so:
namespace App;
PHPFile::make()->class(Models\Car::class);
PHPFile::make()->class(\App\Models\Car::class);
PHPFile::make()->class('App\Models\Car');
PHPFile::make()->class('\App\Models\Car');
PHPFile::make()->class('app/Models/Car.php');
all of these will write two app/Models/Car.php
.