diff --git a/.gitattributes b/.gitattributes index ad93b42..6da0f41 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,4 +14,5 @@ .gitignore export-ignore .styleci.yml export-ignore CHANGELOG.md export-ignore +phpstan.neon.dist export-ignore phpunit.xml.dist export-ignore diff --git a/.github/ISSUE_TEMPLATE/1_Bug_report.md b/.github/ISSUE_TEMPLATE/1_Bug_report.md deleted file mode 100644 index 14aee51..0000000 --- a/.github/ISSUE_TEMPLATE/1_Bug_report.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: "Bug report" -about: "Report something that's broken. Please ensure your Laravel version is still supported: https://laravel.com/docs/releases#support-policy" ---- - - - - -- Tinker Version: #.#.# -- Laravel Version: #.#.# -- PHP Version: #.#.# -- Database Driver & Version: - -### Description: - - -### Steps To Reproduce: - - - diff --git a/.github/ISSUE_TEMPLATE/1_Bug_report.yml b/.github/ISSUE_TEMPLATE/1_Bug_report.yml new file mode 100644 index 0000000..d5458a1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1_Bug_report.yml @@ -0,0 +1,47 @@ +name: Bug Report +description: "Report something that's broken." +body: + - type: markdown + attributes: + value: "Please read [our full contribution guide](https://laravel.com/docs/contributions#bug-reports) before submitting bug reports. If you notice improper DocBlock, PHPStan, or IDE warnings while using Laravel, do not create a GitHub issue. Instead, please submit a pull request to fix the problem." + - type: input + attributes: + label: Tinker Version + description: Provide the Tinker version that you are using. + placeholder: 1.6.1 + validations: + required: true + - type: input + attributes: + label: Laravel Version + description: Provide the Laravel version that you are using. [Please ensure it is still supported.](https://laravel.com/docs/releases#support-policy) + placeholder: 10.4.1 + validations: + required: true + - type: input + attributes: + label: PHP Version + description: Provide the PHP version that you are using. + placeholder: 8.1.4 + validations: + required: true + - type: input + attributes: + label: Database Driver & Version + description: If applicable, provide the database driver and version you are using. + placeholder: "MySQL 8.0.31 for macOS 13.0 on arm64 (Homebrew)" + validations: + required: false + - type: textarea + attributes: + label: Description + description: Provide a detailed description of the issue you are facing. + validations: + required: true + - type: textarea + attributes: + label: Steps To Reproduce + description: Provide detailed steps to reproduce your issue. If necessary, please provide a GitHub repository to demonstrate your issue using `laravel new bug-report --github="--public"`. + validations: + required: true + diff --git a/.github/ISSUE_TEMPLATE/2_Feature_request.md b/.github/ISSUE_TEMPLATE/2_Feature_request.md deleted file mode 100644 index e530d76..0000000 --- a/.github/ISSUE_TEMPLATE/2_Feature_request.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -name: "Feature request" -about: 'For ideas or feature requests, please make a pull request, or open an issue' ---- diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 6253bb2..4ce1fe0 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,8 @@ blank_issues_enabled: false contact_links: + - name: Feature request + url: https://github.com/laravel/tinker/pulls + about: 'For ideas or feature requests, send in a pull request' - name: Support Questions & Other url: https://laravel.com/docs/contributions#support-questions about: 'This repository is only for reporting bugs. If you have a question or need help using the library, click:' diff --git a/.github/SECURITY.md b/.github/SECURITY.md index dd673d4..800b8af 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -15,7 +15,7 @@ If you discover a security vulnerability within Laravel, please send an email to ``` -----BEGIN PGP PUBLIC KEY BLOCK----- Version: OpenPGP v2.0.8 -Comment: https://sela.io/pgp/ +Comment: Report Security Vulnerabilities to taylor@laravel.com xsFNBFugFSQBEACxEKhIY9IoJzcouVTIYKJfWFGvwFgbRjQWBiH3QdHId5vCrbWo s2l+4Rv03gMG+yHLJ3rWElnNdRaNdQv59+lShrZF7Bvu7Zvc0mMNmFOM/mQ/K2Lt diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 0000000..368c185 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,15 @@ +name: static analysis + +on: + push: + branches: + - master + - '*.x' + pull_request: + +permissions: + contents: read + +jobs: + tests: + uses: laravel/.github/.github/workflows/static-analysis.yml@main diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d1d2e26..94eb45f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,8 +16,11 @@ jobs: strategy: fail-fast: true matrix: - php: [7.2, 7.3, 7.4, '8.0', 8.1, 8.2] - laravel: [6, 7, 8, 9, 10] + php: [7.2, 7.3, 7.4, '8.0', 8.1, 8.2, 8.3] + laravel: [6, 7, 8, 9, 10, 11, 12] + include: + - php: 8.4 + laravel: 11 exclude: - php: 7.2 laravel: 8 @@ -25,32 +28,60 @@ jobs: laravel: 9 - php: 7.2 laravel: 10 + - php: 7.2 + laravel: 11 + - php: 7.2 + laravel: 12 - php: 7.3 laravel: 9 - php: 7.3 laravel: 10 + - php: 7.3 + laravel: 11 + - php: 7.3 + laravel: 12 - php: 7.4 laravel: 9 - php: 7.4 laravel: 10 + - php: 7.4 + laravel: 11 + - php: 7.4 + laravel: 12 - php: '8.0' laravel: 10 + - php: '8.0' + laravel: 11 + - php: '8.0' + laravel: 12 - php: 8.1 laravel: 6 - php: 8.1 laravel: 7 + - php: 8.1 + laravel: 11 + - php: 8.1 + laravel: 12 - php: 8.2 laravel: 6 - php: 8.2 laravel: 7 - php: 8.2 laravel: 8 + - php: 8.3 + laravel: 6 + - php: 8.3 + laravel: 7 + - php: 8.3 + laravel: 8 + - php: 8.3 + laravel: 9 name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -63,8 +94,7 @@ jobs: - name: Install dependencies run: | - composer require "illuminate/contracts=^${{ matrix.laravel }}" --no-update - composer update --prefer-dist --no-interaction --no-progress + composer update --prefer-dist --no-interaction --no-progress --with="illuminate/contracts=^${{ matrix.laravel }}" - name: Execute tests - run: vendor/bin/phpunit --verbose + run: vendor/bin/phpunit diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index 1625bda..ebda620 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -4,6 +4,10 @@ on: release: types: [released] +permissions: {} + jobs: update: + permissions: + contents: write uses: laravel/.github/.github/workflows/update-changelog.yml@main diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b8ec05..1cb753e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,38 @@ # Release Notes -## [Unreleased](https://github.com/laravel/tinker/compare/v2.7.3...2.x) +## [Unreleased](https://github.com/laravel/tinker/compare/v2.10.1...2.x) + +## [v2.10.1](https://github.com/laravel/tinker/compare/v2.10.0...v2.10.1) - 2025-01-27 + +* Update logo to support dark/light theme by [@milewski](https://github.com/milewski) in https://github.com/laravel/tinker/pull/183 +* [2.x] Supports Laravel 12 by [@crynobone](https://github.com/crynobone) in https://github.com/laravel/tinker/pull/185 + +## [v2.10.0](https://github.com/laravel/tinker/compare/v2.9.0...v2.10.0) - 2024-09-23 + +* Use actions/checkout[@v4](https://github.com/v4) by [@Jubeki](https://github.com/Jubeki) in https://github.com/laravel/tinker/pull/172 +* Use new static analysis workflow by [@Jubeki](https://github.com/Jubeki) in https://github.com/laravel/tinker/pull/173 +* Replace dead link in Security Policy by [@Jubeki](https://github.com/Jubeki) in https://github.com/laravel/tinker/pull/180 +* [2.x] Supports PHP 8.4 by [@crynobone](https://github.com/crynobone) in https://github.com/laravel/tinker/pull/182 + +## [v2.9.0](https://github.com/laravel/tinker/compare/v2.8.2...v2.9.0) - 2024-01-04 + +* Update PsySH dependency to v0.12 by [@bobthecow](https://github.com/bobthecow) in https://github.com/laravel/tinker/pull/170 +* [2.x] Merging develop by [@nunomaduro](https://github.com/nunomaduro) in https://github.com/laravel/tinker/pull/171 + +## [v2.8.2](https://github.com/laravel/tinker/compare/v2.8.1...v2.8.2) - 2023-08-15 + +- [2.x] Adds type checking by [@nunomaduro](https://github.com/nunomaduro) in https://github.com/laravel/tinker/pull/160 +- [2.x] Remove unused `orchestra/testbench` deps by [@crynobone](https://github.com/crynobone) in https://github.com/laravel/tinker/pull/166 + +## [v2.8.1](https://github.com/laravel/tinker/compare/v2.8.0...v2.8.1) - 2023-02-15 + +- Cast ProcessResult objects by @mpociot in https://github.com/laravel/tinker/pull/159 + +## [v2.8.0](https://github.com/laravel/tinker/compare/v2.7.3...v2.8.0) - 2023-01-10 + +### Added + +- Laravel v10 support ## [v2.7.3](https://github.com/laravel/tinker/compare/v2.7.2...v2.7.3) - 2022-11-09 diff --git a/README.md b/README.md index 40284ac..1ed1a49 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

