Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]: "
labels: bug
assignees: ''

---

Questions? Discussions: https://phalcon.io/discussions or Discord: https://phalcon.io/discord

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior. Include the exact command you ran:

```bash
vendor/bin/crest <command> <arguments>
```

> Re-run with `--trace` and paste the full output. That turns the one-line error into a stack trace, which is usually the whole answer.

```
paste output here
```

**Expected behavior**
A clear and concise description of what you expected to happen.

**Generated output**
If the bug is in a generator, paste the file crest produced and describe how it differs from what you expected.

```php
// paste generated code
```

**Details**
Paste the output of `vendor/bin/crest about` - it reports the PHP, Phalcon and crest versions in one go:

```
paste `crest about` output here
```

- Phalcon variant: ext-phalcon (`^5`) | phalcon/phalcon (`^6`)
- Operating System:
- Installation type: `composer require --dev phalcon/crest` | from source
- Project flavor: adr | mvc | cli
- `crest.php` present: yes | no (if yes, paste it)

**Additional context**
Add any other context about the problem here.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[NFR]: "
labels: new feature request
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen. If it is a new command, sketch the invocation:

```bash
vendor/bin/crest <command> <arguments> [--options]
```

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Prior art**
Did `phalcon-devtools` do this, and if so under what name? Crest is replacing devtools, so an existing v4 command is a strong argument on its own.

**Additional context**
Add any other context or screenshots about the feature request here.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2

updates:
# Keep the SHA-pinned GitHub Actions current. Dependabot opens reviewable
# pull requests that bump both the commit SHA and the trailing "# version"
# comment; it never merges on its own.
- package-ecosystem: "github-actions"
directories:
- "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
16 changes: 16 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Hello!

* Type: bug fix | new feature | code quality | documentation
* Link to issue:

**In raising this pull request, I confirm the following:**

- [ ] I have checked that another pull request for this purpose does not exist
- [ ] I wrote some tests for this PR
- [ ] `composer test`, `composer cs` and `composer analyze` all pass
- [ ] `composer infection` still reports 100% MSI, or any surviving mutant is documented as equivalent in `resources/infection.json5`
- [ ] I have created a PR for the [documentation](https://github.com/phalcon/docs) about this change, if user facing

Small description of change:

Thanks
47 changes: 8 additions & 39 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,45 +126,14 @@ jobs:
- name: "Unit tests"
run: composer test

mutation:
name: "Mutation testing"

permissions:
contents: read

runs-on: ubuntu-latest

needs:
- unit-tests

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 1
token: ${{ github.token }}

- name: "Setup PHP"
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2
with:
php-version: '8.1'
extensions: ${{ env.EXTENSIONS }}
coverage: pcov
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Install dependencies with Composer"
uses: ramsey/composer-install@26d8a556604053a9612623447203a691f406fbe6 # v4
with:
composer-options: "--prefer-dist"

# resources/infection.json5 sets minMsi/minCoveredMsi to 100, so this
# step fails on any surviving mutant that is not documented there as
# equivalent. Infection is a temporary dependency: it comes back out of
# composer.json before release, at which point this job goes with it.
- name: "Infection"
run: composer infection

# Mutation testing is not a job here yet. Infection runs locally for now
# (`composer infection`, gated at MSI 100 by resources/infection.json5).
#
# The blocker is the PHP floor: at ^8.1 composer can only resolve
# thecodingmachine/safe to dev-master, which eagerly autoloads its function
# files and floods 8.4+ runs with deprecation notices. Once the floor moves
# past 8.1 a stable Safe release becomes resolvable and this becomes a
# standard job alongside the others.
coverage:
name: "Coverage, SonarQube and octocov"

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/vendor/
# Local convenience symlink to a sibling phalcon checkout. Never committed:
# it points outside the repository and only resolves on the machine that made it.
/phalcon
/.env
/tests/_output/*
!/tests/_output/.gitkeep
Expand Down
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Changelog

All notable changes are documented here. The format is based on [Keep a Changelog][keep_a_changelog] and this project adheres to [Semantic Versioning][semantic_versioning].

## [Unreleased]

### Added

- Added `route:list`, listing every route the application answers with its method and Action class. Reads the Action classes rather than a route table, since ADR has none. [#1](https://github.com/phalcon/crest/issues/1)
- Added `config:show`, showing the resolved project configuration and marking each value as declared or inferred. [#1](https://github.com/phalcon/crest/issues/1)
- Added `container:list`, listing the services registered in the project container with their class and whether they have been resolved. [#1](https://github.com/phalcon/crest/issues/1)
- Added `event:list`, listing the listeners attached to the project events manager. [#1](https://github.com/phalcon/crest/issues/1)
- Added `list` (aliases `commands`, `enumerate`), listing the available commands. [#1](https://github.com/phalcon/crest/issues/1)
- Added the `bootstrap` key to `crest.php`, naming the project front controller so commands that need a running application can boot one: `'bootstrap' => App\Front\AppFront::class`. Requires a `boot()` returning a container. [#1](https://github.com/phalcon/crest/issues/1)
- Added `Crest\Console\Input::argumentString()`, `optionString()` and `optionStringOrNull()`, narrowing the common string case so commands do not each repeat a type guard.

### Changed

- `make:action` now writes a `params()` declaration for routes with attributes, so they arrive constrained and cast rather than as raw strings.
- `make:action` now rejects a static segment after a placeholder and suggests the supported spelling: `/album/{id}/edit` is reported as `/album/edit/{id}`. Arguments trail the static path, so the first form has no class name that describes it.
- Renamed `Crest\Adr` to `Crest\ADR`, and `Flavor::Adr`, `Flavor::Cli` and `Flavor::Mvc` to `Flavor::ADR`, `Flavor::CLI` and `Flavor::MVC`, matching `Phalcon\ADR`. Backed values are unchanged.
- Renamed `Crest\ADR\CandidateSource` to `ActionResolver` and `PhalconRouterCandidates` to `PhalconRouterResolver`. One path now names exactly one Action, so there are no candidates to choose between.
- Dependencies now resolve against the PHP 8.1 floor via `config.platform`, so the lock matches the declared minimum.

### Removed

- Removed the shadowed-action warning from `make:action`. One path names exactly one Action, so nothing can be shadowed.

[keep_a_changelog]: https://keepachangelog.com/en/1.0.0/
[semantic_versioning]: https://semver.org/spec/v2.0.0.html
[Unreleased]: https://github.com/phalcon/crest/commits/master
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Phalcon Crest

Command line application for Phalcon generators, introspection and project tooling.
Command line application for Phalcon - generators, introspection and project tooling.

## Requirements

- PHP `^8.1`
- Phalcon, either the `ext-phalcon` C extension (`^5`) or the `phalcon/phalcon` PHP
implementation (`^6`) crest itself needs neither to run
implementation (`^6`) - crest itself needs neither to run

## Install

Expand Down Expand Up @@ -42,7 +42,7 @@ return [
];
```

Namespaces are resolved from your psr-4 map, so a path must be covered by an autoload rule
Namespaces are resolved from your psr-4 map, so a path must be covered by an autoload rule -
`src/Action` under `App\ => src/` becomes `App\Action`. If you write to a directory your
autoloader does not cover, declare the namespace outright:

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"infection/infection": "^0.29",
"pds/composer-script-names": "^1",
"pds/skeleton": "^1",
"phalcon/phalcon": "^6.0@beta",
"phalcon/phalcon": "v6.0.x-dev",
"phalcon/talon": "^0.8",
"phpstan/phpstan": "^2",
"phpunit/phpunit": "^10.5",
Expand Down
17 changes: 9 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading