From 185aa7860181744ba594336fd1ac8cd75c52c272 Mon Sep 17 00:00:00 2001 From: Colin Viebrock Date: Wed, 30 Oct 2024 17:09:03 -0500 Subject: [PATCH] Various updates for new admin and site packages, and some phpstan fixes --- Store/Store.php | 7 -- Store/StoreArticlePageFactory.php | 7 +- Store/StoreCartLightbox.php | 2 + Store/StoreItemsView.php | 2 + Store/StorePageFactory.php | 2 +- Store/StorePayPalPaymentProvider.php | 6 +- Store/StoreShipmentMethod.php | 7 +- Store/StoreStatusList.php | 24 +++--- Store/StoreVoucherRow.php | 2 + Store/StoreXMLRPCServerFactory.php | 2 +- .../components/Account/AddressDelete.php | 2 +- .../admin/components/Account/AddressEdit.php | 4 +- Store/admin/components/Account/Details.php | 9 ++- .../Account/PaymentMethodDelete.php | 2 +- .../components/Account/PaymentMethodEdit.php | 2 +- Store/admin/components/Ad/Details.php | 4 +- Store/admin/components/Ad/Index.php | 2 +- Store/admin/components/Article/Edit.php | 2 +- Store/admin/components/Attribute/Delete.php | 2 +- Store/admin/components/Attribute/Edit.php | 4 +- Store/admin/components/Attribute/Index.php | 2 +- .../admin/components/AttributeType/Delete.php | 2 +- Store/admin/components/AttributeType/Edit.php | 4 +- .../admin/components/AttributeType/Index.php | 4 +- Store/admin/components/Catalog/Clone.php | 2 +- Store/admin/components/Catalog/Delete.php | 2 +- Store/admin/components/Catalog/Edit.php | 6 +- Store/admin/components/Catalog/Index.php | 2 +- Store/admin/components/Catalog/Status.php | 2 +- .../StoreCatalogStatusCellRenderer.php | 2 +- .../admin/components/Category/AddProducts.php | 2 +- .../components/Category/ChangeItemStatus.php | 5 +- Store/admin/components/Category/Delete.php | 2 +- Store/admin/components/Category/Edit.php | 4 +- .../components/Category/FeaturedProducts.php | 2 +- .../admin/components/Category/ImageDelete.php | 2 +- Store/admin/components/Category/ImageEdit.php | 14 ++-- Store/admin/components/Category/Index.php | 11 +-- .../components/Category/RelatedArticles.php | 2 +- .../components/Category/RemoveProducts.php | 2 +- .../components/Category/SetItemEnabled.php | 3 +- Store/admin/components/Country/Delete.php | 2 +- Store/admin/components/Country/Edit.php | 4 +- Store/admin/components/Country/Index.php | 2 +- Store/admin/components/Dashboard/Index.php | 5 +- Store/admin/components/Feature/Delete.php | 2 +- Store/admin/components/Feature/Edit.php | 16 ++-- Store/admin/components/Feature/Index.php | 4 +- Store/admin/components/Item/Delete.php | 2 +- Store/admin/components/Item/Edit.php | 4 +- .../components/Item/QuantityDiscount.php | 2 +- .../Item/QuantityDiscountDelete.php | 2 +- Store/admin/components/ItemGroup/Delete.php | 2 +- Store/admin/components/ItemGroup/Edit.php | 2 +- .../ItemMinimumQuantityGroup/Delete.php | 2 +- .../ItemMinimumQuantityGroup/Edit.php | 4 +- .../ItemMinimumQuantityGroup/Index.php | 2 +- Store/admin/components/Locale/Delete.php | 2 +- Store/admin/components/Locale/Edit.php | 4 +- Store/admin/components/Locale/Index.php | 2 +- Store/admin/components/Order/Cancel.php | 2 +- Store/admin/components/Order/CommentEdit.php | 2 +- .../components/Order/EmailConfirmation.php | 2 +- Store/admin/components/Order/Index.php | 2 +- Store/admin/components/Order/NoteEdit.php | 2 +- Store/admin/components/PaymentType/Delete.php | 2 +- Store/admin/components/PaymentType/Edit.php | 4 +- Store/admin/components/PaymentType/Index.php | 2 +- Store/admin/components/PriceRange/Delete.php | 2 +- Store/admin/components/PriceRange/Edit.php | 4 +- Store/admin/components/PriceRange/Index.php | 2 +- Store/admin/components/Product/Delete.php | 2 +- Store/admin/components/Product/Details.php | 13 ++-- Store/admin/components/Product/Edit.php | 4 +- .../admin/components/Product/ImageDelete.php | 2 +- Store/admin/components/Product/ImageEdit.php | 13 ++-- Store/admin/components/Product/Index.php | 2 +- .../components/Product/ProductCollection.php | 2 +- .../Product/ProductCollectionDelete.php | 2 +- .../components/Product/QueueAttributes.php | 2 +- .../components/Product/RelatedArticles.php | 2 +- .../components/Product/RelatedProduct.php | 2 +- .../Product/RelatedProductDelete.php | 2 +- Store/admin/components/ProvState/Delete.php | 2 +- Store/admin/components/ProvState/Edit.php | 2 +- Store/admin/components/ProvState/Index.php | 2 +- Store/admin/components/Region/Delete.php | 2 +- Store/admin/components/Region/Edit.php | 2 +- Store/admin/components/Region/Index.php | 4 +- .../admin/components/SaleDiscount/Delete.php | 2 +- Store/admin/components/SaleDiscount/Edit.php | 4 +- Store/admin/components/SaleDiscount/Index.php | 2 +- .../SalesByRegionReport/Details.php | 4 +- .../components/SalesByRegionReport/Index.php | 2 +- .../admin/components/SalesReport/Details.php | 6 +- Store/admin/components/SalesReport/Index.php | 2 +- .../admin/components/ShippingType/Delete.php | 2 +- .../admin/components/ShippingType/Details.php | 2 +- Store/admin/components/ShippingType/Edit.php | 2 +- Store/admin/components/ShippingType/Index.php | 2 +- .../components/ShippingType/RateDelete.php | 2 +- .../components/ShippingType/RateEdit.php | 4 +- Store/dataobjects/StoreAddress.php | 2 +- Store/dataobjects/StoreProduct.php | 2 +- Store/pages/StoreCategoryNotVisiblePage.php | 2 +- Store/pages/StoreCheckoutAddressPage.php | 23 +++++- .../StoreCheckoutAddressVerificationPage.php | 2 +- Store/pages/StoreCheckoutEditPage.php | 1 + Store/pages/StoreProductImagePage.php | 1 + Store/pages/StoreProductNotVisiblePage.php | 2 +- Store/pages/StoreSearchResultsPage.php | 74 ------------------- Store/pages/StoreXmlSiteMapPage.php | 2 - Store/views/StoreBlorgPostSearchView.php | 21 ------ composer.json | 30 +++++++- phpstan.neon | 8 ++ 115 files changed, 244 insertions(+), 286 deletions(-) delete mode 100644 Store/views/StoreBlorgPostSearchView.php create mode 100644 phpstan.neon diff --git a/Store/Store.php b/Store/Store.php index 82e8ae9fd..cdd2a344f 100644 --- a/Store/Store.php +++ b/Store/Store.php @@ -162,13 +162,6 @@ public static function init() SiteViewFactory::addPath('Store/views'); - if (class_exists('Blorg')) { - SiteViewFactory::registerView( - 'post-search', - 'StoreBlorgPostSearchView' - ); - } - self::$is_initialized = true; } diff --git a/Store/StoreArticlePageFactory.php b/Store/StoreArticlePageFactory.php index a86a3a8f9..d0b108b12 100644 --- a/Store/StoreArticlePageFactory.php +++ b/Store/StoreArticlePageFactory.php @@ -25,7 +25,7 @@ public function __construct(SiteApplication $app) // }}} // {{{ protected function isVisible() - protected function isVisible(SiteArticle $article, $source) + protected function isVisible(SiteArticle $article, $source): bool { $region = $this->app->getRegion(); $sql = sprintf('select count(id) from EnabledArticleView @@ -51,7 +51,8 @@ protected function isVisible(SiteArticle $article, $source) protected function getNotVisiblePage( SiteArticle $article, SiteLayout $layout - ) { + ): SitePage + { $page = new SitePage($this->app, $layout); $page = $this->decorate($page, 'StoreArticleNotVisiblePage'); $page->setArticle($article); @@ -69,7 +70,7 @@ protected function getNotVisiblePage( * @return SiteArticle the specified article or null if no such article * exists. */ - protected function getArticle($path) + protected function getArticle($path): SiteArticle { $article = parent::getArticle($path); $article->setRegion($this->app->getRegion()); diff --git a/Store/StoreCartLightbox.php b/Store/StoreCartLightbox.php index ac40e1d6d..485d7e4ce 100644 --- a/Store/StoreCartLightbox.php +++ b/Store/StoreCartLightbox.php @@ -48,6 +48,8 @@ class StoreCartLightbox extends SwatControl */ protected $app; + private ?StoreCartProcessor $processor = null; + /** * @var SwatUI */ diff --git a/Store/StoreItemsView.php b/Store/StoreItemsView.php index 8336ba30d..245bfe2d0 100644 --- a/Store/StoreItemsView.php +++ b/Store/StoreItemsView.php @@ -28,6 +28,8 @@ class StoreItemsView extends SwatControl protected $has_description = false; + protected string $source; + /** * @var boolean */ diff --git a/Store/StorePageFactory.php b/Store/StorePageFactory.php index f7694ed37..4f4037435 100644 --- a/Store/StorePageFactory.php +++ b/Store/StorePageFactory.php @@ -24,7 +24,7 @@ public function __construct(SiteApplication $app) // }}} // {{{ public function resolvePage() - public function resolvePage($source, SiteLayout $layout = null) + public function resolvePage($source, SiteLayout $layout = null): SiteAbstractPage { $layout = ($layout === null) ? $this->resolveLayout($source) : $layout; diff --git a/Store/StorePayPalPaymentProvider.php b/Store/StorePayPalPaymentProvider.php index bc28e279b..2b683f13c 100644 --- a/Store/StorePayPalPaymentProvider.php +++ b/Store/StorePayPalPaymentProvider.php @@ -117,7 +117,7 @@ public function __construct(array $parameters = array()) $valid_modes = array('live', 'sandbox'); if (!in_array($parameters['mode'], $valid_modes)) { - throw new StoreException('Mode "'.$mode.'" is not valid for '. + throw new StoreException('Mode "'.$parameters['mode'].'" is not valid for '. 'the PayPal payment provider.'); } @@ -830,7 +830,7 @@ public function formatString($string, $max_length = 0) // truncate to max_length if ($max_length > 0) { - $string = mb_mb_substr($string, 0, $max_length); + $string = mb_substr($string, 0, $max_length); } return $string; @@ -1475,7 +1475,7 @@ protected function getCreditCardType(StoreOrderPaymentMethod $payment_method) break; default: - throw new StorePaymentException('Unsupported card type in order.'); + throw new StorePaymentCardTypeException('Unsupported card type in order.'); } return $type; diff --git a/Store/StoreShipmentMethod.php b/Store/StoreShipmentMethod.php index a4e57babf..31634bc66 100644 --- a/Store/StoreShipmentMethod.php +++ b/Store/StoreShipmentMethod.php @@ -14,11 +14,12 @@ class StoreShipmentMethod /** * An approximation of how long it takes to ship items with this method. * - * @return DateInterval the approximate time it will take to deliver a - * shipment using this method. + * @return ?DateInterval the approximate time it will take to deliver a + * shipment using this method, or null. */ - public function getTimeToDeliver($address) + public function getTimeToDeliver($address): ?DateInterval { + return null; } // }}} diff --git a/Store/StoreStatusList.php b/Store/StoreStatusList.php index 16aba7f34..db4b80cab 100644 --- a/Store/StoreStatusList.php +++ b/Store/StoreStatusList.php @@ -17,10 +17,8 @@ abstract class StoreStatusList extends SwatObject implements Iterator, Countable /** * Index value used to implement the iterator interface for this list - * - * @var integer */ - private $current_index = 0; + private int $current_index = 0; // }}} // {{{ protected properties @@ -97,7 +95,7 @@ public function getByShortname($shortname) * * @return mixed the current status. */ - public function current() + public function current(): mixed { return $this->statuses[$this->current_index]; } @@ -108,9 +106,9 @@ public function current() /** * Returns the key of the current status * - * @return integer the key of the current status + * @return int the key of the current status */ - public function key() + public function key(): int { return $this->current_index; } @@ -121,7 +119,7 @@ public function key() /** * Moves forward to the next status */ - public function next() + public function next(): void { $this->current_index++; } @@ -143,7 +141,7 @@ public function prev() /** * Rewinds this iterator to the first status */ - public function rewind() + public function rewind(): void { $this->current_index = 0; } @@ -154,10 +152,10 @@ public function rewind() /** * Checks is there is a current status after calls to rewind() and next() * - * @return boolean true if there is a current status and false if there - * is not. + * @return bool true if there is a current status and false if there + * is not. */ - public function valid() + public function valid(): bool { return isset($this->statuses[$this->current_index]); } @@ -170,9 +168,9 @@ public function valid() * * This satisfies the Countable interface. * - * @return integer the number of statuses in this list. + * @return int the number of statuses in this list. */ - public function count() + public function count(): int { return count($this->statuses); } diff --git a/Store/StoreVoucherRow.php b/Store/StoreVoucherRow.php index 5f1816b44..c5de4d6f3 100644 --- a/Store/StoreVoucherRow.php +++ b/Store/StoreVoucherRow.php @@ -10,6 +10,8 @@ class StoreVoucherRow extends StoreTotalRow { // {{{ public function __construct() + protected SwatButton $remove_button; + public function __construct() { parent::__construct(); diff --git a/Store/StoreXMLRPCServerFactory.php b/Store/StoreXMLRPCServerFactory.php index a34980635..d6062e5b4 100644 --- a/Store/StoreXMLRPCServerFactory.php +++ b/Store/StoreXMLRPCServerFactory.php @@ -19,7 +19,7 @@ public function __construct(SiteApplication $app) // }}} // {{{ protected function getPageMap() - protected function getPageMap() + protected function getPageMap(): array { return array( 'search-panel' => 'StoreSearchPanelServer', diff --git a/Store/admin/components/Account/AddressDelete.php b/Store/admin/components/Account/AddressDelete.php index fdb54dcc0..e97fafb1d 100644 --- a/Store/admin/components/Account/AddressDelete.php +++ b/Store/admin/components/Account/AddressDelete.php @@ -19,7 +19,7 @@ class StoreAccountAddressDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Account/AddressEdit.php b/Store/admin/components/Account/AddressEdit.php index 79e55d8ad..748422776 100644 --- a/Store/admin/components/Account/AddressEdit.php +++ b/Store/admin/components/Account/AddressEdit.php @@ -189,7 +189,7 @@ protected function getCountry() // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $values = $this->getUIValues(); @@ -263,7 +263,7 @@ protected function getUIValues() // }}} // {{{ protected function validate() - protected function validate() + protected function validate(): void { $provstate = $this->ui->getWidget('provstate'); $country = $this->ui->getWidget('country'); diff --git a/Store/admin/components/Account/Details.php b/Store/admin/components/Account/Details.php index cf89a7d09..5c26f10b4 100644 --- a/Store/admin/components/Account/Details.php +++ b/Store/admin/components/Account/Details.php @@ -105,7 +105,7 @@ protected function setTimeZone() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): ?SwatTableModel { switch ($view->id) { case 'orders_view': @@ -115,12 +115,13 @@ protected function getTableModel(SwatView $view) case 'payment_methods_view': return $this->getPaymentMethodsTableModel($view); } + return null; } // }}} // {{{ protected function getOrdersTableModel() - protected function getOrdersTableModel(SwatTableView $view) + protected function getOrdersTableModel(SwatTableView $view): SwatDBDefaultRecordsetWrapper { $sql = 'select Orders.id, Orders.account as account_id, @@ -143,7 +144,7 @@ protected function getOrdersTableModel(SwatTableView $view) // }}} // {{{ protected function getAddressesTableModel() - protected function getAddressesTableModel(SwatTableView $view) + protected function getAddressesTableModel(SwatTableView $view): SwatTableStore { $account = $this->getAccount(); $billing_id = $account->getInternalValue('default_billing_address'); @@ -167,7 +168,7 @@ protected function getAddressesTableModel(SwatTableView $view) // }}} // {{{ protected function getPaymentMethodsTableModel() - protected function getPaymentMethodsTableModel(SwatTableView $view) + protected function getPaymentMethodsTableModel(SwatTableView $view): SwatTableStore { $wrapper = SwatDBClassMap::get('StoreAccountPaymentMethodWrapper'); diff --git a/Store/admin/components/Account/PaymentMethodDelete.php b/Store/admin/components/Account/PaymentMethodDelete.php index 75fda738a..db58b7e28 100644 --- a/Store/admin/components/Account/PaymentMethodDelete.php +++ b/Store/admin/components/Account/PaymentMethodDelete.php @@ -19,7 +19,7 @@ class StoreAccountPaymentMethodDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Account/PaymentMethodEdit.php b/Store/admin/components/Account/PaymentMethodEdit.php index e9ae41bf2..cecf2e5cc 100644 --- a/Store/admin/components/Account/PaymentMethodEdit.php +++ b/Store/admin/components/Account/PaymentMethodEdit.php @@ -81,7 +81,7 @@ protected function getPaymentMethod() // process phase // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $payment_method = $this->getPaymentMethod(); $payment_method->payment_type = diff --git a/Store/admin/components/Ad/Details.php b/Store/admin/components/Ad/Details.php index 385c70ced..84869432a 100644 --- a/Store/admin/components/Ad/Details.php +++ b/Store/admin/components/Ad/Details.php @@ -35,7 +35,7 @@ protected function getUiXml() // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): ?SwatTableModel { switch ($view->id) { case 'orders_view': @@ -48,7 +48,7 @@ protected function getTableModel(SwatView $view) // }}} // {{{ protected function getOrdersTableModel() - protected function getOrdersTableModel() + protected function getOrdersTableModel(): SwatTableStore { $regions = $this->queryRegions(); $this->appendRegionColumns($regions); diff --git a/Store/admin/components/Ad/Index.php b/Store/admin/components/Ad/Index.php index 6795bad80..accddebf1 100644 --- a/Store/admin/components/Ad/Index.php +++ b/Store/admin/components/Ad/Index.php @@ -24,7 +24,7 @@ protected function getUiXml() // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $sql = sprintf('select Ad.*, coalesce(OrderCountByAdView.order_count, 0) as order_count, diff --git a/Store/admin/components/Article/Edit.php b/Store/admin/components/Article/Edit.php index ea86893c4..8861b5dfb 100644 --- a/Store/admin/components/Article/Edit.php +++ b/Store/admin/components/Article/Edit.php @@ -32,7 +32,7 @@ protected function getUiXml() // process phase // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { parent::saveDBData(); diff --git a/Store/admin/components/Attribute/Delete.php b/Store/admin/components/Attribute/Delete.php index 8a895812c..2948f41f5 100644 --- a/Store/admin/components/Attribute/Delete.php +++ b/Store/admin/components/Attribute/Delete.php @@ -12,7 +12,7 @@ class StoreAttributeDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Attribute/Edit.php b/Store/admin/components/Attribute/Edit.php index cadd4c7e2..c0560f0ee 100644 --- a/Store/admin/components/Attribute/Edit.php +++ b/Store/admin/components/Attribute/Edit.php @@ -75,7 +75,7 @@ protected function getUiXml() // process phase // {{{ protected function validate() - protected function validate() + protected function validate(): void { $shortname = $this->ui->getWidget('shortname'); @@ -97,7 +97,7 @@ protected function validate() // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateAttribute(); $this->attribute->save(); diff --git a/Store/admin/components/Attribute/Index.php b/Store/admin/components/Attribute/Index.php index 99aae2085..15cdd531d 100644 --- a/Store/admin/components/Attribute/Index.php +++ b/Store/admin/components/Attribute/Index.php @@ -43,7 +43,7 @@ protected function processActions(SwatView $view, SwatActions $actions) // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatTableStore { $sql = sprintf('select Attribute.* from Attribute diff --git a/Store/admin/components/AttributeType/Delete.php b/Store/admin/components/AttributeType/Delete.php index 38675be51..a6c68106a 100644 --- a/Store/admin/components/AttributeType/Delete.php +++ b/Store/admin/components/AttributeType/Delete.php @@ -12,7 +12,7 @@ class StoreAttributeTypeDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/AttributeType/Edit.php b/Store/admin/components/AttributeType/Edit.php index 84a8eec0c..4bf3f396f 100644 --- a/Store/admin/components/AttributeType/Edit.php +++ b/Store/admin/components/AttributeType/Edit.php @@ -53,7 +53,7 @@ protected function initAttributeType() // process phase // {{{ protected function validate() - protected function validate() + protected function validate(): void { $shortname = $this->ui->getWidget('shortname'); @@ -74,7 +74,7 @@ protected function validate() // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateAttributeType(); $this->attribute_type->save(); diff --git a/Store/admin/components/AttributeType/Index.php b/Store/admin/components/AttributeType/Index.php index a273d40a6..adae23bf6 100644 --- a/Store/admin/components/AttributeType/Index.php +++ b/Store/admin/components/AttributeType/Index.php @@ -43,11 +43,11 @@ protected function processActions(SwatView $view, SwatActions $actions) // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): StoreAttributeTypeWrapper { $sql = 'select * from AttributeType order by shortname'; - $rs = SwatDB::query($this->app->db, $sql, 'StoreAttributeTypeWrapper'); + $rs = SwatDB::query($this->app->db, $sql, StoreAttributeTypeWrapper::class); return $rs; } diff --git a/Store/admin/components/Catalog/Clone.php b/Store/admin/components/Catalog/Clone.php index e0b675abe..592da3be1 100644 --- a/Store/admin/components/Catalog/Clone.php +++ b/Store/admin/components/Catalog/Clone.php @@ -33,7 +33,7 @@ protected function getUiXml() // process phase // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $title = $this->ui->getWidget('title')->value; diff --git a/Store/admin/components/Catalog/Delete.php b/Store/admin/components/Catalog/Delete.php index 118bd428c..b7dc83996 100644 --- a/Store/admin/components/Catalog/Delete.php +++ b/Store/admin/components/Catalog/Delete.php @@ -14,7 +14,7 @@ class StoreCatalogDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Catalog/Edit.php b/Store/admin/components/Catalog/Edit.php index 1f2551243..ac1072266 100644 --- a/Store/admin/components/Catalog/Edit.php +++ b/Store/admin/components/Catalog/Edit.php @@ -9,6 +9,8 @@ */ class StoreCatalogEdit extends AdminDBEdit { + protected StoreCatalog $catalog; + // init phase // {{{ protected function initInternal() @@ -27,7 +29,7 @@ protected function initInternal() protected function initCatalog() { - $class_name = SwatDBClassMap::get('StoreCatalog'); + $class_name = SwatDBClassMap::get(StoreCatalog::class); $this->catalog = new $class_name(); $this->catalog->setDatabase($this->app->db); @@ -52,7 +54,7 @@ protected function getUiXml() // process phase // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateCatalog(); $this->catalog->save(); diff --git a/Store/admin/components/Catalog/Index.php b/Store/admin/components/Catalog/Index.php index 52c62762c..355ab781c 100644 --- a/Store/admin/components/Catalog/Index.php +++ b/Store/admin/components/Catalog/Index.php @@ -64,7 +64,7 @@ protected function getUiXml() // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { /* * This dynamic SQL is needed to make the table orderable by the diff --git a/Store/admin/components/Catalog/Status.php b/Store/admin/components/Catalog/Status.php index 3f8a2871d..8b67202ab 100644 --- a/Store/admin/components/Catalog/Status.php +++ b/Store/admin/components/Catalog/Status.php @@ -69,7 +69,7 @@ protected function getUiXml() // process phase // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $region_list = $this->ui->getWidget('regions'); SwatDB::updateBinding($this->app->db, 'CatalogRegionBinding', diff --git a/Store/admin/components/Catalog/include/StoreCatalogStatusCellRenderer.php b/Store/admin/components/Catalog/include/StoreCatalogStatusCellRenderer.php index a90f51fec..825f25d10 100644 --- a/Store/admin/components/Catalog/include/StoreCatalogStatusCellRenderer.php +++ b/Store/admin/components/Catalog/include/StoreCatalogStatusCellRenderer.php @@ -60,7 +60,7 @@ public function render() echo SwatString::toList($region_titles); } else { - $span_tag = new SwatHtmLTag('span'); + $span_tag = new SwatHtmlTag('span'); $span_tag->class = 'swat-null-text-cell-renderer'; $span_tag->setContent(sprintf('<%s>', Store::_('no regions'))); $span_tag->display(); diff --git a/Store/admin/components/Category/AddProducts.php b/Store/admin/components/Category/AddProducts.php index 8cde8fda3..6bdc23892 100644 --- a/Store/admin/components/Category/AddProducts.php +++ b/Store/admin/components/Category/AddProducts.php @@ -135,7 +135,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $search = $this->getProductSearch(); diff --git a/Store/admin/components/Category/ChangeItemStatus.php b/Store/admin/components/Category/ChangeItemStatus.php index 14ca49367..f0835ba3b 100644 --- a/Store/admin/components/Category/ChangeItemStatus.php +++ b/Store/admin/components/Category/ChangeItemStatus.php @@ -18,6 +18,7 @@ class StoreCategoryChangeItemStatus extends AdminDBConfirmation * @var StoreItemStatus */ private $status; + private StoreCatalogSwitcher $catalog_switcher; // }}} // {{{ public function setCategory() @@ -56,7 +57,7 @@ protected function initInternal() // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); @@ -152,7 +153,7 @@ private function getItemQuerySQL() $sql = 'select distinct Item.id from Item inner join Product on Product.id = Item.product - inner join CategoryProductBinding on + inner join CategoryProductBinding on CategoryProductBinding.product = Product.id inner join getCategoryDescendants(null) as category_descendants on diff --git a/Store/admin/components/Category/Delete.php b/Store/admin/components/Category/Delete.php index a0558c99e..c35bc70be 100644 --- a/Store/admin/components/Category/Delete.php +++ b/Store/admin/components/Category/Delete.php @@ -31,7 +31,7 @@ protected function processInternal() // }}} // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Category/Edit.php b/Store/admin/components/Category/Edit.php index dec3fb887..287658eb5 100644 --- a/Store/admin/components/Category/Edit.php +++ b/Store/admin/components/Category/Edit.php @@ -65,7 +65,7 @@ protected function getUiXml() // process phase // {{{ protected function validate() - protected function validate() + protected function validate(): void { $shortname = $this->ui->getWidget('shortname')->value; @@ -106,7 +106,7 @@ protected function validateShortname($shortname) // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateCategory(); diff --git a/Store/admin/components/Category/FeaturedProducts.php b/Store/admin/components/Category/FeaturedProducts.php index 42fd158c5..d5bffe251 100644 --- a/Store/admin/components/Category/FeaturedProducts.php +++ b/Store/admin/components/Category/FeaturedProducts.php @@ -112,7 +112,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $sql = 'select distinct Product.id, Product.title from Product diff --git a/Store/admin/components/Category/ImageDelete.php b/Store/admin/components/Category/ImageDelete.php index 1da1dadb7..505750f32 100644 --- a/Store/admin/components/Category/ImageDelete.php +++ b/Store/admin/components/Category/ImageDelete.php @@ -49,7 +49,7 @@ protected function getUiXml() // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Category/ImageEdit.php b/Store/admin/components/Category/ImageEdit.php index d43e00fff..68b4e0c21 100644 --- a/Store/admin/components/Category/ImageEdit.php +++ b/Store/admin/components/Category/ImageEdit.php @@ -146,24 +146,20 @@ protected function getUiXml() * * @returns boolean */ - protected function validate() + protected function validate(): void { - $valid = true; - $automatic = $this->ui->getWidget('original_image'); if ($automatic->isUploaded()) { - $valid = true; - } elseif ($this->id === null && !$this->checkManualUploads()) { + return; + } + if ($this->id === null && !$this->checkManualUploads()) { $message = new SwatMessage(Store::_('You need to specify all '. 'image sizes when creating a new image or upload an image to '. 'be automatically resized.'), 'error'); $this->ui->getWidget('message')->add($message); - $valid = false; } - - return $valid; } // }}} @@ -183,7 +179,7 @@ protected function checkManualUploads() // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->processImage(); $this->category->image = $this->image; diff --git a/Store/admin/components/Category/Index.php b/Store/admin/components/Category/Index.php index 53a7c666c..f90aac8bc 100644 --- a/Store/admin/components/Category/Index.php +++ b/Store/admin/components/Category/Index.php @@ -1044,7 +1044,7 @@ public function buildActions() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): ?SwatDBDefaultRecordsetWrapper { switch ($view->id) { case 'categories_index_view': @@ -1056,6 +1056,7 @@ protected function getTableModel(SwatView $view) case 'related_articles_index_view': return $this->getRelatedArticleTableModel($view); } + return null; } // }}} @@ -1217,7 +1218,7 @@ private function buildCategoryNavBar($category) // build phase - table views // {{{ protected function getCategoryTableModel() - protected function getCategoryTableModel(SwatTableView $view) + protected function getCategoryTableModel(SwatTableView $view): SwatDBDefaultRecordsetWrapper { $sql = 'select Category.id, Category.title, @@ -1255,7 +1256,7 @@ protected function getCategoryTableModel(SwatTableView $view) // }}} // {{{ protected function getProductTableModel() - protected function getProductTableModel(SwatTableView $view) + protected function getProductTableModel(SwatTableView $view): SwatDBDefaultRecordsetWrapper { $sql = 'select Product.id, Product.title, @@ -1381,7 +1382,7 @@ protected function setProductVisibility(SwatTableModel $model) // }}} // {{{ private function getFeaturedProductTableModel() - private function getFeaturedProductTableModel(SwatTableView $view) + private function getFeaturedProductTableModel(SwatTableView $view): SwatDBDefaultRecordsetWrapper { $sql = 'select Product.id, Product.title, @@ -1411,7 +1412,7 @@ private function getFeaturedProductTableModel(SwatTableView $view) // }}} // {{{ private function getRelatedArticleTableModel() - private function getRelatedArticleTableModel(SwatTableView $view) + private function getRelatedArticleTableModel(SwatTableView $view): SwatDBDefaultRecordsetWrapper { $sql = 'select Article.id, Article.title diff --git a/Store/admin/components/Category/RelatedArticles.php b/Store/admin/components/Category/RelatedArticles.php index d2d2eeab4..e5215a647 100644 --- a/Store/admin/components/Category/RelatedArticles.php +++ b/Store/admin/components/Category/RelatedArticles.php @@ -123,7 +123,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $sql = sprintf('select count(id) from Article where %s', $this->getWhereClause()); diff --git a/Store/admin/components/Category/RemoveProducts.php b/Store/admin/components/Category/RemoveProducts.php index 0c2e95b70..684994f56 100644 --- a/Store/admin/components/Category/RemoveProducts.php +++ b/Store/admin/components/Category/RemoveProducts.php @@ -37,7 +37,7 @@ protected function initInternal() // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Category/SetItemEnabled.php b/Store/admin/components/Category/SetItemEnabled.php index cbad3f590..2fa24ace9 100644 --- a/Store/admin/components/Category/SetItemEnabled.php +++ b/Store/admin/components/Category/SetItemEnabled.php @@ -14,6 +14,7 @@ class StoreCategorySetItemEnabled extends AdminDBConfirmation private $category_id; private $enabled; private $region = null; + private StoreCatalogSwitcher $catalog_switcher; // }}} // {{{ public function setCategory() @@ -61,7 +62,7 @@ protected function initInternal() // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Country/Delete.php b/Store/admin/components/Country/Delete.php index 18face4fc..56af860d9 100644 --- a/Store/admin/components/Country/Delete.php +++ b/Store/admin/components/Country/Delete.php @@ -12,7 +12,7 @@ class StoreCountryDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Country/Edit.php b/Store/admin/components/Country/Edit.php index e278f0ef5..46d15d05b 100644 --- a/Store/admin/components/Country/Edit.php +++ b/Store/admin/components/Country/Edit.php @@ -49,7 +49,7 @@ protected function getUiXml() // process phase // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $values = $this->getUIValues(); @@ -72,7 +72,7 @@ protected function saveDBData() // }}} // {{{ protected function validate() - protected function validate() + protected function validate(): void { // validate country id if ($this->id === null) { diff --git a/Store/admin/components/Country/Index.php b/Store/admin/components/Country/Index.php index 212c71f50..53af026c9 100644 --- a/Store/admin/components/Country/Index.php +++ b/Store/admin/components/Country/Index.php @@ -43,7 +43,7 @@ protected function processActions(SwatView $view, SwatActions $actions) // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $sql = sprintf('select id, title, visible from Country order by %s', $this->getOrderByClause($view, 'title')); diff --git a/Store/admin/components/Dashboard/Index.php b/Store/admin/components/Dashboard/Index.php index 45cb1bd54..cf835fd68 100644 --- a/Store/admin/components/Dashboard/Index.php +++ b/Store/admin/components/Dashboard/Index.php @@ -140,12 +140,13 @@ protected function buildOrders() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): ?SwatTableStore { switch ($view->id) { case 'new_content_view': return $this->getNewContentTableModel($view); } + return null; } // }}} @@ -153,7 +154,7 @@ protected function getTableModel(SwatView $view) // new content table // {{{ protected function getNewContentTableModel() - protected function getNewContentTableModel(SwatView $view) + protected function getNewContentTableModel(SwatView $view): SwatTableStore { $this->buildNewContentData(); $this->buildNewContentNote(); diff --git a/Store/admin/components/Feature/Delete.php b/Store/admin/components/Feature/Delete.php index 5edf6aa66..5c3567226 100644 --- a/Store/admin/components/Feature/Delete.php +++ b/Store/admin/components/Feature/Delete.php @@ -12,7 +12,7 @@ class StoreFeatureDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Feature/Edit.php b/Store/admin/components/Feature/Edit.php index 9d117482c..38f09a836 100644 --- a/Store/admin/components/Feature/Edit.php +++ b/Store/admin/components/Feature/Edit.php @@ -70,16 +70,18 @@ private function initFeature() // process phase // {{{ protected function validate() - protected function validate() + protected function validate(): void { - $valid = parent::validate(); + parent::validate(); $start_date = $this->ui->getWidget('start_date')->value; $end_date = $this->ui->getWidget('end_date')->value; - if ($start_date !== null && $end_date !== null && - SwatDate::compare($start_date, $end_date) > 0) { - $valid = false; + if ( + $start_date !== null + && $end_date !== null + && SwatDate::compare($start_date, $end_date) > 0 + ) { $message = new SwatMessage( 'The dates entered are not a valid set of dates. '. 'The date entered in the Start Date '. @@ -96,8 +98,6 @@ protected function validate() $this->ui->getWidget('start_date_field')->display_messages = false; $this->ui->getWidget('end_date_field')->display_messages = false; } - - return $valid; } // }}} @@ -149,7 +149,7 @@ protected function updateFeature() // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateFeature(); $this->feature->save(); diff --git a/Store/admin/components/Feature/Index.php b/Store/admin/components/Feature/Index.php index b18a7a92b..7ec5b7db8 100644 --- a/Store/admin/components/Feature/Index.php +++ b/Store/admin/components/Feature/Index.php @@ -110,7 +110,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatTableStore { $instance_where = ($this->app->getInstanceId() === null) ? '1 = 1' : @@ -129,7 +129,7 @@ protected function getTableModel(SwatView $view) $instance_where ); - $wrapper = SwatDBClassMap::get('StoreFeatureWrapper'); + $wrapper = SwatDBClassMap::get(StoreFeatureWrapper::class); $features = SwatDB::query($this->app->db, $sql, $wrapper); $store = new SwatTableStore(); diff --git a/Store/admin/components/Item/Delete.php b/Store/admin/components/Item/Delete.php index a5b43ba4d..7f55e3252 100644 --- a/Store/admin/components/Item/Delete.php +++ b/Store/admin/components/Item/Delete.php @@ -12,7 +12,7 @@ class StoreItemDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Item/Edit.php b/Store/admin/components/Item/Edit.php index 28015476c..75569321e 100644 --- a/Store/admin/components/Item/Edit.php +++ b/Store/admin/components/Item/Edit.php @@ -175,7 +175,7 @@ protected function processPriceReplicatorByRegion( // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateItem(); $this->item->save(); @@ -227,7 +227,7 @@ protected function updateItem() // }}} // {{{ protected function validate() - protected function validate() + protected function validate(): void { $sql = sprintf( 'select catalog from Product where id = %s', diff --git a/Store/admin/components/Item/QuantityDiscount.php b/Store/admin/components/Item/QuantityDiscount.php index e89a1b35d..0d6e95750 100644 --- a/Store/admin/components/Item/QuantityDiscount.php +++ b/Store/admin/components/Item/QuantityDiscount.php @@ -442,7 +442,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $regions = $this->queryRegions(); diff --git a/Store/admin/components/Item/QuantityDiscountDelete.php b/Store/admin/components/Item/QuantityDiscountDelete.php index 83d0f3e68..26d943c61 100644 --- a/Store/admin/components/Item/QuantityDiscountDelete.php +++ b/Store/admin/components/Item/QuantityDiscountDelete.php @@ -26,7 +26,7 @@ public function setRelocateURL($url) // process phaes // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/ItemGroup/Delete.php b/Store/admin/components/ItemGroup/Delete.php index b2504a0ce..43ed896ad 100644 --- a/Store/admin/components/ItemGroup/Delete.php +++ b/Store/admin/components/ItemGroup/Delete.php @@ -29,7 +29,7 @@ protected function initInternal() // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/ItemGroup/Edit.php b/Store/admin/components/ItemGroup/Edit.php index c78f82053..0fccf1468 100644 --- a/Store/admin/components/ItemGroup/Edit.php +++ b/Store/admin/components/ItemGroup/Edit.php @@ -58,7 +58,7 @@ protected function getUiXml() // process phase // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateItemGroup(); $this->item_group->save(); diff --git a/Store/admin/components/ItemMinimumQuantityGroup/Delete.php b/Store/admin/components/ItemMinimumQuantityGroup/Delete.php index 24e736d02..057f4597c 100644 --- a/Store/admin/components/ItemMinimumQuantityGroup/Delete.php +++ b/Store/admin/components/ItemMinimumQuantityGroup/Delete.php @@ -12,7 +12,7 @@ class StoreItemMinimumQuantityGroupDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/ItemMinimumQuantityGroup/Edit.php b/Store/admin/components/ItemMinimumQuantityGroup/Edit.php index fe47a323a..9ecca7799 100644 --- a/Store/admin/components/ItemMinimumQuantityGroup/Edit.php +++ b/Store/admin/components/ItemMinimumQuantityGroup/Edit.php @@ -52,7 +52,7 @@ protected function initItemMinimumQuantityGroup() // process phase // {{{ protected function validate() - protected function validate() + protected function validate(): void { $shortname = $this->ui->getWidget('shortname'); $title = $this->ui->getWidget('title'); @@ -91,7 +91,7 @@ protected function validateShortname($shortname) // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateItemMinimumQuantityGroup(); $this->item_group->save(); diff --git a/Store/admin/components/ItemMinimumQuantityGroup/Index.php b/Store/admin/components/ItemMinimumQuantityGroup/Index.php index ba5df014a..b32149fed 100644 --- a/Store/admin/components/ItemMinimumQuantityGroup/Index.php +++ b/Store/admin/components/ItemMinimumQuantityGroup/Index.php @@ -45,7 +45,7 @@ protected function processActions(SwatView $view, SwatActions $actions) // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $sql = sprintf('select id, title, shortname from ItemMinimumQuantityGroup order by %s', diff --git a/Store/admin/components/Locale/Delete.php b/Store/admin/components/Locale/Delete.php index d594cee19..28a79d325 100644 --- a/Store/admin/components/Locale/Delete.php +++ b/Store/admin/components/Locale/Delete.php @@ -12,7 +12,7 @@ class StoreLocaleDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); $item_list = $this->getItemList('text'); diff --git a/Store/admin/components/Locale/Edit.php b/Store/admin/components/Locale/Edit.php index 2c3c2962c..d00cb6c68 100644 --- a/Store/admin/components/Locale/Edit.php +++ b/Store/admin/components/Locale/Edit.php @@ -48,7 +48,7 @@ protected function initLocale() // process phase // {{{ protected function validate() - protected function validate() + protected function validate(): void { $localeid = $this->ui->getWidget('id'); @@ -65,7 +65,7 @@ protected function validate() // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateLocale(); $this->locale->save(); diff --git a/Store/admin/components/Locale/Index.php b/Store/admin/components/Locale/Index.php index 98fec7d52..fa04fcaa1 100644 --- a/Store/admin/components/Locale/Index.php +++ b/Store/admin/components/Locale/Index.php @@ -43,7 +43,7 @@ protected function processActions(SwatView $view, SwatActions $actions) // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $sql = 'select Locale.id, Region.title as region_title from Locale diff --git a/Store/admin/components/Order/Cancel.php b/Store/admin/components/Order/Cancel.php index d76d71b0d..d5403dd34 100644 --- a/Store/admin/components/Order/Cancel.php +++ b/Store/admin/components/Order/Cancel.php @@ -69,7 +69,7 @@ protected function initOrder() // process phase // {{{ protected function processResponse() - protected function processResponse() + protected function processResponse(): void { $form = $this->ui->getWidget('confirmation_form'); diff --git a/Store/admin/components/Order/CommentEdit.php b/Store/admin/components/Order/CommentEdit.php index 4655e32e3..591ab262f 100644 --- a/Store/admin/components/Order/CommentEdit.php +++ b/Store/admin/components/Order/CommentEdit.php @@ -74,7 +74,7 @@ protected function getOrder() // process phase // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $values = $this->ui->getValues(array('admin_comments')); diff --git a/Store/admin/components/Order/EmailConfirmation.php b/Store/admin/components/Order/EmailConfirmation.php index ee1c3428f..3cff1082e 100644 --- a/Store/admin/components/Order/EmailConfirmation.php +++ b/Store/admin/components/Order/EmailConfirmation.php @@ -73,7 +73,7 @@ protected function getOrder() // process phase // {{{ protected function processResponse() - protected function processResponse() + protected function processResponse(): void { $form = $this->ui->getWidget('confirmation_form'); diff --git a/Store/admin/components/Order/Index.php b/Store/admin/components/Order/Index.php index d0278cae6..fb063a084 100644 --- a/Store/admin/components/Order/Index.php +++ b/Store/admin/components/Order/Index.php @@ -380,7 +380,7 @@ protected function getJoinClauses() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatTableStore { $sql = 'select count(Orders.id) from Orders %s where %s'; diff --git a/Store/admin/components/Order/NoteEdit.php b/Store/admin/components/Order/NoteEdit.php index 31e4ffb5e..f137c9a1a 100644 --- a/Store/admin/components/Order/NoteEdit.php +++ b/Store/admin/components/Order/NoteEdit.php @@ -74,7 +74,7 @@ protected function getOrder() // process phase // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $values = $this->ui->getValues(array('notes')); diff --git a/Store/admin/components/PaymentType/Delete.php b/Store/admin/components/PaymentType/Delete.php index ac9e8ef57..339d6724e 100644 --- a/Store/admin/components/PaymentType/Delete.php +++ b/Store/admin/components/PaymentType/Delete.php @@ -12,7 +12,7 @@ class StorePaymentTypeDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/PaymentType/Edit.php b/Store/admin/components/PaymentType/Edit.php index 3dc7648af..8d021d72b 100644 --- a/Store/admin/components/PaymentType/Edit.php +++ b/Store/admin/components/PaymentType/Edit.php @@ -59,7 +59,7 @@ protected function initPaymentType() // process phase // {{{ protected function validate() - protected function validate() + protected function validate(): void { $shortname = $this->ui->getWidget('shortname'); $title = $this->ui->getWidget('title'); @@ -98,7 +98,7 @@ protected function validateShortname($shortname) // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updatePaymentType(); $this->payment_type->save(); diff --git a/Store/admin/components/PaymentType/Index.php b/Store/admin/components/PaymentType/Index.php index 2d5abdd6c..8c505918a 100644 --- a/Store/admin/components/PaymentType/Index.php +++ b/Store/admin/components/PaymentType/Index.php @@ -123,7 +123,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $sql = sprintf('select id, title, shortname from PaymentType order by %s', diff --git a/Store/admin/components/PriceRange/Delete.php b/Store/admin/components/PriceRange/Delete.php index 035defb4d..591341c1d 100644 --- a/Store/admin/components/PriceRange/Delete.php +++ b/Store/admin/components/PriceRange/Delete.php @@ -12,7 +12,7 @@ class StorePriceRangeDelete extends AdminDBDelete // process phase // {{{ protected funtion processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/PriceRange/Edit.php b/Store/admin/components/PriceRange/Edit.php index c2eb6f99e..4db61bde1 100644 --- a/Store/admin/components/PriceRange/Edit.php +++ b/Store/admin/components/PriceRange/Edit.php @@ -61,7 +61,7 @@ protected function getUiXml() // process phase // {{{ protected function validate() - protected function validate() + protected function validate(): void { $start_price = floor($this->ui->getWidget('start_price')->value); $end_price = floor($this->ui->getWidget('end_price')->value); @@ -75,7 +75,7 @@ protected function validate() // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updatePriceRange(); $this->price_range->save(); diff --git a/Store/admin/components/PriceRange/Index.php b/Store/admin/components/PriceRange/Index.php index cf4e6b156..7249b2cfd 100644 --- a/Store/admin/components/PriceRange/Index.php +++ b/Store/admin/components/PriceRange/Index.php @@ -51,7 +51,7 @@ protected function processActions(SwatView $view, SwatActions $actions) // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatTableStore { $sql = 'select * from PriceRange order by %s'; diff --git a/Store/admin/components/Product/Delete.php b/Store/admin/components/Product/Delete.php index 947828f6e..10bcf2f7b 100644 --- a/Store/admin/components/Product/Delete.php +++ b/Store/admin/components/Product/Delete.php @@ -44,7 +44,7 @@ protected function initInternal() // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Product/Details.php b/Store/admin/components/Product/Details.php index 7c9ccd21f..abf5eabe3 100644 --- a/Store/admin/components/Product/Details.php +++ b/Store/admin/components/Product/Details.php @@ -586,7 +586,7 @@ protected function buildForms() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): ?SwatTableModel { switch ($view->id) { case 'items_view': @@ -598,6 +598,7 @@ protected function getTableModel(SwatView $view) case 'related_articles_view': return $this->getRelatedArticlesTableModel($view); } + return null; } // }}} @@ -902,7 +903,7 @@ protected function buildStatusList() // }}} // {{{ protected function getItemsTableModel() - protected function getItemsTableModel(SwatTableView $view) + protected function getItemsTableModel(SwatTableView $view): SwatTableStore { $sql = $this->getItemsSql($view); $items = SwatDB::query($this->app->db, $sql, @@ -1187,7 +1188,7 @@ private function appendPriceColumns(SwatTableView $view, $regions) // add input cells if view has an input row if ($view->getFirstRowByClass('SwatTableViewInputRow') !== null) { - $cell = new SwatInputcell(); + $cell = new SwatInputCell(); $cell->setWidget($money_entry); $column->setInputCell($cell); @@ -1271,7 +1272,7 @@ private function buildRelatedProducts() // }}} // {{{ private function getRelatedProductsTableModel() - private function getRelatedProductsTableModel(SwatTableView $view) + private function getRelatedProductsTableModel(SwatTableView $view): SwatDBDefaultRecordsetWrapper { $sql = 'select id, title from Product @@ -1308,7 +1309,7 @@ private function buildProductCollections() // }}} // {{{ private function getProductCollectionsTableModel() - private function getProductCollectionsTableModel(SwatTableView $view) + private function getProductCollectionsTableModel(SwatTableView $view): SwatDBDefaultRecordsetWrapper { $sql = 'select id, title from Product @@ -1345,7 +1346,7 @@ private function buildRelatedArticles() // }}} // {{{ private function getRelatedArticlesTableModel() - private function getRelatedArticlesTableModel(SwatTableView $view) + private function getRelatedArticlesTableModel(SwatTableView $view): SwatDBDefaultRecordsetWrapper { $sql = 'select Article.id, Article.title diff --git a/Store/admin/components/Product/Edit.php b/Store/admin/components/Product/Edit.php index 0eb24bd18..f4394edb9 100644 --- a/Store/admin/components/Product/Edit.php +++ b/Store/admin/components/Product/Edit.php @@ -138,7 +138,7 @@ protected function getUiXml() // process phase // {{{ protected function validate() - protected function validate() + protected function validate(): void { $shortname = $this->ui->getWidget('shortname'); $title = $this->ui->getWidget('title'); @@ -224,7 +224,7 @@ protected function validateShortname($shortname) // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateProduct(); $this->product->save(); diff --git a/Store/admin/components/Product/ImageDelete.php b/Store/admin/components/Product/ImageDelete.php index 2edb7a22d..3bdaa7af8 100644 --- a/Store/admin/components/Product/ImageDelete.php +++ b/Store/admin/components/Product/ImageDelete.php @@ -78,7 +78,7 @@ protected function getUiXml() // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Product/ImageEdit.php b/Store/admin/components/Product/ImageEdit.php index fd8e75c89..a6c71b6e3 100644 --- a/Store/admin/components/Product/ImageEdit.php +++ b/Store/admin/components/Product/ImageEdit.php @@ -156,14 +156,13 @@ protected function getUiXml() * * @returns boolean */ - protected function validate() + protected function validate(): void { - $valid = true; - $automatic = $this->ui->getWidget('original_image'); if ($automatic->isUploaded()) { - $valid = true; - } elseif ($this->id === null && !$this->checkManualUploads()) { + return; + } + if ($this->id === null && !$this->checkManualUploads()) { $message = new SwatMessage(Store::_('You need to specify all '. 'image sizes when creating a new image or upload an image to '. 'be automatically resized.'), @@ -172,8 +171,6 @@ protected function validate() $this->ui->getWidget('message')->add($message); $valid = false; } - - return $valid; } // }}} @@ -193,7 +190,7 @@ protected function checkManualUploads() // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->processImage(); $values = $this->ui->getValues(array('title', 'border', 'description')); diff --git a/Store/admin/components/Product/Index.php b/Store/admin/components/Product/Index.php index a364dbe80..5a1bee75c 100644 --- a/Store/admin/components/Product/Index.php +++ b/Store/admin/components/Product/Index.php @@ -522,7 +522,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $search = $this->getProductSearch(); diff --git a/Store/admin/components/Product/ProductCollection.php b/Store/admin/components/Product/ProductCollection.php index 8f4d25569..f4d3f95dd 100644 --- a/Store/admin/components/Product/ProductCollection.php +++ b/Store/admin/components/Product/ProductCollection.php @@ -177,7 +177,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $search = $this->getProductSearch(); diff --git a/Store/admin/components/Product/ProductCollectionDelete.php b/Store/admin/components/Product/ProductCollectionDelete.php index d70c3419f..3c9812375 100644 --- a/Store/admin/components/Product/ProductCollectionDelete.php +++ b/Store/admin/components/Product/ProductCollectionDelete.php @@ -54,7 +54,7 @@ protected function initInternal() // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Product/QueueAttributes.php b/Store/admin/components/Product/QueueAttributes.php index f6ce607b9..94bf5d742 100644 --- a/Store/admin/components/Product/QueueAttributes.php +++ b/Store/admin/components/Product/QueueAttributes.php @@ -117,7 +117,7 @@ public function process() // }}} // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Product/RelatedArticles.php b/Store/admin/components/Product/RelatedArticles.php index 9a73ef026..7cc726edd 100644 --- a/Store/admin/components/Product/RelatedArticles.php +++ b/Store/admin/components/Product/RelatedArticles.php @@ -141,7 +141,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $sql = sprintf('select count(id) from Article where %s', $this->getWhereClause()); diff --git a/Store/admin/components/Product/RelatedProduct.php b/Store/admin/components/Product/RelatedProduct.php index 3e15ec00c..fee9df7a0 100644 --- a/Store/admin/components/Product/RelatedProduct.php +++ b/Store/admin/components/Product/RelatedProduct.php @@ -154,7 +154,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $search = $this->getProductSearch(); diff --git a/Store/admin/components/Product/RelatedProductDelete.php b/Store/admin/components/Product/RelatedProductDelete.php index be4e7017b..4f3e842ab 100644 --- a/Store/admin/components/Product/RelatedProductDelete.php +++ b/Store/admin/components/Product/RelatedProductDelete.php @@ -54,7 +54,7 @@ protected function initInternal() // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/ProvState/Delete.php b/Store/admin/components/ProvState/Delete.php index 366f1566b..ee5e64370 100644 --- a/Store/admin/components/ProvState/Delete.php +++ b/Store/admin/components/ProvState/Delete.php @@ -12,7 +12,7 @@ class StoreProvStateDelete extends AdminDBDelete // process phase // {{{ protected funtion processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/ProvState/Edit.php b/Store/admin/components/ProvState/Edit.php index 56bcb7760..7cd8ff449 100644 --- a/Store/admin/components/ProvState/Edit.php +++ b/Store/admin/components/ProvState/Edit.php @@ -63,7 +63,7 @@ protected function getUiXml() // process phase // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateProvState(); $this->prov_state->save(); diff --git a/Store/admin/components/ProvState/Index.php b/Store/admin/components/ProvState/Index.php index 8486dc112..75f741de0 100644 --- a/Store/admin/components/ProvState/Index.php +++ b/Store/admin/components/ProvState/Index.php @@ -48,7 +48,7 @@ protected function processActions(SwatView $view, SwatActions $actions) // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatDBDefaultRecordsetWrapper { $sql = 'select ProvState.id, ProvState.title, Country.title as country_title, ProvState.abbreviation diff --git a/Store/admin/components/Region/Delete.php b/Store/admin/components/Region/Delete.php index 217e693d4..c08bc83e8 100644 --- a/Store/admin/components/Region/Delete.php +++ b/Store/admin/components/Region/Delete.php @@ -12,7 +12,7 @@ class StoreRegionDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/Region/Edit.php b/Store/admin/components/Region/Edit.php index 7711e67a1..f5c4a14c6 100644 --- a/Store/admin/components/Region/Edit.php +++ b/Store/admin/components/Region/Edit.php @@ -66,7 +66,7 @@ protected function initRegion() // process phase // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $values = $this->ui->getValues(array('title')); $this->region->title = $values['title']; diff --git a/Store/admin/components/Region/Index.php b/Store/admin/components/Region/Index.php index fcaebaef4..197e6b3d3 100644 --- a/Store/admin/components/Region/Index.php +++ b/Store/admin/components/Region/Index.php @@ -43,12 +43,12 @@ protected function processActions(SwatView $view, SwatActions $actions) // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): StoreRegionWrapper { $sql = sprintf('select id, title from Region order by %s', $this->getOrderByClause($view, 'title')); - $regions = SwatDB::query($this->app->db, $sql, 'StoreRegionWrapper'); + $regions = SwatDB::query($this->app->db, $sql, StoreRegionWrapper::class); return $regions; } diff --git a/Store/admin/components/SaleDiscount/Delete.php b/Store/admin/components/SaleDiscount/Delete.php index d5033c61d..afcfcf757 100644 --- a/Store/admin/components/SaleDiscount/Delete.php +++ b/Store/admin/components/SaleDiscount/Delete.php @@ -12,7 +12,7 @@ class StoreSaleDiscountDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/SaleDiscount/Edit.php b/Store/admin/components/SaleDiscount/Edit.php index 0bf6734fd..d6317cc4f 100644 --- a/Store/admin/components/SaleDiscount/Edit.php +++ b/Store/admin/components/SaleDiscount/Edit.php @@ -58,7 +58,7 @@ protected function getUiXml() // process phase // {{{ protected function validate() - protected function validate() + protected function validate(): void { $shortname = $this->ui->getWidget('shortname')->value; @@ -98,7 +98,7 @@ protected function validateShortname($shortname) // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateSaleDiscount(); $this->sale_discount->save(); diff --git a/Store/admin/components/SaleDiscount/Index.php b/Store/admin/components/SaleDiscount/Index.php index 7389ec3a4..fd67d2ea2 100644 --- a/Store/admin/components/SaleDiscount/Index.php +++ b/Store/admin/components/SaleDiscount/Index.php @@ -72,7 +72,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): ?SwatTableModel { $sql = 'select SaleDiscount.* from SaleDiscount diff --git a/Store/admin/components/SalesByRegionReport/Details.php b/Store/admin/components/SalesByRegionReport/Details.php index b115ff969..976a385e4 100644 --- a/Store/admin/components/SalesByRegionReport/Details.php +++ b/Store/admin/components/SalesByRegionReport/Details.php @@ -84,7 +84,7 @@ protected function initInternal() throw new AdminNotFoundException( sprintf( 'Unable to load report for a year prior to “%s”', - $tax_start_date->getYear() + $this->taxation_start_date->getDate()->getYear() ) ); } @@ -146,7 +146,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatTableStore { $end_date = clone $this->start_date; $end_date->setDate( diff --git a/Store/admin/components/SalesByRegionReport/Index.php b/Store/admin/components/SalesByRegionReport/Index.php index 7b6eeb256..b32e8af75 100644 --- a/Store/admin/components/SalesByRegionReport/Index.php +++ b/Store/admin/components/SalesByRegionReport/Index.php @@ -85,7 +85,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): ?SwatTableModel { $now = new SwatDate(); $now->setTimezone($this->app->default_time_zone); diff --git a/Store/admin/components/SalesReport/Details.php b/Store/admin/components/SalesReport/Details.php index 6377f1411..c9256765a 100644 --- a/Store/admin/components/SalesReport/Details.php +++ b/Store/admin/components/SalesReport/Details.php @@ -78,7 +78,9 @@ protected function initStartDate($year, $month) $this->start_date = new SwatDate('now', $this->app->default_time_zone); if ($this->start_date->setDate($year, $month, 1) === false) { throw new AdminNotFoundException(sprintf( - 'Unable to load commission report with id of “%s”', $id)); + 'Unable to load commission report with year of “%s” and month of “%s”', + $year, $month + )); } } @@ -233,7 +235,7 @@ protected function buildInternal() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatTableStore { $regions = $this->getRegions(); $locale_id = $regions->getFirst()->getFirstLocale()->id; diff --git a/Store/admin/components/SalesReport/Index.php b/Store/admin/components/SalesReport/Index.php index 61069e96e..51877564a 100644 --- a/Store/admin/components/SalesReport/Index.php +++ b/Store/admin/components/SalesReport/Index.php @@ -151,7 +151,7 @@ protected function appendRegionColumns( // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatTableStore { $start_date = new SwatDate(); $start_date->setDate($this->year, 1, 1); diff --git a/Store/admin/components/ShippingType/Delete.php b/Store/admin/components/ShippingType/Delete.php index 997d36653..7d0317b21 100644 --- a/Store/admin/components/ShippingType/Delete.php +++ b/Store/admin/components/ShippingType/Delete.php @@ -12,7 +12,7 @@ class StoreShippingTypeDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/ShippingType/Details.php b/Store/admin/components/ShippingType/Details.php index d1c9853d0..febf987ee 100644 --- a/Store/admin/components/ShippingType/Details.php +++ b/Store/admin/components/ShippingType/Details.php @@ -97,7 +97,7 @@ protected function buildNavBar() // }}} // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): SwatTableStore { $sql = sprintf('select * from ShippingRate where shipping_type = %s order by region, threshold', diff --git a/Store/admin/components/ShippingType/Edit.php b/Store/admin/components/ShippingType/Edit.php index d64e471f1..24702efd8 100644 --- a/Store/admin/components/ShippingType/Edit.php +++ b/Store/admin/components/ShippingType/Edit.php @@ -77,7 +77,7 @@ protected function updateShippingType() // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateShippingType(); $this->shipping_type->save(); diff --git a/Store/admin/components/ShippingType/Index.php b/Store/admin/components/ShippingType/Index.php index f1cbb53a9..28ab326b5 100644 --- a/Store/admin/components/ShippingType/Index.php +++ b/Store/admin/components/ShippingType/Index.php @@ -36,7 +36,7 @@ protected function processActions(SwatView $view, SwatActions $actions) // build phase // {{{ protected function getTableModel() - protected function getTableModel(SwatView $view) + protected function getTableModel(SwatView $view): ?SwatTableModel { $sql = 'select * from ShippingType order by displayorder'; diff --git a/Store/admin/components/ShippingType/RateDelete.php b/Store/admin/components/ShippingType/RateDelete.php index 613dd3cd7..ad50c89b1 100644 --- a/Store/admin/components/ShippingType/RateDelete.php +++ b/Store/admin/components/ShippingType/RateDelete.php @@ -12,7 +12,7 @@ class StoreShippingTypeRateDelete extends AdminDBDelete // process phase // {{{ protected function processDBData() - protected function processDBData() + protected function processDBData(): void { parent::processDBData(); diff --git a/Store/admin/components/ShippingType/RateEdit.php b/Store/admin/components/ShippingType/RateEdit.php index 5c7899f4d..cb52e524f 100644 --- a/Store/admin/components/ShippingType/RateEdit.php +++ b/Store/admin/components/ShippingType/RateEdit.php @@ -74,7 +74,7 @@ protected function getUiXml() // process phase // {{{ protected function validate() - protected function validate() + protected function validate(): void { parent::validate(); @@ -97,7 +97,7 @@ protected function validate() // }}} // {{{ protected function saveDBData() - protected function saveDBData() + protected function saveDBData(): void { $this->updateShippingRate(); $this->shipping_rate->save(); diff --git a/Store/dataobjects/StoreAddress.php b/Store/dataobjects/StoreAddress.php index 9a5fd4f4f..09740b8ab 100644 --- a/Store/dataobjects/StoreAddress.php +++ b/Store/dataobjects/StoreAddress.php @@ -197,7 +197,7 @@ abstract class StoreAddress extends SwatDBDataObject 'CRT' => 'CT', 'CT' => 'CT', 'COURTS' => 'CTS', - 'CT' => 'CTS', + 'CTS' => 'CTS', 'COVE' => 'CV', 'CV' => 'CV', 'COVES' => 'CVS', diff --git a/Store/dataobjects/StoreProduct.php b/Store/dataobjects/StoreProduct.php index c0a676947..1b0581a36 100644 --- a/Store/dataobjects/StoreProduct.php +++ b/Store/dataobjects/StoreProduct.php @@ -876,7 +876,7 @@ public function displayAsTile($link, $image_size = 'thumb') $anchor_tag->close(); - $paragraph_tag = new SwatHtmltag('p'); + $paragraph_tag = new SwatHtmlTag('p'); $summary = SwatString::condense($this->bodytext, 200); $paragraph_tag->setContent($summary); $paragraph_tag->open(); diff --git a/Store/pages/StoreCategoryNotVisiblePage.php b/Store/pages/StoreCategoryNotVisiblePage.php index e5dcbfc53..0a6efc1c3 100644 --- a/Store/pages/StoreCategoryNotVisiblePage.php +++ b/Store/pages/StoreCategoryNotVisiblePage.php @@ -61,7 +61,7 @@ protected function getAvailableRegions() // }}} // {{{ protected function buildNavBar() - protected function buildNavBar() + protected function buildNavBar($link_prefix = '') { if (isset($this->layout->navbar)) $this->layout->navbar->createEntry('Store', 'store'); diff --git a/Store/pages/StoreCheckoutAddressPage.php b/Store/pages/StoreCheckoutAddressPage.php index c6b9aa75e..0196c5a7c 100644 --- a/Store/pages/StoreCheckoutAddressPage.php +++ b/Store/pages/StoreCheckoutAddressPage.php @@ -26,6 +26,8 @@ abstract class StoreCheckoutAddressPage extends StoreCheckoutEditPage */ protected $auto_complete; + protected bool $show_invalid_message = true; + // }}} // init phase @@ -245,12 +247,30 @@ protected function buildForm() } // }}} - // {{{ abstarct protected function getInlineJavaScript() + // {{{ protected function buildList() + + protected function buildList() + { + } + + // }}} + // {{{ protected function loadDataFromSession() + + protected function loadDataFromSession() + { + } + + // }}} + // {{{ abstract protected function getInlineJavaScript() abstract protected function getInlineJavaScript(); // }}} + // {{{ protected function saveDataToSession() + abstract protected function saveDataToSession(); + + // }}} // finalize phase // {{{ public function finalize() @@ -277,6 +297,7 @@ public function finalize() } // }}} + } ?> diff --git a/Store/pages/StoreCheckoutAddressVerificationPage.php b/Store/pages/StoreCheckoutAddressVerificationPage.php index 864eca7e9..66973b3c3 100644 --- a/Store/pages/StoreCheckoutAddressVerificationPage.php +++ b/Store/pages/StoreCheckoutAddressVerificationPage.php @@ -164,7 +164,7 @@ protected function buildList() ); echo '
'; printf( - SwatString::minizeEntities( + SwatString::minimizeEntities( Store::_( 'If there is a mistake, %splease return to the '. 'previous step%s to change the address, otherwise '. diff --git a/Store/pages/StoreCheckoutEditPage.php b/Store/pages/StoreCheckoutEditPage.php index ce1554b77..5ad627659 100644 --- a/Store/pages/StoreCheckoutEditPage.php +++ b/Store/pages/StoreCheckoutEditPage.php @@ -258,6 +258,7 @@ public function postBuildCommon() } // }}} + } ?> diff --git a/Store/pages/StoreProductImagePage.php b/Store/pages/StoreProductImagePage.php index 11dc4ef17..edbccd2c9 100644 --- a/Store/pages/StoreProductImagePage.php +++ b/Store/pages/StoreProductImagePage.php @@ -10,6 +10,7 @@ class StoreProductImagePage extends StorePage public $product_id; public $image_id; + public SwatToolLink $back_link; // }}} // {{{ protected properties diff --git a/Store/pages/StoreProductNotVisiblePage.php b/Store/pages/StoreProductNotVisiblePage.php index feb636efc..91777a8ac 100644 --- a/Store/pages/StoreProductNotVisiblePage.php +++ b/Store/pages/StoreProductNotVisiblePage.php @@ -60,7 +60,7 @@ protected function getAvailableRegions() // }}} // {{{ protected function buildNavBar() - protected function buildNavBar() + protected function buildNavBar($link_prefix = '') { if (!isset($this->layout->navbar)) return; diff --git a/Store/pages/StoreSearchResultsPage.php b/Store/pages/StoreSearchResultsPage.php index 35c9cfaa7..2c0a1e5d6 100644 --- a/Store/pages/StoreSearchResultsPage.php +++ b/Store/pages/StoreSearchResultsPage.php @@ -121,8 +121,6 @@ protected function buildResults() $this->buildArticles($fulltext_result); elseif ($type === 'product') $this->buildProducts($fulltext_result); - elseif (class_exists('Blorg') && $type === 'post') - $this->buildPosts($fulltext_result); $this->ui->getWidget('product_results_frame')->title = null; @@ -134,8 +132,6 @@ protected function buildResults() $this->buildCategories($fulltext_result); $this->buildProducts($fulltext_result); - if (class_exists('Blorg')) - $this->buildPosts($fulltext_result); } else { $this->buildProducts($fulltext_result); $this->ui->getWidget('product_results_frame')->title = null; @@ -239,76 +235,6 @@ protected function instantiateArticleSearchEngine() // }}} - // build phase - posts - // {{{ protected function buildPosts() - - protected function buildPosts($fulltext_result) - { - $pager = $this->ui->getWidget('post_pager'); - $engine = $this->instantiatePostSearchEngine(); - $engine->setFulltextResult($fulltext_result); - $posts = $engine->search($pager->page_size, $pager->current_record); - - $pager->total_records = $engine->getResultCount(); - $pager->link = $this->source; - - $this->result_count['post'] = count($posts); - - if (count($posts) > 0) { - $this->has_results[] = 'post'; - - $frame = $this->ui->getWidget('post_results_frame'); - $results = $this->ui->getWidget('post_results'); - $frame->visible = true; - - ob_start(); - $this->displayPosts($posts); - $results->content = ob_get_clean(); - } - } - - // }}} - // {{{ protected function instantiatePostSearchEngine() - - protected function instantiatePostSearchEngine() - { - $engine = new BlorgPostSearchEngine($this->app); - $this->setSearchEngine('post', $engine); - return $engine; - } - - // }}} - // {{{ protected function displayPosts() - - /** - * Displays search results for a collection of posts - * - * @param BlorgPostWrapper $posts the posts to display - * search results for. - */ - protected function displayPosts(BlorgPostWrapper $posts) - { - $view = SiteViewFactory::get($this->app, 'post-search'); - - $view->setPartMode('bodytext', SiteView::MODE_SUMMARY); - $view->setPartMode('extended_bodytext', SiteView::MODE_NONE); - $view->setPartMode('tags', SiteView::MODE_NONE); - $view->setPartMode('author', SiteView::MODE_NONE); - $view->setPartMode('comment_count', SiteView::MODE_NONE); - - if (count($posts) > 0) { - echo ''; - } - } - - // }}} - // build phase - categories // {{{ protected function buildCategories() diff --git a/Store/pages/StoreXmlSiteMapPage.php b/Store/pages/StoreXmlSiteMapPage.php index d3482d5ab..d585f7354 100644 --- a/Store/pages/StoreXmlSiteMapPage.php +++ b/Store/pages/StoreXmlSiteMapPage.php @@ -72,8 +72,6 @@ protected function queryCategories() and id in (select category from VisibleCategoryView) order by displayorder, title'; - $sql = sprintf($sql, $this->app->db->quote(true, 'boolean')); - $categories = SwatDB::query($this->app->db, $sql, $wrapper); $categories->setRegion($this->app->getRegion()); diff --git a/Store/views/StoreBlorgPostSearchView.php b/Store/views/StoreBlorgPostSearchView.php deleted file mode 100644 index 4d8f29443..000000000 --- a/Store/views/StoreBlorgPostSearchView.php +++ /dev/null @@ -1,21 +0,0 @@ -microblog_length = 100; - $this->bodytext_summary_length = 100; - } - - // }}} -} - -?> diff --git a/composer.json b/composer.json index e2d38ea0a..06dd63288 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,27 @@ } ], "repositories": [ + { + "type": "path", + "url": "../site", + "only": ["silverorange/site"], + "options": { + "versions": { + "silverorange/site": "15.1.0" + } + } + }, + { + "type": "path", + "url": "../admin", + "only": ["silverorange/admin"], + "options": { + "versions": { + "silverorange/admin": "7.0.0" + } + } + }, + { "type": "composer", "url": "https://composer.silverorange.com", @@ -43,17 +64,18 @@ } ], "require": { - "php": ">=8.1.0", + "php": ">=8.2", "ext-imagick": "*", "pear/text_password": "^1.1.1", "pear/validate_finance_creditcard": ">=0.5.2", - "silverorange/admin": "^6.2.0", - "silverorange/site": "^14.5.0", + "silverorange/admin": "^6.2.0 || ^7.0.0", + "silverorange/site": "^14.5.0 || ^15.0.0", "silverorange/swat": "^7.3.0", "silverorange/xml_rpc_ajax": "^3.1.0", "silverorange/yui": "^1.0.11" }, "require-dev": { + "phpstan/phpstan": "^1.12", "silverorange/coding-standard": "^1.0.0" }, "suggest": { @@ -61,12 +83,12 @@ "braintree/braintree_php": "Payments with Braintree", "pear/payment_paypal_soap": "Payments with PayPal.", "silverorange/atom_feed": "Froogle product feeds for Google.", - "silverorange/blorg": "Product reviews.", "silverorange/deliverance": "Email mailing list support.", "silverorange/nate_go_search": "Product search indexing." }, "scripts": { "lint": "./vendor/bin/phpcs", + "phpstan": "./vendor/bin/phpstan analyze", "post-install-cmd": "./vendor/bin/phpcs --config-set installed_paths vendor/silverorange/coding-standard/src", "post-update-cmd": "./vendor/bin/phpcs --config-set installed_paths vendor/silverorange/coding-standard/src" }, diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 000000000..432e7975d --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,8 @@ +parameters: + phpVersion: 80200 + level: 0 + paths: + - Store + - po/preprocess.php + editorUrl: '%%file%%:%%line%%' + editorUrlTitle: '%%file%%:%%line%%'