Logo Laravel Tinker

+

Logo Laravel Tinker

Build Status diff --git a/art/logo.svg b/art/logo.svg index 5e2fa9b..6825e83 100644 --- a/art/logo.svg +++ b/art/logo.svg @@ -1 +1,21 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + diff --git a/composer.json b/composer.json index a75eaf8..4d7b5b9 100644 --- a/composer.json +++ b/composer.json @@ -11,18 +11,19 @@ ], "require": { "php": "^7.2.5|^8.0", - "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0", - "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0", - "psy/psysh": "^0.10.4|^0.11.1", - "symfony/var-dumper": "^4.3.4|^5.0|^6.0" + "illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0", + "psy/psysh": "^0.11.1|^0.12.0", + "symfony/var-dumper": "^4.3.4|^5.0|^6.0|^7.0" }, "require-dev": { "mockery/mockery": "~1.3.3|^1.4.2", - "phpunit/phpunit": "^8.5.8|^9.3.3" + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^8.5.8|^9.3.3|^10.0" }, "suggest": { - "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0)." + "illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0)." }, "autoload": { "psr-4": { @@ -37,9 +38,6 @@ } }, "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - }, "laravel": { "providers": [ "Laravel\\Tinker\\TinkerServiceProvider" diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..d0484d8 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,11 @@ +parameters: + paths: + - config + - src + + level: 0 + + ignoreErrors: + - "#Unsafe usage of new static\\(\\)#" + - "#Class Illuminate\\\\Foundation\\\\Application not found.#" + - "#Class Laravel\\\\Lumen\\\\Application not found.#" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 367feb0..fa94d8c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,7 +12,7 @@ > - ./tests/ + ./tests/ diff --git a/src/Console/TinkerCommand.php b/src/Console/TinkerCommand.php index 9c12158..07ad30d 100644 --- a/src/Console/TinkerCommand.php +++ b/src/Console/TinkerCommand.php @@ -131,6 +131,10 @@ protected function getCasters() $casters['Illuminate\Database\Eloquent\Model'] = 'Laravel\Tinker\TinkerCaster::castModel'; } + if (class_exists('Illuminate\Process\ProcessResult')) { + $casters['Illuminate\Process\ProcessResult'] = 'Laravel\Tinker\TinkerCaster::castProcessResult'; + } + if (class_exists('Illuminate\Foundation\Application')) { $casters['Illuminate\Foundation\Application'] = 'Laravel\Tinker\TinkerCaster::castApplication'; } diff --git a/src/TinkerCaster.php b/src/TinkerCaster.php index a5c04de..be3544e 100644 --- a/src/TinkerCaster.php +++ b/src/TinkerCaster.php @@ -94,6 +94,22 @@ public static function castStringable($stringable) ]; } + /** + * Get an array representing the properties of a process result. + * + * @param \Illuminate\Process\ProcessResult $result + * @return array + */ + public static function castProcessResult($result) + { + return [ + Caster::PREFIX_VIRTUAL.'output' => $result->output(), + Caster::PREFIX_VIRTUAL.'errorOutput' => $result->errorOutput(), + Caster::PREFIX_VIRTUAL.'exitCode' => $result->exitCode(), + Caster::PREFIX_VIRTUAL.'successful' => $result->successful(), + ]; + } + /** * Get an array representing the properties of a model. * @@ -113,7 +129,7 @@ public static function castModel($model) $hidden = array_flip($model->getHidden()); $appends = (function () { - return array_combine($this->appends, $this->appends); + return array_combine($this->appends, $this->appends); // @phpstan-ignore-line })->bindTo($model, $model)(); foreach ($appends as $appended) { diff --git a/src/TinkerServiceProvider.php b/src/TinkerServiceProvider.php index 3f1cd56..0da82b8 100644 --- a/src/TinkerServiceProvider.php +++ b/src/TinkerServiceProvider.php @@ -20,7 +20,7 @@ public function boot() $source = realpath($raw = __DIR__.'/../config/tinker.php') ?: $raw; if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) { - $this->publishes([$source => config_path('tinker.php')]); + $this->publishes([$source => $this->app->configPath('tinker.php')]); } elseif ($this->app instanceof LumenApplication) { $this->app->configure('tinker'); }