nixpkgs/home/programs/neovim/configuration/snippets/php.snippets

320 lines
9.3 KiB
Plaintext

snippet t3de Insert TYPO3 Extbase var_dump
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(${1:debug_backtrace()}, '$1', 8, ${2:true});${3:die;}${4}
snippet additionalconf
if (getenv('TYPO3_ADDITIONAL_CONFIGURATION')) {
require getenv('TYPO3_ADDITIONAL_CONFIGURATION');
}
snippet xdebug
\xdebug_break();
snippet services.php
<?php
declare(strict_types=1);
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
return static function (ContainerConfigurator $containerConfigurator) {
$services = $containerConfigurator->services()
->defaults()
->autowire()
->autoconfigure()
;
$services->load('DanielSiepmann\\\\`expand('%:h:s?.*ext/??:s?local_packages/??:s?localPackages/??:s?packages/??:s?Configuration??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?')`\\', '../Classes/*');
${0}
};
snippet compilerpass
$container->registerForAutoconfiguration(Translator::class)->addTag('e2_core.environmentspecific.translator');
$container->addCompilerPass(new class implements CompilerPassInterface {
public function process(ContainerBuilder $container): void
{
$registry = $container->findDefinition(Registry::class);
$serviceNames = array_keys($container->findTaggedServiceIds('e2_core.environmentspecific.translator'));
foreach ($serviceNames as $serviceName) {
$registry->addMethodCall(
'addEntry',
[
$container->findDefinition($serviceName),
]
);
}
}
});
snippet declare_strict
declare(strict_types=1);
snippet t3log
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)
->getLogger('das')
->debug('DAS', [${1}]);
snippet throw
throw new \Exception('${1:message}', `system('date +%s')`);
snippet construct
public function __construct(
${0}
) {
}
snippet invoke
public function __invoke(
${0}
) {
}
snippet t3file
<?php
declare(strict_types=1);
/*
* Copyright (C) `system('date +%Y')` `system('git config --get user.name')` <`system('git config --get user.email')`>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace DanielSiepmann`expand('%:h:s?.*ext/??:s?Classes/??:s?local_packages/??:s?localPackages/??:s?packages/??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`;
class ${1:`expand('%:t:s?.php??')`}
{
${2}
}
snippet localconf
<?php
declare(strict_types=1);
(static function (string $extensionKey): void {
${0}
})('${1:}');
snippet file
<?php
declare(strict_types=1);
/*
* Copyright (C) `system('date +%Y')` `system('git config --get user.name')` <`system('git config --get user.email')`>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace DanielSiepmann`expand('%:h:s?Classes/??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`;
class ${1:`expand('%:t:s?.php??')`} extends ${2} implements ${3}
{
${4}
}
snippet testfile
<?php
declare(strict_types=1);
/*
* Copyright (C) `system('date +%Y')` `system('git config --get user.name')` <`system('git config --get user.email')`>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace DanielSiepmann`expand('%:h:s?.*ext/??:s?local_packages/??:s?packages/??:s?Classes/??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`;
use DanielSiepmann`expand('%:r:s?.*ext/??:s?local_packages/??:s?packages/??:s?Classes/??:s?Tests/Unit/??:s?Tests/Functional/??:s?Test??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
#[CoversClass(${1:`expand('%:t:s?Test.php??')`}::class)]
final class ${1:`expand('%:t')`} extends TestCase
{
#[Test]
public function canBeCreated(): void
{
$subject = new `expand('%:r:s?Test$??:s?.*/??')`();
self::assertInstanceOf(
`expand('%:r:s?Test$??:s?.*/??')`::class,
$subject
);
}
}
snippet testfilelegacy
<?php
declare(strict_types=1);
/*
* Copyright (C) `system('date +%Y')` `system('git config --get user.name')` <`system('git config --get user.email')`>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace DanielSiepmann`expand('%:h:s?.*ext/??:s?local_packages/??:s?Classes/??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`;
use DanielSiepmann`expand('%:r:s?.*ext/??:s?local_packages/??:s?Classes/??:s?Tests/Unit/??:s?Tests/Functional/??:s?Test??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`;
use PHPUnit\Framework\TestCase;
/**
* @covers \DanielSiepmann`expand('%:r:s?.*ext/??:s?local_packages/??:s?Classes/??:s?Tests/Unit/??:s?Tests/Functional/??:s?Test??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`
*/
final class ${1:`expand('%:t:s?.php??')`} extends TestCase
{
/**
* @test
*/
public function canBeCreated(): void
{
$subject = new `expand('%:r:s?Test$??:s?.*/??')`();
self::assertInstanceOf(
`expand('%:r:s?Test$??:s?.*/??')`::class,
$subject
);
}
}
snippet codeceptiontestfile
<?php
declare(strict_types=1);
/*
* Copyright (C) `system('date +%Y')` `system('git config --get user.name')` <`system('git config --get user.email')`>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace Tests`expand('%:h:s?tests/??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`;
use PhpbrowserTester;
final class ${1:`expand('%:t:s?.php??')`}
{
public function firstTest(PhpbrowserTester $I): void
{
$I->amOnPage('');
}
}
snippet Exception
throw new \Exception('${1}', `strftime('%s')`);
snippet if
if (${1}) {
${0}
}
snippet foreach
foreach ($${1:variable} as $${2:value}) {
${0}
}
snippet foreachk
foreach ($${1:variable} as $${2:key} => $${3:value}) {
${0}
}
snippet fun
${1:private} function ${2:name}(${3})${4}
{
${0}
}
snippet closure
(function () {
${0}
})();
snippet test
#[Test]
public function ${1:name}(): void
{
${0}
}
snippet testlegacy
/**
* @test
*/
public function ${1:name}(): void
{
${0}
}
snippet die
throw new \Exception('debugging end: ' . var_export(${1}, true));${2}