Skip to content

🎉 Version 2 🎉

Latest
Compare
Choose a tag to compare
@navarr navarr released this 11 Jul 19:53
· 6 commits to main since this release
9af08fc

After a lot of hard work, I'm proud to present Version 2 of navarr/dependency-annotation!

Addition and preference of PHP8 Attribute

This library now uses a PHP8 attribute as it's preference when parsing dependencies, making the package name a little bit of a misnomer. This does not mean the project is limited to PHP8, however! PHP8 Attributes are fully compatible with older versions of PHP so long as they do not take up more than one line.

The preferred way of declaring your dependencies is, to now:

$> composer require --dev navarr/attribute-dependency

And then, in your PHP code:

use Navarr\Attribute\Dependency;

class SomeClass
{
    #[Dependency('example/some-package', '>=5', 'Why we\'ve chosen this constraint')]
    public function execute() { /* ... */ }
}

By default, the tool will no longer search for or output annotations. If you would like to run this on older codebases, you can include the flag --include-legacy-annotations.

Additional methods of output

Our only command is still composer why-block for now, but we've expanded the available output formats. You can pass flag --format or -f with a value of text, csv, json, or xml! In all cases, the results will be written to standard out and can be redirected into a file or piped into a utility like jq.

Improved Stability

I have gone absolutely crazy with testing. This repository uses phpstan at the strictest available level, runs at least 80 unit tests with over 250 assertions, and the output of the Infection mutation testing library is paid attention to for hardening to ensure edge cases are being covered.

Final Version of why-block

$> composer help why-block
Usage:
  why-block [options] [--] <package> <version>

Arguments:
  package                           Package to inspect
  version                           Version you want to update it to

Options:
  -f, --format[=FORMAT]             Format to output results in.  Accepted values: text, csv, json, xml [default: "text"]
  -e, --fail-on-error               Immediately fail on parsing errors
  -l, --include-legacy-annotations  Include old @dependency/@composerDependency annotations in search
  -r, --include-root-dependencies   Search root dependencies for the @dependency annotation
  -a, --include-all-dependencies    Search all dependencies for the @dependency annotation
  -h, --help                        Display help for the given command. When no command is given display help for the list command
  -q, --quiet                       Do not output any message
  -V, --version                     Display this application version
      --ansi|--no-ansi              Force (or disable --no-ansi) ANSI output
  -n, --no-interaction              Do not ask any interactive question
      --profile                     Display timing and memory usage information
      --no-plugins                  Whether to disable plugins.
  -d, --working-dir=WORKING-DIR     If specified, use the given directory as working directory.
      --no-cache                    Prevent use of the cache
  -v|vv|vvv, --verbose              Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug