From c6a96909424b3b305fb2f3178d1ad480e4b41ad8 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Fri, 21 Jul 2023 10:50:58 -0400 Subject: [PATCH] Minor rector fixes, fix rector config --- src/Controller/CameraController.php | 4 +- src/Entity/Brand.php | 3 +- src/Entity/BrandCategory.php | 3 +- src/Entity/Chipset.php | 5 +- src/Entity/GpuCore.php | 8 +- src/Entity/Socket.php | 7 +- src/Maker/MakeCollectionCrud.php | 2 +- src/Migrations/Version0.php | 70 ++++++------ src/Resources/crud/templates/index.tpl.php | 2 +- tools/rector.php | 118 ++++++++++----------- 10 files changed, 111 insertions(+), 111 deletions(-) diff --git a/src/Controller/CameraController.php b/src/Controller/CameraController.php index 15819ad..d671e61 100644 --- a/src/Controller/CameraController.php +++ b/src/Controller/CameraController.php @@ -51,8 +51,8 @@ class CameraController extends AbstractController { 'mount' => 'ASC', 'model' => 'ASC', ]); - $working = array_filter($receivedItems, [$this, 'isWorking']); - $notWorking = array_filter($receivedItems, [$this, 'isNotWorking']); + $working = array_filter($receivedItems, $this->isWorking(...)); + $notWorking = array_filter($receivedItems, $this->isNotWorking(...)); return $this->render('camera/index.html.twig', [ 'not_received' => $newItems, diff --git a/src/Entity/Brand.php b/src/Entity/Brand.php index 642d7f0..cd97c47 100644 --- a/src/Entity/Brand.php +++ b/src/Entity/Brand.php @@ -4,11 +4,12 @@ namespace App\Entity; use Doctrine\Common\Collections\{ArrayCollection, Collection}; use Doctrine\ORM\Mapping as ORM; +use Stringable; #[ORM\Table(name: 'brand', schema: 'collection')] #[ORM\Entity] #[ORM\UniqueConstraint(name: 'brand_unq', columns: ['name'])] -class Brand { +class Brand implements Stringable { use GetSet; #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] diff --git a/src/Entity/BrandCategory.php b/src/Entity/BrandCategory.php index 582a997..2e96d48 100644 --- a/src/Entity/BrandCategory.php +++ b/src/Entity/BrandCategory.php @@ -3,10 +3,11 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; +use Stringable; #[ORM\Table(name: 'brand_category', schema: 'collection')] #[ORM\Entity] -class BrandCategory { +class BrandCategory implements Stringable { use GetSet; #[ORM\Id] diff --git a/src/Entity/Chipset.php b/src/Entity/Chipset.php index 0577f0f..7fccb16 100644 --- a/src/Entity/Chipset.php +++ b/src/Entity/Chipset.php @@ -4,10 +4,11 @@ namespace App\Entity; use Doctrine\Common\Collections\{ArrayCollection, Collection}; use Doctrine\ORM\Mapping as ORM; +use Stringable; #[ORM\Table(name: 'chipset', schema: 'collection')] #[ORM\Entity] -class Chipset { +class Chipset implements Stringable { use GetSet; #[ORM\Column('id', type: 'integer', nullable: FALSE)] @@ -33,6 +34,6 @@ class Chipset { { $name = $this->brand->getName() . ' ' . $this->name; - return ($this->parts !== '') ? "{$name} ({$this->parts})" : $name; + return (string) (($this->parts !== '') ? "{$name} ({$this->parts})" : $name); } } diff --git a/src/Entity/GpuCore.php b/src/Entity/GpuCore.php index b52dff3..aab0837 100644 --- a/src/Entity/GpuCore.php +++ b/src/Entity/GpuCore.php @@ -43,10 +43,10 @@ class GpuCore implements Stringable { public function __toString(): string { - $name = ( ! empty($this->variant)) - ? "$this->name ($this->variant)" - : $this->name; + $name = (empty($this->variant)) + ? $this->name + : "$this->name ($this->variant)"; - return "$name - [$this->brand] $this->generationName"; + return "{$name} - [$this->brand] $this->generationName"; } } diff --git a/src/Entity/Socket.php b/src/Entity/Socket.php index a0cf603..b707ada 100644 --- a/src/Entity/Socket.php +++ b/src/Entity/Socket.php @@ -5,13 +5,14 @@ namespace App\Entity; use App\Enum\SocketType; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; +use Stringable; /** * @see https://en.wikipedia.org/wiki/CPU_socket */ #[ORM\Table(name: 'socket', schema: 'collection')] #[ORM\Entity] -class Socket { +class Socket implements Stringable { use GetSet; #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] @@ -45,8 +46,8 @@ class Socket { public function __toString(): string { - $name = ( ! empty($this->otherName)) ? "$this->name/$this->otherName" : $this->name; + $name = (empty($this->otherName)) ? $this->name : "$this->name/$this->otherName"; - return "$name ({$this->type->value} $this->pinCount)"; + return (string) "{$name} ({$this->type->value} $this->pinCount)"; } } diff --git a/src/Maker/MakeCollectionCrud.php b/src/Maker/MakeCollectionCrud.php index 0676eed..1e38b12 100644 --- a/src/Maker/MakeCollectionCrud.php +++ b/src/Maker/MakeCollectionCrud.php @@ -270,7 +270,7 @@ final class MakeCollectionCrud extends AbstractMaker { if ( ! class_exists(WebTestCase::class)) { - $io->caution('You\'ll need to install the `symfony/test-pack` to execute the tests for your new controller.'); + $io->caution("You'll need to install the `symfony/test-pack` to execute the tests for your new controller."); } } diff --git a/src/Migrations/Version0.php b/src/Migrations/Version0.php index 0eee6f8..8aa3947 100644 --- a/src/Migrations/Version0.php +++ b/src/Migrations/Version0.php @@ -38,22 +38,22 @@ final class Version0 extends AbstractMigration { $this->addSql('CREATE TABLE collection.film_format (id INT NOT NULL, number_id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE TABLE collection.flash (id SERIAL NOT NULL, brand VARCHAR(255) NOT NULL, model VARCHAR(255) NOT NULL, is_auto_flash BOOLEAN NOT NULL, is_ttl BOOLEAN NOT NULL, ttl_type VARCHAR(255) NOT NULL, is_p_ttl BOOLEAN NOT NULL, p_ttl_type VARCHAR(255) NOT NULL, guide_number VARCHAR(255) DEFAULT NULL, purchase_price MONEY DEFAULT NULL, batteries VARCHAR(255) NOT NULL, notes TEXT DEFAULT NULL, serial VARCHAR(255) DEFAULT NULL, formerly_owned BOOLEAN DEFAULT false NOT NULL, received BOOLEAN DEFAULT false NOT NULL, PRIMARY KEY(id))'); - $this->addSql('COMMENT ON COLUMN collection.flash.purchase_price IS \'(DC2Type:money)\''); + $this->addSql("COMMENT ON COLUMN collection.flash.purchase_price IS '(DC2Type:money)'"); $this->addSql('CREATE TABLE collection.brand_category_link (brand_category VARCHAR(255) NOT NULL, brand_id INT NOT NULL, PRIMARY KEY(brand_id, brand_category))'); $this->addSql('CREATE INDEX IDX_5EBFB63CC17C8AD0 ON collection.brand_category_link (brand_category)'); $this->addSql('CREATE INDEX IDX_5EBFB63C44F5D008 ON collection.brand_category_link (brand_id)'); $this->addSql('CREATE TABLE collection.previously_owned_flash (id SERIAL NOT NULL, brand VARCHAR(255) NOT NULL, model VARCHAR(255) NOT NULL, is_auto_flash BOOLEAN NOT NULL, is_ttl BOOLEAN NOT NULL, ttl_type VARCHAR(255) NOT NULL, is_p_ttl BOOLEAN NOT NULL, p_ttl_type VARCHAR(255) NOT NULL, guide_number VARCHAR(255) DEFAULT NULL, purchase_price MONEY DEFAULT NULL, batteries VARCHAR(255) NOT NULL, notes TEXT DEFAULT NULL, serial VARCHAR(255) DEFAULT NULL, formerly_owned BOOLEAN DEFAULT true NOT NULL, received BOOLEAN DEFAULT true NOT NULL, PRIMARY KEY(id))'); - $this->addSql('COMMENT ON COLUMN collection.previously_owned_flash.purchase_price IS \'(DC2Type:money)\''); + $this->addSql("COMMENT ON COLUMN collection.previously_owned_flash.purchase_price IS '(DC2Type:money)'"); - $this->addSql('CREATE TABLE collection.previously_owned_lenses (id SERIAL NOT NULL, brand VARCHAR(64) DEFAULT NULL, coatings VARCHAR(64) DEFAULT NULL, product_line VARCHAR(64) DEFAULT NULL, model VARCHAR(64) DEFAULT NULL, min_f_stop VARCHAR(10) DEFAULT NULL, max_f_stop DOUBLE PRECISION DEFAULT NULL, min_focal_length INT DEFAULT NULL, max_focal_length INT DEFAULT NULL, serial VARCHAR(10) DEFAULT NULL, purchase_price MONEY DEFAULT NULL, notes TEXT DEFAULT NULL, mount VARCHAR(40) DEFAULT NULL, received BOOLEAN NOT NULL, formerly_owned BOOLEAN NOT NULL, front_filter_size NUMERIC(10, 0) DEFAULT NULL, rear_filter_size NUMERIC(10, 0) DEFAULT NULL, is_teleconverter BOOLEAN NOT NULL, design_elements SMALLINT DEFAULT NULL, design_groups SMALLINT DEFAULT NULL, aperture_blades SMALLINT DEFAULT NULL, image_size VARCHAR(255) DEFAULT \'35mm\' NOT NULL, PRIMARY KEY(id))'); - $this->addSql('COMMENT ON COLUMN collection.previously_owned_lenses.purchase_price IS \'(DC2Type:money)\''); + $this->addSql("CREATE TABLE collection.previously_owned_lenses (id SERIAL NOT NULL, brand VARCHAR(64) DEFAULT NULL, coatings VARCHAR(64) DEFAULT NULL, product_line VARCHAR(64) DEFAULT NULL, model VARCHAR(64) DEFAULT NULL, min_f_stop VARCHAR(10) DEFAULT NULL, max_f_stop DOUBLE PRECISION DEFAULT NULL, min_focal_length INT DEFAULT NULL, max_focal_length INT DEFAULT NULL, serial VARCHAR(10) DEFAULT NULL, purchase_price MONEY DEFAULT NULL, notes TEXT DEFAULT NULL, mount VARCHAR(40) DEFAULT NULL, received BOOLEAN NOT NULL, formerly_owned BOOLEAN NOT NULL, front_filter_size NUMERIC(10, 0) DEFAULT NULL, rear_filter_size NUMERIC(10, 0) DEFAULT NULL, is_teleconverter BOOLEAN NOT NULL, design_elements SMALLINT DEFAULT NULL, design_groups SMALLINT DEFAULT NULL, aperture_blades SMALLINT DEFAULT NULL, image_size VARCHAR(255) DEFAULT '35mm' NOT NULL, PRIMARY KEY(id))"); + $this->addSql("COMMENT ON COLUMN collection.previously_owned_lenses.purchase_price IS '(DC2Type:money)'"); - $this->addSql('CREATE TABLE collection.lenses (id SERIAL NOT NULL, brand VARCHAR(64) DEFAULT NULL, coatings VARCHAR(64) DEFAULT NULL, product_line VARCHAR(64) DEFAULT NULL, model VARCHAR(64) DEFAULT NULL, min_f_stop VARCHAR(10) DEFAULT NULL, max_f_stop DOUBLE PRECISION DEFAULT NULL, min_focal_length INT DEFAULT NULL, max_focal_length INT DEFAULT NULL, serial VARCHAR(10) DEFAULT NULL, purchase_price MONEY DEFAULT NULL, notes TEXT DEFAULT NULL, mount VARCHAR(40) DEFAULT NULL, received BOOLEAN NOT NULL, formerly_owned BOOLEAN NOT NULL, front_filter_size NUMERIC(10, 0) DEFAULT NULL, rear_filter_size NUMERIC(10, 0) DEFAULT NULL, is_teleconverter BOOLEAN NOT NULL, design_elements SMALLINT DEFAULT NULL, design_groups SMALLINT DEFAULT NULL, aperture_blades SMALLINT DEFAULT NULL, image_size VARCHAR(255) DEFAULT \'35mm\' NOT NULL, PRIMARY KEY(id))'); - $this->addSql('COMMENT ON COLUMN collection.lenses.purchase_price IS \'(DC2Type:money)\''); + $this->addSql("CREATE TABLE collection.lenses (id SERIAL NOT NULL, brand VARCHAR(64) DEFAULT NULL, coatings VARCHAR(64) DEFAULT NULL, product_line VARCHAR(64) DEFAULT NULL, model VARCHAR(64) DEFAULT NULL, min_f_stop VARCHAR(10) DEFAULT NULL, max_f_stop DOUBLE PRECISION DEFAULT NULL, min_focal_length INT DEFAULT NULL, max_focal_length INT DEFAULT NULL, serial VARCHAR(10) DEFAULT NULL, purchase_price MONEY DEFAULT NULL, notes TEXT DEFAULT NULL, mount VARCHAR(40) DEFAULT NULL, received BOOLEAN NOT NULL, formerly_owned BOOLEAN NOT NULL, front_filter_size NUMERIC(10, 0) DEFAULT NULL, rear_filter_size NUMERIC(10, 0) DEFAULT NULL, is_teleconverter BOOLEAN NOT NULL, design_elements SMALLINT DEFAULT NULL, design_groups SMALLINT DEFAULT NULL, aperture_blades SMALLINT DEFAULT NULL, image_size VARCHAR(255) DEFAULT '35mm' NOT NULL, PRIMARY KEY(id))"); + $this->addSql("COMMENT ON COLUMN collection.lenses.purchase_price IS '(DC2Type:money)'"); - $this->addSql('CREATE TABLE collection.film (id SERIAL NOT NULL, brand VARCHAR(255) NOT NULL, product_line VARCHAR(255) DEFAULT NULL, film_name VARCHAR(255) NOT NULL, film_speed_asa INT NOT NULL, film_speed_din INT NOT NULL, film_format VARCHAR(255) NOT NULL, film_base VARCHAR(255) DEFAULT \'Cellulose Triacetate\' NOT NULL, unused_rolls INT DEFAULT 0 NOT NULL, developed_rolls INT DEFAULT 0 NOT NULL, chemistry VARCHAR(255) DEFAULT \'C-41\' NOT NULL, notes TEXT DEFAULT NULL, film_alias VARCHAR(255) DEFAULT NULL, rolls_in_camera INT DEFAULT 0 NOT NULL, PRIMARY KEY(id))'); + $this->addSql("CREATE TABLE collection.film (id SERIAL NOT NULL, brand VARCHAR(255) NOT NULL, product_line VARCHAR(255) DEFAULT NULL, film_name VARCHAR(255) NOT NULL, film_speed_asa INT NOT NULL, film_speed_din INT NOT NULL, film_format VARCHAR(255) NOT NULL, film_base VARCHAR(255) DEFAULT 'Cellulose Triacetate' NOT NULL, unused_rolls INT DEFAULT 0 NOT NULL, developed_rolls INT DEFAULT 0 NOT NULL, chemistry VARCHAR(255) DEFAULT 'C-41' NOT NULL, notes TEXT DEFAULT NULL, film_alias VARCHAR(255) DEFAULT NULL, rolls_in_camera INT DEFAULT 0 NOT NULL, PRIMARY KEY(id))"); $this->addSql('CREATE TABLE collection.fpu (id SERIAL NOT NULL, brand_id INT NOT NULL, socket_id INT NOT NULL, model VARCHAR(255) NOT NULL, clock_speed INT NOT NULL, count INT DEFAULT 1 NOT NULL, notes TEXT DEFAULT NULL, series VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX idx_c741fa58d20e239c ON collection.fpu (socket_id)'); @@ -65,47 +65,47 @@ final class Version0 extends AbstractMigration { $this->addSql('CREATE TABLE collection.cpu (id SERIAL NOT NULL, brand_id INT NOT NULL, architecture VARCHAR(255) NOT NULL, product_line VARCHAR(255) NOT NULL, model VARCHAR(255) NOT NULL, part_number VARCHAR(255) NOT NULL, lot_number VARCHAR(255) DEFAULT NULL, micro_architecture VARCHAR(255) DEFAULT NULL, codename VARCHAR(255) DEFAULT NULL, base_speed INT NOT NULL, boost_speed INT DEFAULT NULL, cores INT NOT NULL, threads INT NOT NULL, igp VARCHAR(255) DEFAULT NULL, voltage DOUBLE PRECISION DEFAULT NULL, tdp INT DEFAULT NULL, process_node INT DEFAULT NULL, count INT NOT NULL, usable BOOLEAN NOT NULL, received BOOLEAN NOT NULL, link VARCHAR(255) NOT NULL, notes TEXT DEFAULT NULL, l1_data_size INT DEFAULT NULL, l1_code_size INT DEFAULT NULL, l1_unified_size INT DEFAULT NULL, l1_unified_way INT DEFAULT NULL, l2_count INT NOT NULL, l2_size INT DEFAULT NULL, l2_way INT DEFAULT NULL, l3_count INT NOT NULL, l3_size INT DEFAULT NULL, l3_way INT DEFAULT NULL, l1_data_way INT DEFAULT NULL, l1_code_way INT DEFAULT NULL, l1_data_count INT DEFAULT NULL, l1_code_count INT DEFAULT NULL, l1_unified_count INT DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_C18A38B344F5D008 ON collection.cpu (brand_id)'); - $this->addSql('COMMENT ON COLUMN collection.cpu.lot_number IS \'The CPU lot number, such as s-spec for Intel CPUs\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.base_speed IS \'The stock speed of the cpu in MHz\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.boost_speed IS \'The max boost speed of the cpu in MHz, if applicable\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.igp IS \'The name of the integrated graphics processor\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.usable IS \'Whether the chip is working, and can be used with other hardware I have\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.received IS \'Whether I have the chip in my possession (instead of in shipping)\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.l1_data_size IS \'The size of each Level 1 data cache in KB\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.l1_code_size IS \'The size of each Level 1 instruction cache in KB\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.l1_unified_size IS \'The size of each Level 1 unified cache in KB\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.l2_count IS \'The number of L2 caches on the package, usually the same as the number of cores\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.l2_size IS \'The size of each Level 2 cache in KB\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.l3_count IS \'The number of L3 caches on the package\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.l3_size IS \'The size of each Level 3 cache in KB\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.l1_data_count IS \'The number of L1 data caches on the package, usually the same as the number of cores\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.l1_code_count IS \'The number of L1 instruction caches on the package, usually the same as the number of cores\''); - $this->addSql('COMMENT ON COLUMN collection.cpu.l1_unified_count IS \'The number of L1 caches on the package, usually the same as the number of cores\''); + $this->addSql("COMMENT ON COLUMN collection.cpu.lot_number IS 'The CPU lot number, such as s-spec for Intel CPUs'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.base_speed IS 'The stock speed of the cpu in MHz'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.boost_speed IS 'The max boost speed of the cpu in MHz, if applicable'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.igp IS 'The name of the integrated graphics processor'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.usable IS 'Whether the chip is working, and can be used with other hardware I have'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.received IS 'Whether I have the chip in my possession (instead of in shipping)'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.l1_data_size IS 'The size of each Level 1 data cache in KB'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.l1_code_size IS 'The size of each Level 1 instruction cache in KB'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.l1_unified_size IS 'The size of each Level 1 unified cache in KB'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.l2_count IS 'The number of L2 caches on the package, usually the same as the number of cores'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.l2_size IS 'The size of each Level 2 cache in KB'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.l3_count IS 'The number of L3 caches on the package'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.l3_size IS 'The size of each Level 3 cache in KB'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.l1_data_count IS 'The number of L1 data caches on the package, usually the same as the number of cores'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.l1_code_count IS 'The number of L1 instruction caches on the package, usually the same as the number of cores'"); + $this->addSql("COMMENT ON COLUMN collection.cpu.l1_unified_count IS 'The number of L1 caches on the package, usually the same as the number of cores'"); $this->addSql('CREATE TABLE collection.camera (id SERIAL NOT NULL, type_id INT NOT NULL, brand VARCHAR(64) NOT NULL, mount VARCHAR(32) NOT NULL, model VARCHAR(255) NOT NULL, is_digital BOOLEAN NOT NULL, crop_factor NUMERIC(10, 0) NOT NULL, is_working BOOLEAN NOT NULL, notes TEXT DEFAULT NULL, serial VARCHAR(20) NOT NULL, formerly_owned BOOLEAN NOT NULL, purchase_price MONEY DEFAULT NULL, battery_type VARCHAR(255) DEFAULT NULL, film_format VARCHAR(255) DEFAULT NULL, received BOOLEAN DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_8326CD6CC54C8C93 ON collection.camera (type_id)'); - $this->addSql('COMMENT ON COLUMN collection.camera.purchase_price IS \'(DC2Type:money)\''); + $this->addSql("COMMENT ON COLUMN collection.camera.purchase_price IS '(DC2Type:money)'"); $this->addSql('CREATE TABLE collection.previously_owned_camera (id SERIAL NOT NULL, type_id INT NOT NULL, brand VARCHAR(64) NOT NULL, mount VARCHAR(32) NOT NULL, model VARCHAR(255) NOT NULL, is_digital BOOLEAN NOT NULL, crop_factor NUMERIC(10, 0) NOT NULL, is_working BOOLEAN NOT NULL, notes TEXT DEFAULT NULL, serial VARCHAR(20) NOT NULL, formerly_owned BOOLEAN NOT NULL, purchase_price MONEY DEFAULT NULL, battery_type VARCHAR(255) DEFAULT NULL, film_format VARCHAR(255) DEFAULT NULL, received BOOLEAN DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_78B0E96CC54C8C93 ON collection.previously_owned_camera (type_id)'); - $this->addSql('COMMENT ON COLUMN collection.previously_owned_camera.purchase_price IS \'(DC2Type:money)\''); + $this->addSql("COMMENT ON COLUMN collection.previously_owned_camera.purchase_price IS '(DC2Type:money)'"); $this->addSql('CREATE TABLE collection.gpu_core (id SERIAL NOT NULL, brand_id INT NOT NULL, name VARCHAR(255) NOT NULL, variant VARCHAR(255) DEFAULT NULL, generation_name VARCHAR(255) DEFAULT NULL, architecture VARCHAR(255) DEFAULT NULL, process_node INT DEFAULT NULL, architecture_link VARCHAR(255) DEFAULT NULL, generation_link VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX IDX_EE59217D44F5D008 ON collection.gpu_core (brand_id)'); - $this->addSql('CREATE TABLE collection.gpu (id SERIAL NOT NULL, board_brand_id INT DEFAULT NULL, gpu_brand_id INT NOT NULL, gpu_core_id INT DEFAULT NULL, reference_model_name VARCHAR(255) NOT NULL, alternate_model_name VARCHAR(255) DEFAULT NULL, notes TEXT DEFAULT NULL, count INT DEFAULT 1 NOT NULL, molex_power INT DEFAULT 0 NOT NULL, pcie_6_pin INT DEFAULT 0 NOT NULL, pcie_8_pin INT DEFAULT 0 NOT NULL, card_key VARCHAR(255) DEFAULT \'PCIe x16\' NOT NULL, tdp INT DEFAULT NULL, link VARCHAR(255) DEFAULT NULL, bus_interface VARCHAR(255) DEFAULT NULL, slot_span INT DEFAULT 1 NOT NULL, base_clock INT DEFAULT NULL, boost_clock INT DEFAULT NULL, memory_clock INT DEFAULT NULL, memory_size INT DEFAULT NULL, memory_bus INT DEFAULT NULL, memory_type VARCHAR(255) DEFAULT NULL, shading_units INT DEFAULT NULL, tmus INT DEFAULT NULL, rops INT DEFAULT NULL, compute_units INT DEFAULT NULL, l1_cache VARCHAR(255) DEFAULT NULL, l2_cache VARCHAR(255) DEFAULT NULL, direct_x_support VARCHAR(255) DEFAULT NULL, opengl_support VARCHAR(255) DEFAULT NULL, opencl_support VARCHAR(255) DEFAULT NULL, vulkan_support VARCHAR(255) DEFAULT NULL, shader_model VARCHAR(255) DEFAULT NULL, acquired BOOLEAN DEFAULT true NOT NULL, PRIMARY KEY(id))'); + $this->addSql("CREATE TABLE collection.gpu (id SERIAL NOT NULL, board_brand_id INT DEFAULT NULL, gpu_brand_id INT NOT NULL, gpu_core_id INT DEFAULT NULL, reference_model_name VARCHAR(255) NOT NULL, alternate_model_name VARCHAR(255) DEFAULT NULL, notes TEXT DEFAULT NULL, count INT DEFAULT 1 NOT NULL, molex_power INT DEFAULT 0 NOT NULL, pcie_6_pin INT DEFAULT 0 NOT NULL, pcie_8_pin INT DEFAULT 0 NOT NULL, card_key VARCHAR(255) DEFAULT 'PCIe x16' NOT NULL, tdp INT DEFAULT NULL, link VARCHAR(255) DEFAULT NULL, bus_interface VARCHAR(255) DEFAULT NULL, slot_span INT DEFAULT 1 NOT NULL, base_clock INT DEFAULT NULL, boost_clock INT DEFAULT NULL, memory_clock INT DEFAULT NULL, memory_size INT DEFAULT NULL, memory_bus INT DEFAULT NULL, memory_type VARCHAR(255) DEFAULT NULL, shading_units INT DEFAULT NULL, tmus INT DEFAULT NULL, rops INT DEFAULT NULL, compute_units INT DEFAULT NULL, l1_cache VARCHAR(255) DEFAULT NULL, l2_cache VARCHAR(255) DEFAULT NULL, direct_x_support VARCHAR(255) DEFAULT NULL, opengl_support VARCHAR(255) DEFAULT NULL, opencl_support VARCHAR(255) DEFAULT NULL, vulkan_support VARCHAR(255) DEFAULT NULL, shader_model VARCHAR(255) DEFAULT NULL, acquired BOOLEAN DEFAULT true NOT NULL, PRIMARY KEY(id))"); $this->addSql('CREATE INDEX IDX_C683906FD402D3B1 ON collection.gpu (board_brand_id)'); $this->addSql('CREATE INDEX IDX_C683906F4561DE01 ON collection.gpu (gpu_brand_id)'); $this->addSql('CREATE INDEX IDX_C683906F87059374 ON collection.gpu (gpu_core_id)'); - $this->addSql('COMMENT ON COLUMN collection.gpu.card_key IS \'The shape of the card connector\''); - $this->addSql('COMMENT ON COLUMN collection.gpu.tdp IS \'Thermal Design Power (in Watts)\''); - $this->addSql('COMMENT ON COLUMN collection.gpu.bus_interface IS \'The type of electrical bus this card uses\''); - $this->addSql('COMMENT ON COLUMN collection.gpu.slot_span IS \'How many expansion slots the card occupies\''); - $this->addSql('COMMENT ON COLUMN collection.gpu.base_clock IS \'Base speed of the gpu core, in MHz\''); - $this->addSql('COMMENT ON COLUMN collection.gpu.boost_clock IS \'GPU core boost clock, in MHz\''); - $this->addSql('COMMENT ON COLUMN collection.gpu.memory_clock IS \'Clock speed of the VRAM, in MHz\''); - $this->addSql('COMMENT ON COLUMN collection.gpu.memory_size IS \'VRAM size, in MiB\''); - $this->addSql('COMMENT ON COLUMN collection.gpu.memory_bus IS \'The width of the memory bus in bits\''); + $this->addSql("COMMENT ON COLUMN collection.gpu.card_key IS 'The shape of the card connector'"); + $this->addSql("COMMENT ON COLUMN collection.gpu.tdp IS 'Thermal Design Power (in Watts)'"); + $this->addSql("COMMENT ON COLUMN collection.gpu.bus_interface IS 'The type of electrical bus this card uses'"); + $this->addSql("COMMENT ON COLUMN collection.gpu.slot_span IS 'How many expansion slots the card occupies'"); + $this->addSql("COMMENT ON COLUMN collection.gpu.base_clock IS 'Base speed of the gpu core, in MHz'"); + $this->addSql("COMMENT ON COLUMN collection.gpu.boost_clock IS 'GPU core boost clock, in MHz'"); + $this->addSql("COMMENT ON COLUMN collection.gpu.memory_clock IS 'Clock speed of the VRAM, in MHz'"); + $this->addSql("COMMENT ON COLUMN collection.gpu.memory_size IS 'VRAM size, in MiB'"); + $this->addSql("COMMENT ON COLUMN collection.gpu.memory_bus IS 'The width of the memory bus in bits'"); } public function down(Schema $schema): void diff --git a/src/Resources/crud/templates/index.tpl.php b/src/Resources/crud/templates/index.tpl.php index 495b6aa..f4fcb1c 100644 --- a/src/Resources/crud/templates/index.tpl.php +++ b/src/Resources/crud/templates/index.tpl.php @@ -43,7 +43,7 @@ {% else %} - no records found + no records found {% endfor %} diff --git a/tools/rector.php b/tools/rector.php index 66348dd..c47aa8d 100644 --- a/tools/rector.php +++ b/tools/rector.php @@ -2,84 +2,80 @@ use Rector\CodeQuality\Rector\BooleanNot\SimplifyDeMorganBinaryRector; use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector; -use Rector\CodeQuality\Rector\For_\{ForRepeatedCountToOwnVariableRector, ForToForeachRector}; +use Rector\CodeQuality\Rector\For_\{ForRepeatedCountToOwnVariableRector}; use Rector\CodeQuality\Rector\If_\{ConsecutiveNullCompareReturnsToNullCoalesceQueueRector, SimplifyIfElseToTernaryRector, SimplifyIfReturnBoolRector}; -use Rector\CodeQuality\Rector\Ternary\{SimplifyDuplicatedTernaryRector, SimplifyTautologyTernaryRector, SwitchNegatedTernaryRector}; +use Rector\CodeQuality\Rector\Ternary\{SimplifyTautologyTernaryRector, SwitchNegatedTernaryRector}; +use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector; use Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector; use Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector; -use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector; +use Rector\CodingStyle\Rector\ClassMethod\{NewlineBeforeNewAssignSetRector}; use Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector; -use Rector\CodingStyle\Rector\FuncCall\{CallUserFuncArrayToVariadicRector, CallUserFuncToMethodCallRector, CountArrayToEmptyArrayComparisonRector}; -use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector; -use Rector\Core\Configuration\Option; +use Rector\CodingStyle\Rector\FuncCall\{CallUserFuncArrayToVariadicRector, CallUserFuncToMethodCallRector, CountArrayToEmptyArrayComparisonRector, VersionCompareFuncCallToConstantRector}; +use Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector; +use Rector\Config\RectorConfig; use Rector\DeadCode\Rector\ClassMethod\{RemoveUselessParamTagRector, RemoveUselessReturnTagRector}; use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector; use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector; use Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector; -use Rector\Doctrine\Set\DoctrineSetList; use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector; use Rector\EarlyReturn\Rector\If_\{ChangeIfElseValueAssignToEarlyReturnRector, RemoveAlwaysElseRector}; +use Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector; +use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; -use Rector\Restoration\Rector\Property\MakeTypedPropertyNullableIfCheckedRector; +use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; use Rector\Symfony\Set\{SymfonyLevelSetList, SymfonySetList}; -use Rector\TypeDeclaration\Rector\ClassMethod\{AddArrayParamDocTypeRector, AddArrayReturnDocTypeRector, AddMethodCallBasedStrictParamTypeRector, ParamTypeByMethodCallTypeRector, ParamTypeByParentCallTypeRector}; +use Rector\TypeDeclaration\Rector\ClassMethod\{AddMethodCallBasedStrictParamTypeRector, ParamTypeByMethodCallTypeRector, ParamTypeByParentCallTypeRector}; use Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector; use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector; -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; -require_once __DIR__ . '/common.inc.php'; +return static function (RectorConfig $config): void { + $config->importShortClasses(FALSE); -return static function (ContainerConfigurator $config): void { - $parameters = $config->parameters(); - $parameters->set(Option::AUTO_IMPORT_NAMES, TRUE); - $parameters->set(Option::IMPORT_SHORT_CLASSES, TRUE); - $parameters->set(Option::SKIP, [ - ReadOnlyPropertyRector::class, - ]); + $config->sets([ + LevelSetList::UP_TO_PHP_82, + PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES, + PHPUnitSetList::PHPUNIT_100, + SymfonyLevelSetList::UP_TO_SYMFONY_60, + ]); - walk_array([$config, 'import'], [ - DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES, - LevelSetList::UP_TO_PHP_81, - SymfonyLevelSetList::UP_TO_SYMFONY_60, - SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES, - ]); + $config->rules([ + AddArrayDefaultToArrayPropertyRector::class, + AddClosureReturnTypeRector::class, + AddMethodCallBasedStrictParamTypeRector::class, + CallUserFuncArrayToVariadicRector::class, + CallUserFuncToMethodCallRector::class, + ChangeIfElseValueAssignToEarlyReturnRector::class, + ChangeNestedForeachIfsToEarlyContinueRector::class, + CompleteDynamicPropertiesRector::class, + ConsecutiveNullCompareReturnsToNullCoalesceQueueRector::class, + CountArrayToEmptyArrayComparisonRector::class, + ForRepeatedCountToOwnVariableRector::class, + NewlineBeforeNewAssignSetRector::class, + ParamTypeByMethodCallTypeRector::class, + ParamTypeByParentCallTypeRector::class, + RemoveAlwaysElseRector::class, + RemoveDuplicatedCaseInSwitchRector::class, + RemoveFinalFromConstRector::class, + RemoveUnusedForeachKeyRector::class, + RemoveUselessParamTagRector::class, + RemoveUselessReturnTagRector::class, + RemoveUselessVarTagRector::class, + SimplifyDeMorganBinaryRector::class, + SimplifyIfElseToTernaryRector::class, + SimplifyIfReturnBoolRector::class, + SimplifyTautologyTernaryRector::class, + StaticArrowFunctionRector::class, + SwitchNegatedTernaryRector::class, + SymplifyQuoteEscapeRector::class, + TypedPropertyFromAssignsRector::class, + VersionCompareFuncCallToConstantRector::class, + WrapEncapsedVariableInCurlyBracesRector::class, + ]); - $services = $config->services(); - walk_array([$services, 'set'], [ - SimplifyDeMorganBinaryRector::class, - CompleteDynamicPropertiesRector::class, - ForRepeatedCountToOwnVariableRector::class, - ForToForeachRector::class, - ConsecutiveNullCompareReturnsToNullCoalesceQueueRector::class, - SimplifyIfElseToTernaryRector::class, - SimplifyIfReturnBoolRector::class, - SimplifyDuplicatedTernaryRector::class, - SimplifyTautologyTernaryRector::class, - SwitchNegatedTernaryRector::class, - AddArrayDefaultToArrayPropertyRector::class, - RemoveFinalFromConstRector::class, - NewlineBeforeNewAssignSetRector::class, - WrapEncapsedVariableInCurlyBracesRector::class, - CallUserFuncArrayToVariadicRector::class, - CallUserFuncToMethodCallRector::class, - CountArrayToEmptyArrayComparisonRector::class, - NewlineAfterStatementRector::class, - RemoveUselessParamTagRector::class, - RemoveUselessReturnTagRector::class, - RemoveUnusedForeachKeyRector::class, - RemoveUselessVarTagRector::class, - RemoveDuplicatedCaseInSwitchRector::class, - ChangeNestedForeachIfsToEarlyContinueRector::class, - ChangeIfElseValueAssignToEarlyReturnRector::class, - RemoveAlwaysElseRector::class, - MakeTypedPropertyNullableIfCheckedRector::class, - AddArrayParamDocTypeRector::class, - AddArrayReturnDocTypeRector::class, - AddMethodCallBasedStrictParamTypeRector::class, - ParamTypeByMethodCallTypeRector::class, - ParamTypeByParentCallTypeRector::class, - AddClosureReturnTypeRector::class, - TypedPropertyFromAssignsRector::class, - ]); + $config->skip([ + NullToStrictStringFuncCallArgRector::class, + ReadOnlyPropertyRector::class, + RestoreDefaultNullToNullableTypePropertyRector::class, + ]); };