Skip to content

Commit

Permalink
minor Sylius#11619 [Docs] Fixing php-errors in the documentation (mam…
Browse files Browse the repository at this point in the history
…azu)

This PR was merged into the 1.8-dev branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | master
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | -none-
| License         | MIT

I am currently developing a [documentation validator](https://github.com/mamazu/documentation-parser) and added an `rst` parser to it. Sylius was the trail run project and this is what I got out of it (fixes are done manually).

One thing I am struggling with a little is the `...` situation. Having `...` in a documentation is not very helpful, because to me it is saying: "You know what to fill in here". But then why write the documentation in the first place. (eg. `SyliusOrderBundle/processors.rst`) So I am not sure about that.


Commits
-------

e688b3e Fixing the documentation
98422f1 Replacing the service defintion for documentation
7821f6c Fixing the parsing of json
  • Loading branch information
lchrusciel authored Jul 9, 2020
2 parents a3be6b1 + 7821f6c commit 08e3351
Show file tree
Hide file tree
Showing 26 changed files with 83 additions and 73 deletions.
10 changes: 5 additions & 5 deletions docs/bdd/basic-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ This gap will be more understandable on the below code example.
protected function getDefinedElements(): array
{
return ['sidebar' => ['css' => '.sidebar']]
return ['sidebar' => ['css' => '.sidebar']];
}
protected function getUrl(): string
Expand All @@ -240,12 +240,12 @@ This gap will be more understandable on the below code example.
protected function getDefinedElements(): array
{
return ['sidebar' => ['css' => '.sidebar']]
return ['sidebar' => ['css' => '.sidebar']];
}
protected function getUrl(): string
{
return 'http://your_domain.com/leagues/'
return 'http://your_domain.com/leagues/';
}
}
Expand All @@ -267,7 +267,7 @@ This gap will be more understandable on the below code example.
*/
public function iWantToReadSideBarOnHomePage($someInformation): void // Still "http://your_domain.com".
{
$someInformation === $this->leagueIndexPage->readMatchResults() // This returns true, but wait a second we are on home page (dummy pages).
$someInformation === $this->leagueIndexPage->readMatchResults(); // This returns true, but wait a second we are on home page (dummy pages).
$someInformation === $this->homePage->readWeather() // This also returns true.
}
Expand Down Expand Up @@ -359,7 +359,7 @@ Ui contexts
.. code-block:: php
namespace Sylius\Behat\Context\Ui\Admin
namespace Sylius\Behat\Context\Ui\Admin;
final class NotificationContext implements Context
{
Expand Down
4 changes: 2 additions & 2 deletions docs/book/contributing/documentation/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ Example
public function foo($bar)
{
// set foo with a value of bar
$foo = ...;
$foo = $bar;
$cat = new Cat($foo);
// ... check if $bar has the correct value
return $cat->baz($bar, ...);
return $cat->baz($bar, /*...*/);
}
}
Expand Down
10 changes: 6 additions & 4 deletions docs/book/customers/addresses/address_book.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ On the Customer entity we are holding a collection of addresses:

.. code-block:: php
/**
* @var Collection|AddressInterface[]
*/
protected $addresses;
class Customer {
/**
* @var Collection|AddressInterface[]
*/
protected $addresses;
}
We can operate on it as usual - by adding and removing objects.

Expand Down
6 changes: 3 additions & 3 deletions docs/book/installation/sylius_plus_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Installing Sylius Plus as a plugin to a Sylius application
// config/bundles.php
return [
...
//...
Sylius\Plus\SyliusPlusPlugin::class => ['all' => true],
];
Expand Down Expand Up @@ -86,7 +86,7 @@ Installing Sylius Plus as a plugin to a Sylius application
.. code-block:: yaml
// config/routes/sylius_admin.yaml:
...
#...
sylius_plus_admin:
resource: "@SyliusPlusPlugin/Resources/config/admin_routing.yaml"
Expand All @@ -95,7 +95,7 @@ Installing Sylius Plus as a plugin to a Sylius application
.. code-block:: yaml
// config/routes/sylius_admin_api.yaml:
...
#...
sylius_plus_admin_api:
resource: "@SyliusPlusPlugin/Resources/config/api_routing.yaml"
Expand Down
6 changes: 3 additions & 3 deletions docs/book/orders/checkout.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ and apply a proper transition and flush the order via the manager.
$stateMachineFactory = $this->container->get('sm.factory');
$stateMachine = $stateMachineFactory->get($order, OrderCheckoutTransitions::GRAPH)
$stateMachine = $stateMachineFactory->get($order, OrderCheckoutTransitions::GRAPH);
$stateMachine->apply(OrderCheckoutTransitions::TRANSITION_SELECT_SHIPPING);
$this->container->get('sylius.manager.order')->flush();
Expand Down Expand Up @@ -229,7 +229,7 @@ and apply a proper transition and flush the order via the manager.
$stateMachineFactory = $this->container->get('sm.factory');
$stateMachine = $stateMachineFactory->get($order, OrderCheckoutTransitions::GRAPH)
$stateMachine = $stateMachineFactory->get($order, OrderCheckoutTransitions::GRAPH);
$stateMachine->apply(OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT);
$this->container->get('sylius.manager.order')->flush();
Expand Down Expand Up @@ -258,7 +258,7 @@ Before executing the completing transition you can set some notes to your order.

