Skip to content

Drop support for older Laravels, apply formatting#245

Merged
dwightwatson merged 8 commits intomasterfrom
cleanup
Apr 21, 2026
Merged

Drop support for older Laravels, apply formatting#245
dwightwatson merged 8 commits intomasterfrom
cleanup

Conversation

@dwightwatson
Copy link
Copy Markdown
Owner

@dwightwatson dwightwatson commented Apr 21, 2026

  • Only support Laravel 13
  • Use Pint for consistent formatting

Copilot AI review requested due to automatic review settings April 21, 2026 23:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the package’s supported framework/tooling targets to Laravel 12/13 and applies consistent formatting (Pint-style), alongside related test and code cleanup.

Changes:

  • Update Composer constraints to only allow Illuminate 12/13, add Pint, and bump PHPUnit.
  • Update CI matrix to run against Laravel 12/13 and newer PHP versions.
  • Reformat source/tests and modernize PHPUnit setUp() visibility + test method naming.

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
composer.json Drops Illuminate 9–11, bumps PHPUnit, adds Pint.
.github/workflows/run-tests.yml Updates PHP/Laravel test matrix to newer versions.
src/ValidationException.php Reorders imports/docblocks; adjusts return type annotations.
src/ValidatingTrait.php Import/docblock tweaks + formatting updates.
src/ValidatingObserver.php Docblock/formatting updates; string formatting.
src/ValidatingModel.php Docblock return type simplification + import.
src/ValidatingInterface.php Import/docblock updates.
tests/TestCase.php Reorders imports and changes base TestCase from abstract to concrete.
tests/ValidationExceptionTest.php Formatting + setUp() visibility + test naming.
tests/ValidatingTraitTest.php Formatting + setUp() visibility + test naming + stub updates.
tests/ValidatingObserverTest.php Formatting + setUp() visibility + test naming.
tests/ValidatingModelTest.php Formatting + test naming + removes unused import.
tests/Injectors/UniqueWithInjectorTest.php Formatting + setUp() visibility + test naming + imports.
tests/Injectors/UniqueInjectorTest.php Formatting + setUp() visibility + test naming + imports.
src/Injectors/UniqueWithInjector.php Formatting (concat spacing/docblocks).
src/Injectors/UniqueInjector.php Formatting (concat spacing/docblocks).
Comments suppressed due to low confidence (1)

src/ValidatingObserver.php:45

  • These docblocks say the observer methods return bool, but performValidation() returns null in multiple branches (e.g., when validation is skipped or a validating event returns non-null). Update the documented return types to reflect the actual bool|null behavior (or make the methods consistently return a boolean).
     * @return bool
     */
    public function saving(Model $model)
    {
        return $this->performValidation($model, 'saving');
    }

    /**
     * Register the validation event for restoring the model.
     *
     * @return bool
     */
    public function restoring(Model $model)
    {
        return $this->performValidation($model, 'restoring');
    }

    /**
     * Perform validation with the specified ruleset.
     *
     * @param  string  $event
     * @return bool
     */
    protected function performValidation(Model $model, $event)
    {
        // If the model has validating enabled, perform it.
        if ($model->getValidating()) {
            // Fire the namespaced validating event and prevent validation
            // if it returns a value.
            if ($this->fireValidatingEvent($model, $event) !== null) {
                return;
            }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/ValidatingTraitTest.php Outdated
Comment thread composer.json
Comment on lines 16 to +27
"require": {
"php": "^8.1",
"illuminate/contracts": "~9.0|~10.0|~11.0|~12.0|~13.0",
"illuminate/database": "~9.0|~10.0|~11.0|~12.0|~13.0",
"illuminate/events": "~9.0|~10.0|~11.0|~12.0|~13.0",
"illuminate/support": "~9.0|~10.0|~11.0|~12.0|~13.0",
"illuminate/validation": "~9.0|~10.0|~11.0|~12.0|~13.0"
"illuminate/contracts": "~13.0",
"illuminate/database": "~13.0",
"illuminate/events": "~13.0",
"illuminate/support": "~13.0",
"illuminate/validation": "~13.0"
},
"require-dev": {
"mockery/mockery": "^1.4.4",
"phpunit/phpunit": "~9.0"
"phpunit/phpunit": "~12.0",
"laravel/pint": "^1.29"
Comment thread src/ValidationException.php Outdated
Comment on lines +5 to +8
use Illuminate\Contracts\Support\Messagebag;
use Illuminate\Contracts\Support\MessageProvider;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Database\Eloquent\Model;
Comment thread src/ValidatingInterface.php Outdated
* @return void
* @throws \Watson\Validating\ValidatingException
*
* @throws ValidatingException
os: [ubuntu-latest, windows-latest]
php: [8.1, 8.2]
laravel: [9.*, 10.*]
php: [8.4, 8.5]
Comment thread composer.json
Comment on lines 24 to 28
"require-dev": {
"mockery/mockery": "^1.4.4",
"phpunit/phpunit": "~9.0"
"phpunit/phpunit": "~12.0",
"laravel/pint": "^1.29"
},
Comment thread src/ValidationException.php Outdated
@@ -43,7 +42,7 @@ public function model()
/**
* Get the mdoel with validation errors.
Comment thread tests/TestCase.php
use PHPUnit\Framework\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
class TestCase extends BaseTestCase
dwightwatson and others added 4 commits April 22, 2026 09:17
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@dwightwatson dwightwatson merged commit 8dea035 into master Apr 21, 2026
8 checks passed
@dwightwatson dwightwatson deleted the cleanup branch April 21, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants