Skip to content

v0.10.0

Compare
Choose a tag to compare
@osmianski osmianski released this 08 Oct 11:07
· 19 commits to v0.10 since this release

New Way Of Applying Dynamic Traits

From now on, Module::$traits property is obsolete. Instead, specify the class you are extending directly in the dynamic trait class using #[UseIn] attribute:

use Osm\Core\Attributes\UseIn;
...
#[UseIn(Foo::class)]
trait FooTrait
{

}

Sorting By Dependency

Application packages, modules, themes and data source indexers are all sorted by dependency using new sort_by_dependency() helper function. Calling this function may seem a bit clunky, but it does the job:

return sort_by_dependency($packages, 'Packages',
    fn($positions) =>
        fn(Package $a, Package $b) =>
            $positions[$a->name] <=> $positions[$b->name]
    );

Objects that are being sorted should have unique name, and after - am array of object names it should go after:

/**
 * @property string $name
 * @property string[] $after
 * ...
 */
class Package extends Object_ {
}   

Related Releases