.. code-block:: php
$order->setNotes('Thank you dear shop owners! I am allergic to tape so please use something else for packaging.')
$order->setNotes('Thank you dear shop owners! I am allergic to tape so please use something else for packaging.');
After that get the StateMachine for the Order via the StateMachineFactory with a proper schema,
and apply a proper transition and flush the order via the manager.
Expand Down
2 changes: 1 addition & 1 deletion docs/book/orders/payments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ In order to have your new payment method available in the checkout remember to *

.. code-block:: php
$paymentMethod->addChannel($channel)
$paymentMethod->addChannel($channel);
Payment Gateway configuration
-----------------------------
Expand Down
14 changes: 8 additions & 6 deletions docs/book/orders/returns.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Overwrite the ``ReturnRequestResolutionsProvider`` service:
Sylius\Plus\Returns\Domain\Provider\ReturnRequestResolutionsProvider:
class: Sylius\Plus\Returns\Application\Provider\StringReturnRequestResolutionsProvider
arguments:
- ['refund', 'repair'] // the "replacement" resolution has been removed
- ['refund', 'repair'] # the "replacement" resolution has been removed
In order to **add a custom Resolution**:

Expand Down Expand Up @@ -145,31 +145,33 @@ API coverage

Sylius Plus provides a route that allows accepting or rejecting return request with an API call:

.. code-block:: php
.. code-block:: text
POST /api/v1/return-requests/{id}/accept
The ``id`` is an id of return request that we want to accept. Content of the request may contain response of return request:

.. code-block:: php
.. code-block:: json
{
"response": "Return request confirmed and accepted."
}
.. code-block:: php
.. code-block:: text
POST /api/v1/return-requests/{id}/reject
The ``id`` is an id of return request that we want to accept. Content of the request may contain response of return request:

.. code-block:: php
.. code-block:: json
{
"response": "We are not able to replace this item."
}
// The response can also be empty:
The response can also be empty:

.. code-block:: json
{}
Expand Down
2 changes: 1 addition & 1 deletion docs/book/orders/taxation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Read more about Products and Variants :doc:`here </book/products/products>`.
$taxCategory = $this->container->get('sylius.repository.tax_category')->findOneBy(['code' => 'taxable_goods']);
/** @var ProductVariantInterface $variant */
$variant = $this>container->get('sylius.repository.product_variant')->findOneBy(['code' => 'mug']);
$variant = $this->container->get('sylius.repository.product_variant')->findOneBy(['code' => 'mug']);
$variant->setTaxCategory($taxCategory);
Expand Down
2 changes: 1 addition & 1 deletion docs/book/products/taxons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ of the modern e-commerce systems.
The Taxons system in Sylius works in a hierarchical way.
Let's see exemplary categories trees:

.. code-block:: php
.. code-block:: text
Category
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The sellable object can be retrieved and set, using the following setter and get

In most cases you'll use the **OrderBuilder** service to create your orders.

Just like for the order, the total is available via the same method, but the unit price is accessible using the ``->getUnitPrice()``
Just like for the order, the total is available via the same method, but the unit price is accessible using the ``->getUnitPrice()``
Each item also can calculate its total, using the quantity (``->getQuantity()``) and the unit price.

