Repository navigation
Releases: pieceofcake2/upgrade
Releases · pieceofcake2/upgrade
Release list
v1.1.0
- New
rectorcommand, which runs the Rector rules of the plugin for a change of pieceofcake2/cakephp: the setsvariadic-arguments(PR #20) andnamespaced-classes(PR #21) - New
layoutcommand: 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.phpin the CakePHP 5 directories (layout/,element/,email/,Error/),app/Vendor/moves tovendors/, and the paths ofcomposer.jsonfollow the moves. Files move withgit mvin 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 inresources/skeleton/, with the constants of the application of the old entry files, which are removed withgit rm - New
namespacecommand: 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 intosrc/,src/Lib/<Type>/tosrc/<Type>/and core class overrides tosrc/Cake/<path>, declares the namespaces from the paths, renames and imports the classes, removesApp::uses(), replaces the class names in strings by::class, addsApp.namespacetoconfig/core.phpand switchescomposer.jsonto PSR-4. It needs the layout of pieceofcake2/app and stops on the CakePHP 2 layout.--dry-runshows the changes as a diff namespaceimports the classes of CakePHP and of the application withusestatements inconfig/, 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.layoutstill creates the entry files with the global names, which work in a global application (PR #23)namespacesorts theusestatements of the files that it changes, with the ones that the files had, as the CakePHP coding standard expects (SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses) (PR #23)layoutalso moves an application withoutapp/, whose root is the directoryapp/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, keepswebroot/,tmp/and thevendor/of Composer, movesPlugin/toplugins/withextra.installer-pathsfor the plugins that Composer installs, replaces the oldwebroot/index.phpandwebroot/test.phpand aConfig/define.phpin 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 withConsole/cake upgrade layout -root "$PWD" -app "$PWD", as the console looks for the application inapp/of the directory ofcomposer.json; without the options,layoutchanges nothing and prints this command (PR #23)namespaceno longer asks to updateautoload.psr-4: src/by hand when it movessrc/Lib/<Type>/tosrc/<Type>/(PR #23)- New
class-name-stringsrules: 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-nameskeeps the short names ('Auth','DebugKit.Toolbar') namespaced-classes: a comparison with the class of an object (get_class($x) === 'CakeRequest') becomesinstanceofwhen 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 getusestatements, as the names of the code, whichever version of pieceofcake2/cakephp is installed- Requires nikic/php-parser ^5.0, which
layoutandnamespaceuse outside Rector
Installation
composer require --dev pieceofcake2/upgrade:^1.1See 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
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
v1.0.3
v1.0.2
v1.0.1
Changes
- refactor: Restructure tests directory and update dependencies
Full Changelog: v1.0.0...v1.0.1