Cleanup PHP Snippets
This commit is contained in:
parent
8244983c2d
commit
dc8e02c1df
|
@ -46,19 +46,6 @@ snippet compilerpass
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
snippet t3sqlde
|
|
||||||
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)
|
|
||||||
->getConnectionByName('Default')
|
|
||||||
->getConfiguration()
|
|
||||||
->setSQLLogger(new class implements \Doctrine\DBAL\Logging\SQLLogger {
|
|
||||||
public function startQuery($sql, ?array $params = null, ?array $types = null) {
|
|
||||||
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($sql, 'sql', 8, false);
|
|
||||||
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($params, 'params', 8, false);
|
|
||||||
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($types, 'types', 8, false);
|
|
||||||
}
|
|
||||||
public function stopQuery() { }
|
|
||||||
});
|
|
||||||
|
|
||||||
snippet declare_strict
|
snippet declare_strict
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
@ -67,20 +54,9 @@ snippet t3log
|
||||||
->getLogger('das')
|
->getLogger('das')
|
||||||
->debug('DAS', [${1}]);
|
->debug('DAS', [${1}]);
|
||||||
|
|
||||||
snippet t3mem
|
|
||||||
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')
|
|
||||||
->getLogger('das')
|
|
||||||
->debug('memory stats ${1}', [
|
|
||||||
'memory_get_usage' => \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize(memory_get_usage()),
|
|
||||||
'memory_get_peak_usage' => \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize(memory_get_peak_usage()),
|
|
||||||
]);
|
|
||||||
|
|
||||||
snippet throw
|
snippet throw
|
||||||
throw new \Exception('${1:message}', `system('date +%s')`);
|
throw new \Exception('${1:message}', `system('date +%s')`);
|
||||||
|
|
||||||
snippet t3devlog
|
|
||||||
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('${1:message}', '${2:ds}', ${3:0}, ${4:[]});
|
|
||||||
|
|
||||||
snippet construct
|
snippet construct
|
||||||
public function __construct(
|
public function __construct(
|
||||||
${0}
|
${0}
|
||||||
|
@ -93,53 +69,6 @@ snippet invoke
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet sfile
|
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace `expand('%:h:gs?src/??:gs?/?\\\?')`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class `expand('%:t:s?.php??')`
|
|
||||||
* @package `expand('%:h:gs?src/??:gs?/?\\\?')`
|
|
||||||
*/
|
|
||||||
class `expand('%:t:s?.php??')`
|
|
||||||
{
|
|
||||||
${0}
|
|
||||||
}
|
|
||||||
|
|
||||||
snippet lfile
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `expand('%:h:gs?/?\\?:s?.?\u&?')`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class ${1:`expand('%:t:s?.php??')`}
|
|
||||||
{
|
|
||||||
${2}
|
|
||||||
}
|
|
||||||
|
|
||||||
snippet lseedfile
|
|
||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factory;
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use App\\`expand('%:t:r:s?Seeder??')`;
|
|
||||||
|
|
||||||
final class `expand('%:t:r')` extends Seeder
|
|
||||||
{
|
|
||||||
public function run(Factory $factory)
|
|
||||||
{
|
|
||||||
$factory->create(`expand('%:t:r:s?Seeder??')`::class, 50)->each(function ($`expand('%:t:r:s?Seeder??:s?.?\l&?')`) use ($factory) {
|
|
||||||
// $`expand('%:t:r:s?Seeder??:s?.?\l&?')`->posts()->save($factory->make(\App\Post::class));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
snippet t3file
|
snippet t3file
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
@ -211,56 +140,6 @@ snippet file
|
||||||
${4}
|
${4}
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet stestfile
|
|
||||||
<?php
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace `expand('%:h:gs?src/??:gs?/?\\\?')`;
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests `expand('%:t:s?.php??')`
|
|
||||||
* @package `expand('%:h:gs?src/??:gs?/?\\\?')`
|
|
||||||
*/
|
|
||||||
final class `expand('%:t:s?.php??')` extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @test
|
|
||||||
*/
|
|
||||||
public function ${0}()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
snippet ltestfile
|
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace `expand('%:h:gs?/?\\?:s?.?\u&?')`;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factory;
|
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
||||||
use Tests\TestCase;
|
|
||||||
|
|
||||||
final class ${1:`expand('%:t:s?.php??')`} extends TestCase
|
|
||||||
{
|
|
||||||
use RefreshDatabase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var
|
|
||||||
*/
|
|
||||||
protected $subject;
|
|
||||||
|
|
||||||
public function setUp()
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
$this->subject = $this->app->make(::class);
|
|
||||||
}
|
|
||||||
${4}
|
|
||||||
}
|
|
||||||
|
|
||||||
snippet testfile
|
snippet testfile
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
@ -421,6 +300,13 @@ snippet closure
|
||||||
})();
|
})();
|
||||||
|
|
||||||
snippet test
|
snippet test
|
||||||
|
#[Test]
|
||||||
|
public function ${1:name}(): void
|
||||||
|
{
|
||||||
|
${0}
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet testlegacy
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
@ -429,8 +315,5 @@ snippet test
|
||||||
${0}
|
${0}
|
||||||
}
|
}
|
||||||
|
|
||||||
snippet dump
|
|
||||||
var_dump(${1});${2}
|
|
||||||
|
|
||||||
snippet die
|
snippet die
|
||||||
throw new \Exception('debugging end: ' . var_export(${1}, true));${2}
|
throw new \Exception('debugging end: ' . var_export(${1}, true));${2}
|
||||||
|
|
Loading…
Reference in a new issue