.. warning::
Expand All @@ -103,7 +103,7 @@ Each item also can calculate its total, using the quantity (``->getQuantity()``)
$item = $itemRepository->createNew();
$item->setVariant($book);
$item->setUnitPrice(2000)
$item->setUnitPrice(2000);
$orderItemQuantityModifier->modify($item, 4); //modifies item's quantity to 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ In a controller:
<?php
// Fetch order from DB
$order = ...;
$order = $this->container->get('sylius.repository.order')->find('$id');
// Get the processor from the container or inject the service
$orderProcessor = ...;
$orderProcessor = $this->container->get('sylius.order_processing.order_processor');
$orderProcessor->process($order);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Summary
interface: Sylius\Component\Promotion\Model\PromotionRuleInterface
controller: Sylius\Bundle\ResourceBundle\Controller\ResourceController
repository: ~
factory: Sylius\Component\Resource\Factory\Factory
form: Sylius\Bundle\PromotionBundle\Form\Type\PromotionRuleType
promotion_coupon:
classes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Resolving rate and using calculator
<?php
namespace Acme\ShopBundle\Taxation
namespace Acme\ShopBundle\Taxation;
use Acme\ShopBundle\Entity\Order;
use Sylius\Bundle\TaxationBundle\Calculator\CalculatorInterface;
Expand All @@ -36,7 +36,7 @@ Resolving rate and using calculator
public function __construct(
CalculatorInterface $calculator,
TaxRateResolverInterface $taxRateResolver,
TaxRateResolverInterface $taxRateResolver
)
{
$this->calculator = $calculator;
Expand Down
17 changes: 10 additions & 7 deletions docs/components_and_bundles/bundles/SyliusTaxonomyBundle/taxon.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ To get a collection of child taxons under taxon, use the ``findChildren`` method
<?php
public function myAction(Request $request)
class MyActionController
{
// Find the parent taxon
$taxonRepository = $this->container->get('sylius.repository.taxon');
$taxon = $taxonRepository->findOneByName('Categories');
$taxonRepository = $this->container->get('sylius.repository.taxon');
$taxons = $taxonRepository->findChildren($taxon);
public function myAction(Request $request)
{
// Find the parent taxon
$taxonRepository = $this->container->get('sylius.repository.taxon');
$taxon = $taxonRepository->findOneByName('Categories');
$taxonRepository = $this->container->get('sylius.repository.taxon');
$taxons = $taxonRepository->findChildren($taxon);
}
}
``$taxons`` variable will now contain a list (ArrayCollection) of taxons in following order: T-Shirts, Men, Women, Stickers, Mugs, Books.
4 changes: 2 additions & 2 deletions docs/components_and_bundles/components/Locale/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ The **LocaleProvider** allows you to get all available locales.
$localeProvider = new LocaleProvider($locales);
$localeProvider->getAvailableLocalesCodes() //Output will be a collection of available locales
$localeProvider->isLocaleAvailable('en') //It will check if that locale is enabled
$localeProvider->getAvailableLocalesCodes(); //Output will be a collection of available locales
$localeProvider->isLocaleAvailable('en'); //It will check if that locale is enabled
.. note::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ VolumeRateCalculator

.. code-block:: php
<?
<?php
use Sylius\Component\Shipping\Model\Shipment;
use Sylius\Component\Shipping\Model\ShipmentItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ letters. Example usage:
$canonicalEmail = $canonicalizer->canonicalize($user->getEmail());
$user->setEmailCanonical($canonicalEmail);
$user->getEmail() // returns 'MyEmail@eXample.Com'
$user->getEmailCanonical() // returns 'myemail@example.com'
$user->getEmail(); // returns 'MyEmail@eXample.Com'
$user->getEmailCanonical(); // returns 'myemail@example.com'
16 changes: 9 additions & 7 deletions docs/cookbook/configuration/disabling-shop-admin-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ How to disable Sylius shop?
// # config/bundles.php
return [
...
//...
// Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true], // - remove or leave this line commented
...
//...
];
**2.** Remove SyliusShopBundle's configs from ``config/packages/_sylius.yaml``.
Expand All @@ -31,7 +31,9 @@ Here you've got the lines that should disappear from this file:
imports:
# - { resource: "@SyliusShopBundle/Resources/config/app/config.yml" } # remove or leave this line commented
...
#...
#sylius_shop:
# product_grid:
# include_all_descendants: true
Expand Down Expand Up @@ -103,11 +105,11 @@ How to disable Sylius Admin?
// # config/bundles.php
return [
...
//...
// Sylius\Bundle\AdminBundle\SyliusAdminBundle::class => ['all' => true], // - remove or leave this line commented
...
//...
];
**2.** Remove SyliusAdminBundle's config import from ``config/packages/_sylius.yaml``.
Expand Down Expand Up @@ -182,12 +184,12 @@ How to disable Sylius API?
// # config/bundles.php
return [
...
//...
// FOS\OAuthServerBundle\FOSOAuthServerBundle::class => ['all' => true],
// Sylius\Bundle\AdminApiBundle\SyliusAdminApiBundle::class => ['all' => true], // - remove or leave this line commented
...
//...
];
**2.** Remove SyliusAdminApiBundle's config import from ``config/packages/_sylius.yaml``.
Expand Down
2 changes: 1 addition & 1 deletion docs/cookbook/entities/custom-translatable-model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ To have templates for your Entity administration out of the box you can use Grid
10. Create template
-------------------

.. code-block:: php
.. code-block:: twig
# App/Resources/views/Supplier/_form.html.twig
{% from '@SyliusAdmin/Macro/translationForm.html.twig' import translationForm %}
Expand Down
2 changes: 1 addition & 1 deletion docs/cookbook/frontend/webpack.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This is a simple guide on how to start using webpack in Sylius apps. Webpack fin
**4.** Overwrite template files and add new assets paths for admin and shop:

.. code-block:: php
.. code-block:: twig
// templates/bundles/SyliusAdminBundle/_scripts.html.twig
{{ encore_entry_script_tags('admin-entry', null, 'admin') }}
Expand Down
2 changes: 1 addition & 1 deletion docs/customization/fixtures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ just like in the example mentioned above.
final class ShippingMethodExampleFactory extends BaseShippingMethodExampleFactory
{
...
//...
public function create(array $options = []): ShippingMethodInterface
{
Expand Down
Loading

0 comments on commit 08e3351

Please sign in to comment.