Skip to content
PhpSpec extension for automatically sorting use statements in generated specifications.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Sorted use statements for PhpSpec

  1. Are you working on a project with a namespace beginning with Q, R, S, T, U, V, W, X, Y, or Z?
  2. Do you like your use statements sorted alphabetically?

If you answered yes to both of those questions, this is the PhpSpec extension for you!


Installation and beyond

Using Composer, require this package as a development dependency:

$ composer require --dev unfunco/phpspec-sort-use-statements

…and enable the extension by adding the following to your phpspec.yml configuration.

  Unfunco\PhpSpec\Extension\SortUseStatements: ~

Generate specifications as you normally would. If you are using a custom specification template, you can add %use% to your template to interpolate sorted use statements, as in this example:


namespace %namespace%;


final class %name% extends ObjectBehavior
    function it_is_initializable()


Copyright © 2018 Daniel Morris
Made available under the terms of the Apache License, Version 2.0.

You can’t perform that action at this time.