Skip to content

Commit

Permalink
Merge branch '5.1' into 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Jun 22, 2024
2 parents 10b69c1 + e2c42b1 commit 192e6b9
Show file tree
Hide file tree
Showing 18 changed files with 108 additions and 83 deletions.
12 changes: 0 additions & 12 deletions .github/FUNDING.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/PHPStan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Run PHPStan
run: vendor/bin/phpstan analyse app/src/ app/tests/
run: vendor/bin/phpstan analyse
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Ignores text editor metadata
*.komodoproject
.editorconfig
.vscode

# Ignores Mac metadata. You can configure this globally if you use a Mac: http://islegend.com/development/setting-global-gitignore-mac-windows/
.DS_Store

Expand Down
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"junstyle.php-cs-fixer",
"xdebug.php-debug",
"neilbrayfield.php-docblocker",
"bmewburn.vscode-intelephense-client",
"sanderronde.phpstan-vscode"
]
}
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"log": false,
}
]
}
43 changes: 43 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "PHPUnit",
"type": "shell",
"options": {
"env": {
"XDEBUG_CONFIG": "idekey=VSCODE"
}
},
"command": "printf '\\33c\\e[3J' && vendor/bin/phpunit --stop-on-error --stop-on-failure", //
// "command": "printf '\\33c\\e[3J' && vendor/bin/phpunit --filter SprunjeTest --stop-on-error --stop-on-failure",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "PHP CS Fixer",
"type": "shell",
"options": {},
"command": "vendor/bin/php-cs-fixer fix",
"problemMatcher": [],
},
{
"label": "Serve",
"type": "shell",
"options": {},
"command": "php bakery serve",
"problemMatcher": [],
},
{
"label": "PHPStan",
"type": "shell",
"command": "vendor/bin/phpstan analyse",
"problemMatcher": []
}
]
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [5.2.0](https://github.com/userfrosting/sprinkle-core/compare/5.1.0...5.2.0)

## [5.1.1](https://github.com/userfrosting/sprinkle-core/compare/5.1.0...5.1.1)
- Fix issue with sprunje using multiple listable fetched from database ([Chat Reference](https://chat.userfrosting.com/channel/support?msg=sgMq8sbAjsCN2ZGXj))

## [5.1.0](https://github.com/userfrosting/sprinkle-core/compare/5.0.1...5.1.0)
- Drop PHP 8.1 support, add PHP 8.3 support
- Update to Laravel 10
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ See main [UserFrosting Documentation](https://learn.userfrosting.com) for more i
- [Changelog](CHANGELOG.md)
- [Issues](https://github.com/userfrosting/UserFrosting/issues)
- [License](LICENSE.md)
- [Style Guide](STYLE-GUIDE.md)
- [Style Guide](https://github.com/userfrosting/.github/blob/main/.github/STYLE-GUIDE.md)
## Contributing
Expand Down
51 changes: 0 additions & 51 deletions STYLE-GUIDE.md

This file was deleted.

7 changes: 7 additions & 0 deletions app/src/Csrf/CsrfGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
*/
class CsrfGuard extends Guard
{
/**
* Overwrites the default constructor to inject dependencies.
*
* @param Config $config
* @param Session $session
* @param App<\DI\Container> $app
*/
public function __construct(
protected Config $config,
Session $session,
Expand Down
2 changes: 1 addition & 1 deletion app/src/Listeners/SetRouteCaching.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SetRouteCaching
*
* @param Config $config
* @param ResourceLocatorInterface $locator
* @param App $app
* @param App<\DI\Container> $app
*/
public function __construct(
protected Config $config,
Expand Down
5 changes: 4 additions & 1 deletion app/src/Sprunje/Sprunje.php
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,11 @@ abstract protected function baseQuery();
*/
protected function getColumnValues(string $column): array
{
// Clone query, so we don't modify the initial one
$query = clone $this->query;

/** @var Collection<int, mixed[]> */
$rawValues = $this->query->select($column)
$rawValues = $query->select($column)
->distinct()
->orderBy($column, 'asc')
->get();
Expand Down
5 changes: 5 additions & 0 deletions app/src/Util/RouteList.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
*/
class RouteList
{
/**
* Inject dependencies.
*
* @param App<\DI\Container> $app
*/
public function __construct(protected App $app)
{
}
Expand Down
21 changes: 14 additions & 7 deletions app/tests/Integration/Sprunje/SprunjeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,20 @@ class SprunjeTest extends CoreTestCase
{
/** @var mixed[] */
protected array $listable = [
'type' => [
['value' => 1, 'text' => 'TYPE A'],
['value' => 2, 'text' => 'TYPE B'],
],
'name' => [
// N.B.: Values are sorted automatically
['value' => 'bar', 'text' => 'bar'],
['value' => 'foo', 'text' => 'foo'],
['value' => 'foobar', 'text' => 'foobar'],
],
'type' => [
['value' => 1, 'text' => 'TYPE A'],
['value' => 2, 'text' => 'TYPE B'],
],
'active' => [
['value' => false, 'text' => false],
['value' => true, 'text' => true],
]
];

public function setUp(): void
Expand Down Expand Up @@ -203,11 +207,11 @@ public function testWithCustomSort(): void
public function testWithSortException(): void
{
$sprunje = new TestSprunje([
'sorts' => ['description' => 'desc'],
'sorts' => ['active' => 'desc'],
]);

$this->expectException(SprunjeException::class);
$this->expectExceptionMessage('Bad sort: description');
$this->expectExceptionMessage('Bad sort: active');
$sprunje->getArray();
}

Expand Down Expand Up @@ -491,11 +495,14 @@ class TestSprunje extends Sprunje
protected array $sortable = [
'id',
'name',
'description',
'type',
];

protected array $listable = [
'name',
'type',
'name',
'active',
];

protected function baseQuery()
Expand Down
2 changes: 1 addition & 1 deletion app/tests/Integration/Util/RouteParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function setUp(): void
{
parent::setUp();

/** @var App */
/** @var App<\DI\Container> */
$app = $this->ci->get(App::class);
$collector = $app->getRouteCollector();
$collector->setBasePath('/Myfoo');
Expand Down
2 changes: 1 addition & 1 deletion app/tests/Unit/Listeners/SetRouteCachingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testSetRouteCaching(): void
->shouldReceive('setCacheFile')->with('/foo/route.cache')->once()
->getMock();

/** @var App */
/** @var App<\DI\Container> */
$app = Mockery::mock(App::class)
->shouldReceive('getRouteCollector')->once()->andReturn($collector)
->getMock();
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
parameters:
level: 8
paths:
- app/src/
- app/tests/
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- '#Dynamic call to static method PHPUnit\\Framework\\.*#'
Expand Down

0 comments on commit 192e6b9

Please sign in to comment.