Skip to content

Releases: pieceofcake2/upgrade

v1.1.0

Choose a tag to compare

@ttsuru ttsuru released this 23 Oct 06:37
v1.1.0
373295f
  • New rector command, which runs the Rector rules of the plugin for a change of pieceofcake2/cakephp: the sets variadic-arguments (PR #20) and namespaced-classes (PR #21)
  • New layout command: moves an application from the CakePHP 2 layout (app/Config/, app/Controller/, app/View/, ...) to the layout of pieceofcake2/app (config/, src/, templates/, resources/locales/, tests/, plugins/, webroot/), or the configuration, templates, translations and tests of a plugin (--plugin). The templates become .php in the CakePHP 5 directories (layout/, element/, email/, Error/), app/Vendor/ moves to vendors/, and the paths of composer.json follow the moves. Files move with git mv in a Git repository. The missing entry files of pieceofcake2/app (config/define.php, bin/cake, webroot/index.php, webroot/test.php, webroot/.htaccess) are created from the copies in resources/skeleton/, with the constants of the application of the old entry files, which are removed with git rm
  • New namespace command: moves the classes of an application (App, or --namespace) or of a plugin (its name) into a namespace. It moves the class folders of a plugin into src/, src/Lib/<Type>/ to src/<Type>/ and core class overrides to src/Cake/<path>, declares the namespaces from the paths, renames and imports the classes, removes App::uses(), replaces the class names in strings by ::class, adds App.namespace to config/core.php and switches composer.json to PSR-4. It needs the layout of pieceofcake2/app and stops on the CakePHP 2 layout. --dry-run shows the changes as a diff
  • namespace imports the classes of CakePHP and of the application with use statements in config/, the entry files (bin/cake, webroot/index.php, webroot/test.php) and the templates, which stay without a namespace. A template gets them at the top, also for the classes of its docblocks (@var View $this), in its first block of PHP or in a new <?php ... ?> block, as the templates of pieceofcake2/app; a template that names no class does not change. layout still creates the entry files with the global names, which work in a global application (PR #23)
  • namespace sorts the use statements of the files that it changes, with the ones that the files had, as the CakePHP coding standard expects (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses) (PR #23)
  • layout also moves an application without app/, whose root is the directory app/ of CakePHP 2 (Config/, Controller/, View/, webroot/, ... in the root), with directories that may be lowercase already. It tells it apart from a plugin and from the new layout, keeps webroot/, tmp/ and the vendor/ of Composer, moves Plugin/ to plugins/ with extra.installer-paths for the plugins that Composer installs, replaces the old webroot/index.php and webroot/test.php and a Config/define.php in the old form when Git has them, and keeps the entry files that the application already has in the new style, with the paths of the moved directories updated. The constants of the old entry files that are built on the paths of the old layout or defined under a condition are listed instead of copied. Run it with Console/cake upgrade layout -root "$PWD" -app "$PWD", as the console looks for the application in app/ of the directory of composer.json; without the options, layout changes nothing and prints this command (PR #23)
  • namespace no longer asks to update autoload.psr-4: src/ by hand when it moves src/Lib/<Type>/ to src/<Type>/ (PR #23)
  • New class-name-strings rules: the class names in the settings that name a class ($components, $helpers, $uses, the associations, engines, handlers, Dispatcher.filters, viewClassMap, Components->load(), Helpers->load(), Behaviors->load(), loadModel(), ...) become ::class. --no-short-names keeps the short names ('Auth', 'DebugKit.Toolbar')
  • namespaced-classes: a comparison with the class of an object (get_class($x) === 'CakeRequest') becomes instanceof when no class of CakePHP or of the processed code extends the class; otherwise it keeps ::class, and the command lists the place for a review. The names in docblocks get use statements, as the names of the code, whichever version of pieceofcake2/cakephp is installed
  • Requires nikic/php-parser ^5.0, which layout and namespace use outside Rector

Installation

composer require --dev pieceofcake2/upgrade:^1.1

See the documentation (Japanese). Run upgrade layout before upgrade namespace; the code that namespace writes needs pieceofcake2/cakephp 2.13.

Full Changelog: v1.0.5...v1.1.0

v1.0.5

Choose a tag to compare

@ttsuru ttsuru released this 16 Oct 09:35
v1.0.5
3a85c10

Changes

  • Document the origin of the package (#10)
  • Title the PHPUnit job summary Unit tests (#11)
  • Use the CakePHP2 standard of pieceofcake2/phpcs-cakephp2 (#12)
  • Add a Japanese translation of the documentation (#13)
  • Align the Japanese style with the other plugins (#14)
  • Add the Qlty configuration and limit the GitHub token in CI (#15)
  • Require pieceofcake2/phpcs-cakephp2 ^1.1 (#16)
  • Require pieceofcake2/phpstan-cakephp2 ^1.0 (#17)
  • Order README badges as PHP, CakePHP, PHPStan, CI (#18)
  • Set up the test database as pieceofcake2/app does (#19)

Full Changelog: v1.0.4...v1.0.5

v1.0.4

Choose a tag to compare

@ttsuru ttsuru released this 16 Oct 02:27
v1.0.4
89df312

Changes

  • Move the documentation to docs/ and publish it to GitHub Pages (#6)
  • Add job summaries to CI (#7)
  • Include the docs in Composer dist archives (#8)
  • Unify the documentation links in the README (#9)

Full Changelog: v1.0.3...v1.0.4

v1.0.3

Choose a tag to compare

@ttsuru ttsuru released this 16 Oct 02:27
v1.0.3
3bdc8f2

Changes

  • Run CI with SQLite only (#3)
  • Update the copyright notice and GitHub Actions (#4)
  • Add PHPStan analysis at level 5 (#5)

Full Changelog: v1.0.2...v1.0.3

v1.0.2

Choose a tag to compare

@ttsuru ttsuru released this 16 Oct 02:27
v1.0.2
3726fc6

Changes

  • Add UpgradeShell tests and align with debug_kit (#1)
  • Use codecov-action to upload test results (#2)

Full Changelog: v1.0.1...v1.0.2

v1.0.1

Choose a tag to compare

@ttsuru ttsuru released this 16 Oct 02:27

Changes

  • refactor: Restructure tests directory and update dependencies

Full Changelog: v1.0.0...v1.0.1

v1.0.0

Choose a tag to compare

@ttsuru ttsuru released this 16 Oct 02:27

Changes

  • Initial commit: Extract Upgrade plugin from CakePHP core
  • ci: Add GitHub Actions CI workflow
  • docs: Add Composer installation instructions