• Always use class aliases?

    From Flash@21:1/5 to All on Sun Jul 3 10:23:09 2022
    https://www.exakat.io/en/6-good-practices-for-use/
    "Any call to a fully namespaced should be avoided, and at least aliased. Firstly, this shorten the code, keep it easier to read. This may also be
    called ‘Avoid long classes name in code’.
    ..........
    .............
    ....."

    But in some cases, I consider it something a little excessive.
    For example

    --- SCRIPT ---
    <?php
    use MyClass as MyClass; // little excessive?
    // ...
    --- END SCRIPT ---

    What do you think?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ace of diamonds@21:1/5 to All on Wed Jul 6 09:19:12 2022
    Hey guy. Would You want to get rich with me doing programming? If yes, call me !!!!!!!!!

    ✆☎☏📱📞 : 372 53900660


    Flash kirjutas Pühapäev, 3. juuli 2022 kl 10:23:18 UTC+2:
    https://www.exakat.io/en/6-good-practices-for-use/
    "Any call to a fully namespaced should be avoided, and at least aliased. Firstly, this shorten the code, keep it easier to read. This may also be called ‘Avoid long classes name in code’.
    ..........
    .............
    ....."

    But in some cases, I consider it something a little excessive.
    For example

    --- SCRIPT ---
    <?php
    use MyClass as MyClass; // little excessive?
    // ...
    --- END SCRIPT ---

    What do you think?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Wed Jul 6 20:02:22 2022
    Flash:

    https://www.exakat.io/en/6-good-practices-for-use/
    "Any call to a fully namespaced should be avoided, and at least aliased. Firstly, this shorten the code, keep it easier to read. This may also be called ‘Avoid long classes name in code’.
    ..........
    .............
    ....."

    But in some cases, I consider it something a little excessive.
    For example

    --- SCRIPT ---
    <?php
    use MyClass as MyClass; // little excessive?
    // ...
    --- END SCRIPT ---

    What do you think?

    This makes no sense at all. You don't need an alias if you use the class
    at it is:

    <?php
    use MyClass;


    Aliases are only needed if you want to use a class as *another* name in
    your code:

    <?php
    use SomeNamespace\SomotherNamespace\LongClassName as MyClass;




    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Flash@21:1/5 to All on Thu Jul 7 11:46:41 2022
    Il 06/07/22 20:02, Arno Welzel ha scritto:
    This makes no sense at all. You don't need an alias if you use the class
    at it is:

    <?php
    use MyClass;


    ~$ php -r 'use stdClass;'

    Warning: The use statement with non-compound name 'stdClass' has no
    effect in Command line code on line 1

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From De ongekruisigde@21:1/5 to Ace of diamonds on Thu Jul 7 11:35:35 2022
    On 2022-07-06, Ace of diamonds <he12091983@gmail.com> wrote:
    Hey guy. Would You want to get rich with me doing programming? If yes, call me !!!!!!!!!

    ✆☎☏📱📞 : [0-9]{3} [0-9]{8}

    No ace, you read like a script kiddie.



    Flash kirjutas Pühapäev, 3. juuli 2022 kl 10:23:18 UTC+2:
    https://www.exakat.io/en/6-good-practices-for-use/
    "Any call to a fully namespaced should be avoided, and at least aliased.
    Firstly, this shorten the code, keep it easier to read. This may also be
    called ‘Avoid long classes name in code’.
    ..........
    .............
    ....."

    But in some cases, I consider it something a little excessive.
    For example

    --- SCRIPT ---
    <?php
    use MyClass as MyClass; // little excessive?
    // ...
    --- END SCRIPT ---

    What do you think?


    --
    Without followers, evil cannot spread.
    [Spock, "And The Children Shall Lead", stardate 5029.5]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arno Welzel@21:1/5 to All on Sun Jul 10 04:39:43 2022
    Flash:

    Il 06/07/22 20:02, Arno Welzel ha scritto:
    This makes no sense at all. You don't need an alias if you use the class
    at it is:

    <?php
    use MyClass;


    ~$ php -r 'use stdClass;'

    Warning: The use statement with non-compound name 'stdClass' has no
    effect in Command line code on line 1

    Yes, I forgot that you need the namespace as well, either defined in the
    use statement:

    <?php
    use SomeNamespace\MyClass;

    Or in your code:

    <?php
    namespace SomeNamespace;

    use MyClass;

    But then you don't have to add an alias if you want to use the class as "MyClass", so - this is not needed:

    <?php
    use SomeNamespace\MyClass as MyClass;

    Also see <https://www.php.net/manual/en/language.namespaces.importing.php>


    --
    Arno Welzel
    https://arnowelzel.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From He, who travels time to time@21:1/5 to All on Thu Sep 22 07:13:24 2022
    Hey... Want to talk? Call me.... My telephone number >>>>

    (+372) 56330687


    Flash kirjutas Pühapäev, 3. juuli 2022 kl 11:23:18 UTC+3:
    https://www.exakat.io/en/6-good-practices-for-use/
    "Any call to a fully namespaced should be avoided, and at least aliased. Firstly, this shorten the code, keep it easier to read. This may also be called ‘Avoid long classes name in code’.
    ..........
    .............
    ....."

    But in some cases, I consider it something a little excessive.
    For example

    --- SCRIPT ---
    <?php
    use MyClass as MyClass; // little excessive?
    // ...
    --- END SCRIPT ---

    What do you think?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)